Move crash reporting listener to the server

Summary: Changelog: Move crash watcher to the server. Add 'device-crash' event. Add 'device-start-crash-watcher', 'device-stop-crash-watcher' commands. Add 'onDeviceCrash' method to Plugin Client.

Reviewed By: mweststrate

Differential Revision: D33089810

fbshipit-source-id: ed62ee7c1129e5e25af18b444744b0796f567b72
This commit is contained in:
Andrey Goncharov
2021-12-20 11:37:25 -08:00
committed by Facebook GitHub Bot
parent 9fd45b96d2
commit 731749b41f
21 changed files with 519 additions and 426 deletions

View File

@@ -15,6 +15,8 @@ export abstract class ServerDevice {
readonly flipperServer: FlipperServerImpl;
connected = true;
protected stopCrashWatcherCb?: () => void;
constructor(flipperServer: FlipperServerImpl, info: DeviceDescription) {
this.flipperServer = flipperServer;
this.info = info;
@@ -46,6 +48,20 @@ export abstract class ServerDevice {
// to be subclassed
}
startCrashWatcher() {
this.stopCrashWatcherCb = this.startCrashWatcherImpl?.();
}
protected startCrashWatcherImpl(): () => void {
// to be subclassed
return () => {};
}
stopCrashWatcher() {
this.stopCrashWatcherCb?.();
this.stopCrashWatcherCb = undefined;
}
async screenshotAvailable(): Promise<boolean> {
return false;
}