Fix WearOS deep-link screenshot capture getting stuck on startup screen#16
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Wear OS emulator screenshot GitHub Actions workflow to avoid deep-link captures getting stuck on the startup screen by ensuring the app is restarted and deep links are opened more reliably between captures.
Changes:
- Added an
open_deep_link()helper to force-stop the app and attempt an implicit BROWSABLE deep-link launch with a fallback to explicit activity launch. - Updated the deep-link capture loop to call
open_deep_link "$url"instead of directly callingadb shell am start -n ....
Comments suppressed due to low confidence (1)
.github/workflows/wearos-emulator-screenshots.yml:474
am startdoesn't accept a bare package name as a positional argument;"$BUNDLE_ID"at the end is likely interpreted as an intent URI and will cause this implicit start to always fail. Use-p "$BUNDLE_ID"(or remove the argument entirely if you truly want an unrestricted implicit intent) so the implicit deep link attempt can succeed as intended.
if adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "$url" "$BUNDLE_ID" >/dev/null 2>&1 </dev/null; then
return 0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return 0 | ||
| fi | ||
|
|
||
| adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null |
There was a problem hiding this comment.
This function runs under set -euo pipefail. If the fallback adb ... am start on the last line fails, Bash may exit the entire step before open_deep_link can return a non-zero status to the caller (so the loop won't reach the ::warning::Failed to open deep link path). Consider guarding the final start with || return 1 (or temporarily disabling set -e within the function) so failures are handled via the caller's if open_deep_link ...; then ... else ... logic.
| adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null | |
| adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null || return 1 |
Motivation
Description
open_deep_linkhelper that force-stops the app, then attempts an implicit BROWSABLE intent targeting the app package and falls back to an explicitMAIN_ACTIVITYlaunch if needed in.github/workflows/wearos-emulator-screenshots.yml.am start -ncall in the deep-link loop withopen_deep_linkto ensure a fresh app state before each capture while preserving the existing foreground check and screenshot logic.Testing
open_deep_link()function is present and the capture loop now callsopen_deep_link "$url"; these assertions passed.git diff --checkand committed the updated workflow file successfully without introducing whitespace errors.Codex Task