Run transition when app dies in freeform

In a freeform environment, currently a shell transition times out when
an app is killed via adb force-stop.

In this timeout case, setReady() isn't called where it's supposed to
because handleAppDied doesn't directly trigger any z-order or focus
update in freeform mode.

This CL adjusts the if condition in question so that this kind of
lingering transition will be executed even without any focus change.

Bug: 244123821
Bug: 268239637
Test: adb shell am force-stop com.android.settings
Change-Id: I07bdadd81f6992445b11e21dc08a68c231e8d5b8
This commit is contained in:
Kazuki Takise
2023-03-16 22:34:33 +09:00
parent e17d89baec
commit cefc4aa8af
2 changed files with 5 additions and 6 deletions

View File

@@ -2288,11 +2288,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
resumedOnDisplay[0] |= curResult;
return;
}
if (rootTask.getDisplayArea().isTopRootTask(rootTask)
&& topRunningActivity.isState(RESUMED)) {
// Kick off any lingering app transitions from the MoveTaskToFront
// operation, but only consider the top task and root-task on that
// display.
if (topRunningActivity.isState(RESUMED)
&& topRunningActivity == rootTask.getDisplayArea().topRunningActivity()) {
// Kick off any lingering app transitions form the MoveTaskToFront operation,
// but only consider the top activity on that display.
rootTask.executeAppTransition(targetOptions);
} else {
resumedOnDisplay[0] |= topRunningActivity.makeActiveIfNeeded(target);

View File

@@ -775,7 +775,7 @@ public class RootWindowContainerTests extends WindowTestsBase {
// Assume the task is at the topmost position
assertFalse(rootTask.isTopRootTaskInDisplayArea());
doReturn(rootTask).when(mRootWindowContainer).getTopDisplayFocusedRootTask();
doReturn(taskDisplayArea.getHomeActivity()).when(taskDisplayArea).topRunningActivity();
// Use the task as target to resume.
mRootWindowContainer.resumeFocusedTasksTopActivities();