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

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

Fix WallpaperCropper key error.

Fix an error introduced when trying to replace Map<Int, Rect> with
SparseArray<Rect>. It's clearly wrong to iterate over a SparseArray with
a "for" loop, then use the "i" index on another SparseArray.

Flag: ACONFIG com.android.window.flags.multi_crop DEVELOPMENT
Bug: 270726737
Test: there was a clear issue in some cases, manually debugged it

Change-Id: I3d78a8c958a05b5b2f55eb30d1d1bf4972c2170b
parent f227a2bc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -410,9 +410,10 @@ public class WallpaperCropper {
                // adapt the entries in wallpaper.mCropHints for the actual display
                SparseArray<Rect> updatedCropHints = new SparseArray<>();
                for (int i = 0; i < wallpaper.mCropHints.size(); i++) {
                    Rect defaultCrop = defaultDisplayCrops.valueAt(i);
                    int orientation = wallpaper.mCropHints.keyAt(i);
                    Rect defaultCrop = defaultDisplayCrops.get(orientation);
                    if (defaultCrop != null) {
                        updatedCropHints.put(defaultDisplayCrops.keyAt(i), defaultCrop);
                        updatedCropHints.put(orientation, defaultCrop);
                    }
                }
                wallpaper.mCropHints = updatedCropHints;