From 290ef34cb0d9e91e29b2e21cae69786997a3bd57 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 5 May 2020 20:30:26 -0700 Subject: [PATCH] Fixes testResumedWhenRecreatedFromInNonFocusedStack If the activity is in stopping or stopped state, for instance, it's in split screen task and not the top one, the last configuration it should keep is the one before multi-window mode change. Bug: 155691588 Test: atest --iteration 5 ActivityLifecycleSplitScreenTests Change-Id: I95e469798fe67ff75abef33b5e515a09c7e4731c --- .../java/com/android/server/wm/ActivityRecord.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index e08bfd55011f0..ad806c2bcae74 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -1160,8 +1160,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else { mLastReportedMultiWindowMode = inMultiWindowMode; computeConfigurationAfterMultiWindowModeChange(); - ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, - true /* ignoreVisibility */); + // If the activity is in stopping or stopped state, for instance, it's in the + // split screen task and not the top one, the last configuration it should keep + // is the one before multi-window mode change. + final ActivityState state = getState(); + if (state != STOPPED && state != STOPPING) { + ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, + true /* ignoreVisibility */); + } } } }