wait_for_emulator.sh 753 B

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