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

Commit cb2e2286 authored by James O'Leary's avatar James O'Leary Committed by Automerger Merge Worker
Browse files

Merge "Fix boot time regression on Wembley" into sc-dev am: d96ed76d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic0874511341951757a41dc7d424b95a22a31a7ec
parents 09399afb d96ed76d
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.util.Size;
import com.android.internal.graphics.ColorUtils;
import com.android.internal.graphics.palette.CelebiQuantizer;
import com.android.internal.graphics.palette.Palette;
import com.android.internal.graphics.palette.VariationalKMeansQuantizer;
import com.android.internal.util.ContrastColorUtil;

import java.io.FileOutputStream;
@@ -178,11 +179,20 @@ public final class WallpaperColors implements Parcelable {
                    optimalSize.getHeight(), true /* filter */);
        }

        final Palette palette = Palette
        final Palette palette;
        if (ActivityManager.isLowRamDeviceStatic()) {
            palette = Palette
                    .from(bitmap, new VariationalKMeansQuantizer())
                    .maximumColorCount(5)
                    .resizeBitmapArea(MAX_WALLPAPER_EXTRACTION_AREA)
                    .generate();
        } else {
            palette = Palette
                    .from(bitmap, new CelebiQuantizer())
                    .maximumColorCount(256)
                    .resizeBitmapArea(MAX_WALLPAPER_EXTRACTION_AREA)
                    .generate();
        }
        // Remove insignificant colors and sort swatches by population
        final ArrayList<Palette.Swatch> swatches = new ArrayList<>(palette.getSwatches());
        swatches.sort((a, b) -> b.getPopulation() - a.getPopulation());