Allow to start only one instance of log listener and crash watcher

Summary:
Changelog: Allow only a single crash watcher and a single log listener per device. Start log listener and crash watcher for every device upon connection. Remove commands to start/stop them externally.

Monitored CPU load for a physical Android device with the log listener on and off. Did not notice any real difference.

Resolved crashing adbkit-logcat by forcing the usage of 2.0.1. A proper fix would be to unify babel transforms for browser flipper and electron flipper, but we might re-think how we distribute flipper in the next half, so a simple hot fix might be a better use of time and resources.

Reviewed By: mweststrate

Differential Revision: D33132506

fbshipit-source-id: 39d422682a10a64830ac516e30f43f32f416819d
This commit is contained in:
Andrey Goncharov
2021-12-20 11:37:25 -08:00
committed by Facebook GitHub Bot
parent 731749b41f
commit debf872806
19 changed files with 838 additions and 424 deletions

View File

@@ -160,13 +160,11 @@ export default class BaseDevice implements Device {
}
async startLogging() {
await this.flipperServer.exec('device-start-logging', this.serial);
this.flipperServer.on('device-log', this.deviceLogEventHandler);
}
stopLogging() {
this.flipperServer.off('device-log', this.deviceLogEventHandler);
return this.flipperServer.exec('device-stop-logging', this.serial);
}
addLogListener(callback: DeviceLogListener): Symbol {
@@ -206,13 +204,11 @@ export default class BaseDevice implements Device {
}
async startCrashWatcher() {
await this.flipperServer.exec('device-start-crash-watcher', this.serial);
this.flipperServer.on('device-crash', this.crashLogEventHandler);
}
stopCrashWatcher() {
this.flipperServer.off('device-crash', this.crashLogEventHandler);
return this.flipperServer.exec('device-stop-crash-watcher', this.serial);
}
addCrashListener(callback: CrashLogListener): Symbol {