Commit Graph

22 Commits

Author SHA1 Message Date
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
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
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
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
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
754afd0d2d Fix and re-apply "[flipper] Automatically set Android devices into the permissive mode"
Summary: Reverts D36263724 (0ee8f09fe5) and fixes the underlying crash by setting only physical devices in the permissive mode

Reviewed By: passy

Differential Revision: D36275055

fbshipit-source-id: 25a691e9c07e20a3341630db508795c133a9bd81
2022-05-10 08:42:58 -07:00
Mengke Ding
0ee8f09fe5 Back out "Automatically set Android devices into the permissive mode"
Summary:
Original commit changeset: 471470c5ca91

Original Phabricator Diff: D35356211 (501abc6b55)

Recently, bloks users reported that android emulators lost connection upon launching Flipper. (S270689)

Manual bisecting indicates that remote emulators won't crash on v0.142.362128844 (4/6) but crash on 0.143.365099607 (4/21).

Looking at https://www.internalfb.com/code/fbsource/[history]/xplat/scripts/.flipperversion.v2, and backing out D35356211 (501abc6b55) fixes the issue.

It's still unclear why setting `setIntoPermissiveMode` would crash/disconnect the android emulators, I'd defer Flipper team to investigate this further but this diff should unblock all the android bloks emulator + Flipper use case.

Reviewed By: lblasa

Differential Revision: D36263724

fbshipit-source-id: e8674730c0185457f6eda347ce7d9a41f9e1a2a4
2022-05-09 16:04:14 -07:00
Andrey Goncharov
501abc6b55 Automatically set Android devices into the permissive mode
Reviewed By: nikoant

Differential Revision: D35356211

fbshipit-source-id: 471470c5ca91c824590a409c4474433f2277b1f2
2022-04-07 02:49:48 -07:00
Pascal Hartig
c180b24753 Fix typo
Summary: Well, and added another word.

Reviewed By: lblasa

Differential Revision: D34944504

fbshipit-source-id: eb4e7db05ee846721fa18899aa50596124632b5b
2022-03-17 04:11:37 -07:00
Andrey Goncharov
6c74f2dd18 Set device features on device initialization
Summary:
1. Identify if device supports screenshots/screen recording when it is created.
2. Disable screen recording/screenshot buttons when they are not supported

Reviewed By: passy

Differential Revision: D34611133

fbshipit-source-id: 82ad2d67e4af482d9becf7995187667b5d99bc36
2022-03-04 02:00:23 -08:00
Michel Weststrate
a31494f321 Fix unnecessary 'still authorizing' error
Summary:
When connection to Android, I always get an error popup with 'device still authorizing', which disappears itself and the device connects fine. It seems that this was a case we handled gracefully before, but the error message we check for has changed. Also updated the log message so that we get it in our monitoring I don't silently get stuck in this state.

Changelog: Fixed 'device still authorizing' errors showing up while connecting to an Android device

Reviewed By: aigoncharov

Differential Revision: D33976028

fbshipit-source-id: dbb055bbbd43bad129b10ffee4a8dbb50be8e87a
2022-02-03 04:20:54 -08:00
Andrey Goncharov
51ef1810b2 Defer initialization of Android and iOS device managers
Summary: Remove hidden async initialization of adb and idb. Make it explicit. Remove nullable fields in Android and iOS device managers.

Reviewed By: lawrencelomax

Differential Revision: D33915177

fbshipit-source-id: 882f79310410e0dfde6169abf343ab808644e4a2
2022-02-02 03:07:00 -08:00
Andrey Goncharov
fd13399cb9 Extract WWW certificate provider
Summary: Extract WWW certificate provider from the iOS certificate provider. Hide its implementation from OSS since it is not relevant for OSS folks.

Reviewed By: mweststrate

Differential Revision: D33895378

fbshipit-source-id: 376afda3b5fa3857c0eb280b92555314eb1a0d1f
2022-02-02 03:07:00 -08:00
Andrey Goncharov
29f6d0e711 Add device-specific Certificate Providers
Reviewed By: mweststrate

Differential Revision: D33821880

