From cd005ebf76d9bde584987be4690b128f687bc46d Mon Sep 17 00:00:00 2001 From: "younghwan1.kim" Date: Thu, 2 Apr 2015 19:15:11 +0900 Subject: [PATCH] [ActivityManager] Do not add service to reschedule after removing users. Some service which has persistent attribute has restarted again and again after removing users. but it dies right after launching because it is not valid in owner mode. This patch will check service's userId whether userId is alive or not. And then if userId is not alive, then service will bring down. Change-Id: Id99bf3c651b88e377f1fd6bec8aaad81318d7579 --- services/core/java/com/android/server/am/ActiveServices.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 059dde156260f..dcd0222fe8f11 100755 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -2228,7 +2228,7 @@ public final class ActiveServices { EventLog.writeEvent(EventLogTags.AM_SERVICE_CRASHED_TOO_MUCH, sr.userId, sr.crashCount, sr.shortName, app.pid); bringDownServiceLocked(sr); - } else if (!allowRestart) { + } else if (!allowRestart || !mAm.isUserRunningLocked(sr.userId, false)) { bringDownServiceLocked(sr); } else { boolean canceled = scheduleServiceRestartLocked(sr, true);