Make sure disconnected devices / apps can be imported and exported

Summary:
It should be possible to exported disconnected devices, so that flipper traces / support form reports can be created from them. This diff introduces this functionality. Support for plugins with custom export logic is introduced in a later diff.

Issues fixed in this diff:
- don't try to take a screenshot for a disconnected device (this would hang forever)
- device plugins were always exported, regardless whether the user did select them or not
- sandy plugins were never part of exported disconnected clients
- increased the amount of data exported for device logs to ~10 MB. This makes more sense now as the logs will no longer be included in all cases
- fixed issue where are plugins would appear to be enabled after the client disconnected (this bug is the result of some unfortunate naming of `isArchived` vs `isConnected` semantics. Will clean up those names in a later diff.

Changelog: It is now possible to create a Flipper trace for disconnected devices and apps

Reviewed By: nikoant

Differential Revision: D26250894

fbshipit-source-id: 4dd0ec0cb152b1a8f649c31913e80efc25bcc5dd
This commit is contained in:
Michel Weststrate
2021-02-09 04:12:09 -08:00
committed by Facebook GitHub Bot
parent 8bc1b953c2
commit ff7997b3fa
11 changed files with 65 additions and 29 deletions

View File

@@ -431,10 +431,14 @@ export async function processStore(
statusUpdate = () => {};
}
statusUpdate('Capturing screenshot...');
const deviceScreenshot = await capture(device).catch((e) => {
console.warn('Failed to capture device screenshot when exporting. ' + e);
return null;
});
const deviceScreenshot = device.isArchived
? null
: await capture(device).catch((e) => {
console.warn(
'Failed to capture device screenshot when exporting. ' + e,
);
return null;
});
const processedClients = processClients(clients, serial, statusUpdate);
const processedPluginStates = processPluginStates({
clients: processedClients,
@@ -461,7 +465,7 @@ export async function processStore(
);
const devicePluginStates = await makeObjectSerializable(
await device.exportState(idler, statusUpdate),
await device.exportState(idler, statusUpdate, selectedPlugins),
idler,
statusUpdate,
'Serializing device plugins',
@@ -610,11 +614,7 @@ export function determinePluginsToProcess(
const selectedPlugins = plugins.selectedPlugins;
for (const client of clients) {
if (
!selectedDevice ||
selectedDevice.isArchived ||
client.query.device_id !== selectedDevice.serial
) {
if (!selectedDevice || client.query.device_id !== selectedDevice.serial) {
continue;
}
const selectedFilteredPlugins = client