Update wait-for-android-emulator

This commit is contained in:
Quentin Monnier 2023-01-18 17:57:38 +00:00 committed by Sylvain Berfini
parent 4308bedbd6
commit e83e427eb1

View file

@ -9,7 +9,7 @@ adb="${ANDROID_HOME}/platform-tools/adb"
device="emulator-5554"
timeout_in_sec=360
while getopts a:t:d flag; do
while getopts a:d:t flag; do
case "${flag}" in
a) adb=${OPTARG};;
d) device=${OPTARG};;
@ -19,11 +19,11 @@ done
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`$adb -s $device -e shell getprop init.svc.bootanim 2>&1 &`
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
if [[ "$bootanim" =~ "device '$device' not found" || "$bootanim" =~ "device '$device' offline"
|| "$bootanim" =~ "running" ]]; then
let "failcounter += 1"
if [[ $failcounter = 1 ]]; then
echo -n "Waiting for emulator to start"; else
echo -n "Waiting for $device to start"; else
echo -n "."
fi
if [[ $failcounter -gt timeout_in_sec ]]; then
@ -34,4 +34,4 @@ until [[ "$bootanim" =~ "stopped" ]]; do
sleep 1
done
echo "Emulator is ready"
echo "$device is ready"