Loading services/core/java/com/android/server/am/ActiveServices.java +44 −29 Original line number Diff line number Diff line Loading @@ -192,6 +192,12 @@ public final class ActiveServices { @Override public void stopForegroundServicesForUidPackage(final int uid, final String packageName) { synchronized (mAm) { stopAllForegroundServicesLocked(uid, packageName); } } } void stopAllForegroundServicesLocked(final int uid, final String packageName) { final ServiceMap smap = getServiceMapLocked(UserHandle.getUserId(uid)); final int N = smap.mServicesByInstanceName.size(); final ArrayList<ServiceRecord> toStop = new ArrayList<>(N); Loading @@ -209,7 +215,7 @@ public final class ActiveServices { final int numToStop = toStop.size(); if (numToStop > 0 && DEBUG_FOREGROUND_SERVICE) { Slog.i(TAG, "Package " + packageName + "/" + uid + " entering FAS with foreground services"); + " in FAS with foreground services"); } for (int i = 0; i < numToStop; i++) { final ServiceRecord r = toStop.get(i); Loading @@ -219,8 +225,6 @@ public final class ActiveServices { setServiceForegroundInnerLocked(r, 0, null, 0, 0); } } } } /** * Information about an app that is currently running one or more foreground services. Loading Loading @@ -1010,12 +1014,23 @@ public final class ActiveServices { } } if (!aa.mAppOnTop) { // Transitioning a fg-service host app out of top: if it's bg restricted, // it loses the fg service state now. if (!appRestrictedAnyInBackground(aa.mUid, aa.mPackageName)) { if (active == null) { active = new ArrayList<>(); } if (DEBUG_FOREGROUND_SERVICE) Slog.d(TAG, "Adding active: pkg=" + aa.mPackageName + ", uid=" + aa.mUid); active.add(aa); } else { if (DEBUG_FOREGROUND_SERVICE) { Slog.d(TAG, "bg-restricted app " + aa.mPackageName + "/" + aa.mUid + " exiting top; demoting fg services "); } stopAllForegroundServicesLocked(aa.mUid, aa.mPackageName); } } } smap.removeMessages(ServiceMap.MSG_UPDATE_FOREGROUND_APPS); Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +44 −29 Original line number Diff line number Diff line Loading @@ -192,6 +192,12 @@ public final class ActiveServices { @Override public void stopForegroundServicesForUidPackage(final int uid, final String packageName) { synchronized (mAm) { stopAllForegroundServicesLocked(uid, packageName); } } } void stopAllForegroundServicesLocked(final int uid, final String packageName) { final ServiceMap smap = getServiceMapLocked(UserHandle.getUserId(uid)); final int N = smap.mServicesByInstanceName.size(); final ArrayList<ServiceRecord> toStop = new ArrayList<>(N); Loading @@ -209,7 +215,7 @@ public final class ActiveServices { final int numToStop = toStop.size(); if (numToStop > 0 && DEBUG_FOREGROUND_SERVICE) { Slog.i(TAG, "Package " + packageName + "/" + uid + " entering FAS with foreground services"); + " in FAS with foreground services"); } for (int i = 0; i < numToStop; i++) { final ServiceRecord r = toStop.get(i); Loading @@ -219,8 +225,6 @@ public final class ActiveServices { setServiceForegroundInnerLocked(r, 0, null, 0, 0); } } } } /** * Information about an app that is currently running one or more foreground services. Loading Loading @@ -1010,12 +1014,23 @@ public final class ActiveServices { } } if (!aa.mAppOnTop) { // Transitioning a fg-service host app out of top: if it's bg restricted, // it loses the fg service state now. if (!appRestrictedAnyInBackground(aa.mUid, aa.mPackageName)) { if (active == null) { active = new ArrayList<>(); } if (DEBUG_FOREGROUND_SERVICE) Slog.d(TAG, "Adding active: pkg=" + aa.mPackageName + ", uid=" + aa.mUid); active.add(aa); } else { if (DEBUG_FOREGROUND_SERVICE) { Slog.d(TAG, "bg-restricted app " + aa.mPackageName + "/" + aa.mUid + " exiting top; demoting fg services "); } stopAllForegroundServicesLocked(aa.mUid, aa.mPackageName); } } } smap.removeMessages(ServiceMap.MSG_UPDATE_FOREGROUND_APPS); Loading