summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/Display.java44
-rw-r--r--core/java/android/view/IWindowManager.aidl3
-rw-r--r--core/java/android/view/WindowManagerPolicy.java6
3 files changed, 37 insertions, 16 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index b5d36d9..8032546 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -80,25 +80,37 @@ public class Display {
* adjusted for you based on the current rotation of the display.
*/
public void getSize(Point outSize) {
+ getSizeInternal(outSize, true);
+ }
+
+ /**
+ * Returns the raw size of the display, in pixels. Note that this
+ * should <em>not</em> generally be used for computing layouts, since
+ * a device will typically have screen decoration (such as a status bar)
+ * along the edges of the display that reduce the amount of application
+ * space available from the raw size returned here. This value is
+ * adjusted for you based on the current rotation of the display.
+ */
+ private void getSizeInternal(Point outSize, boolean doCompat) {
try {
IWindowManager wm = getWindowManager();
if (wm != null) {
wm.getDisplaySize(outSize);
+ if (doCompat && mCompatibilityInfo != null) {
+ synchronized (mTmpMetrics) {
+ mTmpMetrics.unscaledWidthPixels = outSize.x;
+ mTmpMetrics.unscaledHeightPixels = outSize.y;
+ mTmpMetrics.density = mDensity;
+ mCompatibilityInfo.applyToDisplayMetrics(mTmpMetrics);
+ outSize.x = mTmpMetrics.widthPixels;
+ outSize.y = mTmpMetrics.heightPixels;
+ }
+ }
} else {
// This is just for boot-strapping, initializing the
// system process before the window manager is up.
outSize.y = getRealHeight();
}
- if (mCompatibilityInfo != null) {
- synchronized (mTmpMetrics) {
- mTmpMetrics.realWidthPixels = outSize.x;
- mTmpMetrics.realHeightPixels = outSize.y;
- mTmpMetrics.density = mDensity;
- mCompatibilityInfo.applyToDisplayMetrics(mTmpMetrics);
- outSize.x = mTmpMetrics.widthPixels;
- outSize.y = mTmpMetrics.heightPixels;
- }
- }
} catch (RemoteException e) {
Slog.w("Display", "Unable to get display size", e);
}
@@ -109,7 +121,7 @@ public class Display {
*/
public void getRectSize(Rect outSize) {
synchronized (mTmpPoint) {
- getSize(mTmpPoint);
+ getSizeInternal(mTmpPoint, true);
outSize.set(0, 0, mTmpPoint.x, mTmpPoint.y);
}
}
@@ -137,7 +149,7 @@ public class Display {
synchronized (mTmpPoint) {
long now = SystemClock.uptimeMillis();
if (now > (mLastGetTime+20)) {
- getSize(mTmpPoint);
+ getSizeInternal(mTmpPoint, true);
mLastGetTime = now;
}
return mTmpPoint.x;
@@ -152,7 +164,7 @@ public class Display {
synchronized (mTmpPoint) {
long now = SystemClock.uptimeMillis();
if (now > (mLastGetTime+20)) {
- getSize(mTmpPoint);
+ getSizeInternal(mTmpPoint, true);
mLastGetTime = now;
}
return mTmpPoint.y;
@@ -218,7 +230,7 @@ public class Display {
*/
public void getMetrics(DisplayMetrics outMetrics) {
synchronized (mTmpPoint) {
- getSize(mTmpPoint);
+ getSizeInternal(mTmpPoint, false);
outMetrics.widthPixels = mTmpPoint.x;
outMetrics.heightPixels = mTmpPoint.y;
}
@@ -248,8 +260,8 @@ public class Display {
outMetrics.xdpi = mDpiX;
outMetrics.ydpi = mDpiY;
- outMetrics.realWidthPixels = outMetrics.widthPixels;
- outMetrics.realHeightPixels = outMetrics.heightPixels;
+ outMetrics.unscaledWidthPixels = outMetrics.widthPixels;
+ outMetrics.unscaledHeightPixels = outMetrics.heightPixels;
}
static IWindowManager getWindowManager() {
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index adafb59..bdf04ab 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -59,6 +59,9 @@ interface IWindowManager
void setForcedDisplaySize(int longDimen, int shortDimen);
void clearForcedDisplaySize();
+ // Is device configured with a hideable status bar or a tablet system bar?
+ boolean canStatusBarHide();
+
// These can only be called when injecting events to your own window,
// or by holding the INJECT_EVENTS permission. These methods may block
// until pending input events are finished being dispatched even when 'sync' is false.
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 64b1ac8..82a4d2d 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -466,6 +466,12 @@ public interface WindowManagerPolicy {
public int getMaxWallpaperLayer();
/**
+ * Return true if the policy allows the status bar to hide. Otherwise,
+ * it is a tablet-style system bar.
+ */
+ public boolean canStatusBarHide();
+
+ /**
* Return the display width available after excluding any screen
* decorations that can never be removed. That is, system bar or
* button bar.