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

Commit be6ef6dc authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

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

parents 5c0ab458 90c0b155
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -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;
            }
        }
+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;
            }