Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4a04f9d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update removeTaskInternal Desktop case" into main

parents 9dbae036 ea495859
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -3939,11 +3939,9 @@ public abstract class RecentsView<
                    if (shouldRemoveTask) {
                        if (dismissedTaskView.isRunningTask()) {
                            finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
                                    () -> removeTaskInternal(dismissedTaskViewId,
                                            dismissedTaskView instanceof DesktopTaskView));
                                    () -> removeTaskInternal(dismissedTaskView));
                        } else {
                            removeTaskInternal(dismissedTaskViewId,
                                    dismissedTaskView instanceof DesktopTaskView);
                            removeTaskInternal(dismissedTaskView);
                        }
                        announceForAccessibility(
                                getResources().getString(R.string.task_view_closed));
@@ -4311,20 +4309,22 @@ public abstract class RecentsView<
        return lastVisibleIndex;
    }

    private void removeTaskInternal(int dismissedTaskViewId, boolean isDesktop) {
        int[] taskIds = getTaskIdsForTaskViewId(dismissedTaskViewId);
        UI_HELPER_EXECUTOR.getHandler().post(() -> {
            if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION.isTrue() && isDesktop) {
                // TODO: b/372005228 - Use the api with desktop id instead.
                SystemUiProxy.INSTANCE.get(getContext()).removeDesktop(
                        mContainer.getDisplay().getDisplayId());
  private void removeTaskInternal(@NonNull TaskView dismissedTaskView) {
    UI_HELPER_EXECUTOR
        .getHandler()
        .post(
            () -> {
              if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION.isTrue()
                  && dismissedTaskView instanceof DesktopTaskView) {
                // TODO: b/362720497 - Use the api with desktop id instead.
                SystemUiProxy.INSTANCE
                    .get(getContext())
                    .removeDesktop(mContainer.getDisplay().getDisplayId());
              } else {
                for (int taskId : taskIds) {
                    if (taskId != -1) {
                for (int taskId : dismissedTaskView.getTaskIds()) {
                    ActivityManagerWrapper.getInstance().removeTask(taskId);
                }
              }
            }
            });
  }