Do not wait for Activity#onDestroy if the activity has no process

The activity process was killed by force stopping the app package in
#teardown, but the activity was deferred to be removed from wm hierarchy
due to in transition. Before the transition completed, a kill-task-process
message was scheduled because the app task was requested to be removed
by the test. The app process that started afterward could then be
killed once the timeout occurs.

Bug: 286349050
Test: atest DisplayTests
Change-Id: I8c70c25342fd373c812f535bd2bc47da4038af04
This commit is contained in:
Louis Chang
2023-06-09 08:31:24 +00:00
parent 5f433062b0
commit ae44d64d17

View File

@@ -1891,7 +1891,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
// DestroyActivityItem may be called first.
final ActivityRecord top = task.getTopMostActivity();
if (top != null && top.finishing && !top.mAppStopped && top.lastVisibleTime > 0
&& !task.mKillProcessesOnDestroyed) {
&& !task.mKillProcessesOnDestroyed && top.hasProcess()) {
task.mKillProcessesOnDestroyed = true;
mHandler.sendMessageDelayed(
mHandler.obtainMessage(KILL_TASK_PROCESSES_TIMEOUT_MSG, task),