Loading services/core/java/com/android/server/am/ActivityManagerService.java +9 −8 Original line number Diff line number Diff line Loading @@ -18341,16 +18341,17 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public boolean hasRunningForegroundService(int uid, int foregroundServicetype) { synchronized (ActivityManagerService.this) { return mProcessList.searchEachLruProcessesLOSP(true, app -> { if (app.uid != uid) { return null; final UidRecord uidRec = mProcessList.mActiveUids.get(uid); if (uidRec == null) { return false; } for (int i = uidRec.getNumOfProcs() - 1; i >= 0; i--) { final ProcessRecord app = uidRec.getProcessRecordByIndex(i); if ((app.mServices.containsAnyForegroundServiceTypes(foregroundServicetype))) { return Boolean.TRUE; return true; } return null; }) != null; } return false; } } services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -232,7 +232,10 @@ public final class MediaProjectionManagerService extends SystemService return; } if ((serviceTypes & ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION) != 0) { if (mActivityManagerInternal.hasRunningForegroundService( uid, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)) { // If there is any process within this UID running a FGS // with the mediaProjection type, that's Okay. return; } Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +9 −8 Original line number Diff line number Diff line Loading @@ -18341,16 +18341,17 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public boolean hasRunningForegroundService(int uid, int foregroundServicetype) { synchronized (ActivityManagerService.this) { return mProcessList.searchEachLruProcessesLOSP(true, app -> { if (app.uid != uid) { return null; final UidRecord uidRec = mProcessList.mActiveUids.get(uid); if (uidRec == null) { return false; } for (int i = uidRec.getNumOfProcs() - 1; i >= 0; i--) { final ProcessRecord app = uidRec.getProcessRecordByIndex(i); if ((app.mServices.containsAnyForegroundServiceTypes(foregroundServicetype))) { return Boolean.TRUE; return true; } return null; }) != null; } return false; } }
services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -232,7 +232,10 @@ public final class MediaProjectionManagerService extends SystemService return; } if ((serviceTypes & ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION) != 0) { if (mActivityManagerInternal.hasRunningForegroundService( uid, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)) { // If there is any process within this UID running a FGS // with the mediaProjection type, that's Okay. return; } Loading