fix: add MAIN/LAUNCHER flags to Android launcher activity resolver#115
Merged
thymikee merged 2 commits intoFeb 24, 2026
Merged
Conversation
The `resolve-activity` fallback command was missing `-a android.intent.action.MAIN` and `-c android.intent.category.LAUNCHER`, causing it to resolve the wrong activity on multi-entry apps like Microsoft Outlook. This adds the correct intent flags so the resolver consistently returns the launcher activity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
am start -p <package> can exit 0 while printing "Error: Activity not started" to stdout. The previous try/catch never entered the fallback because runCmd did not throw. Now we check the output for error indicators via isAmStartError() and proceed to the resolve-activity fallback when the primary launch silently fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Have tested in my Android phone (Android 12) which didn't work before, now it works with the fix. |
thymikee
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-a android.intent.action.MAIN -c android.intent.category.LAUNCHERto theresolve-activityfallback command inresolveAndroidLaunchComponent()am start -W -p <package>exits with code 0 even when it fails to resolve the activity, printingError: Activity not started, unable to resolve Intentto stdout. The originaltry/catchnever triggered the fallback becauserunCmddid not throw on exit code 0. AddedisAmStartError()to detect this silent failure and correctly fall through to the component-based fallback.Changes
Commit 1: Fix resolve-activity flags
resolveAndroidLaunchComponent()now passes-a android.intent.action.MAIN -c android.intent.category.LAUNCHERtocmd package resolve-activity, ensuring the correct launcher activity is resolved for multi-entry apps.Commit 2: Detect am start silent failures
try/catchwithallowFailure: true+ stdout/stderr inspection viaisAmStartError()am start -preturning exit code 0 withError: Activity not startedin stdout now correctly triggers the component-based fallbackTest plan
parseAndroidLaunchComponentcorrectly parses multi-entry resolve outputisAmStartErrordetectsam startfailure messages in stdoutisAmStartErrorreturns false for successful launchesresolve-activitycommand includes-a MAIN -c LAUNCHERflags-p <package>(system-driven resolution)agent-device open "com.microsoft.office.outlook" --platform androidlaunches Outlook without--activityflag on physical device