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

Commit 194ff90c authored by John Spurlock's avatar John Spurlock Committed by Android Git Automerger
Browse files

am 802e04c1: am a89727c8: Merge "Ensure wallpaper hint is at least the...

am 802e04c1: am a89727c8: Merge "Ensure wallpaper hint is at least the display\'s max size." into klp-dev

* commit '802e04c1':
  Ensure wallpaper hint is at least the display's max size.
parents 05d15b36 802e04c1
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