Fixed issue where ADB would be initialised, despite being disabled in settings

Summary:
As reported here: https://github.com/facebook/flipper/issues/2873, ADB would be initialised, even when disabled explicitly, resulting in an error if ADB could not be found.

Changelog: Fix: made sure that the "Android disabled" setting is respected.

Reviewed By: lblasa

Differential Revision: D31019099

fbshipit-source-id: 9d57945f2c21655426da42eb976dd46d8605d007
This commit is contained in:
Michel Weststrate
2021-09-17 07:21:25 -07:00
committed by Facebook GitHub Bot
parent d7da816e36
commit c865446312
2 changed files with 39 additions and 12 deletions

View File

@@ -219,6 +219,22 @@ class ServerController extends EventEmitter implements ServerEventsListener {
onSecureConnectionAttempt(clientQuery: SecureClientQuery): void {
this.logger.track('usage', 'trusted-request-handler-called', clientQuery);
const {os, app, device_id} = clientQuery;
// without these checks, the user might see a connection timeout error instead, which would be much harder to track down
if (os === 'iOS' && !this.flipperServer.config.enableIOS) {
console.error(
`Refusing connection from ${app} on ${device_id}, since iOS support is disabled in settings`,
);
return;
}
if (os === 'Android' && !this.flipperServer.config.enableAndroid) {
console.error(
`Refusing connection from ${app} on ${device_id}, since Android support is disabled in settings`,
);
return;
}
this.connectionTracker.logConnectionAttempt(clientQuery);
if (this.timeHandlers.get(clientQueryToKey(clientQuery))) {