diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index 1b4035f17..676ded68c 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -295,6 +295,7 @@ export type FlipperServerCommands = { ) => Promise; 'android-get-emulators': () => Promise; 'android-launch-emulator': (name: string, coldboot: boolean) => Promise; + 'android-adb-kill': () => Promise; 'ios-get-simulators': (bootedOnly: boolean) => Promise; 'ios-launch-simulator': (udid: string) => Promise; 'ios-idb-kill': () => Promise; diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index 4a6802cef..511cd2003 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -486,6 +486,10 @@ export class FlipperServerImpl implements FlipperServer { }, 'android-launch-emulator': async (name, coldBoot) => launchEmulator(this.config.settings.androidHome, name, coldBoot), + 'android-adb-kill': async () => { + assertNotNull(this.android); + return this.android.adbKill(); + }, 'ios-get-simulators': async (bootedOnly) => { assertNotNull(this.ios); return this.ios.getSimulators(bootedOnly); diff --git a/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx b/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx index 1589f3ffa..337f98672 100644 --- a/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx +++ b/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx @@ -267,6 +267,10 @@ export class AndroidDeviceManager { } } + async adbKill() { + await this.adbClient.kill(); + } + private handleOfflineDevice(device: Device): void { console.warn( `[conn] Found device ${device.id}, but it has status offline. If this concerns an emulator and the problem persists, try these potential solutions: https://stackoverflow.com/a/21330228/1983583, https://stackoverflow.com/a/56053223/1983583`,