Using the boot state provided from service.bootanim.exit
may produce unstable results, if you try to install an app right after.
Especially if you use it to check after rebooting with adb shell su 0 setprop ctl.restart zygote
service.bootanim.exit
is the "google" icon shown on white background when the emulator is booting. When it has completed, next state is the "Phone is starting" screen, where app install is not immediately possible.
I found monitoring the switch from no network to LTE or WIFI to happen after the UI is done rendering. This way the emulator is ready for user input, including app loading.
adb shell dumpsys connectivity | sed -e '/[0-9] NetworkAgentInfo.*CONNECTED/p' -n
Emulator network changes states from no network, to LTE and finally WIFI after UI has completed loading. Tested on Android 10 with Google API support.
Without sed
you get an overload of info. Try grep
for either WIFI or LTE if you want a found/not found response.