Skip to content

Commit e7b0a61

Browse files
committed
Revert "Improve emulator launch fallback"
This reverts commit 2e8a075.
1 parent 527ad3f commit e7b0a61

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

scripts/run-android-instrumentation-tests.sh

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,10 @@ if [ -z "$PACKAGE_NAME" ]; then
125125
fi
126126

127127
ra_log "Launching $PACKAGE_NAME before capturing screenshot"
128-
if adb_target shell monkey -p "$PACKAGE_NAME" -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1; then
129-
ra_log "Application launch via monkey succeeded"
130-
else
131-
ra_log "Failed to launch $PACKAGE_NAME via monkey; attempting explicit resolve" >&2
132-
MAIN_ACTIVITY="$(adb_target shell cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.LAUNCHER "$PACKAGE_NAME" 2>/dev/null | tr -d '\r' | tail -n 1)"
133-
MAIN_ACTIVITY="${MAIN_ACTIVITY##* }"
134-
if [[ -z "$MAIN_ACTIVITY" || "$MAIN_ACTIVITY" != */* ]]; then
135-
ra_log "Unable to resolve launchable activity for $PACKAGE_NAME (cmd package output: ${MAIN_ACTIVITY:-<empty>})" >&2
136-
exit 1
137-
fi
138-
ra_log "Resolved main activity $MAIN_ACTIVITY; starting via am"
139-
if ! adb_target shell am start -n "$MAIN_ACTIVITY" >/dev/null 2>&1; then
140-
ra_log "Failed to start $MAIN_ACTIVITY via am start" >&2
141-
exit 1
142-
fi
143-
fi
144-
145-
sleep 5
128+
adb_target shell monkey -p "$PACKAGE_NAME" -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1 || {
129+
ra_log "Failed to launch $PACKAGE_NAME via monkey" >&2
130+
exit 1
131+
}
146132

147133
SCREENSHOT_DEVICE_PATH="/sdcard/Download/cn1-instrumentation-screenshot.png"
148134
SCREENSHOT_DIR="$REPO_ROOT/out/android-emulator"

0 commit comments

Comments
 (0)