From 0ecc00909f9a68bdd61898167d1d83f169516964 Mon Sep 17 00:00:00 2001 From: Quentin Monnier Date: Wed, 18 Jan 2023 16:53:50 +0000 Subject: [PATCH] Update wait-for-android-emulator --- .gitlab-ci-files/wait-for-android-emulator | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci-files/wait-for-android-emulator b/.gitlab-ci-files/wait-for-android-emulator index 6e5c35bc7..093e995e5 100755 --- a/.gitlab-ci-files/wait-for-android-emulator +++ b/.gitlab-ci-files/wait-for-android-emulator @@ -1,15 +1,24 @@ #!/bin/bash -# Originally written by Ralf Kistner , but placed in the public domain - set +e bootanim="" failcounter=0 + +adb=`${ANDROID_HOME}/platform-tools/adb` +device=`emulator-5554` timeout_in_sec=360 +while getopts a:t:d flag; do + case "${flag}" in + a) adb=${OPTARG};; + d) device=${OPTARG};; + t) timeout_in_sec=${OPTARG};; + esac +done + until [[ "$bootanim" =~ "stopped" ]]; do - bootanim=`${ANDROID_HOME}/platform-tools/adb -e shell getprop init.svc.bootanim 2>&1 &` + bootanim=`$adb -s $device -e shell getprop init.svc.bootanim 2>&1 &` if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline" || "$bootanim" =~ "running" ]]; then let "failcounter += 1" @@ -25,4 +34,4 @@ until [[ "$bootanim" =~ "stopped" ]]; do sleep 1 done -echo "Emulator is ready" \ No newline at end of file +echo "Emulator is ready"