Repository navigation
Fix blurry Android 12+ splash icon - #835
Open
josh-burton wants to merge 1 commit into
Open
josh-burton wants to merge 1 commit into
josh-burton wants to merge 1 commit into
Conversation
Android 12+ pre-draws a still windowSplashScreenAnimatedIcon into a bitmap at the 108dp default icon size, then scales that bitmap up to the final icon size (160dp, or 192dp without an icon background). The icon is soft however large the source image is. Animatable icons skip the pre-draw and are drawn straight from the drawable at the final size. The package now writes drawable-v31/android12splash_icon.xml, a one-frame, one-shot animation-list that wraps the existing android12splash bitmaps, and points the v31 styles at it. One frame never schedules a redraw, so nothing moves. The file is deleted when no Android 12 image is configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #724, #766, #789, #818.
Problem
On Android 12+ the splash icon looks soft or pixelated, even with a 1152×1152 source image.
The cause is in the platform, not in the resized PNGs. When
windowSplashScreenAnimatedIconis a still drawable, SystemUI wraps it inImmobileIconDrawable. That class pre-draws the icon into a bitmap atstarting_surface_default_icon_size(108dp), then scales the bitmap up with a matrix to the final icon size: 160dp, or 192dp with no icon background. So the icon is always drawn at 108dp and stretched, whatever resolution the PNG has.An
Animatabledrawable takes a different path,AnimatableIconAnimateListener. It draws the drawable directly at its final bounds, so the full-resolution bitmap is used.Source:
SplashscreenContentDrawer(thewindowSplashScreenAnimatedIconbranch callscreateIconDrawable(..., loadInDetail = false)) andSplashscreenIconDrawableFactory(ImmobileIconDrawable.preDrawIcon(drawable, srcIconSize)).Fix
createnow writesdrawable-v31/android12splash_icon.xml. This is a one-shotanimation-listwith one zero-duration frame that wraps the existing@drawable/android12splashbitmaps.windowSplashScreenAnimatedIconat that file. The night bitmaps still resolve through the normal resource qualifiers, so one XML file covers light and dark.AnimationDrawablenever schedules a redraw, so nothing moves. SystemUI also sees a total duration of 0.remove.Tests
test/android12_splash_icon_test.dart. It runscreateSplashagainst a temporary Android project and checks the generated drawable and both v31 styles. It also checks that the file and the style item are removed when the Android 12 image is dropped from the config.flutter test: all 16 tests pass.flutter analyzereports only the existingXmlNamedeprecation infos.Not tested
I have not checked this on an Android 12+ device yet. The fix follows from the AOSP code linked above. A screenshot from an Android 12+ device, before and after, would confirm it.
🤖 Generated with Claude Code