Commit Graph

16 Commits

Author SHA1 Message Date
Michel Weststrate
c43049d881 Preserve device state after disconnect
Summary:
This diff stack introduces support for keeping devices and clients around after they have disconnected. This is a pretty important debugging improvement, that will allow inspecting a device / app after it crashed for example.

This feature existed partially before, but only supported Android, and only support plugins with persisted state; as it replace the current device with an archived version of the same device. In practice this didn't work really well, as most plugins would not be available, and all non-persisted state would be lost.

This diff makes sure we can keep devices around after disconnecting, the next one will keep the clients around as well. And explain some code choices in more detail.

Note that `Device.isArchived` was an overloaded term before, and even more now (both representing imported and disconnected devices), will address that in a later diff.

https://github.com/facebook/flipper/issues/1460
https://github.com/facebook/flipper/issues/812
https://github.com/facebook/flipper/issues/1487

Changelog: iOS and Android devices will preserve their state after being disconnected

Reviewed By: nikoant

Differential Revision: D26224310

fbshipit-source-id: 7dfc93c2a109a51c2880ec212a00463bc8d32041
2021-02-09 04:16:24 -08:00
Michel Weststrate
7cc55daf34 Stop storing device logs on the device object and in the plugin
Summary:
Logs were stored hardcoded on the Device object first, this diff makes it normal plugin state.

This makes sure that we can use the same abstractions as in all plugins that store large data sets, and that we can leverage the upcoming DataSource abstraction.

Reviewed By: nikoant

Differential Revision: D26127243

fbshipit-source-id: 7c386a615fa7989f35ba0df5b7c1d218d37b57a2
2021-02-01 11:43:30 -08:00
Anton Nikolaev
d7cfcb5d8e Extend device plugin metadata to include supported devices
Summary: Plugin metadata format extended to include type of each plugin (client / device) and list of supported devices (android/ios/..., emulator/physical, etc). This will allow to detect plugins supported by device even if they are not installed and only available on Marketplace.

Reviewed By: mweststrate

Differential Revision: D26073531

fbshipit-source-id: e331f1be1af1046cd4220a286a1d52378c26cc53
2021-01-27 17:31:41 -08:00
John Knox
3e911c8288 Add option to cold boot emulators
Summary: This is useful when your emulator freezes.

Reviewed By: mweststrate

Differential Revision: D25998579

fbshipit-source-id: 236c16c3008f0e33d62e4c486b5a04383b1a59ba
2021-01-25 08:57:01 -08:00
Pritesh Nandgaonkar
439601e20c Fix Screen recorder not stopping
Summary:
This fixes the issue raised [here](https://fb.workplace.com/groups/flippersupport/permalink/1059080941239230/) I added the `-l` tag which is for sending signal

{F360746398}

Reviewed By: jknoxville

Differential Revision: D25945336

fbshipit-source-id: a1d8eaf3888072a64ab682fbbc60c03c15ac023a
2021-01-18 06:17:52 -08:00
Chaiwat Ekkaewnumchai
28cd62bc99 Fix Screen Recording Not Working on Android Marshmallow
Summary: [Reported in the support group](https://fb.workplace.com/groups/flippersupport/permalink/1040131853134139/), screen recording can't be stopped on Android Marshmallow (SDK version 23). This is because the shell commands used in screen recording are different in SDK 23 compared to higher SDK. First, `pgrep` in SDK 23 doesn't have `-L` option. Second, `ls -l` of SDK 23 returns different pattern; we've relied on the 5th number to indicate the file size of a video, while it is on 4th number for SDK 23.

Reviewed By: passy

Differential Revision: D25641605

fbshipit-source-id: 110cb779ef4b2dc63a862bf5e4e5f3a304a0d8ec
2020-12-21 09:54:31 -08:00
Michel Weststrate
8025c49768 Upgrade to TypeScript 4.1
Summary:
allow-large-files

Upgrade to TypeScript 4.1

Reviewed By: nikoant

Differential Revision: D25122073

fbshipit-source-id: 7d2bc6f97595c825c9527b0c6ecab07698d5f981
2020-11-26 04:22:05 -08:00
Michel Weststrate
17baa3084c Introduce emulatur launch dialog
Summary:
Changelog: Flipper can now launch iOS simulators by using `File > Launch Emulator...`

In the Sandy designs the device selector dropdown no longer shows the option to launch an emulator. So added a button to app inspect and the main menu instead.

I found it always a bit funny that we can launch android emulators, but not iOS emulators. Turns out that launching them is actually not very complex, so added capabilities to launch ios emulators

Reviewed By: jknoxville

Differential Revision: D24021737

fbshipit-source-id: c106cc2246921e008f9c808ebb811d8e333aa93b
2020-10-01 05:35:11 -07:00
Michel Weststrate
9c202a4a10 Introduce menu entry support
Summary:
[interesting] since it shows how Flipper APIs are exposed through sandy. However, the next diff is a much simpler example of that

This diff adds support for adding menu entries for sandy plugin (renamed keyboard actions to menus, as it always creates a menu entry, but not necessarily a keyboard shortcut)

```

  client.addMenuEntry(
    // custom entry
    {
      label: 'Reset Selection',
      topLevelMenu: 'Edit',
      handler: () => {
        selectedID.set(null);
      },
    },
    // based on built-in action (sets standard label, shortcut)
    {
      action: 'createPaste',
      handler: () => {
        console.log('creating paste');
      },
    },
  );
```

Most of this diff is introducing the concept of FlipperUtils, a set of static Flipper methods (not related to a device or client) that can be used from Sandy. This will for example be used to implement things as `createPaste` as well

Reviewed By: nikoant

Differential Revision: D22766990

fbshipit-source-id: ce90af3b700e6c3d9a779a3bab4673ba356f3933
2020-08-04 07:47:14 -07:00
Michel Weststrate
94eaaf5dca killed the concept of customizable column sets per device in device logs
Summary:
No device was using this feature, so doesn't look like there is a reason to keep it.

...if somebody was about to use this feature, let me know :). But probably, if we need this, a much more simple solution is to determine the visible columns with a simple switch on device type in the logs plugin, even though that is strictly speaking less scalable. But the current solution feels a bit over-engineered for something that is not really used.

Marked [interesting] as I might be missing some background concept which would make this relevant as well.

Reviewed By: jknoxville, nikoant

Differential Revision: D22763507

fbshipit-source-id: ecdbc779cbbfa3b0b72c80b459b12c1a25bf3fc4
2020-08-04 07:47:14 -07:00
Michel Weststrate
d538b66088 Cleaned up deviceType enum
Summary:
The device type enum was mixing two different concepts (emulator vs physical) and (archived vs not), and we already have a separate `isArchived` field. So cleaned this up to not leak it into sandy.

If anybody can think of any unforeseen consequences of this, lemme know :)

