Commit Graph

117 Commits

Author SHA1 Message Date
Andrey Goncharov
fb37f27ff5 Suport device-open-app command
Summary: It is an escape hatch for testing iOS Sample app if `navigate('/')` cannot be made to work easily (D51394323)

Reviewed By: lblasa

Differential Revision: D51466697

fbshipit-source-id: fd6c2f37504807b4b634b85cb10e837523dadba8
2023-11-20 07:14:09 -08:00
Lorenzo Blasa
57d4e86545 Additional troubleshoot guidance for idb
Summary:
Reference:
https://fb.workplace.com/groups/flippersupport/permalink/1717333982080586/

The steps added below seem to have fixed the issue.

Still need to investigate why these steps are needed.

Reviewed By: aigoncharov

Differential Revision: D50797561

fbshipit-source-id: a31c71dbedc506344438082846b41ff16b6f459a
2023-10-31 05:16:21 -07:00
Anton Kastritskiy
663380e721 mark unused vars as errors
Reviewed By: lblasa

Differential Revision: D50500690

fbshipit-source-id: 6f739fe25c232ecfe842337af4399681e85f6a13
2023-10-20 12:44:58 -07:00
Lorenzo Blasa
6468665116 Improve device listing
Summary: Do not use mutex for device listing.

Reviewed By: antonk52

Differential Revision: D50265112

fbshipit-source-id: 9b3bf4f9351e28dfb6366b6b787ec8b466b9bc47
2023-10-13 07:50:25 -07:00
Lorenzo Blasa
3e8f94ceda iOS get devices/targets/simulators cleanup
Summary: ^

Reviewed By: passy

Differential Revision: D48781211

fbshipit-source-id: 71133c07d15ca6a380d85e582d55cbdb192b5a19
2023-08-30 04:24:05 -07:00
Lorenzo Blasa
0045f15e2a isAvailable to isIdbAvailable
Summary: Make it more clear what are we checking about.

Reviewed By: aigoncharov

Differential Revision: D48781145

fbshipit-source-id: c3c03b407dc7f47730a3fb80de769243768b34ec
2023-08-30 04:24:05 -07:00
Lorenzo Blasa
03c0874f30 Query devices should be async
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D48781102

fbshipit-source-id: c987be90c7bca7dbab40a89b389ee86ef2230393
2023-08-30 04:24:05 -07:00
Pascal Hartig
d4d8c965eb Show iOS version in launcher
Summary:
A little hacky because we currently have too many implementations for getting devices but lblasa is working on cleaning this up. Once that's done, we should add some tests for this.

Changelog: Show the iOS version of simulators in the launcher window

Reviewed By: lblasa

Differential Revision: D48777923

fbshipit-source-id: 18846520feba8eb10b6417f87bd802ffaabb1dff
2023-08-29 04:55:46 -07:00
Lorenzo Blasa
f93da44ee5 Remove idb device polling record
Summary:
If listing devices is successful, then don't record the event
as this is triggered every X amount of seconds.

Reviewed By: antonk52

Differential Revision: D47995681

fbshipit-source-id: 2d0fa68fd7b9c4ce74bad9e8cc0296691d9b8880
2023-08-11 08:19:51 -07:00
Lorenzo Blasa
d43173a8df adb kill-server
Summary: Introduce a new command to allow killing adb

Reviewed By: antonk52

Differential Revision: D47988522

fbshipit-source-id: bb4f17faa7f9b31b9d42e45c0ce39b3f5d98f4b3
2023-08-02 07:56:17 -07:00
Lorenzo Blasa
f301de64f3 iOSDeviceManager queryDevicesForever converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47912037

fbshipit-source-id: ac7a9650c82219a21577e6bca7e08d075ae5da15
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
e9bae419a7 iOSDeviceManager getSimulators converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47911997

fbshipit-source-id: df2cab1986d5ddc7f2bc4e857c76cd178f6a7ccb
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
1f63a25027 idb kill
Summary: Introduce a new command to allow killing idb

Reviewed By: lawrencelomax

Differential Revision: D47911709

fbshipit-source-id: 970f1147a177bbcca0bdfa9e9ba970cdc8a914a3
2023-07-31 03:55:58 -07:00
Andrey Goncharov
9ef69bdbad Downgrade metro connection error
Reviewed By: passy

Differential Revision: D47515502

fbshipit-source-id: aa05e9f62b661989187f0340cf06eaa7dbaac379
2023-07-17 08:38:50 -07:00
Lorenzo Blasa
0e01fcad44 Android container utility integration
Summary: Report commands as executed by the android container utility.

Reviewed By: antonk52

Differential Revision: D47340410

