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

Commit ea495859 authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Update removeTaskInternal Desktop case

- Pass TaskView directly to removeTaskInternal
- Update the bug id

Bug: 370757235
Test: Manual
Flag: EXEMPT No-op
Change-Id: I0ad0d42541221d1ce6e27c708f469e5c0757b8ef
parent c1c1c873
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);
                }
              }
            }
            });
  }