summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-19 15:01:36 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-19 15:01:36 -0700
commit661f362a2c531c46fdce5359b176a30ba7d16e1f (patch)
tree3489c48288e41e7d7896662c1240ef181c29e6b5 /core
parent675035d77403080e65308e2d37db624d4c4b8c78 (diff)
parent68c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3 (diff)
downloadframeworks_base-661f362a2c531c46fdce5359b176a30ba7d16e1f.zip
frameworks_base-661f362a2c531c46fdce5359b176a30ba7d16e1f.tar.gz
frameworks_base-661f362a2c531c46fdce5359b176a30ba7d16e1f.tar.bz2
Merge "Add new API to find smallest/largest screen size."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/Display.java43
-rw-r--r--core/java/android/view/IWindowManager.aidl1
2 files changed, 44 insertions, 0 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index ad2283e..bda8016 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -143,6 +143,49 @@ public class Display {
}
/**
+ * Return the range of display sizes an application can expect to encounter
+ * under normal operation, as long as there is no physical change in screen
+ * size. This is basically the sizes you will see as the orientation
+ * changes, taking into account whatever screen decoration there is in
+ * each rotation. For example, the status bar is always at the top of the
+ * screen, so it will reduce the height both in landscape and portrait, and
+ * the smallest height returned here will be the smaller of the two.
+ *
+ * This is intended for applications to get an idea of the range of sizes
+ * they will encounter while going through device rotations, to provide a
+ * stable UI through rotation. The sizes here take into account all standard
+ * system decorations that reduce the size actually available to the
+ * application: the status bar, navigation bar, system bar, etc. It does
+ * <em>not</em> take into account more transient elements like an IME
+ * soft keyboard.
+ *
+ * @param outSmallestSize Filled in with the smallest width and height
+ * that the application will encounter, in pixels (not dp units). The x
+ * (width) dimension here directly corresponds to
+ * {@link android.content.res.Configuration#smallestScreenWidthDp
+ * Configuration.smallestScreenWidthDp}, except the value here is in raw
+ * screen pixels rather than dp units. Your application may of course
+ * still get smaller space yet if, for example, a soft keyboard is
+ * being displayed.
+ * @param outLargestSize Filled in with the largest width and height
+ * that the application will encounter, in pixels (not dp units). Your
+ * application may of course still get larger space than this if,
+ * for example, screen decorations like the status bar are being hidden.
+ */
+ public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize) {
+ try {
+ IWindowManager wm = getWindowManager();
+ wm.getCurrentSizeRange(outSmallestSize, outLargestSize);
+ } catch (RemoteException e) {
+ Slog.w("Display", "Unable to get display size range", e);
+ outSmallestSize.x = 0;
+ outSmallestSize.y = 0;
+ outLargestSize.x = 0;
+ outLargestSize.y = 0;
+ }
+ }
+
+ /**
* Return the maximum screen size dimension that will happen. This is
* mostly for wallpapers.
* @hide
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index b70d7b5..e1f01db 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -58,6 +58,7 @@ interface IWindowManager
void getDisplaySize(out Point size);
void getRealDisplaySize(out Point size);
int getMaximumSizeDimension();
+ void getCurrentSizeRange(out Point smallestSize, out Point largestSize);
void setForcedDisplaySize(int longDimen, int shortDimen);
void clearForcedDisplaySize();