Reviewed By: jknoxville

Differential Revision: D22763506

fbshipit-source-id: bd2f7dbd1d2d2e6942ba7c6ddd8dc91ee34d591d
2020-08-04 07:47:13 -07:00
Michel Weststrate
91ed4e31c0 Introduce DevicePlugin APIs
Summary:
This stack introduces Sandy device plugins, they are quite similar to normal plugins, but, a devicePlugin module is organized as

```
export function supportsDevice(device): boolean

export function devicePlugin(devicePluginClient)

export function Component
```

Device plugins get access to the device meta data and can subscribe to the `onLogEntry` callback and `onDestroy` lifecycle.

They will be able to store state just as normal plugins, but can't send or receive methods, so devicePluginClient is a bit limited.

This diff only sets up most of the new data structures, and makes sure everything still compiles and no existing tests fail.

To prevent this diff from becoming to big, actually loading, rendering and testing device plugins will be done in next diffs

Please take a critical look at the api proposed and the (especially) the public names used :)

Reviewed By: passy, nikoant

Differential Revision: D22691351

fbshipit-source-id: bdbbd7f86d14b646fc9a693ad19f33583a76f26d
2020-08-04 07:08:31 -07:00
Pascal Hartig
8ff1411f91 Fix screen recording on Android 11
Summary:
Instead of relying on system blocks used, we use the file size reported by ls.
Android 11 seems to be more lazy when it comes to fsync'ing so there's a pretty
good chance that if we just check for with `du` or `ls -ls` we will see an "empty" file
because it hasn't been written to disk yet. By the normal `ls` output instead, we'll
just read the file and see how many bytes it's long, which should be more
accurate in all cases.

Changelog: Fix screen recording for Android 11 beta

Reviewed By: jknoxville

Differential Revision: D22283092

fbshipit-source-id: 6d33ca297f1c0734ab4ffc466d9e483aa1a1bdb5
2020-06-29 07:20:40 -07:00
Pritesh Nandgaonkar
dafe493930 Add architecture and sdk version information
Summary: This diff adds abilist and sdk version information in the AndroidDevice.

Reviewed By: mweststrate

Differential Revision: D22210225

fbshipit-source-id: cda3dea9d89fdaa62a08aa000c93e39177c67bdd
2020-06-25 04:25:19 -07:00
Pascal Hartig
fc9ed65762 prettier 2
Summary:
Quick notes:

- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.

Close https://github.com/facebook/flipper/pull/915

Reviewed By: jknoxville

Differential Revision: D20594929

fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
2020-03-24 09:38:11 -07:00
Anton Nikolaev
863f89351e Yarn workspaces
Summary:
1) moved "sonar/desktop/src" to "sonar/desktop/app/src", so "app" is now a separate package containing the core Flipper app code
2) Configured yarn workspaces with the root in "sonar/desktop": app, static, pkg, doctor, headless-tests. Plugins are not included for now, I plan to do this later.

Reviewed By: jknoxville

Differential Revision: D20535782

fbshipit-source-id: 600b2301960f37c7d72166e0d04eba462bec9fc1
2020-03-20 13:37:41 -07:00