Wait for emulator to boot.

The recipe module was not waiting for the emulator to boot causing
errors when trying to install applications as even when the device was
discovered by adb it was still offline.

Change-Id: I5fa3d5f640614a4765424dbe1af344dbfa77e9c7
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/46040
Reviewed-by: Ricardo Amador <ricardoamador@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/android_virtual_device/resources/avd_setup.sh b/recipe_modules/android_virtual_device/resources/avd_setup.sh
index c0c452d..340e0e4 100644
--- a/recipe_modules/android_virtual_device/resources/avd_setup.sh
+++ b/recipe_modules/android_virtual_device/resources/avd_setup.sh
@@ -22,3 +22,5 @@
 $1 shell settings put global development_settings_enabled 1
 # Enable MTP file transfer
 $1 shell svc usb setFunctions mtp
+# Wait for device to boot and unlock device's screen.
+$1 wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'