Skip to content

Move icon decoding off main thread and use ImageBitmap in UI models#16

Merged
Dev97633 merged 1 commit into
mainfrom
codex/fix-jank-by-decoding-icons-off-thread
Apr 9, 2026
Merged

Move icon decoding off main thread and use ImageBitmap in UI models#16
Dev97633 merged 1 commit into
mainfrom
codex/fix-jank-by-decoding-icons-off-thread

Conversation

@Dev97633
Copy link
Copy Markdown
Owner

@Dev97633 Dev97633 commented Apr 9, 2026

Motivation

  • Reduce UI jank caused by calling toBitmap() during composition and avoid Compose instability caused by mutable Drawable references.
  • Ensure icon decoding happens off the main thread so list composition only reads an already-decoded ImageBitmap reference.

Description

  • Change AppData.icon from Drawable? to ImageBitmap? and remove the incorrect @Immutable annotation so Compose isn't misled by mutable drawables.
  • Move icon conversion into loadAllAppDataWithIcons (already running on Dispatchers.Default) by converting app icons with (loadIcon(...) ).toBitmap(width=80,height=80).asImageBitmap() and storing the result in AppData.
  • Remove in-composition conversions and remember(appData.icon) in AppListItem and render appData.icon directly as an Image.
  • Update AppDetailsScreen to render the pre-decoded ImageBitmap directly and remove per-screen toBitmap() work.
  • Remove the redundant inner key(appData.packageName) wrapper inside the items(..., key = { it.packageName }) block and adjust imports (ImageBitmap added, Drawable removed where applicable).

Testing

  • Ran ./gradlew :app:compileDebugKotlin in this environment which failed with Permission denied when invoking the wrapper binary.
  • Re-ran the wrapper (via bash ./gradlew :app:compileDebugKotlin) which failed due to the environment's missing/invalid Java runtime (exec: : not found), so compilation could not be validated here.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84f4c450df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.getOrNull(),
icon = runCatching {
(appInfo?.loadIcon(pm) ?: pm.getApplicationIcon(pkg.packageName))
.toBitmap(width = 80, height = 80)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Decode detail icons at display resolution

loadAllAppDataWithIcons now always rasterizes app icons to 80x80, but AppDetailsScreen renders that same bitmap in a 120.dp avatar (larger than 80 physical pixels on most devices), so icons are upscaled and visibly blurry in the details view. This is a regression from the previous details-specific conversion path and affects all high-density screens; decode a larger bitmap for detail usage (or keep separate sizes) to avoid quality loss.

Useful? React with 👍 / 👎.

@Dev97633 Dev97633 merged commit c241922 into main Apr 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant