summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/res
diff options
context:
space:
mode:
authorMitsuru Oshima <oshima@google.com>2009-07-14 10:41:13 -0700
committerMitsuru Oshima <oshima@google.com>2009-07-14 11:11:17 -0700
commitddd12535f095d8d056716c3290faf50ec52a538a (patch)
treebf5da24c87529503059153abe3a913216336e3d6 /core/java/android/content/res
parent9181bc9ab75f97f11f2188237ba4a0f31569dfb5 (diff)
downloadframeworks_base-ddd12535f095d8d056716c3290faf50ec52a538a.zip
frameworks_base-ddd12535f095d8d056716c3290faf50ec52a538a.tar.gz
frameworks_base-ddd12535f095d8d056716c3290faf50ec52a538a.tar.bz2
Return adjusted display for WindowManager.getDefaultDisplay()
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r--core/java/android/content/res/Resources.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 8de938d..a9aa1ee 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -34,6 +34,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.util.LongSparseArray;
+import android.view.Display;
import java.io.IOException;
import java.io.InputStream;
@@ -87,6 +88,7 @@ public class Resources {
PluralRules mPluralRule;
private final CompatibilityInfo mCompatibilityInfo;
+ private Display mDefaultDisplay;
private static final LongSparseArray<Object> EMPTY_ARRAY = new LongSparseArray<Object>() {
@Override
@@ -1915,6 +1917,24 @@ public class Resources {
+ Integer.toHexString(id));
}
+ /**
+ * Returns the display adjusted for the Resources' metrics.
+ * @hide
+ */
+ public Display getDefaultDisplay(Display defaultDisplay) {
+ if (mDefaultDisplay == null) {
+ if (!mCompatibilityInfo.isScalingRequired() && mCompatibilityInfo.supportsScreen()) {
+ // the app supports the display. just use the default one.
+ mDefaultDisplay = defaultDisplay;
+ } else {
+ // display needs adjustment.
+ mDefaultDisplay = Display.createMetricsBasedDisplay(
+ defaultDisplay.getDisplayId(), mMetrics);
+ }
+ }
+ return mDefaultDisplay;
+ }
+
private TypedArray getCachedStyledAttributes(int len) {
synchronized (mTmpValue) {
TypedArray attrs = mCachedStyledAttributes;