File tree Expand file tree Collapse file tree 1 file changed +4
-18
lines changed
Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -125,24 +125,10 @@ if [ -z "$PACKAGE_NAME" ]; then
125125fi
126126
127127ra_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
147133SCREENSHOT_DEVICE_PATH=" /sdcard/Download/cn1-instrumentation-screenshot.png"
148134SCREENSHOT_DIR=" $REPO_ROOT /out/android-emulator"
You can’t perform that action at this time.
0 commit comments