wait_for_emulator.sh 645 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain
  3. bootanim=""
  4. failcounter=0
  5. checkcounter=0
  6. until [[ "$bootanim" =~ "stopped" ]]; do
  7. bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
  8. echo "($checkcounter) $bootanim"
  9. if [[ "$bootanim" =~ "not found" || "$bootanim" =~ "error" ]]; then
  10. let "failcounter += 1"
  11. if [[ $failcounter -gt 3 ]]; then
  12. echo "Failed to start emulator"
  13. exit 1
  14. fi
  15. fi
  16. let "checkcounter += 1"
  17. sleep 5
  18. done
  19. echo "($checkcounter) Done"
  20. adb -e shell input keyevent 82
  21. echo "($checkcounter) Unlocked emulator screen"