summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-11-04 13:48:38 -0500
committerJohn Spurlock <jspurlock@google.com>2013-11-04 16:15:34 -0500
commit7ea91ec181b88f71390c544029d0c864f49ca92d (patch)
treef14d4d6114302e4fb278b9476357266ce7c3a7e8 /services/java
parent3e7495b26058d1442c4ed4960818399728e6bc31 (diff)
downloadframeworks_base-7ea91ec181b88f71390c544029d0c864f49ca92d.zip
frameworks_base-7ea91ec181b88f71390c544029d0c864f49ca92d.tar.gz
frameworks_base-7ea91ec181b88f71390c544029d0c864f49ca92d.tar.bz2
Ensure wallpaper hint is at least the display's max size.
Bug:11332853 Change-Id: Ied13ffab77395f64642f7fb536f36d9cd8367e74
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/WallpaperManagerService.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index 6957bac..c1a60ee 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -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