Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b9845ad authored by Riddle Hsu's avatar Riddle Hsu
Browse files

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
parent 117470de
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -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(
            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