fbshipit-source-id: c75c71db4d7dc680f75cf41ba2d5dad009a5fd03
2022-02-02 03:07:00 -08:00
Andrey Goncharov
da618fd3f3 Decouple CertificateProvider and adb/idb client intialization
Summary:
Previously CertificateProvider initialized ADB and provided config to IDB. As result, AndroidDeviceManager and iOSDeviceManager indirectly depended on CertificateProvider.

With this diff we:
1. Make idbConfig resemble adbClient.
2. Make AndroidDeviceManager and iOSDeviceManager initialize their own clients
3. Fix server crash when one of the clients couldn't be initialized. The reason for the crash is CertificateProvider.prototype.init which is no longer needed.

Reviewed By: passy

Differential Revision: D33711652

fbshipit-source-id: 055b5625ed993827b65396f4af5157808479242b
2022-01-26 04:23:05 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Michel Weststrate
ef2a86e7a8 Sdk path should be used when launching emulator
Summary:
Changelog: Fixed issue where a missing ANDROID_SDK_ROOT env var made it impossible to launch emulators

Run into an issue where ANDROID_SDK_ROOT wasn't set for my user, causing Flipper not to be able to launch emulator, which was looked up from the path rather than using the flipper settings.

Fixes: https://github.com/facebook/flipper/issues/3119

Reviewed By: timur-valiev

Differential Revision: D33158280

fbshipit-source-id: ea5616b10265ed43f1012c58da081be275ff1d5b
2021-12-16 14:51:08 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).

This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.

Reviewed By: passy, aigoncharov

Differential Revision: D32498649

fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
2021-12-08 04:30:54 -08:00
Ranesh Saha
d8824fb130 Update emulator path to emulator directory instead of deprecated tool… (#3046)
Summary:
…s directory

Currently, flipper tries to launch emulators using  `<android sdk path>\tools\emulator.exe`. The use of this emulator path has been deprecated for a while now, and remains in the sdk for those on versions of Android Studio 2.2 and older (see https://issuetracker.google.com/issues/66886035?pli=1). The supported path is `<android sdk path>\emulator\emulator.exe`. Trying to use the deprecated path on Windows results in a failure to launch AVDs.

## Changelog

Point emulator path to emulator directory instead of deprecated tools directory.

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

Test Plan: Verified a failure to launch the AVD on windows using the deprecated path. Confirmed that updating the path results in a successful launch and the device showing up in flipper.

Reviewed By: passy

Differential Revision: D32489840

Pulled By: nikoant

fbshipit-source-id: dde5bf5a29e89549f160d9d71133ff70398e1c1d
2021-11-17 05:10:53 -08:00
Ranesh Saha
ddb4e70c2a Updating splitting of avd names to work on Windows and Unix based sys… (#3041)
Summary:
…tems

When trying to start an android emulator in Windows, there is a failure in trying to read `<avd name>.ini`. The reason for this is because when we run `<android sdk path>\tools\emulator.exe -list-avds`, a split is performed with the new line character (`\n`). Unfortunately, this does not work for Windows, which uses `\r\n` as the new line termination. This results in a carriage return remaining on each output string, which results in trying to access `<avd name> .ini`, which is an invalid path.

The fix is to update the split to use a regex that is compatible for both Unix and Windows based systems.

## Changelog

Updating splitting of avd names to work on Windows and Unix based systems

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

Test Plan: Verified the avd names didn't have any trailing whitespace, and the emulator is able to launch.

Reviewed By: mweststrate

Differential Revision: D32387162

Pulled By: nikoant

fbshipit-source-id: 0900bee17b225cfa5484a29c96f8e2c1c2e31477
2021-11-12 08:07:18 -08:00
Lorenzo Blasa
423a2c6c06 Alt ports to be reversed on Android
Summary: This change adds the alt ports to the list of ports to be reversed on Android

Reviewed By: mweststrate

Differential Revision: D31607559

fbshipit-source-id: 4e1201c7255fcd3a437c743f827ae4bceb746348
2021-10-13 10:31:41 -07:00
Michel Weststrate
d88b28330a Move app/server to flipper-server-core
Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).

Reviewed By: passy

Differential Revision: D31541378

fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
2021-10-12 16:00:52 -07:00