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

Commit a02a4129 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Cleanup fix_get_bitmap_crops flag

Flag: EXEMPT flag removal
Bug: 433268500
Test: presubmit

Change-Id: Ifc68b4651caf72d4dc6ec304b5bf84400a41a22e
parent 8d0e4de2
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -46,16 +46,6 @@ flag {
  }
}

flag {
  name: "fix_get_bitmap_crops"
  namespace: "systemui"
  description: "Avoid some rounding errors in WallpaperManager.getBitmapCrops(..., originalBitmap=true)"
  bug: "384502688"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "fix_wallpaper_crops_on_restore"
  namespace: "systemui"
+0 −17
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ import libcore.io.IoUtils;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
@@ -433,21 +431,6 @@ public class WallpaperCropper {
        return result;
    }

    /**
     * Inverse operation of {@link #getRelativeCropHints(WallpaperData)}
     */
    static List<Rect> getOriginalCropHints(
            WallpaperData wallpaper, List<Rect> relativeCropHints) {
        List<Rect> result = new ArrayList<>();
        for (Rect crop : relativeCropHints) {
            Rect originalRect = new Rect(crop);
            originalRect.scale(wallpaper.mSampleSize);
            originalRect.offset(wallpaper.cropHint.left, wallpaper.cropHint.top);
            result.add(originalRect);
        }
        return result;
    }

    /**
     * Given some suggested crops, find cropHints for all orientations of the default display.
     */
+6 −14
Original line number Diff line number Diff line
@@ -20,10 +20,9 @@ import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_WALLPAPER_INTERNAL;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import static android.app.Flags.fixGetBitmapCrops;
import static android.app.Flags.alwaysRebindUserSetWallpaper;
import static android.app.Flags.notifyKeyguardEvents;
import static android.app.Flags.updateRecentsFromSystem;
import static android.app.Flags.alwaysRebindUserSetWallpaper;
import static android.app.WallpaperManager.COMMAND_REAPPLY;
import static android.app.WallpaperManager.FLAG_LOCK;
import static android.app.WallpaperManager.FLAG_SYSTEM;
@@ -2282,8 +2281,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            }

            SparseArray<Rect> relativeCropHints = WallpaperCropper.getRelativeCropHints(
                    wallpaper, fixGetBitmapCrops() && originalBitmap);
            Point relativeCropSize = (fixGetBitmapCrops() && originalBitmap)
                    wallpaper, /* ignoreSampleSize= */ originalBitmap);
            Point relativeCropSize = originalBitmap
                    ? new Point(wallpaper.cropHint.width(), wallpaper.cropHint.height())
                    : new Point(
                            (int) Math.ceil(wallpaper.cropHint.width() / wallpaper.mSampleSize),
@@ -2308,20 +2307,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    == View.LAYOUT_DIRECTION_RTL;
            WallpaperDefaultDisplayInfo defaultDisplayInfo =
                    mWallpaperDisplayHelper.getDefaultDisplayInfo();
            SparseArray<Rect> cropHints = fixGetBitmapCrops()
                    ? relativeCropHints
                    : adjustedRelativeSuggestedCrops;
            for (Point displaySize : displaySizes) {
                result.add(WallpaperCropper.getCrop(displaySize, defaultDisplayInfo,
                        relativeCropSize, cropHints, rtl));
                        relativeCropSize, relativeCropHints, rtl));
            }
            if (originalBitmap) {
                if (fixGetBitmapCrops()) {
                result.forEach(crop ->
                        crop.offset(wallpaper.cropHint.left, wallpaper.cropHint.top));
                } else {
                    result = WallpaperCropper.getOriginalCropHints(wallpaper, result);
                }
            }
            return result;
        }