From df259d3021d892ff404afb857176465bc82cd8bb Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 5 Dec 2016 20:33:10 -0800 Subject: [PATCH] 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. We take extra care with SCREENLAYOUT_COMPAT_NEEDED as it doesn't have an undefined value. Bug: 33098677 Test: bit FrameworksCoreTests:android.content.res.ConfigurationTest Change-Id: I6e7d123d5444f93c511aeb6e0f3adfea2a480352 --- .../android/content/res/Configuration.java | 38 ++++++++---- .../content/res/ConfigurationTest.java | 58 +++++++++++++++++++ 2 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 core/tests/coretests/src/android/content/res/ConfigurationTest.java diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index ee1f1907fcb87..227dc91cf108a 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -1047,18 +1047,36 @@ public final class Configuration implements Parcelable, Comparable