summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-02 09:20:52 -0700
committerDianne Hackborn <hackbod@google.com>2011-06-02 09:20:52 -0700
commited60f81940c5f2125518c7c31ad4f61b8a9baf3e (patch)
tree59c083e4c28f202179b41cfb350a2c68c43ad0d3 /core
parentc49b870adf26cd0ca6c0c562fe544b27d6ca312e (diff)
parent76450622f08b1d0d09df7f1ad8e52afe01090770 (diff)
downloadframeworks_base-ed60f81940c5f2125518c7c31ad4f61b8a9baf3e.zip
frameworks_base-ed60f81940c5f2125518c7c31ad4f61b8a9baf3e.tar.gz
frameworks_base-ed60f81940c5f2125518c7c31ad4f61b8a9baf3e.tar.bz2
resolved conflicts for merge of 76450622 to master
Change-Id: I26ccd8f264e65f100d894f43cf597a781552db83
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ContextImpl.java3
-rw-r--r--core/java/android/content/res/CompatibilityInfo.java8
-rw-r--r--core/java/android/util/DisplayMetrics.java24
-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
-rw-r--r--core/res/res/values-large/config.xml2
-rw-r--r--core/res/res/values-sw600dp/config.xml2
-rwxr-xr-xcore/res/res/values/config.xml2
-rw-r--r--core/res/res/values/dimens.xml6
10 files changed, 62 insertions, 38 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 51f1e3d..73170bb 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -425,9 +425,6 @@ class ContextImpl extends Context {
registerService(WINDOW_SERVICE, new ServiceFetcher() {
public Object getService(ContextImpl ctx) {
- RuntimeException e = new RuntimeException("foo");
- e.fillInStackTrace();
- Log.i(TAG, "Getting window manager", e);
CompatibilityInfo ci = ctx.mResources.getCompatibilityInfo();
return WindowManagerImpl.getDefault(ci);
}});
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index dca53a8..8d725cd 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -392,8 +392,8 @@ public class CompatibilityInfo implements Parcelable {
// compatible with large screens, so diddle it.
CompatibilityInfo.updateCompatibleScreenFrame(inoutDm, null, inoutDm);
} else {
- inoutDm.widthPixels = inoutDm.realWidthPixels;
- inoutDm.heightPixels = inoutDm.realHeightPixels;
+ inoutDm.widthPixels = inoutDm.unscaledWidthPixels;
+ inoutDm.heightPixels = inoutDm.unscaledHeightPixels;
}
if (isScalingRequired()) {
@@ -429,8 +429,8 @@ public class CompatibilityInfo implements Parcelable {
*/
public static float updateCompatibleScreenFrame(DisplayMetrics dm,
Rect outRect, DisplayMetrics outDm) {
- final int width = dm.realWidthPixels;
- final int height = dm.realHeightPixels;
+ final int width = dm.unscaledWidthPixels;
+ final int height = dm.unscaledHeightPixels;
int shortSize, longSize;
if (width < height) {
shortSize = width;
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java
index 8018ff9..60a4ef2 100644
--- a/core/java/android/util/DisplayMetrics.java
+++ b/core/java/android/util/DisplayMetrics.java
@@ -105,10 +105,18 @@ public class DisplayMetrics {
*/
public float ydpi;
- /** @hide */
- public int realWidthPixels;
- /** @hide */
- public int realHeightPixels;
+ /**
+ * The reported display width prior to any compatibility mode scaling
+ * being applied.
+ * @hide
+ */
+ public int unscaledWidthPixels;
+ /**
+ * The reported display height prior to any compatibility mode scaling
+ * being applied.
+ * @hide
+ */
+ public int unscaledHeightPixels;
public DisplayMetrics() {
}
@@ -121,8 +129,8 @@ public class DisplayMetrics {
scaledDensity = o.scaledDensity;
xdpi = o.xdpi;
ydpi = o.ydpi;
- realWidthPixels = o.realWidthPixels;
- realHeightPixels = o.realHeightPixels;
+ unscaledWidthPixels = o.unscaledWidthPixels;
+ unscaledHeightPixels = o.unscaledHeightPixels;
}
public void setToDefaults() {
@@ -133,8 +141,8 @@ public class DisplayMetrics {
scaledDensity = density;
xdpi = DENSITY_DEVICE;
ydpi = DENSITY_DEVICE;
- realWidthPixels = 0;
- realHeightPixels = 0;
+ unscaledWidthPixels = 0;
+ unscaledHeightPixels = 0;
}
@Override
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.
diff --git a/core/res/res/values-large/config.xml b/core/res/res/values-large/config.xml
index c94256e..9327200 100644
--- a/core/res/res/values-large/config.xml
+++ b/core/res/res/values-large/config.xml
@@ -23,8 +23,6 @@
<!-- see comment in values/config.xml -->
<dimen name="config_prefDialogWidth">440dp</dimen>
- <bool name="config_statusBarCanHide">false</bool>
-
<!-- see comment in values/config.xml -->
<integer name="config_longPressOnPowerBehavior">2</integer>
diff --git a/core/res/res/values-sw600dp/config.xml b/core/res/res/values-sw600dp/config.xml
index 49ace34..d6a0cdd 100644
--- a/core/res/res/values-sw600dp/config.xml
+++ b/core/res/res/values-sw600dp/config.xml
@@ -20,8 +20,6 @@
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <bool name="config_statusBarCanHide">false</bool>
-
<!-- see comment in values/config.xml -->
<integer name="config_longPressOnPowerBehavior">2</integer>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index af08d45..fc14a2a 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -20,8 +20,6 @@
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <bool name="config_statusBarCanHide">true</bool>
-
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
icons in the status bar that are not notifications. -->
<string-array name="config_statusBarIcons">
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index f5de1d2..724c528 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -32,10 +32,14 @@
<dimen name="toast_y_offset">64dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_height">25dip</dimen>
- <!-- Height of the status bar -->
+ <!-- Height of the system bar -->
+ <dimen name="system_bar_height">48dip</dimen>
+ <!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">25dip</dimen>
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">48sp</dimen>
+ <!-- Height of notification icons in the system bar -->
+ <dimen name="system_bar_icon_size">32dip</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
<!-- Size of the fastscroll hint letter -->