Correct error in Configuration.updateFrom
When updating the non direction members of screenLayout we check that they are not in total undefined, before accepting the new value in full. This was enough for LONG/SIZE which are always undefined or set together. It seems we have paths now where SCREENLAYOUT_ROUND however can be undefined and the others will be set. In this case if we pass a configuration with SCREENLAYOUT_ROUND_UNDEFINED but LONG/SIZE set to updateFrom then we will overwrite our previous SCREENLAYOUT_ROUND value. This triggers extra configuration changes. Bug: 33098677 Test: bit FrameworksCoreTests:android.content.res.ConfigurationTest Change-Id: I6eb321d27011a2af2134d0ed5b6864d4cd902dc3
This commit is contained in:
@@ -1047,18 +1047,29 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
||||
changed |= ActivityInfo.CONFIG_ORIENTATION;
|
||||
orientation = delta.orientation;
|
||||
}
|
||||
if (getScreenLayoutNoDirection(delta.screenLayout) !=
|
||||
(SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED)
|
||||
&& (getScreenLayoutNoDirection(screenLayout) !=
|
||||
getScreenLayoutNoDirection(delta.screenLayout))) {
|
||||
|
||||
if (((delta.screenLayout & SCREENLAYOUT_SIZE_MASK) != SCREENLAYOUT_SIZE_UNDEFINED)
|
||||
&& (delta.screenLayout & SCREENLAYOUT_SIZE_MASK)
|
||||
!= (screenLayout & SCREENLAYOUT_SIZE_MASK)) {
|
||||
changed |= ActivityInfo.CONFIG_SCREEN_LAYOUT;
|
||||
// We need to preserve the previous layout dir bits if they were defined
|
||||
if ((delta.screenLayout&SCREENLAYOUT_LAYOUTDIR_MASK) == 0) {
|
||||
screenLayout = (screenLayout&SCREENLAYOUT_LAYOUTDIR_MASK)|delta.screenLayout;
|
||||
} else {
|
||||
screenLayout = delta.screenLayout;
|
||||
}
|
||||
screenLayout = (screenLayout & ~SCREENLAYOUT_SIZE_MASK)
|
||||
| (delta.screenLayout & SCREENLAYOUT_SIZE_MASK);
|
||||
}
|
||||
if (((delta.screenLayout & SCREENLAYOUT_LONG_MASK) != SCREENLAYOUT_LONG_UNDEFINED)
|
||||
&& (delta.screenLayout & SCREENLAYOUT_LONG_MASK)
|
||||
!= (screenLayout & SCREENLAYOUT_LONG_MASK)) {
|
||||
changed |= ActivityInfo.CONFIG_SCREEN_LAYOUT;
|
||||
screenLayout = (screenLayout & ~SCREENLAYOUT_LONG_MASK)
|
||||
| (delta.screenLayout & SCREENLAYOUT_LONG_MASK);
|
||||
}
|
||||
if (((delta.screenLayout & SCREENLAYOUT_ROUND_MASK) != SCREENLAYOUT_ROUND_UNDEFINED)
|
||||
&& (delta.screenLayout & SCREENLAYOUT_ROUND_MASK)
|
||||
!= (screenLayout & SCREENLAYOUT_ROUND_MASK)) {
|
||||
changed |= ActivityInfo.CONFIG_SCREEN_LAYOUT;
|
||||
screenLayout = (screenLayout & ~SCREENLAYOUT_ROUND_MASK)
|
||||
| (delta.screenLayout & SCREENLAYOUT_ROUND_MASK);
|
||||
}
|
||||
|
||||
if (delta.uiMode != (UI_MODE_TYPE_UNDEFINED|UI_MODE_NIGHT_UNDEFINED)
|
||||
&& uiMode != delta.uiMode) {
|
||||
changed |= ActivityInfo.CONFIG_UI_MODE;
|
||||
|
||||
Reference in New Issue
Block a user