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

Commit fa145ff4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix B&R for multi crop" into main

parents 3ab01d2d d7182f30
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -55,3 +55,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "fix_wallpaper_crops_on_restore"
  namespace: "systemui"
  description: "Preserve center for wallpaper crops on restore"
  bug: "332937943"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
 No newline at end of file
+252 −88

File changed.

Preview size limit exceeded, changes collapsed.

+531 −29

File changed.

Preview size limit exceeded, changes collapsed.

+10 −1
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.server.wallpaper;

import static android.app.Flags.fixWallpaperCropsOnRestore;
import static android.app.WallpaperManager.ORIENTATION_LANDSCAPE;
import static android.app.WallpaperManager.ORIENTATION_PORTRAIT;
import static android.app.WallpaperManager.ORIENTATION_UNKNOWN;
import static android.app.WallpaperManager.getOrientation;
import static android.app.WallpaperManager.getRotatedOrientation;
@@ -234,8 +236,15 @@ public class WallpaperCropper {
        // have the suggested crop of the relative folded orientation, reuse it by adding content.
        int foldedOrientation = defaultDisplayInfo.getFoldedOrientation(orientation);
        suggestedCrop = suggestedCrops.get(foldedOrientation);
        // Exception: don't reuse the suggested crop for landscape if a portrait suggested crop
        // exists. In that case we'd rather go to case 6 and use the portrait suggested crop. This
        // is in order to have a consistent wallpaper position on both SQUARE_PORTRAIT and
        // SQUARE_LANDSCAPE orientations.
        boolean skip = fixWallpaperCropsOnRestore()
                && foldedOrientation == ORIENTATION_LANDSCAPE
                && suggestedCrops.contains(ORIENTATION_PORTRAIT);
        suggestedDisplaySize = defaultDisplayInfo.defaultDisplaySizes.get(foldedOrientation);
        if (suggestedCrop != null) {
        if (suggestedCrop != null && !skip) {
            // only keep the visible part (without parallax)
            Rect adjustedCrop = noParallax(suggestedCrop, suggestedDisplaySize, bitmapSize, rtl);
            return getAdjustedCrop(adjustedCrop, bitmapSize, displaySize, false, rtl, ADD);