From 2902b938e1d118adf6a933f118b220a50cddf274 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 5 Jul 2023 16:09:55 -0700 Subject: [PATCH] Allow multiple close transactions for task view This is something that can happen, so we should support it rather than throwing an illegal state exception. This CL just creates a new pending transaction for the close/hide request and adds it to the list. Test: None - there is no way to reproduce this bug, this is a blind fix Bug: 288508212 Change-Id: I0264d06c7b5598a892f40cde637eff06c083ce8b --- .../wm/shell/taskview/TaskViewTransitions.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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 5baf2e3202272..16f0e3987e240 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 @@ -202,15 +202,10 @@ public class TaskViewTransitions implements Transitions.TransitionHandler { if (taskView == null) return null; // Opening types should all be initiated by shell if (!TransitionUtil.isClosingType(request.getType())) return null; - PendingTransition pending = findPendingCloseTransition(taskView); - if (pending == null) { - pending = new PendingTransition(request.getType(), null, taskView, null /* cookie */); - } - if (pending.mClaimed != null) { - throw new IllegalStateException("Task is closing in 2 collecting transitions?" - + " This state doesn't make sense"); - } + PendingTransition pending = new PendingTransition(request.getType(), null, + taskView, null /* cookie */); pending.mClaimed = transition; + mPending.add(pending); return new WindowContainerTransaction(); }