fix: dedupe app list by package to prevent LazyColumn key collision#19
Open
bbendes wants to merge 1 commit into
Open
fix: dedupe app list by package to prevent LazyColumn key collision#19bbendes wants to merge 1 commit into
bbendes wants to merge 1 commit into
Conversation
Apps that declare multiple ACTION_MAIN/CATEGORY_LAUNCHER activities (e.g.
Tasker) returned multiple ResolveInfo entries from queryIntentActivities,
producing duplicate AppInfo rows with the same packageName. LazyColumn's
key={ it.packageName } then crashed with IllegalArgumentException.
Author
|
Fixes: #14 |
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
Apps that declare more than one
ACTION_MAIN/CATEGORY_LAUNCHERactivity (e.g. Tasker, withnet.dinglisch.android.taskerm) causepm.queryIntentActivities()to return multipleResolveInfoentries for the same package.AppSelectionViewModel.loadInstalledApps()then producedduplicate
AppInforows, and theLazyColumninAppSelectionActivity— keyed onpackageName— crashed with:java.lang.IllegalArgumentException: Key "net.dinglisch.android.taskerm" was already used.
If you are using LazyColumn/Row please make sure you provide a unique key for each item.
The screen crashed on entry for anyone with such an app installed.
Fix: add
.distinctBy { it.packageName }before sorting, inAppSelectionActivity.kt. Label/icon are package-scoped so collapsing extra launcher entriesdoesn't lose information.
Test plan