}
}
if (finishing) {
- if (r.app != null) {
+ if (r.app != null && !r.app.persistent) {
r.app.services.remove(r);
}
r.app = null;
Slog.i(TAG, " Force stopping service " + service);
if (service.app != null) {
service.app.removed = true;
- service.app.services.remove(service);
+ if (!service.app.persistent) {
+ service.app.services.remove(service);
+ }
}
service.app = null;
service.isolatedProc = null;
synchronized (sr.stats.getBatteryStats()) {
sr.stats.stopLaunchedLocked();
}
- if (sr.app != null) {
+ if (sr.app != null && !sr.app.persistent) {
sr.app.services.remove(sr);
}
sr.app = null;