Clean up the no-history entries while the app died

mNoHistoryActivities, A list maintains the no-history activities.
If the device goes to sleep with such activity in the paused state
then save it here and finish it later if another activity replaces
it. We should clean up the entries together while the app dies
otherwise the items still stay in the list.

Bug: 200159293
Bug: 199523354
Test: 1. start some activity with no-history and transparent property
      2. adb shell am force-stop “the app”
      3. adb dumpsys activity activities to check mNoHistoryActivities.
Change-Id: Ib2e3f12f83d562cd25efe918eb27e25f4dc890b2
This commit is contained in:
Jeff Chang
2021-09-22 15:40:09 +08:00
parent e8af787674
commit a665923928
2 changed files with 2 additions and 3 deletions

View File

@@ -1940,6 +1940,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
void removeHistoryRecords(WindowProcessController app) {
removeHistoryRecords(mStoppingActivities, app, "mStoppingActivities");
removeHistoryRecords(mFinishingActivities, app, "mFinishingActivities");
removeHistoryRecords(mNoHistoryActivities, app, "mNoHistoryActivities");
}
private void removeHistoryRecords(ArrayList<ActivityRecord> list, WindowProcessController app,
@@ -1977,6 +1978,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
mWaitingActivityLaunched.get(i).dump(pw, prefix + " ");
}
}
pw.println(prefix + "mNoHistoryActivities=" + mNoHistoryActivities);
pw.println();
}

View File

@@ -538,9 +538,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
isPausingDied = true;
}
if (mLastPausedActivity != null && mLastPausedActivity.app == app) {
if (mLastPausedActivity.isNoHistory()) {
mTaskSupervisor.mNoHistoryActivities.remove(mLastPausedActivity);
}
mLastPausedActivity = null;
}
return isPausingDied;