fbshipit-source-id: dc2f80572816c8746e603aae2d721da2c47c3c4e
2023-07-12 03:30:34 -07:00
Lorenzo Blasa
6668420083 Disable stdout for successful device listing
Summary: If it is successful, we rarely care about stdout, which can be quite verbose. So don't use it.

Reviewed By: antonk52

Differential Revision: D47339446

fbshipit-source-id: 66f43d4184e44ed07364a6f33715139e19b2dc1d
2023-07-11 07:21:00 -07:00
Lorenzo Blasa
564d62d8d5 AndroidDevice, transform to async function
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47331809

fbshipit-source-id: 819aefd1703cefc24b71216b946ca66bed3f5db1
2023-07-11 04:04:37 -07:00
Lorenzo Blasa
cc0f42be76 Integrate iOS and Android certificate providers with recorder
Summary: Integrate and clean existing logs.

Reviewed By: antonk52

Differential Revision: D47330592

fbshipit-source-id: 7b1c7ebbe5804ccc184edd2583f5cddd598f11e8
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
c15ac08714 Clean AndroidCertificateProvider
Summary: Remove debug logs and add re-format other warn logs to have parity with iOS

Reviewed By: antonk52

Differential Revision: D47330455

fbshipit-source-id: ac8edde2124bbe99d0ea11f46f3b85dd77b96c7b
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
e20d723ac0 Make ClientQuery available to certificate provider
Summary:
CertificateProvider is intrinsically related to a client query, make it available to it.

This becomes the optional 'context' of shell executions. When these are recorded, the context is provider to the recorder which can then link an ongoing certificate exchange process with the success or failure of said command.

Reviewed By: antonk52

Differential Revision: D47295894

fbshipit-source-id: 9469d18bda02793d71a6a8b29c93f4af1db23569
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
fc38355eee Centralise logging
Summary:
Centralise connectivity logging into a single place. By having all logs go through a single interface, then it becomes trivial to manipulate them as needed.

In this change, this is not done.

In subsequent diffs, logs will be dispatched via an event and will be visualised in the Connectivity Hub.

Reviewed By: passy

Differential Revision: D47185054

fbshipit-source-id: fb5eab98895be0c8f61fb9a77d3e66d6a8dbcb27
2023-07-10 04:14:14 -07:00
Lorenzo Blasa
f78ca5c09e iOSContainerUtility improvements (?)
Summary:
Bit of refactoring, bit of improvements, maybe. Mainly:

- Name consistency
- Promise chaining to async/await
- Refactoring

Reviewed By: lawrencelomax, antonk52

Differential Revision: D47224620

fbshipit-source-id: 5f4515f576decc03d470c11f24577b43f34a5a28
2023-07-05 05:15:01 -07:00
Lorenzo Blasa
f63e5d440a Move certificate exchange bits to app-connectivity
Summary: Bit of reorganising as utils is a bit too generic and crowded.

Reviewed By: passy

Differential Revision: D47186536

fbshipit-source-id: 7b1dd26db95aef00778ff4f23d91f7371c4d07ad
2023-07-04 02:19:58 -07:00
Lorenzo Blasa
7dc978c3d3 Remove processDevices logs
Summary: These are no longer that useful and can be quite verbose, remove.

Reviewed By: antonk52

Differential Revision: D46516093

fbshipit-source-id: e6c3a546d379ca20ff8757fdc3feaa11bf0788a0
2023-06-07 06:59:31 -07:00
Andrey Goncharov
e8e1a32e48 Back out "Update adbkit and logcat to maintained librarys"
Summary:
Original commit changeset: 2a23c0eaa12f

Original Phabricator Diff: D45569652

The new lib causes weird log parsing https://fb.workplace.com/groups/flippersupport/permalink/1629943924152926/

Reviewed By: LukeDefeo, passy

Differential Revision: D46390961

fbshipit-source-id: 7c9d0ca7fff2d9cb1ac1a309710f2348233a3471
2023-06-02 08:10:47 -07:00
Lorenzo Blasa
828d56f617 Kill PortForwardingApp on exit
Summary:
I noticed we were not killing the PortForwardingApp on exit.

This is not ideal.

So, use an exit hook to kill the app.

Reviewed By: passy

Differential Revision: D46392855

fbshipit-source-id: e2b75f76c9dfab0ff46df3ad2c94a1a523154b2a
2023-06-02 07:55:56 -07:00
Andrey Goncharov
94cb8935b2 Fix adb connection
Summary: On my mac localhost resolves to an IP6 address by the new adb lib. This should fix it.

Reviewed By: LukeDefeo

Differential Revision: D46314612

