Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f003540 authored by Jay Aliomer's avatar Jay Aliomer Committed by Automerger Merge Worker
Browse files

Merge "Only cache mini bitmap wallpaper when there are widgets" into sc-v2-dev am: 4743b44c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16066645

Change-Id: I398adeb1a1b4072d9e0d47fc27e8dc08c3349597
parents 4e2db854 4743b44c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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);
                }
+7 −0
Original line number Diff line number Diff line
@@ -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();