From 0c893536cf8453316b0ccab9468d0d1e1d6f2116 Mon Sep 17 00:00:00 2001 From: Chilun Huang Date: Mon, 9 May 2022 19:41:18 +0800 Subject: [PATCH] Destroy the last embedded activity immediately When a back gesture on the last embedded activity, it is added to the stopping list and waits for an idle event to be finished. But, the next activity, on the other splitted side, is already visible and won't trigger the idle event. Eventually cause the split-screen cannot be dismissed. The embedded activity doesn't need the animation because it is the last one. Destroy it immediately so split-screen can be dismissed. Bug: 230588790 Test: atest RecentsAnimationControllerTest Change-Id: I4c230cfe902531db7d80b3bbe00e89c30ced99aa --- services/core/java/com/android/server/wm/ActivityRecord.java | 5 +++-- 1 file changed, 3 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 791d193f36ab9..e6be1371e2c5c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -3532,7 +3532,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final ActivityRecord next = getDisplayArea().topRunningActivity( true /* considerKeyguardState */); - // If the finishing activity is the last activity of a organized TaskFragment and has an + // If the finishing activity is the last activity of an organized TaskFragment and has an // adjacent TaskFragment, check if the activity removal should be delayed. boolean delayRemoval = false; final TaskFragment taskFragment = getTaskFragment(); @@ -3540,7 +3540,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final TaskFragment organized = taskFragment.getOrganizedTaskFragment(); final TaskFragment adjacent = organized != null ? organized.getAdjacentTaskFragment() : null; - if (adjacent != null && organized.topRunningActivity() == null) { + if (adjacent != null && next.isDescendantOf(adjacent) + && organized.topRunningActivity() == null) { delayRemoval = organized.isDelayLastActivityRemoval(); } }