start.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. function wait_emulator_to_be_ready() {
  3. cpu_support_hardware_acceleration=$(grep -cw ".*\(vmx\|svm\).*" /proc/cpuinfo)
  4. kvm_support=$(kvm-ok)
  5. emulator_name=${EMULATOR_NAME_ARM}
  6. if [ "$cpu_support_hardware_acceleration" != 0 ] && [ "$kvm_support" != *"NOT"* ]; then
  7. emulator_name=${EMULATOR_NAME_x86}
  8. fi
  9. adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
  10. # This command worked inside the original docker container:
  11. # emulator -avd android_arm -no-window -no-accel -timezone Europe/Paris -no-boot-anim -noaudio
  12. emulator -avd "${emulator_name}" -verbose -no-boot-anim -gpu swiftshader_indirect -timezone Europe/Paris -noaudio -no-accel -netspeed full -camera-back none -camera-front none -logcat "*:w" &
  13. boot_completed=false
  14. while [ "$boot_completed" == false ]; do
  15. status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
  16. echo "Boot Status: $status"
  17. if [ "$status" == "1" ]; then
  18. boot_completed=true
  19. else
  20. sleep 1
  21. fi
  22. done
  23. }
  24. function disable_animation() {
  25. adb shell "settings put global window_animation_scale 0.0"
  26. adb shell "settings put global transition_animation_scale 0.0"
  27. adb shell "settings put global animator_duration_scale 0.0"
  28. }
  29. wait_emulator_to_be_ready
  30. sleep 1
  31. disable_animation