summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2011-02-28 19:22:13 -0800
committerChristopher Tate <ctate@google.com>2011-02-28 19:22:13 -0800
commit7f765cf588e37a70fa2a1d251aaa8e7b847801b6 (patch)
tree2a6978568d9c69e9828c1458442ab50718fc4122
parent6c2193a7e26c0794f45dfb60d2a0cf6ae776f390 (diff)
downloadframeworks_base-7f765cf588e37a70fa2a1d251aaa8e7b847801b6.zip
frameworks_base-7f765cf588e37a70fa2a1d251aaa8e7b847801b6.tar.gz
frameworks_base-7f765cf588e37a70fa2a1d251aaa8e7b847801b6.tar.bz2
Make sure to properly default the screen size during wallpaper restore
The wallpaper service claims a desired width/height of (-1,-1) during initial setup, so look to the default display's metrics if necessary. Change-Id: I341f12fb7b0b9d6b7761c277f23fc68fa5355256
-rw-r--r--core/java/android/app/backup/WallpaperBackupHelper.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/app/backup/WallpaperBackupHelper.java b/core/java/android/app/backup/WallpaperBackupHelper.java
index d70b3d3..6539711 100644
--- a/core/java/android/app/backup/WallpaperBackupHelper.java
+++ b/core/java/android/app/backup/WallpaperBackupHelper.java
@@ -21,6 +21,8 @@ import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.ParcelFileDescriptor;
import android.util.Slog;
+import android.view.Display;
+import android.view.WindowManager;
import java.io.File;
@@ -65,6 +67,13 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu
mDesiredMinWidth = (double) wpm.getDesiredMinimumWidth();
mDesiredMinHeight = (double) wpm.getDesiredMinimumHeight();
+ if (mDesiredMinWidth <= 0 || mDesiredMinHeight <= 0) {
+ WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ Display d = wm.getDefaultDisplay();
+ mDesiredMinWidth = d.getWidth();
+ mDesiredMinHeight = d.getHeight();
+ }
+
if (DEBUG) {
Slog.d(TAG, "dmW=" + mDesiredMinWidth + " dmH=" + mDesiredMinHeight);
}