From 092371abae0d2fcf8fc62de77b3053c08252513b Mon Sep 17 00:00:00 2001 From: lijilou Date: Fri, 10 Jan 2025 10:46:15 +0800 Subject: don't call the reparent method when the old parent of task is removed. The activities in the task may already be finishing. Then the task could be removed when performing the idle check. Test: monkey test Flag: EXEMPT bugfix Bug: 388883786 Change-Id: I762d3aaaa7a4b2eac2784d1f578960c4348a5a9d --- .../core/java/com/android/server/wm/ActivityTaskSupervisor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index 9a3ad2d85de6..cebf1bee3439 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -1655,6 +1655,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { activityIdleInternal(null /* idleActivity */, false /* fromTimeout */, true /* processPausingActivities */, null /* configuration */); + if (rootTask.getParent() == null) { + // The activities in the task may already be finishing. Then the task could be removed + // when performing the idle check. + return; + } + // Reparent all the tasks to the bottom of the display final DisplayContent toDisplay = mRootWindowContainer.getDisplayContent(DEFAULT_DISPLAY); -- cgit v1.2.3-59-g8ed1b