summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/res
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-07 14:09:47 -0700
committerDianne Hackborn <hackbod@google.com>2011-06-08 18:45:43 -0700
commit5fd2169eabd77e6bfafaf456e58051a3bafb2bca (patch)
tree77048c3540c64cad77e5c140b6477a321190c586 /core/java/android/content/res
parent4381f6421ca408d1dc66430ddfb107c5011bfe25 (diff)
downloadframeworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.zip
frameworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.tar.gz
frameworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.tar.bz2
Work on issue #4518815: Compatibility mode introduces compatibility regression...
...for Market App iRunner There were a lot of serious issues with how we updated (or often didn't update) the display and resource state when switching compatibility mode in conjunction with restarting and updating application components. This addresses everything I could find. Unfortunately it does *not* fix this particular app. I am starting to think this is just an issue in the app. This change does fix a number of other problems I could repro, such as switching the compatibility mode of an IME. Also a few changes here and there to get rid of $#*&^!! debug logs. Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r--core/java/android/content/res/CompatibilityInfo.java3
-rw-r--r--core/java/android/content/res/Configuration.java35
-rwxr-xr-xcore/java/android/content/res/Resources.java34
3 files changed, 53 insertions, 19 deletions
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index b686e54..acf2f2f 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -456,6 +456,9 @@ public class CompatibilityInfo implements Parcelable {
inoutConfig.screenLayout =
(inoutConfig.screenLayout&~Configuration.SCREENLAYOUT_SIZE_MASK)
| Configuration.SCREENLAYOUT_SIZE_NORMAL;
+ inoutConfig.screenWidthDp = inoutConfig.compatScreenWidthDp;
+ inoutConfig.screenHeightDp = inoutConfig.compatScreenHeightDp;
+ inoutConfig.smallestScreenWidthDp = inoutConfig.compatSmallestScreenWidthDp;
}
}
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 6409aac..e2c6483 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -269,6 +269,13 @@ public final class Configuration implements Parcelable, Comparable<Configuration
*/
public int smallestScreenWidthDp;
+ /** @hide Hack to get this information from WM to app running in compat mode. */
+ public int compatScreenWidthDp;
+ /** @hide Hack to get this information from WM to app running in compat mode. */
+ public int compatScreenHeightDp;
+ /** @hide Hack to get this information from WM to app running in compat mode. */
+ public int compatSmallestScreenWidthDp;
+
/**
* @hide Internal book-keeping.
*/
@@ -309,6 +316,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
screenWidthDp = o.screenWidthDp;
screenHeightDp = o.screenHeightDp;
smallestScreenWidthDp = o.smallestScreenWidthDp;
+ compatScreenWidthDp = o.compatScreenWidthDp;
+ compatScreenHeightDp = o.compatScreenHeightDp;
+ compatSmallestScreenWidthDp = o.compatSmallestScreenWidthDp;
seq = o.seq;
}
@@ -444,9 +454,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
orientation = ORIENTATION_UNDEFINED;
screenLayout = SCREENLAYOUT_SIZE_UNDEFINED;
uiMode = UI_MODE_TYPE_UNDEFINED;
- screenWidthDp = SCREEN_WIDTH_DP_UNDEFINED;
- screenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED;
- smallestScreenWidthDp = SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
+ screenWidthDp = compatScreenWidthDp = SCREEN_WIDTH_DP_UNDEFINED;
+ screenHeightDp = compatScreenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED;
+ smallestScreenWidthDp = compatSmallestScreenWidthDp = SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
seq = 0;
}
@@ -550,11 +560,18 @@ public final class Configuration implements Parcelable, Comparable<Configuration
changed |= ActivityInfo.CONFIG_SCREEN_SIZE;
screenHeightDp = delta.screenHeightDp;
}
- if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED
- && smallestScreenWidthDp != delta.smallestScreenWidthDp) {
- changed |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
+ if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
smallestScreenWidthDp = delta.smallestScreenWidthDp;
}
+ if (delta.compatScreenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
+ compatScreenWidthDp = delta.compatScreenWidthDp;
+ }
+ if (delta.compatScreenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
+ compatScreenHeightDp = delta.compatScreenHeightDp;
+ }
+ if (delta.compatSmallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
+ compatSmallestScreenWidthDp = delta.compatSmallestScreenWidthDp;
+ }
if (delta.seq != 0) {
seq = delta.seq;
@@ -739,6 +756,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
dest.writeInt(screenWidthDp);
dest.writeInt(screenHeightDp);
dest.writeInt(smallestScreenWidthDp);
+ dest.writeInt(compatScreenWidthDp);
+ dest.writeInt(compatScreenHeightDp);
+ dest.writeInt(compatSmallestScreenWidthDp);
dest.writeInt(seq);
}
@@ -763,6 +783,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
screenWidthDp = source.readInt();
screenHeightDp = source.readInt();
smallestScreenWidthDp = source.readInt();
+ compatScreenWidthDp = source.readInt();
+ compatScreenHeightDp = source.readInt();
+ compatSmallestScreenWidthDp = source.readInt();
seq = source.readInt();
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 70bf524..bd8b1a4 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -1414,18 +1414,6 @@ public class Resources {
if (compat != null) {
mCompatibilityInfo = compat;
}
- int configChanges = 0xfffffff;
- if (config != null) {
- mTmpConfig.setTo(config);
- if (mCompatibilityInfo != null) {
- mCompatibilityInfo.applyToConfiguration(mTmpConfig);
- }
- configChanges = mConfiguration.updateFrom(mTmpConfig);
- configChanges = ActivityInfo.activityInfoConfigToNative(configChanges);
- }
- if (mConfiguration.locale == null) {
- mConfiguration.locale = Locale.getDefault();
- }
if (metrics != null) {
mMetrics.setTo(metrics);
// NOTE: We should re-arrange this code to create a Display
@@ -1441,7 +1429,25 @@ public class Resources {
mCompatibilityInfo.applyToDisplayMetrics(mMetrics);
}
}
+ if (mCompatibilityInfo != null) {
+ mCompatibilityInfo.applyToDisplayMetrics(mMetrics);
+ }
mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale;
+ int configChanges = 0xfffffff;
+ if (config != null) {
+ mTmpConfig.setTo(config);
+ if (mCompatibilityInfo != null) {
+ mCompatibilityInfo.applyToConfiguration(mTmpConfig);
+ }
+ if (mTmpConfig.locale == null) {
+ mTmpConfig.locale = Locale.getDefault();
+ }
+ configChanges = mConfiguration.updateFrom(mTmpConfig);
+ configChanges = ActivityInfo.activityInfoConfigToNative(configChanges);
+ }
+ if (mConfiguration.locale == null) {
+ mConfiguration.locale = Locale.getDefault();
+ }
String locale = null;
if (mConfiguration.locale != null) {
@@ -1476,7 +1482,7 @@ public class Resources {
mConfiguration.screenLayout, mConfiguration.uiMode,
Build.VERSION.RESOURCES_SDK_INT);
- if (false) {
+ if (DEBUG_CONFIG) {
Slog.i(TAG, "**** Updating config of " + this + ": final config is " + mConfiguration
+ " final compat is " + mCompatibilityInfo);
}
@@ -1558,6 +1564,8 @@ public class Resources {
* @return The resource's current display metrics.
*/
public DisplayMetrics getDisplayMetrics() {
+ if (DEBUG_CONFIG) Slog.v(TAG, "Returning DisplayMetrics: " + mMetrics.widthPixels
+ + "x" + mMetrics.heightPixels + " " + mMetrics.density);
return mMetrics;
}