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

Commit 36e121d4 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Make the task remove a wct" into udc-dev

parents d1b1115b f5824def
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPAND
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubblePositioner.MAX_HEIGHT;
import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
@@ -1057,13 +1058,21 @@ public class BubbleExpandedView extends LinearLayout {
            Log.d(TAG, "cleanUpExpandedState: bubble=" + getBubbleKey() + " task=" + mTaskId);
        }
        if (getTaskId() != INVALID_TASK_ID) {
            // Ensure the task is removed from WM
            if (ENABLE_SHELL_TRANSITIONS) {
                if (mTaskView != null) {
                    mTaskView.removeTask();
                }
            } else {
                try {
                    ActivityTaskManager.getService().removeTask(getTaskId());
                } catch (RemoteException e) {
                    Log.w(TAG, e.getMessage());
                }
            }
        }
        if (mTaskView != null) {
            // Release the surface & other task view related things
            mTaskView.release();
            removeView(mTaskView);
            mTaskView = null;
+7 −0
Original line number Diff line number Diff line
@@ -176,6 +176,13 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback,
        mTaskViewTaskController.setWindowBounds(mTmpRect);
    }

    /**
     * Call to remove the task from window manager. This task will not appear in recents.
     */
    public void removeTask() {
        mTaskViewTaskController.removeTask();
    }

    /**
     * Release this container if it is initialized.
     */
+10 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
    }

    /** Until all users are converted, we may have mixed-use (eg. Car). */
    private boolean isUsingShellTransitions() {
    public boolean isUsingShellTransitions() {
        return mTaskViewTransitions != null && mTaskViewTransitions.isEnabled();
    }

@@ -401,6 +401,15 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        mSyncQueue.queue(wct);
    }

    /**
     * Call to remove the task from window manager. This task will not appear in recents.
     */
    void removeTask() {
        WindowContainerTransaction wct = new WindowContainerTransaction();
        wct.removeTask(mTaskToken);
        mTaskViewTransitions.closeTaskView(wct, this);
    }

    /** Should be called when the client surface is destroyed. */
    public void surfaceDestroyed() {
        mSurfaceCreated = false;
+13 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.taskview;

import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -201,6 +202,13 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
        startNextTransition();
    }

    void closeTaskView(@NonNull WindowContainerTransaction wct,
            @NonNull TaskViewTaskController taskView) {
        updateVisibilityState(taskView, false /* visible */);
        mPending.add(new PendingTransition(TRANSIT_CLOSE, wct, taskView, null /* cookie */));
        startNextTransition();
    }

    void setTaskViewVisible(TaskViewTaskController taskView, boolean visible) {
        if (mTaskViews.get(taskView) == null) return;
        if (mTaskViews.get(taskView).mVisible == visible) return;
@@ -297,6 +305,11 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
            if (TransitionUtil.isClosingType(chg.getMode())) {
                final boolean isHide = chg.getMode() == TRANSIT_TO_BACK;
                TaskViewTaskController tv = findTaskView(chg.getTaskInfo());
                if (tv == null && !isHide) {
                    // TaskView can be null when closing
                    changesHandled++;
                    continue;
                }
                if (tv == null) {
                    if (pending != null) {
                        Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. This "