diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-19 21:14:48 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-07-19 21:14:48 -0700 |
commit | bec99bffeecacb1af603966391014895f9a16025 (patch) | |
tree | 698db3ee01626f7e4f8db3ba3dce56f44aa45d74 /core/java/android/content/res | |
parent | 79b7c68d5a1979a67d1d5ec6b9229aaab79cad3e (diff) | |
parent | 5c536e9162721c460699a041959a0d67de1d20db (diff) | |
download | frameworks_base-bec99bffeecacb1af603966391014895f9a16025.zip frameworks_base-bec99bffeecacb1af603966391014895f9a16025.tar.gz frameworks_base-bec99bffeecacb1af603966391014895f9a16025.tar.bz2 |
am 5c536e91: Merge change 7840 into donut
Merge commit '5c536e9162721c460699a041959a0d67de1d20db'
* commit '5c536e9162721c460699a041959a0d67de1d20db':
Fix issue where scaled bitmap sizes could be wrong.
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r-- | core/java/android/content/res/CompatibilityInfo.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java index d4e2507..25e7a68 100644 --- a/core/java/android/content/res/CompatibilityInfo.java +++ b/core/java/android/content/res/CompatibilityInfo.java @@ -85,6 +85,11 @@ public class CompatibilityInfo { private static final int SCALING_EXPANDABLE_MASK = SCALING_REQUIRED | EXPANDABLE; /** + * The effective screen density we have selected for this application. + */ + public final int applicationDensity; + + /** * Application's scale. */ public final float applicationScale; @@ -107,28 +112,34 @@ public class CompatibilityInfo { } float packageDensityScale = -1.0f; + int packageDensity = 0; if (appInfo.supportsDensities != null) { int minDiff = Integer.MAX_VALUE; for (int density : appInfo.supportsDensities) { - if (density == ApplicationInfo.ANY_DENSITY) { + if (density == ApplicationInfo.ANY_DENSITY) { + packageDensity = DisplayMetrics.DENSITY_DEVICE; packageDensityScale = 1.0f; break; } int tmpDiff = Math.abs(DisplayMetrics.DENSITY_DEVICE - density); if (tmpDiff == 0) { + packageDensity = DisplayMetrics.DENSITY_DEVICE; packageDensityScale = 1.0f; break; } // prefer higher density (appScale>1.0), unless that's only option. if (tmpDiff < minDiff && packageDensityScale < 1.0f) { + packageDensity = density; packageDensityScale = DisplayMetrics.DENSITY_DEVICE / (float) density; minDiff = tmpDiff; } } } if (packageDensityScale > 0.0f) { + applicationDensity = packageDensity; applicationScale = packageDensityScale; } else { + applicationDensity = DisplayMetrics.DENSITY_DEFAULT; applicationScale = DisplayMetrics.DENSITY_DEVICE / (float) DisplayMetrics.DENSITY_DEFAULT; } @@ -139,9 +150,11 @@ public class CompatibilityInfo { } } - private CompatibilityInfo(int appFlags, int compFlags, float scale, float invertedScale) { + private CompatibilityInfo(int appFlags, int compFlags, + int dens, float scale, float invertedScale) { this.appFlags = appFlags; mCompatibilityFlags = compFlags; + applicationDensity = dens; applicationScale = scale; applicationInvertedScale = invertedScale; } @@ -151,6 +164,7 @@ public class CompatibilityInfo { | ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS | ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS, EXPANDABLE | CONFIGURED_EXPANDABLE, + DisplayMetrics.DENSITY_DEVICE, 1.0f, 1.0f); } @@ -160,7 +174,7 @@ public class CompatibilityInfo { */ public CompatibilityInfo copy() { CompatibilityInfo info = new CompatibilityInfo(appFlags, mCompatibilityFlags, - applicationScale, applicationInvertedScale); + applicationDensity, applicationScale, applicationInvertedScale); return info; } |