Skip to content

Support activity-alias in Android launcher activity detection#187251

Open
mboetger wants to merge 4 commits into
flutter:masterfrom
mboetger:resolve-issue-38965
Open

Support activity-alias in Android launcher activity detection#187251
mboetger wants to merge 4 commits into
flutter:masterfrom
mboetger:resolve-issue-38965

Conversation

@mboetger
Copy link
Copy Markdown
Contributor

Support activity-alias in Android launcher activity detection

Fixes: #38965

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

mboetger added 2 commits May 14, 2026 22:14
Scan both "<activity>" and "<activity-alias>" elements when parsing raw "AndroidManifest.xml"
in "AndroidApk.fromAndroidProject". This allows applications that define their main launcher
activity via an activity-alias to be successfully detected and launched.
Added unit tests in "application_package_test.dart" to verify activity-alias parsing in both the
raw XML manifest parser and the "aapt" dump parser (which already implicitly supported it).

TAG=agy
CONV=8e04fc99-af40-4f70-9234-266a4f69c16e
…ty resolution

Update raw manifest parser to support '<activity-alias>' elements when searching for main launcher activity. This aligns behavior with compiled manifest parsing which already supports it, and allows apps using activity-alias for launchers to start successfully.

Also fixed parser consistency by breaking on first launcher match, and improved safety against missing name attributes on launcher elements.

TAG=agy
CONV=9697b14d-2ef7-49c4-a41b-7296635fc856
@mboetger mboetger requested a review from a team as a code owner May 28, 2026 17:48
@mboetger mboetger requested review from gmackall and removed request for a team May 28, 2026 17:48
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 28, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Android application package parsing to support activity-alias elements in the manifest alongside standard activity elements, and adds corresponding unit tests. Feedback on the changes suggests ensuring packageId is not null before setting launchActivity to prevent string interpolation from bypassing subsequent null checks, and using followedBy to lazily concatenate the activity iterables instead of using the spread operator.

Comment thread packages/flutter_tools/lib/src/android/application_package.dart Outdated
Comment thread packages/flutter_tools/lib/src/android/application_package.dart Outdated
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 28, 2026
- Prevent packageId null bypass via string interpolation by adding a defensive null check.
- Optimize XML activity parsing by lazily concatenating iterables with followedBy instead of allocating a list.

TAG=agy
CONV=d492ea8e-4d8e-443f-b7c7-76f68efb5fc4
@github-actions github-actions Bot removed the CICD Run CI/CD label May 29, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using activity-alias as MAIN/LAUNCHER activity will throw an incorrect error when using flutter run

1 participant