fbshipit-source-id: 3771efd2c6b79fe9ae9851ce4aac35bcede28847
2023-05-31 09:25:55 -07:00
Andrey Goncharov
1d595862b5 Fix e2e test
Summary: This time for real

Reviewed By: elboman

Differential Revision: D46279935

fbshipit-source-id: a639a6abafa7267ef4539c183323a5c96674e202
2023-05-30 09:47:19 -07:00
Andrey Goncharov
53a5939d68 Add one more fallback for the adb path
Summary: It seems that adb path has changed on the jest-e2e side. That might case the flipper e2e test failure. With this fallback we have granular control of the path.

Reviewed By: antonk52

Differential Revision: D46278512

fbshipit-source-id: 97310459de54eeb003eefb3a3ff06af8b13bebae
2023-05-30 09:47:19 -07:00
Andrey Goncharov
898e9c3b07 Update adbkit and logcat to maintained librarys
Summary:
We were using an old unmaintained/abandonned library for communicating with adb server https://github.com/openstf/adbkit

This was giving me issues i couldnt figure out when running flipper server.

There is a popular fork written in typescript here https://github.com/DeviceFarmer/adbkit but it uses blue bird for promises.

There is a fork of the fork here which i have chosen to use which is the same api as above but with es6 promises, https://github.com/UrielCh/adbkit.

Both forks have a slightly different api to the original. In the original library there was a single client and any command directed at a particular device had a serial as the first argument

In the new libraries you create a DeviceClient where the serial is baked in and you don't need to supply this argument every time

allow-large-files

Reviewed By: lblasa

Differential Revision: D45569652

fbshipit-source-id: 2a23c0eaa12feaebdccadb3d343e087c0d5708d5
2023-05-18 09:56:41 -07:00
Andrey Goncharov
a4fcd68c19 Downgrade adb-logcat unexpected shutdown event from error to warning
Reviewed By: mweststrate

Differential Revision: D44089920

fbshipit-source-id: 6d258e507e80b2c9f2ac08f743cdb9fe49b702f2
2023-03-15 06:33:11 -07:00
Pascal Hartig
043f5296d0 Demote active iOS device error
Summary: The error is non-fatal as it's already handled and it's not actionable by the Flipper team.

Reviewed By: lawrencelomax

Differential Revision: D44054514

fbshipit-source-id: c54c7e935374a1c97e54a5da4daaa3f26b236023
2023-03-14 05:16:52 -07:00
Andrey Goncharov
3d70020f40 Downgrade user error to warning
Summary: We can't do much if a phone is not setup properly

Reviewed By: lblasa

Differential Revision: D43980508

fbshipit-source-id: 5baf82ae36030b81c7cc90bcf6a5de2af9304fb3
2023-03-10 08:32:24 -08:00
Pascal Hartig
cfcad76e74 Demote Xcode select error to warning
Summary: This is firing regularly when people have a broken local setup.

Reviewed By: lawrencelomax

Differential Revision: D43834469

fbshipit-source-id: 1fbc2cf52f93046984e9846f8aed931106542b03
2023-03-06 04:54:36 -08:00
Andrey Goncharov
618f58b390 Verbose logging for iOS cert exchange
Summary: Helps debugging cert exchange problems.

Reviewed By: lawrencelomax

Differential Revision: D43495107

