Loading services/core/java/com/android/server/wallpaper/WallpaperCropper.java +21 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,27 @@ public class WallpaperCropper { // This will fall into "Case 4" of this function and center the folded screen return getCrop(displaySize, bitmapSize, newSuggestedCrops, rtl); } // The second exception is if we're on tablet and we're on portrait mode. // In that case, center the wallpaper relatively to landscape and put some parallax. boolean isTablet = mWallpaperDisplayHelper.isLargeScreen() && !mWallpaperDisplayHelper.isFoldable(); if (isTablet && displaySize.x < displaySize.y) { Point rotatedDisplaySize = new Point(displaySize.y, displaySize.x); // compute the crop on landscape (without parallax) Rect landscapeCrop = getCrop(rotatedDisplaySize, bitmapSize, suggestedCrops, rtl); landscapeCrop = noParallax(landscapeCrop, rotatedDisplaySize, bitmapSize, rtl); // compute the crop on portrait at the center of the landscape crop crop = getAdjustedCrop(landscapeCrop, bitmapSize, displaySize, false, rtl, ADD); // add some parallax (until the border of the landscape crop without parallax) if (rtl) { crop.left = landscapeCrop.left; } else { crop.right = landscapeCrop.right; } } return getAdjustedCrop(crop, bitmapSize, displaySize, true, rtl, ADD); } Loading services/core/java/com/android/server/wallpaper/WallpaperDisplayHelper.java +14 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ class WallpaperDisplayHelper { } private static final String TAG = WallpaperDisplayHelper.class.getSimpleName(); private static final float LARGE_SCREEN_MIN_DP = 600f; private final SparseArray<DisplayData> mDisplayDatas = new SparseArray<>(); private final DisplayManager mDisplayManager; private final WindowManagerInternal mWindowManagerInternal; Loading @@ -67,7 +69,8 @@ class WallpaperDisplayHelper { // related orientations pairs for foldable (folded orientation, unfolded orientation) private final List<Pair<Integer, Integer>> mFoldableOrientationPairs = new ArrayList<>(); private boolean mIsFoldable; private final boolean mIsFoldable; private boolean mIsLargeScreen = false; WallpaperDisplayHelper( DisplayManager displayManager, Loading @@ -94,6 +97,9 @@ class WallpaperDisplayHelper { mDefaultDisplaySizes.put(orientation, point); } } mIsLargeScreen |= (displaySize.x / metric.getDensity() >= LARGE_SCREEN_MIN_DP); if (populateOrientationPairs) { int orientation = WallpaperManager.getOrientation(displaySize); float newSurface = displaySize.x * displaySize.y Loading Loading @@ -214,6 +220,13 @@ class WallpaperDisplayHelper { return mIsFoldable; } /** * Return true if any of the screens of the default display is considered large (DP >= 600) */ boolean isLargeScreen() { return mIsLargeScreen; } /** * If a given orientation corresponds to an unfolded orientation on foldable, return the * corresponding folded orientation. Otherwise, return UNKNOWN. Always return UNKNOWN if the Loading Loading
services/core/java/com/android/server/wallpaper/WallpaperCropper.java +21 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,27 @@ public class WallpaperCropper { // This will fall into "Case 4" of this function and center the folded screen return getCrop(displaySize, bitmapSize, newSuggestedCrops, rtl); } // The second exception is if we're on tablet and we're on portrait mode. // In that case, center the wallpaper relatively to landscape and put some parallax. boolean isTablet = mWallpaperDisplayHelper.isLargeScreen() && !mWallpaperDisplayHelper.isFoldable(); if (isTablet && displaySize.x < displaySize.y) { Point rotatedDisplaySize = new Point(displaySize.y, displaySize.x); // compute the crop on landscape (without parallax) Rect landscapeCrop = getCrop(rotatedDisplaySize, bitmapSize, suggestedCrops, rtl); landscapeCrop = noParallax(landscapeCrop, rotatedDisplaySize, bitmapSize, rtl); // compute the crop on portrait at the center of the landscape crop crop = getAdjustedCrop(landscapeCrop, bitmapSize, displaySize, false, rtl, ADD); // add some parallax (until the border of the landscape crop without parallax) if (rtl) { crop.left = landscapeCrop.left; } else { crop.right = landscapeCrop.right; } } return getAdjustedCrop(crop, bitmapSize, displaySize, true, rtl, ADD); } Loading
services/core/java/com/android/server/wallpaper/WallpaperDisplayHelper.java +14 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ class WallpaperDisplayHelper { } private static final String TAG = WallpaperDisplayHelper.class.getSimpleName(); private static final float LARGE_SCREEN_MIN_DP = 600f; private final SparseArray<DisplayData> mDisplayDatas = new SparseArray<>(); private final DisplayManager mDisplayManager; private final WindowManagerInternal mWindowManagerInternal; Loading @@ -67,7 +69,8 @@ class WallpaperDisplayHelper { // related orientations pairs for foldable (folded orientation, unfolded orientation) private final List<Pair<Integer, Integer>> mFoldableOrientationPairs = new ArrayList<>(); private boolean mIsFoldable; private final boolean mIsFoldable; private boolean mIsLargeScreen = false; WallpaperDisplayHelper( DisplayManager displayManager, Loading @@ -94,6 +97,9 @@ class WallpaperDisplayHelper { mDefaultDisplaySizes.put(orientation, point); } } mIsLargeScreen |= (displaySize.x / metric.getDensity() >= LARGE_SCREEN_MIN_DP); if (populateOrientationPairs) { int orientation = WallpaperManager.getOrientation(displaySize); float newSurface = displaySize.x * displaySize.y Loading Loading @@ -214,6 +220,13 @@ class WallpaperDisplayHelper { return mIsFoldable; } /** * Return true if any of the screens of the default display is considered large (DP >= 600) */ boolean isLargeScreen() { return mIsLargeScreen; } /** * If a given orientation corresponds to an unfolded orientation on foldable, return the * corresponding folded orientation. Otherwise, return UNKNOWN. Always return UNKNOWN if the Loading