diff options
| author | 2020-07-30 14:40:29 +0800 | |
|---|---|---|
| committer | 2020-07-30 07:02:49 +0000 | |
| commit | 4ee91bb557aa148928d12bfa86d509cf0489413a (patch) | |
| tree | 9bf1cc0174a529f023fdbc2d8aec4e68d9b3b0de | |
| parent | 7a6667d617b7bca5fc4373e8a050e69d2c0ea8a1 (diff) | |
Don't send onMultiWindowModeChanged if relaunch activity.
If an activity is going to do relaunch, send onMultiWindowModeChanged
sounds meaningless since the activity will be destroy and re-create.
To narrow down the scope, this API should only be useful if the
activity want to handle onConfigurationChanged.
Bug: 162473704
Test: atest ActivityLifecyclePipTests ActivityLifecycleSplitScreenTests
ActivityLifecycleTopResumedStateTests PinnedStackTests SplitScreenTests
ActivityLifecycleKeyguardTests
Change-Id: If4e672e5a891ac315ecc6783af764dfc20ebfeb9
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 9b13d256aea6..63f48076926e 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5111,6 +5111,7 @@ public final class ActivityThread extends ClientTransactionHandler { } } r.setState(ON_DESTROY); + mLastReportedWindowingMode.remove(r.activity.getActivityToken()); } schedulePurgeIdler(); // updatePendingActivityConfiguration() reads from mActivities to update @@ -5353,16 +5354,8 @@ public final class ActivityThread extends ClientTransactionHandler { throw e.rethrowFromSystemServer(); } - // Save the current windowing mode to be restored and compared to the new configuration's - // windowing mode (needed because we update the last reported windowing mode when launching - // an activity and we can't tell inside performLaunchActivity whether we are relaunching) - final int oldWindowingMode = mLastReportedWindowingMode.getOrDefault( - r.activity.getActivityToken(), WINDOWING_MODE_UNDEFINED); handleRelaunchActivityInner(r, configChanges, tmp.pendingResults, tmp.pendingIntents, pendingActions, tmp.startsNotResumed, tmp.overrideConfig, "handleRelaunchActivity"); - mLastReportedWindowingMode.put(r.activity.getActivityToken(), oldWindowingMode); - handleWindowingModeChangeIfNeeded(r.activity, r.activity.mCurrentConfig); - if (pendingActions != null) { // Only report a successful relaunch to WindowManager. pendingActions.setReportRelaunchToWindowManager(true); @@ -5628,10 +5621,6 @@ public final class ActivityThread extends ClientTransactionHandler { throw new IllegalArgumentException("Activity token not set. Is the activity attached?"); } - // multi-window / pip mode changes, if any, should be sent before the configuration change - // callback, see also PinnedStackTests#testConfigurationChangeOrderDuringTransition - handleWindowingModeChangeIfNeeded(activity, newConfig); - final boolean movedToDifferentDisplay = isDifferentDisplay(activity, displayId); boolean shouldReportChange = false; if (activity.mCurrentConfig == null) { @@ -5685,6 +5674,11 @@ public final class ActivityThread extends ClientTransactionHandler { } if (shouldReportChange) { + // multi-window / pip mode changes, if any, should be sent before the configuration + // change callback, see also + // PinnedStackTests#testConfigurationChangeOrderDuringTransition + handleWindowingModeChangeIfNeeded(activity, newConfig); + activity.mCalled = false; activity.onConfigurationChanged(configToReport); if (!activity.mCalled) { |