Malinskiy / action-android

Collection of Android-related GitHub Actions
MIT License
185 stars 24 forks source link

Avoid polling for started emulator #77

Closed hannesa2 closed 1 year ago

hannesa2 commented 1 year ago

Currently you do a polling for an emulator start https://github.com/Malinskiy/action-android/blob/b58aaba4a3bfe4966c26be53b573b2b2a5c2e936/emulator-run-cmd/src/emulator.ts#L42-L69

which results in a lot of noise

image

But there is an adb wait-for-device which can do this with one command. To specify the timeout you could do a timeout <some seconds> adb wait-for-device

It's just a suggestion.

Malinskiy commented 1 year ago

Hey @hannesa2. wait-for-xx command in adb only waits for a specific state in the adb server, in this case you’re suggesting to replace the getprop sys.boot_completed check with checking if device appeared with state device==online. This will result in failures during action execution due to device not fully booted.

Refer to https://cs.android.com/android/platform/superproject/+/master:packages/modules/adb/services.cpp;l=155?q=Wait-for&ss=android%2Fplatform%2Fsuperproject:packages%2Fmodules%2Fadb%2F for more information on how wait-for-xx works.