From 779851dc3547da63230dc778fdb5080201eccfac Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Fri, 7 Oct 2022 23:39:52 +0000 Subject: [PATCH] upgrade appdied transition trigger to task if relevant When an app is killed, we send a transition request for it but with the trigger at activity-level. However, the handleAppDied logic immediately detaches the Task which means Shell can't prepare for that (particularly split-screen). This change will upgrade the trigger to task-level if the task is going to be removed. Bug: 251459369 Test: atest EnterSplitScreenFromOverview Change-Id: Iaf901cb7db41a23a482b67801172053095c8dd47 --- .../core/java/com/android/server/wm/ActivityRecord.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index fab168369470e..44e3490f1165b 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4076,7 +4076,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // to the restarted activity. nowVisible = mVisibleRequested; } - mTransitionController.requestCloseTransitionIfNeeded(this); + // upgrade transition trigger to task if this is the last activity since it means we are + // closing the task. + final WindowContainer trigger = remove && task != null && task.getChildCount() == 1 + ? task : this; + mTransitionController.requestCloseTransitionIfNeeded(trigger); cleanUp(true /* cleanServices */, true /* setState */); if (remove) { if (mStartingData != null && mVisible && task != null) {