Loading services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +18 −14 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.util.Map; */ public final class MediaProjectionManagerService extends SystemService implements Watchdog.Monitor { private static final boolean REQUIRE_FG_SERVICE_FOR_PROJECTION = false; private static final String TAG = "MediaProjectionManagerService"; private final Object mLock = new Object(); // Protects the list of media projections Loading Loading @@ -100,6 +101,7 @@ public final class MediaProjectionManagerService extends SystemService false /*allowIsolated*/); mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, mMediaRouterCallback, MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY); if (REQUIRE_FG_SERVICE_FOR_PROJECTION) { mActivityManagerInternal.registerProcessObserver(new IProcessObserver.Stub() { @Override public void onForegroundActivitiesChanged(int pid, int uid, boolean fg) { Loading @@ -116,6 +118,7 @@ public final class MediaProjectionManagerService extends SystemService } }); } } @Override public void onSwitchUser(int userId) { Loading Loading @@ -462,7 +465,8 @@ public final class MediaProjectionManagerService extends SystemService return; } if (targetSdkVersion >= Build.VERSION_CODES.Q if (REQUIRE_FG_SERVICE_FOR_PROJECTION && targetSdkVersion >= Build.VERSION_CODES.Q && !mActivityManagerInternal.hasRunningForegroundService( uid, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)) { throw new SecurityException("Media projections require a foreground service" Loading Loading
services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +18 −14 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.util.Map; */ public final class MediaProjectionManagerService extends SystemService implements Watchdog.Monitor { private static final boolean REQUIRE_FG_SERVICE_FOR_PROJECTION = false; private static final String TAG = "MediaProjectionManagerService"; private final Object mLock = new Object(); // Protects the list of media projections Loading Loading @@ -100,6 +101,7 @@ public final class MediaProjectionManagerService extends SystemService false /*allowIsolated*/); mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, mMediaRouterCallback, MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY); if (REQUIRE_FG_SERVICE_FOR_PROJECTION) { mActivityManagerInternal.registerProcessObserver(new IProcessObserver.Stub() { @Override public void onForegroundActivitiesChanged(int pid, int uid, boolean fg) { Loading @@ -116,6 +118,7 @@ public final class MediaProjectionManagerService extends SystemService } }); } } @Override public void onSwitchUser(int userId) { Loading Loading @@ -462,7 +465,8 @@ public final class MediaProjectionManagerService extends SystemService return; } if (targetSdkVersion >= Build.VERSION_CODES.Q if (REQUIRE_FG_SERVICE_FOR_PROJECTION && targetSdkVersion >= Build.VERSION_CODES.Q && !mActivityManagerInternal.hasRunningForegroundService( uid, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)) { throw new SecurityException("Media projections require a foreground service" Loading