From c5024fc2b453b80db43cf56130f8e01150e343be Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Thu, 26 Aug 2021 11:32:04 +0800 Subject: Not removing primary TaskFragment when clear task Placeholder activity was finished while starting the task root activity from launcher because the task root activity was set as singleTask launch mode. Meanwhile, the primary TaskFragment was also removed because of the split-rule finishPrimaryWithSecondary. Sending the information of whether the last activity on the TaskFragment was finished due to launch other activity to client. So that the organizer can decide whether the primary TaskFragment should removed. Bug: 196179714 Test: relaunch singleTask activity with placeholder Change-Id: I9a0369285adfbdef1edc5a7f2af944ec5b434566 --- .../src/androidx/window/extensions/organizer/SplitController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java index 05c6792a3fc7..756255017d9f 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java @@ -130,7 +130,11 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen // Check if there are no running activities - consider the container empty if there are no // non-finishing activities left. if (!taskFragmentInfo.hasRunningActivity()) { - mPresenter.cleanupContainer(container, true /* shouldFinishDependent */); + // Do not finish the dependents if this TaskFragment was cleared due to launching + // activity in the Task. + final boolean shouldFinishDependent = + !taskFragmentInfo.isTaskClearedForReuse(); + mPresenter.cleanupContainer(container, shouldFinishDependent); updateCallbackIfNecessary(); } } -- cgit v1.2.3-59-g8ed1b