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

Commit 907d34c2 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:...

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22816423



Change-Id: I0057570f8bfc14278dedd3bc16b97b62c1b16612
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents fab172d3 6b96219a
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;
            }