summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jay Aliomer <aaliomer@google.com> 2021-10-19 16:21:07 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-10-19 16:21:07 +0000
commit25ad58563274499db0d73b971a2870918483df01 (patch)
tree79748b25bb0228f7299c20f6ec7b5967304e9994
parent43887b95e8e803c842090bb1941222dfe095dd93 (diff)
parent7f003540d874fbb0ec07f28830abc5fe87f6245c (diff)
Merge "Only cache mini bitmap wallpaper when there are widgets" into sc-v2-dev am: 4743b44cf9 am: 7f003540d8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16066645 Change-Id: I35ea7221daf44a641d47ccfea2a17e4695b36e19
-rw-r--r--packages/SystemUI/src/com/android/systemui/ImageWallpaper.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java7
2 files changed, 17 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index cffc048f3fd4..d2566b448ba6 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -127,7 +127,12 @@ public class ImageWallpaper extends WallpaperService {
setFixedSizeAllowed(true);
updateSurfaceSize();
- mRenderer.setOnBitmapChanged(this::updateMiniBitmap);
+ mRenderer.setOnBitmapChanged(b -> {
+ mLocalColorsToAdd.addAll(mColorAreas);
+ if (mLocalColorsToAdd.size() > 0) {
+ updateMiniBitmapAndNotify(b);
+ }
+ });
getDisplayContext().getSystemService(DisplayManager.class)
.registerDisplayListener(this, mWorker.getThreadHandler());
Trace.endSection();
@@ -171,7 +176,7 @@ public class ImageWallpaper extends WallpaperService {
computeAndNotifyLocalColors(new ArrayList<>(mColorAreas), mMiniBitmap));
}
- private void updateMiniBitmap(Bitmap b) {
+ private void updateMiniBitmapAndNotify(Bitmap b) {
if (b == null) return;
int size = Math.min(b.getWidth(), b.getHeight());
float scale = 1.0f;
@@ -233,6 +238,9 @@ public class ImageWallpaper extends WallpaperService {
Bitmap bitmap = mMiniBitmap;
if (bitmap == null) {
mLocalColorsToAdd.addAll(regions);
+ mRenderer.use(b -> {
+ updateMiniBitmapAndNotify(b);
+ });
} else {
computeAndNotifyLocalColors(regions, bitmap);
}
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
index a51ec54ebcce..729730cdf6f1 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
@@ -66,6 +66,13 @@ public class ImageWallpaperRenderer implements GLWallpaperRenderer {
mOnBitmapUpdated = c;
}
+ /**
+ * @hide
+ */
+ public void use(Consumer<Bitmap> c) {
+ mTexture.use(c);
+ }
+
@Override
public boolean isWcgContent() {
return mTexture.isWcgContent();