Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android-wait-for-emulator consider avd running too early when -no-snapshot option is used with emulator command #1125

Open
damienvergnaud opened this issue Sep 27, 2024 · 0 comments

Comments

@damienvergnaud
Copy link

damienvergnaud commented Sep 27, 2024

Hey,

Concerning this file, we used it, and it brings us satisfaction to give back the stdin when emulator is ready to go.
But we faced an issue where "init.svc.bootanim" isn't really relevant to use when emulator is started with -no-snapshot option on emulator.

We proceeded to see wich adb shell prop could replace bootanim in 2024 on a booting avd with qemu and we found that sys.boot_completed cover the two cases (with -no-snapshot and without it).

Wich is perfect even to run an emulator in CICD (first run without -no-snapshot is indeed, without snapshot anyway).

We though as it helped us to find this script, even 7Years after, we would share our tweaks to eventually help someone :

#!/bin/bash

# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain

# https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator

set +e

sysbootcompleted=""
failcounter=0
timeout_in_sec=360

until [[ "$sysbootcompleted" == "1" ]]; do
  sysbootcompleted=`adb -e shell getprop sys.boot_completed 2>&1 &`
  let "failcounter += 1"
  echo "Waiting for emulator to start"
  if [[ $failcounter -gt timeout_in_sec ]]; then
    echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
    exit 1
  fi
  sleep 1
done

echo "Emulator is ready"

This proposal has been made during my working time at WeScale company ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant