Loading services/core/java/com/android/server/wallpaper/WallpaperCropper.java +18 −3 Original line number Diff line number Diff line Loading @@ -357,15 +357,30 @@ public class WallpaperCropper { * Given some suggested crops, find cropHints for all orientations of the default display. */ SparseArray<Rect> getDefaultCrops(SparseArray<Rect> suggestedCrops, Point bitmapSize) { SparseArray<Rect> result = new SparseArray<>(); // add missing cropHints for all orientation of the default display SparseArray<Point> defaultDisplaySizes = mWallpaperDisplayHelper.getDefaultDisplaySizes(); boolean rtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; // adjust existing entries for the default display SparseArray<Rect> adjustedSuggestedCrops = new SparseArray<>(); for (int i = 0; i < defaultDisplaySizes.size(); i++) { int orientation = defaultDisplaySizes.keyAt(i); Point displaySize = defaultDisplaySizes.valueAt(i); Rect suggestedCrop = suggestedCrops.get(orientation); if (suggestedCrop != null) { adjustedSuggestedCrops.put(orientation, getCrop(displaySize, bitmapSize, suggestedCrops, rtl)); } } // add missing cropHints for all orientation of the default display SparseArray<Rect> result = adjustedSuggestedCrops.clone(); for (int i = 0; i < defaultDisplaySizes.size(); i++) { int orientation = defaultDisplaySizes.keyAt(i); if (result.contains(orientation)) continue; Point displaySize = defaultDisplaySizes.valueAt(i); Rect newCrop = getCrop(displaySize, bitmapSize, suggestedCrops, rtl); Rect newCrop = getCrop(displaySize, bitmapSize, adjustedSuggestedCrops, rtl); result.put(orientation, newCrop); } return result; Loading Loading
services/core/java/com/android/server/wallpaper/WallpaperCropper.java +18 −3 Original line number Diff line number Diff line Loading @@ -357,15 +357,30 @@ public class WallpaperCropper { * Given some suggested crops, find cropHints for all orientations of the default display. */ SparseArray<Rect> getDefaultCrops(SparseArray<Rect> suggestedCrops, Point bitmapSize) { SparseArray<Rect> result = new SparseArray<>(); // add missing cropHints for all orientation of the default display SparseArray<Point> defaultDisplaySizes = mWallpaperDisplayHelper.getDefaultDisplaySizes(); boolean rtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; // adjust existing entries for the default display SparseArray<Rect> adjustedSuggestedCrops = new SparseArray<>(); for (int i = 0; i < defaultDisplaySizes.size(); i++) { int orientation = defaultDisplaySizes.keyAt(i); Point displaySize = defaultDisplaySizes.valueAt(i); Rect suggestedCrop = suggestedCrops.get(orientation); if (suggestedCrop != null) { adjustedSuggestedCrops.put(orientation, getCrop(displaySize, bitmapSize, suggestedCrops, rtl)); } } // add missing cropHints for all orientation of the default display SparseArray<Rect> result = adjustedSuggestedCrops.clone(); for (int i = 0; i < defaultDisplaySizes.size(); i++) { int orientation = defaultDisplaySizes.keyAt(i); if (result.contains(orientation)) continue; Point displaySize = defaultDisplaySizes.valueAt(i); Rect newCrop = getCrop(displaySize, bitmapSize, suggestedCrops, rtl); Rect newCrop = getCrop(displaySize, bitmapSize, adjustedSuggestedCrops, rtl); result.put(orientation, newCrop); } return result; Loading