Skip to content

fix: dedupe app list by package to prevent LazyColumn key collision#19

Open
bbendes wants to merge 1 commit into
cajdata:mainfrom
bbendes:fix/app-list-dedup
Open

fix: dedupe app list by package to prevent LazyColumn key collision#19
bbendes wants to merge 1 commit into
cajdata:mainfrom
bbendes:fix/app-list-dedup

Conversation

@bbendes

@bbendes bbendes commented Jun 1, 2026

Copy link
Copy Markdown

Summary

Apps that declare more than one ACTION_MAIN / CATEGORY_LAUNCHER activity (e.g. Tasker, with net.dinglisch.android.taskerm) cause
pm.queryIntentActivities() to return multiple ResolveInfo entries for the same package. AppSelectionViewModel.loadInstalledApps() then produced
duplicate AppInfo rows, and the LazyColumn in AppSelectionActivity — keyed on packageName — 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, in AppSelectionActivity.kt. Label/icon are package-scoped so collapsing extra launcher entries
doesn't lose information.

Test plan

  • Reproduced on a device with Tasker installed (logcat above).
  • After fix, Manage Blocked Apps opens with a single Tasker row.

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.
@bbendes

bbendes commented Jun 1, 2026

Copy link
Copy Markdown
Author

Fixes: #14

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.

2 participants