Skip to content

Draw static and rotation wallpapers at the display size - #71

Merged
codenameakshay merged 1 commit into
mainfrom
fix/android-wallpaper-display-size
Sep 15, 2026
Merged

codenameakshay merged 1 commit into
mainfrom
fix/android-wallpaper-display-size

Conversation

@codenameakshay

Copy link
Copy Markdown
Owner

Every static scale mode was drawn onto the launcher's desired size, which is 4800×2400 on a 1080×2400 phone. The whole bitmap went in as the crop hint, and Android shows a screen-sized window from its left edge. The result said applied, but:

  • fitCenter and center gave an all-black home screen.
  • centerCrop, fill, and stretch showed only a zoomed-in left strip.

The test image is a portrait 1080×2400 with red, green, and blue columns, a white top, and a yellow bottom. Every mode should show all three columns. From left to right: centerCrop, fitCenter, center, fill, stretch.

Before

After

 applyBitmap
-  size = WallpaperManager desired minimum (4800×2400, clamped to 4096×2048)
+  size = display real size in natural orientation (1080×2400), same bounds
   BitmapTransformer.transform(mode, size)
   setBitmap(crop hint = whole bitmap)
 rotation cache
-  center-crop only when larger than the desired size
+  always center-crop to the display size

Trade-off: launchers no longer pan the wallpaper. The Android guide now says so.

Verification

  • API 36 emulator: all five modes, screenshots above.
  • Three new JVM tests for wallpaperCanvasSize: display size, rotated display, and bounds with aspect ratio kept.
  • Local CI: pass.

🤖 Generated with Claude Code

The engines sized the output from WallpaperManager's desired minimum
size, which is the launcher's wide virtual canvas (4800x2400 on a
1080x2400 phone). The whole bitmap went in as the crop hint, and Android
shows a screen-sized window from its left edge. fitCenter and center
therefore showed only the black bar, and centerCrop, fill, and stretch
showed a zoomed-in left strip, while the result still said applied.

Both engines now draw onto the display size in its natural orientation,
so each scale mode matches what the user sees.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codenameakshay
codenameakshay merged commit 59005b7 into main Sep 15, 2026
6 checks passed
@codenameakshay
codenameakshay deleted the fix/android-wallpaper-display-size branch September 16, 2026 09:44
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.

1 participant