Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java +7 −12 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ 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()) { cleanupContainer(container, true /* shouldFinishDependent */); mPresenter.cleanupContainer(container, true /* shouldFinishDependent */); updateCallbackIfNecessary(); } } Loading @@ -140,7 +140,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return; } cleanupContainer(container, true /* shouldFinishDependent */); mPresenter.cleanupContainer(container, true /* shouldFinishDependent */); updateCallbackIfNecessary(); } Loading Loading @@ -307,13 +307,10 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen mSplitContainers.add(splitContainer); } void cleanupContainer(@NonNull TaskFragmentContainer container, boolean shouldFinishDependent) { if (container.isFinished()) { return; } container.finish(shouldFinishDependent); /** * Removes the container from bookkeeping records. */ void removeContainer(@NonNull TaskFragmentContainer container) { // Remove all split containers that included this one mContainers.remove(container); List<SplitContainer> containersToRemove = new ArrayList<>(); Loading @@ -324,8 +321,6 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } } mSplitContainers.removeAll(containersToRemove); mPresenter.deleteContainer(container); } /** Loading Loading @@ -462,7 +457,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return false; } cleanupContainer(splitContainer.getSecondaryContainer(), mPresenter.cleanupContainer(splitContainer.getSecondaryContainer(), false /* shouldFinishDependent */); return true; } Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitPresenter.java +5 −3 Original line number Diff line number Diff line Loading @@ -68,11 +68,13 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { } /** * Deletes the provided container and updates the presentation if necessary. * Deletes the specified container and all other associated and dependent containers in the same * transaction. */ void deleteContainer(TaskFragmentContainer container) { void cleanupContainer(@NonNull TaskFragmentContainer container, boolean shouldFinishDependent) { final WindowContainerTransaction wct = new WindowContainerTransaction(); deleteTaskFragment(wct, container.getTaskFragmentToken()); container.finish(shouldFinishDependent, this, wct, mController); final TaskFragmentContainer newTopContainer = mController.getTopActiveContainer(); if (newTopContainer != null) { Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/TaskFragmentContainer.java +10 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.Rect; import android.os.Binder; import android.os.IBinder; import android.window.TaskFragmentInfo; import android.window.WindowContainerTransaction; import java.util.ArrayList; import java.util.List; Loading Loading @@ -179,7 +180,8 @@ class TaskFragmentContainer { * Removes all activities that belong to this process and finishes other containers/activities * configured to finish together. */ void finish(boolean shouldFinishDependent) { void finish(boolean shouldFinishDependent, @NonNull SplitPresenter presenter, @NonNull WindowContainerTransaction wct, @NonNull SplitController controller) { if (mIsFinished) { return; } Loading @@ -190,13 +192,19 @@ class TaskFragmentContainer { activity.finish(); } // Cleanup the visuals presenter.deleteTaskFragment(wct, getTaskFragmentToken()); // Cleanup the records controller.removeContainer(this); if (!shouldFinishDependent) { return; } // Finish dependent containers for (TaskFragmentContainer container : mContainersToFinishOnExit) { container.finish(true /* shouldFinishDependent */); container.finish(true /* shouldFinishDependent */, presenter, wct, controller); } mContainersToFinishOnExit.clear(); Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java +7 −12 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ 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()) { cleanupContainer(container, true /* shouldFinishDependent */); mPresenter.cleanupContainer(container, true /* shouldFinishDependent */); updateCallbackIfNecessary(); } } Loading @@ -140,7 +140,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return; } cleanupContainer(container, true /* shouldFinishDependent */); mPresenter.cleanupContainer(container, true /* shouldFinishDependent */); updateCallbackIfNecessary(); } Loading Loading @@ -307,13 +307,10 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen mSplitContainers.add(splitContainer); } void cleanupContainer(@NonNull TaskFragmentContainer container, boolean shouldFinishDependent) { if (container.isFinished()) { return; } container.finish(shouldFinishDependent); /** * Removes the container from bookkeeping records. */ void removeContainer(@NonNull TaskFragmentContainer container) { // Remove all split containers that included this one mContainers.remove(container); List<SplitContainer> containersToRemove = new ArrayList<>(); Loading @@ -324,8 +321,6 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } } mSplitContainers.removeAll(containersToRemove); mPresenter.deleteContainer(container); } /** Loading Loading @@ -462,7 +457,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return false; } cleanupContainer(splitContainer.getSecondaryContainer(), mPresenter.cleanupContainer(splitContainer.getSecondaryContainer(), false /* shouldFinishDependent */); return true; } Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitPresenter.java +5 −3 Original line number Diff line number Diff line Loading @@ -68,11 +68,13 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { } /** * Deletes the provided container and updates the presentation if necessary. * Deletes the specified container and all other associated and dependent containers in the same * transaction. */ void deleteContainer(TaskFragmentContainer container) { void cleanupContainer(@NonNull TaskFragmentContainer container, boolean shouldFinishDependent) { final WindowContainerTransaction wct = new WindowContainerTransaction(); deleteTaskFragment(wct, container.getTaskFragmentToken()); container.finish(shouldFinishDependent, this, wct, mController); final TaskFragmentContainer newTopContainer = mController.getTopActiveContainer(); if (newTopContainer != null) { Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/TaskFragmentContainer.java +10 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.Rect; import android.os.Binder; import android.os.IBinder; import android.window.TaskFragmentInfo; import android.window.WindowContainerTransaction; import java.util.ArrayList; import java.util.List; Loading Loading @@ -179,7 +180,8 @@ class TaskFragmentContainer { * Removes all activities that belong to this process and finishes other containers/activities * configured to finish together. */ void finish(boolean shouldFinishDependent) { void finish(boolean shouldFinishDependent, @NonNull SplitPresenter presenter, @NonNull WindowContainerTransaction wct, @NonNull SplitController controller) { if (mIsFinished) { return; } Loading @@ -190,13 +192,19 @@ class TaskFragmentContainer { activity.finish(); } // Cleanup the visuals presenter.deleteTaskFragment(wct, getTaskFragmentToken()); // Cleanup the records controller.removeContainer(this); if (!shouldFinishDependent) { return; } // Finish dependent containers for (TaskFragmentContainer container : mContainersToFinishOnExit) { container.finish(true /* shouldFinishDependent */); container.finish(true /* shouldFinishDependent */, presenter, wct, controller); } mContainersToFinishOnExit.clear(); Loading