From ecb8654a93a7caa4bd99046f2b8cf13b718afa66 Mon Sep 17 00:00:00 2001 From: James O'Leary Date: Wed, 2 Jun 2021 10:21:58 -0400 Subject: [PATCH] Only rescale wallpaper if its > display height WallpaperPicker assigns wallpapers, this code caches them. The assigned wallpaper is ~always slightly smaller than the display size There's no need to scale _up_ the assigned wallpaper, it will only permanently introduce scaling artifacts while increasing the amount of storage required to store the wallpaper. Most importantly, it creates an inconsistency between the colors WallpaperColors.fromBitmap returns, and the WallpaperColors returned by the system from the cached copy. This causes a large problem for dynamic color, as it means the colors displayed in Wallpaper Picker will differ from the colors actually extracted by the system. Bug: 189931209 Test: Test tons and tons of wallpapers over a couple days. Change-Id: I041d68bf057b24cf4dad677ed403a1c2e67904dc --- .../com/android/server/wallpaper/WallpaperManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index c888e545b24ea..6f2d020837f64 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -628,7 +628,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } // scale if the crop height winds up not matching the recommended metrics - needScale = wpData.mHeight != cropHint.height() + needScale = cropHint.height() > wpData.mHeight || cropHint.height() > GLHelper.getMaxTextureSize() || cropHint.width() > GLHelper.getMaxTextureSize();