From 012697e5a7da6a3e73fdd5432b2097c782752d36 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 28 Jul 2021 11:06:09 -0700 Subject: [PATCH] Do not call setReady(false) when finishing Before, when there is a collecting transition, finishing activity/task will unset the ready state. It can cause issue if the existing transition has already in ready, because there may not be other setReady call for finishing. Bug: 183993924 Test: manually on acloud with resolve activity for two launchers Change-Id: Ibafaf0b9bd7842a30eedbeb02271ab6f96c838ff --- .../core/java/com/android/server/wm/ActivityRecord.java | 8 +++++++- .../com/android/server/wm/ActivityTaskSupervisor.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 5970f622955ec..f727ff9b30be9 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -3453,7 +3453,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (stopped) { abortAndClearOptionsAnimation(); } - mAtmService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, this); + if (mAtmService.getTransitionController().isCollecting()) { + // We don't want the finishing to change the transition ready state since there will not + // be corresponding setReady for finishing. + mAtmService.getTransitionController().collectExistenceChange(this); + } else { + mAtmService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, this); + } } /** diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index f728a481dd521..cb9c0372c3ad2 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -1551,7 +1551,13 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { return; } if (task.isVisible()) { - mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, task); + if (mService.getTransitionController().isCollecting()) { + // We don't want the finishing to change the transition ready state since there will + // not be corresponding setReady for finishing. + mService.getTransitionController().collectExistenceChange(task); + } else { + mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, task); + } } else { // Removing a non-visible task doesn't require a transition, but if there is one // collecting, this should be a member just in case.