summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Craig Mautner <cmautner@google.com> 2013-08-12 17:56:34 -0700
committer Craig Mautner <cmautner@google.com> 2013-08-13 09:23:13 -0700
commit31678b52e4b65e8e4d22ef5dced713424e5deada (patch)
tree02e43104c91edccfa6b7139f4fb40b651842dd1a
parent890db42b0d4873bf3a19cd784bb7497db2add22e (diff)
Fix Configuration layout direction comparison.
If the Configuration layout direction is not changing don't indicate that it has changed. When the indication is made incorrectly it causes the window manager to believe that the configuration has changed and it will start freezing the screen and setting up animations. Bad jank is the result. In Configuration.updateFrom() anytime that the screenLayouts were different the code was setting ActivityInfo.CONFIG_LAYOUT_DIRECTION in the return bitmask. Even if the only difference was between UNDEFINED fields. This fix makes sure that the layout direction field has actually changed before setting ActivityInfo.CONFIG_LAYOUT_DIRECTION in the return bitmask. In Configuration.diff() if the passed Configuration had SCREENLAYOUT_LAYOUTDIR_UNDEFINED the code was setting ActivityInfo.CONFIG_LAYOUT_DIRECTION in the return bitmask. This fix makes sure that if the passed Configuration has fields set to SCREENLAYOUT_*_UNDEFINED then corresponding bits will no longer be set in the returned bitmask. Fixes bug 10291622. Fixes bug 10247094. Change-Id: If26de662206fe85dc4671adbae39dfb99dc1038c
-rw-r--r--core/java/android/content/res/Configuration.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 1c281387fce8..0402eeb94764 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -786,9 +786,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration
// 2 most significant bits in screenLayout).
setLayoutDirection(locale);
}
- if (delta.screenLayout != 0 && screenLayout != delta.screenLayout) {
+ final int deltaScreenLayoutDir = delta.screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK;
+ if (deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED &&
+ deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) {
+ screenLayout = (screenLayout & ~SCREENLAYOUT_LAYOUTDIR_MASK) | deltaScreenLayoutDir;
changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
- setLayoutDirection(locale);
}
if (delta.userSetLocale && (!userSetLocale || ((changed & ActivityInfo.CONFIG_LOCALE) != 0)))
{
@@ -937,7 +939,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
changed |= ActivityInfo.CONFIG_LOCALE;
changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
}
- if (delta.screenLayout != 0 && screenLayout != delta.screenLayout) {
+ final int deltaScreenLayoutDir = delta.screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK;
+ if (deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED &&
+ deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) {
changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
}
if (delta.touchscreen != TOUCHSCREEN_UNDEFINED