summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-11-04 13:48:38 -0500
committerJohn Spurlock <jspurlock@google.com>2013-11-12 10:28:14 -0500
commit41f6464b3f247c6ee0828e1b1aa3300e56e8cabb (patch)
treef9279faf0a421c71c9fba6171414587eb44edf30 /services/java/com/android/server
parentc481a634f4db6e95bc03b22b72414ba12da99f4b (diff)
downloadframeworks_base-41f6464b3f247c6ee0828e1b1aa3300e56e8cabb.zip
frameworks_base-41f6464b3f247c6ee0828e1b1aa3300e56e8cabb.tar.gz
frameworks_base-41f6464b3f247c6ee0828e1b1aa3300e56e8cabb.tar.bz2
Ensure wallpaper hint is at least as large as the display.
Bug:11332853 Bug:11606952 Change-Id: I1840d7b723015c379da8eab7e22aa478d56adeb3
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r--services/java/com/android/server/WallpaperManagerService.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index c1a60ee..e25470c 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -40,6 +40,7 @@ import android.content.pm.ServiceInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.content.res.Resources;
+import android.graphics.Point;
import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
@@ -637,6 +638,16 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
return false;
}
+ private Point getDefaultDisplaySize() {
+ Point p = new Point();
+ try {
+ mIWindowManager.getInitialDisplaySize(Display.DEFAULT_DISPLAY, p);
+ } catch (RemoteException e) {
+ // not remote
+ }
+ return p;
+ }
+
public void setDimensionHints(int width, int height) throws RemoteException {
checkPermission(android.Manifest.permission.SET_WALLPAPER_HINTS);
synchronized (mLock) {
@@ -648,10 +659,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);
+ // Make sure it is at least as large as the display.
+ Point displaySize = getDefaultDisplaySize();
+ width = Math.max(width, displaySize.x);
+ height = Math.max(height, displaySize.y);
if (width != wallpaper.width || height != wallpaper.height) {
wallpaper.width = width;