diff options
4 files changed, 43 insertions, 5 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index 6c482c831152..ba02faf94d69 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -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) { - try { - ActivityTaskManager.getService().removeTask(getTaskId()); - } catch (RemoteException e) { - Log.w(TAG, e.getMessage()); + // 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; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java index e4d8c32eb5c8..4faa92979733 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java @@ -177,6 +177,13 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, } /** + * 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. */ public void release() { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java index 7991c529aa49..f925bb667c15 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java @@ -98,7 +98,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(); } @@ -397,6 +397,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; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java index 81d69a4fa611..b418e45d86b2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java @@ -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).mVisible == visible) return; if (taskView.getTaskInfo() == null) { @@ -294,6 +302,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 " |