Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6a9c7cb authored by Jing Ji's avatar Jing Ji Committed by Automerger Merge Worker
Browse files

Merge "Track the media projection FGS types per UID" into udc-dev am: be6ef6dc

parents 0e72f170 be6ef6dc
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -18348,16 +18348,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;
            }
        }
+4 −1
Original line number Diff line number Diff line
@@ -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;
            }