summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kulian <akulian@google.com>2016-07-22 18:20:32 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-22 18:20:32 +0000
commit466b790f5fe76dc47e6cf6b901b6e9cd93ee8001 (patch)
tree98196a608b1e68d4c307d1bf30728af89cd10c01
parentdc6241cdc586f0f79f4d6cdc1012aa2cdc6b6cf0 (diff)
parent3b3c914e62db9e5e5e57930321cef257f57c73ed (diff)
Make sure to apply latest configuration to resources
am: 3b3c914e62 Change-Id: I5dc1d3518b1568bd8c52c947e7425563553bcf9d
-rw-r--r--core/java/android/app/ActivityThread.java9
-rw-r--r--core/java/android/app/ResourcesManager.java20
2 files changed, 25 insertions, 4 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 7f7945ad4969..f143d8fdcb3a 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4627,11 +4627,12 @@ public final class ActivityThread {
if ((activity == null) || (activity.mCurrentConfig == null)) {
shouldChangeConfig = true;
} else {
- // If the new config is the same as the config this Activity
- // is already running with then don't bother calling
- // onConfigurationChanged
+ // If the new config is the same as the config this Activity is already
+ // running with and the override config also didn't change, then don't
+ // bother calling onConfigurationChanged.
int diff = activity.mCurrentConfig.diff(newConfig);
- if (diff != 0) {
+ if (diff != 0 || !mResourcesManager.isSameResourcesOverrideConfig(activityToken,
+ amOverrideConfig)) {
// Always send the task-level config changes. For system-level configuration, if
// this activity doesn't handle any of the config changes, then don't bother
// calling onConfigurationChanged as we're going to destroy it.
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java
index c4673a3b0b4c..9a9f793bd307 100644
--- a/core/java/android/app/ResourcesManager.java
+++ b/core/java/android/app/ResourcesManager.java
@@ -364,6 +364,26 @@ public class ResourcesManager {
return null;
}
+ /**
+ * Check if activity resources have same override config as the provided on.
+ * @param activityToken The Activity that resources should be associated with.
+ * @param overrideConfig The override configuration to be checked for equality with.
+ * @return true if activity resources override config matches the provided one or they are both
+ * null, false otherwise.
+ */
+ boolean isSameResourcesOverrideConfig(@Nullable IBinder activityToken,
+ @Nullable Configuration overrideConfig) {
+ synchronized (this) {
+ final ActivityResources activityResources
+ = activityToken != null ? mActivityResourceReferences.get(activityToken) : null;
+ if (activityResources == null) {
+ return overrideConfig == null;
+ } else {
+ return Objects.equals(activityResources.overrideConfig, overrideConfig);
+ }
+ }
+ }
+
private ActivityResources getOrCreateActivityResourcesStructLocked(
@NonNull IBinder activityToken) {
ActivityResources activityResources = mActivityResourceReferences.get(activityToken);