summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2021-03-10 15:34:16 +0800
committer Riddle Hsu <riddlehsu@google.com> 2021-03-10 15:41:32 +0000
commit5b9845ad38b47f07923089b63bcd3042a5cf73a3 (patch)
treeef932d067d365c5ff3f7c59438f588eb7d7648e4
parent117470de614a83ac37859f65102bb9541ca9f247 (diff)
Do not report config change to activity if nothing changed
Currently the diff only counts public fields. If only the rotation of the window configuration is changed, the activity still receives onConfigurationChanged which is unexpected. Bug: 165794724 Test: AppConfigurationTests Change-Id: Ice2db32b700493bcd47a38468ae66e91504895a6
-rw-r--r--core/java/android/app/ActivityThread.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 0b5958695dff..8977ba774d0b 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -5775,11 +5775,14 @@ public final class ActivityThread extends ClientTransactionHandler
// ResourcesImpl constructions.
final int diff = activity.mCurrentConfig.diffPublicOnly(newConfig);
- if (diff == 0 && !shouldUpdateWindowMetricsBounds(activity.mCurrentConfig, newConfig)
- && !movedToDifferentDisplay && mResourcesManager.isSameResourcesOverrideConfig(
- activityToken, amOverrideConfig)) {
- // Nothing significant, don't proceed with updating and reporting.
- return null;
+ if (diff == 0) {
+ if (!shouldUpdateWindowMetricsBounds(activity.mCurrentConfig, newConfig)
+ && !movedToDifferentDisplay
+ && mResourcesManager.isSameResourcesOverrideConfig(
+ activityToken, amOverrideConfig)) {
+ // Nothing significant, don't proceed with updating and reporting.
+ return null;
+ }
} else if ((~activity.mActivityInfo.getRealConfigChanged() & diff) == 0) {
// If this activity doesn't handle any of the config changes, then don't bother
// calling onConfigurationChanged. Otherwise, report to the activity for the