summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/Display.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-19 14:51:25 -0700
committerDianne Hackborn <hackbod@google.com>2012-04-19 14:55:13 -0700
commit68c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3 (patch)
treef598517d463bc750d7081e2bd84b1e325c254f32 /core/java/android/view/Display.java
parent1b965941713a395dc8003cf8ee29a40f92dd77aa (diff)
downloadframeworks_base-68c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3.zip
frameworks_base-68c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3.tar.gz
frameworks_base-68c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3.tar.bz2
Add new API to find smallest/largest screen size.
Change-Id: I790801fceaf84ee2e3b1c9d32828285ad3231d0e
Diffstat (limited to 'core/java/android/view/Display.java')
-rw-r--r--core/java/android/view/Display.java43
1 files changed, 43 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