From d601ad1120eae96ec0e6c74427bf6ce3f209b5ba Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Wed, 10 Jun 2020 17:37:32 +0800 Subject: [PATCH] Fix task root bounds be overwritten when dismiss split screen. WindowManagerProxy#applyDismissSplit is getting the root task of secondary split screen instead of freeHomeAndRecents tasks then set the bounds to empty, and becuase the transaction is queued with applySyncTransaction, so even the correct root task bounds should applied when DividerView#exitSplitMode, the bounds could be overwritten if the SyncTransactionQueue apply to WM later. Next time when we start an activity with a new task on the secondary split screen, the activity will be relaunch because the initialization bounds is full screen. Fixes: 158637716 Test: atest ActivityLifecycleSplitScreenTests, repeat several times. Test: run testResumedWhenRecreatedFromInNonFocusedStack then verify the bounds of split-screen-secondary doesn't become empty. Change-Id: Ie344b573f42a47d703ad15f7c1983b6c18905665 --- .../android/systemui/stackdivider/WindowManagerProxy.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java index c8361c63e9604..853a22505542d 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java @@ -229,7 +229,11 @@ public class WindowManagerProxy { // as a result, the above will not capture any tasks; yet, we need to clean-up the // home task bounds. List freeHomeAndRecents = - TaskOrganizer.getRootTasks(Display.DEFAULT_DISPLAY, HOME_AND_RECENTS); + TaskOrganizer.getRootTasks(DEFAULT_DISPLAY, HOME_AND_RECENTS); + // Filter out the root split tasks + freeHomeAndRecents.removeIf(p -> p.token.equals(tiles.mSecondary.token) + || p.token.equals(tiles.mPrimary.token)); + if (primaryChildren.isEmpty() && secondaryChildren.isEmpty() && freeHomeAndRecents.isEmpty()) { return;