summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-05-27 12:09:11 -0700
committerDianne Hackborn <hackbod@google.com>2011-05-27 12:09:11 -0700
commit3904d03dd01dcd43c446744e44b34615825d9679 (patch)
tree90a8c911753fe69f0ab5bbfe273c08c086f8839d /core
parent94250ac69c6e07534e4781d3479dccb79d8c366c (diff)
downloadframeworks_base-3904d03dd01dcd43c446744e44b34615825d9679.zip
frameworks_base-3904d03dd01dcd43c446744e44b34615825d9679.tar.gz
frameworks_base-3904d03dd01dcd43c446744e44b34615825d9679.tar.bz2
Small fixes and cleanup of resource config handling.
Change-Id: I402c31b68f2b4825cb4c610a65ee8e1da471c7bb
Diffstat (limited to 'core')
-rwxr-xr-xcore/java/android/content/res/Resources.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index e63e7eb..81dc46a 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -193,11 +193,7 @@ public class Resources {
Configuration config, CompatibilityInfo compInfo) {
mAssets = assets;
mMetrics.setToDefaults();
- if (compInfo == null) {
- mCompatibilityInfo = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO;
- } else {
- mCompatibilityInfo = compInfo;
- }
+ mCompatibilityInfo = compInfo;
updateConfiguration(config, metrics);
assets.ensureStringBlocks();
}
@@ -1416,7 +1412,9 @@ public class Resources {
int configChanges = 0xfffffff;
if (config != null) {
mTmpConfig.setTo(config);
- mCompatibilityInfo.applyToConfiguration(mTmpConfig);
+ if (mCompatibilityInfo != null) {
+ mCompatibilityInfo.applyToConfiguration(mTmpConfig);
+ }
configChanges = mConfiguration.updateFrom(mTmpConfig);
configChanges = ActivityInfo.activityInfoConfigToNative(configChanges);
}
@@ -1434,7 +1432,9 @@ public class Resources {
// it would be cleaner and more maintainble to just be
// consistently dealing with a compatible display everywhere in
// the framework.
- mCompatibilityInfo.applyToDisplayMetrics(mMetrics);
+ if (mCompatibilityInfo != null) {
+ mCompatibilityInfo.applyToDisplayMetrics(mMetrics);
+ }
}
mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale;
@@ -1565,11 +1565,12 @@ public class Resources {
* Return the compatibility mode information for the application.
* The returned object should be treated as read-only.
*
- * @return compatibility info. null if the app does not require compatibility mode.
+ * @return compatibility info.
* @hide
*/
public CompatibilityInfo getCompatibilityInfo() {
- return mCompatibilityInfo;
+ return mCompatibilityInfo != null ? mCompatibilityInfo
+ : CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO;
}
/**