fbshipit-source-id: 499c08ec6ab15a351d74673f0a5edf9abe5af1b1
2023-02-22 04:42:34 -08:00
kongxiaojun
e2867a74a7 Fixed a bug where the screenshot of some Android phones was unavailable (#4366)
Summary:
The 'screenrecord' command is not in some Android phones e.g OPPO. So 'screenrecord' command can't be used as a basis for determining whether or not you can take a screenshot. Replace it with 'screencap' command  to determine whether you can take a screenshot.

## Changelog

Fixed a bug where the screenshot of some Android phones was unavailable

Pull Request resolved: https://github.com/facebook/flipper/pull/4366

Test Plan: It passed the test on my Mac and OPPO phone Reno2.

Reviewed By: ivanmisuno

Differential Revision: D42918902

Pulled By: passy

fbshipit-source-id: c1f02f075817d90e0d447f466a1168b6ec932e4e
2023-02-02 08:17:33 -08:00
Andrey Goncharov
7e9166137c Add verbose logging for Android cert exchange
Reviewed By: lblasa

Differential Revision: D40981864

fbshipit-source-id: f99f517c5abdce839a441c21d50ce8488b249313
2022-11-04 08:23:44 -07:00
Andrey Goncharov
2c767e1920 Make the universal export work on the older Android devices
Summary: On older Android devices (API 24) `-printf ` is not available

Reviewed By: lblasa

Differential Revision: D40980640

fbshipit-source-id: d1a1bcadc496deaf3d514c1e45b2e0104a937b18
2022-11-04 08:23:44 -07:00
Andrey Goncharov
e886427003 Make device debug info fetching fault tolerant
Summary:
Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit#

Some files on the devices could be unavailable due to lack of permissions (hello SELinux and enterprise builds of iOS apps). Instead of failing the export, we should fetch what we can.

Reviewed By: passy

Differential Revision: D40551931

fbshipit-source-id: 698e157b1283b9e959909b6439cd09d2dc8dc8d6
2022-10-25 05:31:48 -07:00
Andrey Goncharov
821bf2b5b7 Get files from Flipper folder for every app on an iOS device
Summary:
Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit#

Fetch list of files in the `/sonar` folder on iOS devices and fetch all the files

Reviewed By: passy

Differential Revision: D40548410

fbshipit-source-id: d38cbbb1e3b5579c13f30777233e3caf7b8c9b34
2022-10-25 05:31:48 -07:00
Andrey Goncharov
3c8ebf105a Get files from Flipper folder for every app on an Android device
Summary:
Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit#

We'll make the fetching more resilient to errors in subsequent diffs

Reviewed By: passy

Differential Revision: D40512932

fbshipit-source-id: df3d2b14c033ec4434b2bf408f05734d71dee092
2022-10-25 05:31:48 -07:00
Andrey Goncharov
480a3d26f0 List contents of Flipper folder on Android
Summary:
Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit#

In later diffs, we'll start fetching the actual files as well. The list of available files itself might be useful already to see what we have in our folder on the device

Reviewed By: passy

Differential Revision: D40508960

fbshipit-source-id: 96193fef3fed64d509cd3397513ae3e94438ae22
2022-10-25 05:31:48 -07:00
Shoham Peller
29938d0c69 Attempt to su when run-as gets permissions denied
Summary: pull/push might fail when run-as fails on insufficient permissions. When this happens, try to perform the command as root.

Reviewed By: aigoncharov

Differential Revision: D40623363

fbshipit-source-id: a4cc71d70f83ce1a390b14c9af9d3a3fa09f1307
2022-10-24 05:48:06 -07:00
Andrey Goncharov
b5a750935d Populate the initial list of connected devices on startup
Summary:
When we start using Flipper from the CLI for automation, we want to have the list of currently connected devices as soon as flipper server is alive.
Otherwise, we would have to poll flipper server waiting for some magical moment in the future when devices connect.
This way, we can be certain that if flipper server started, but we do not see a device, it is not connected at all.

Reviewed By: mweststrate

Differential Revision: D40184106

fbshipit-source-id: ce4c2b897a2df0081e3a0b6a8c26640599e0f9e8
2022-10-13 03:20:51 -07:00
Andrey Goncharov
97b8b8a1c4 Split flipper-plugin package
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.

Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs

Reviewed By: lblasa

Differential Revision: D38658285

fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
2022-09-15 10:02:19 -07:00
Andrey Goncharov
69812d543e Do not disconnect dummy devices
Summary: Do not remove dummy devices as they are created during WWW cert exchange and are not picked up by IDB

Reviewed By: lblasa

Differential Revision: D39430458

fbshipit-source-id: 249efda23f324522ae2ae3a0ee4f198ab701d22d
2022-09-12 07:37:21 -07:00
Andrey Goncharov
9c7a53fd05 Fix iOS crash parsing
Reviewed By: lawrencelomax

Differential Revision: D39058673

fbshipit-source-id: 64065c6d7e9fa96e827419bd6cffbceccc110d89
2022-09-05 07:46:02 -07:00
Lorenzo Blasa
dab510c546 Fix starting screen captures
Summary:
Starting a screencapture longer than 30 seconds would timeout as the start command waits for the process to finish. Removed that wait is it is the stop command that should only wait for the finish.

(n.b. please ship after accepting, as I'm on PTO)

Reviewed By: LukeDefeo

Differential Revision: D38918570

fbshipit-source-id: fd93e1239985c81a2143ceb79312518e7ebb27f5
2022-08-25 02:18:40 -07:00
Andrey Goncharov
9b58f5217e Catch crash file parsing errors
Reviewed By: passy

Differential Revision: D38940908

fbshipit-source-id: 59f0669311093a4a9c24f570d7e63de0a51f9376
2022-08-23 08:55:25 -07:00
Andrey Goncharov
f132d95bee Fix crash reporter
Summary: Changelog: Make crash reporter pick up and parse .ips crash reports

Reviewed By: LukeDefeo

Differential Revision: D38355089

fbshipit-source-id: dc1b46257ea12c2e67d8a9baab7f35a905be2204
2022-08-02 10:08:35 -07:00