Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -a android.intent.action.MAIN to the launch command #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anonlatte
Copy link

@anonlatte anonlatte commented Feb 13, 2025

Summary

This pull request makes a small adjustment to the ADB command used by the plugin to restart or launch an app’s default activity. Previously, the command did not include any explicit action. Now we add -a android.intent.action.MAIN so that apps that depend on having MAIN set will correctly initialize on startup.

Why this change is necessary

In some apps, certain startup logic or navigation flows only kick in if the incoming Intent has action=MAIN. Without that action, the app might show a blank screen or skip important setup steps. By explicitly including android.intent.action.MAIN, we ensure that those apps can use ADB Idea without unexpected behavior.

Impact on Other Users

  • Low Risk: Most Android apps already declare their default (launcher) activity to handle the MAIN action. Adding it explicitly shouldn’t break anything for them.
  • Optional Nature: If an app doesn’t rely on MAIN, it should work exactly as before. This is simply a more explicit way to handle typical launcher activity scenarios.
  • Potential Benefits: Any app that needs the MAIN action for initialization will now behave correctly on restart or launch via the plugin.

Implementation Details

  • Modified the shell command to include -a android.intent.action.MAIN when launching the default activity.
  • Preserved all other flags and existing functionality (including debug attach).

Specifically, the plugin retrieves the default activity name via getDefaultActivityName(...), which uses DefaultActivityLocator to identify the main launcher activity. Change ensures that the final ADB command explicitly includes -a android.intent.action.MAIN when starting that activity, preserving the intended behavior for apps that rely on MAIN for their initial setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant