From 5502ffbfc2a6c8c8213fefd43c5d6000a38f750d Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 23 Feb 2023 06:00:24 +0000 Subject: [PATCH] Skip updating the leash if a task is removed prior to sync completion - Only affects legacy transitions Fixes: 243848364 Test: atest TaplTestsQuickstep Change-Id: I9d646573e446833ded399676e0a13d8fa4d47733 --- .../wm/shell/fullscreen/FullscreenTaskListener.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java index 26f47fcdaa440..d094c229e0f86 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java @@ -108,6 +108,10 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { } if (!createdWindowDecor) { mSyncQueue.runInSync(t -> { + if (!leash.isValid()) { + // Task vanished before sync completion + return; + } // Reset several properties back to fullscreen (PiP, for example, leaves all these // properties in a bad state). t.setWindowCrop(leash, null); @@ -136,6 +140,10 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { final Point positionInParent = state.mTaskInfo.positionInParent; if (!oldPositionInParent.equals(state.mTaskInfo.positionInParent)) { mSyncQueue.runInSync(t -> { + if (!state.mLeash.isValid()) { + // Task vanished before sync completion + return; + } t.setPosition(state.mLeash, positionInParent.x, positionInParent.y); }); }