Move icon decoding off main thread and use ImageBitmap in UI models#16
Conversation
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
toBitmap()during composition and avoid Compose instability caused by mutableDrawablereferences.ImageBitmapreference.Description
AppData.iconfromDrawable?toImageBitmap?and remove the incorrect@Immutableannotation so Compose isn't misled by mutable drawables.loadAllAppDataWithIcons(already running onDispatchers.Default) by converting app icons with(loadIcon(...) ).toBitmap(width=80,height=80).asImageBitmap()and storing the result inAppData.remember(appData.icon)inAppListItemand renderappData.icondirectly as anImage.AppDetailsScreento render the pre-decodedImageBitmapdirectly and remove per-screentoBitmap()work.key(appData.packageName)wrapper inside theitems(..., key = { it.packageName })block and adjust imports (ImageBitmapadded,Drawableremoved where applicable).Testing
./gradlew :app:compileDebugKotlinin this environment which failed withPermission deniedwhen invoking the wrapper binary.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