Put stopping service's host process on top of cached process list

stopService should be regarded as a service activity, thus after
the service gets stopped, its host process should stay on top of
all cached processes if it slips into cached state.

Bug: 162811773
Test: atest CtsAppTestCases:ActivityManagerTest
Change-Id: I4f42344c373e431b7b4418304f29e79c3dec1a0e
This commit is contained in:
Jing Ji
2021-02-25 17:16:00 -08:00
parent fb19bcc08d
commit e481d169e5

View File

@@ -3868,6 +3868,8 @@ public final class ActiveServices {
r.name.getClassName());
stopServiceAndUpdateAllowlistManagerLocked(r);
if (r.app.getThread() != null) {
// Bump the process to the top of LRU list
mAm.updateLruProcessLocked(r.app, false, null);
updateServiceForegroundLocked(r.app.mServices, false);
try {
bumpServiceExecutingLocked(r, false, "destroy");