Skip to content

Commit 649481e

Browse files
committed
Harden emulator readiness and verify APK installs
1 parent c927501 commit 649481e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/build-android-app.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ fi
12381238
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell locksettings set-disabled true >/dev/null 2>&1 || true
12391239
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell settings put global device_provisioned 1 >/dev/null 2>&1 || true
12401240
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell settings put secure user_setup_complete 1 >/dev/null 2>&1 || true
1241+
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell svc power stayon true >/dev/null 2>&1 || true
12411242
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell input keyevent 82 >/dev/null 2>&1 || true
12421243
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell wm dismiss-keyguard >/dev/null 2>&1 || true
12431244
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell settings put global window_animation_scale 0 >/dev/null 2>&1 || true
@@ -1497,6 +1498,20 @@ if ! adb_wait_framework_ready "$EMULATOR_SERIAL"; then
14971498
exit 1
14981499
fi
14991500

1501+
if ! "$ADB_BIN" -s "$EMULATOR_SERIAL" shell pm list packages | grep -q "^package:${RUNTIME_PACKAGE//./\.}$"; then
1502+
ba_log "ERROR: Installed package $RUNTIME_PACKAGE not visible on $EMULATOR_SERIAL"
1503+
dump_emulator_diagnostics
1504+
stop_emulator
1505+
exit 1
1506+
fi
1507+
1508+
if ! "$ADB_BIN" -s "$EMULATOR_SERIAL" shell pm list packages | grep -q "^package:${TEST_RUNTIME_PACKAGE//./\.}$"; then
1509+
ba_log "ERROR: Installed test package $TEST_RUNTIME_PACKAGE not visible on $EMULATOR_SERIAL"
1510+
dump_emulator_diagnostics
1511+
stop_emulator
1512+
exit 1
1513+
fi
1514+
15001515
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell pm list instrumentation | sed "s/^/[build-android-app] instrumentation: /" || true
15011516
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell pm list packages | grep -E "${RUNTIME_PACKAGE//./\.}|${RUNTIME_PACKAGE//./\.}\\.test" | sed "s/^/[build-android-app] package: /" || true
15021517
"$ADB_BIN" -s "$EMULATOR_SERIAL" shell cmd package resolve-activity --brief "$RUNTIME_PACKAGE/$RUNTIME_STUB_FQCN" | sed "s/^/[build-android-app] resolve-stub (pre-test): /" || true

0 commit comments

Comments
 (0)