Skip to content

Commit 460e04c

Browse files
abueideclaude
andcommitted
fix(android): add missing android_emulator_ready function
The emulator start --wait-ready command was calling android_emulator_ready which didn't exist, causing "command not found" errors in dev mode. Added the function to emulator.sh with logic that matches the "ready" command handler: checks emulator serial and waits for sys.boot_completed. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f824a9d commit 460e04c

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

plugins/android/virtenv/scripts/domain/emulator.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,35 @@ android_stop_emulator() {
480480
echo "✓ Emulators stopped"
481481
fi
482482
}
483+
484+
# Check if the emulator is ready (boot completed)
485+
# Returns 0 if emulator is booted, 1 otherwise
486+
# Used by android.sh emulator start --wait-ready
487+
android_emulator_ready() {
488+
# Resolve serial from state directory (suite-namespaced)
489+
_suite="${SUITE_NAME:-default}"
490+
_runtime_dir="${ANDROID_RUNTIME_DIR:-${ANDROID_USER_HOME:-}}"
491+
if [ -z "$_runtime_dir" ]; then
492+
_runtime_dir="${PWD}/.devbox/virtenv"
493+
fi
494+
_state_dir="$_runtime_dir/$_suite"
495+
496+
_serial=""
497+
if [ -f "$_state_dir/emulator-serial.txt" ]; then
498+
_serial="$(cat "$_state_dir/emulator-serial.txt")"
499+
fi
500+
501+
# Fallback to legacy location
502+
if [ -z "$_serial" ] && [ -n "$_runtime_dir" ] && [ -f "$_runtime_dir/emulator-serial.txt" ]; then
503+
_serial="$(cat "$_runtime_dir/emulator-serial.txt")"
504+
fi
505+
506+
if [ -z "$_serial" ]; then
507+
return 1
508+
fi
509+
510+
if adb -s "$_serial" shell getprop sys.boot_completed 2>/dev/null | grep -q "1"; then
511+
return 0
512+
fi
513+
return 1
514+
}

0 commit comments

Comments
 (0)