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

Commit a89727c8 authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Ensure wallpaper hint is at least the display's max size." into klp-dev

parents c445b3f2 7ea91ec1
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -648,6 +648,10 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
            if (width <= 0 || height <= 0) {
                throw new IllegalArgumentException("width and height must be > 0");
            }
            // Make sure it is at least as large as the display's maximum size.
            int maxSizeDimension = getMaximumSizeDimension();
            width = Math.max(width, maxSizeDimension);
            height = Math.max(height, maxSizeDimension);

            if (width != wallpaper.width || height != wallpaper.height) {
                wallpaper.width = width;
@@ -1146,9 +1150,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
        }

        // We always want to have some reasonable width hint.
        WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
        Display d = wm.getDefaultDisplay();
        int baseSize = d.getMaximumSizeDimension();
        int baseSize = getMaximumSizeDimension();
        if (wallpaper.width < baseSize) {
            wallpaper.width = baseSize;
        }
@@ -1157,6 +1159,12 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
        }
    }

    private int getMaximumSizeDimension() {
        WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
        Display d = wm.getDefaultDisplay();
        return d.getMaximumSizeDimension();
    }

    // Called by SystemBackupAgent after files are restored to disk.
    void settingsRestored() {
        // TODO: If necessary, make it work for secondary users as well. This currently assumes