Loading media/java/android/media/projection/IMediaProjectionManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ interface IMediaProjectionManager { IMediaProjection createProjection(int uid, String packageName, int type, boolean permanentGrant); boolean isValidMediaProjection(IMediaProjection projection); boolean isCurrentProjection(IMediaProjection projection); @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" + ".permission.MANAGE_MEDIA_PROJECTION)") Loading services/core/java/com/android/server/audio/AudioService.java +2 −2 Original line number Diff line number Diff line Loading @@ -11377,12 +11377,12 @@ public class AudioService extends IAudioService.Stub } try { if (!projectionService.isValidMediaProjection(projection)) { if (!projectionService.isCurrentProjection(projection)) { Log.w(TAG, "App passed invalid MediaProjection token"); return false; } } catch (RemoteException e) { Log.e(TAG, "Can't call .isValidMediaProjection() on IMediaProjectionManager" Log.e(TAG, "Can't call .isCurrentProjection() on IMediaProjectionManager" + projectionService.asBinder(), e); return false; } Loading services/core/java/com/android/server/display/DisplayManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -1328,8 +1328,9 @@ public final class DisplayManagerService extends SystemService { if (projection != null) { try { if (!getProjectionService().isValidMediaProjection(projection)) { throw new SecurityException("Invalid media projection"); if (!getProjectionService().isCurrentProjection(projection)) { throw new SecurityException("Cannot create VirtualDisplay with " + "non-current MediaProjection"); } flags = projection.applyVirtualDisplayFlags(flags); } catch (RemoteException e) { Loading services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +11 −10 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ import java.util.Map; * The {@link MediaProjectionManagerService} manages the creation and lifetime of MediaProjections, * as well as the capabilities they grant. Any service using MediaProjection tokens as permission * grants <b>must</b> validate the token before use by calling {@link * IMediaProjectionService#isValidMediaProjection}. * IMediaProjectionService#isCurrentProjection}. */ public final class MediaProjectionManagerService extends SystemService implements Watchdog.Monitor { Loading Loading @@ -228,7 +228,7 @@ public final class MediaProjectionManagerService extends SystemService mCallbackDelegate.dispatchStop(projection); } private boolean isValidMediaProjection(IBinder token) { private boolean isCurrentProjection(IBinder token) { synchronized (mLock) { if (mProjectionToken != null) { return mProjectionToken.equals(token); Loading Loading @@ -313,8 +313,8 @@ public final class MediaProjectionManagerService extends SystemService } @Override // Binder call public boolean isValidMediaProjection(IMediaProjection projection) { return MediaProjectionManagerService.this.isValidMediaProjection( public boolean isCurrentProjection(IMediaProjection projection) { return MediaProjectionManagerService.this.isCurrentProjection( projection == null ? null : projection.asBinder()); } Loading Loading @@ -357,7 +357,7 @@ public final class MediaProjectionManagerService extends SystemService throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify " + "on captured content resize"); } if (!isValidMediaProjection(mProjectionGrant)) { if (!isCurrentProjection(mProjectionGrant)) { return; } final long token = Binder.clearCallingIdentity(); Loading @@ -377,7 +377,7 @@ public final class MediaProjectionManagerService extends SystemService throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify " + "on captured content resize"); } if (!isValidMediaProjection(mProjectionGrant)) { if (!isCurrentProjection(mProjectionGrant)) { return; } final long token = Binder.clearCallingIdentity(); Loading Loading @@ -429,8 +429,9 @@ public final class MediaProjectionManagerService extends SystemService final long origId = Binder.clearCallingIdentity(); try { synchronized (mLock) { if (!isValidMediaProjection(projection)) { throw new SecurityException("Invalid media projection"); if (!isCurrentProjection(projection)) { throw new SecurityException("Unable to set ContentRecordingSession on " + "non-current MediaProjection"); } if (!LocalServices.getService( WindowManagerInternal.class).setContentRecordingSession( Loading Loading @@ -536,7 +537,7 @@ public final class MediaProjectionManagerService extends SystemService throw new IllegalArgumentException("callback must not be null"); } synchronized (mLock) { if (isValidMediaProjection(asBinder())) { if (isCurrentProjection(asBinder())) { Slog.w(TAG, "UID " + Binder.getCallingUid() + " attempted to start already started MediaProjection"); return; Loading Loading @@ -603,7 +604,7 @@ public final class MediaProjectionManagerService extends SystemService @Override // Binder call public void stop() { synchronized (mLock) { if (!isValidMediaProjection(asBinder())) { if (!isCurrentProjection(asBinder())) { Slog.w(TAG, "Attempted to stop inactive MediaProjection " + "(uid=" + Binder.getCallingUid() + ", " + "pid=" + Binder.getCallingPid() + ")"); Loading Loading
media/java/android/media/projection/IMediaProjectionManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ interface IMediaProjectionManager { IMediaProjection createProjection(int uid, String packageName, int type, boolean permanentGrant); boolean isValidMediaProjection(IMediaProjection projection); boolean isCurrentProjection(IMediaProjection projection); @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" + ".permission.MANAGE_MEDIA_PROJECTION)") Loading
services/core/java/com/android/server/audio/AudioService.java +2 −2 Original line number Diff line number Diff line Loading @@ -11377,12 +11377,12 @@ public class AudioService extends IAudioService.Stub } try { if (!projectionService.isValidMediaProjection(projection)) { if (!projectionService.isCurrentProjection(projection)) { Log.w(TAG, "App passed invalid MediaProjection token"); return false; } } catch (RemoteException e) { Log.e(TAG, "Can't call .isValidMediaProjection() on IMediaProjectionManager" Log.e(TAG, "Can't call .isCurrentProjection() on IMediaProjectionManager" + projectionService.asBinder(), e); return false; } Loading
services/core/java/com/android/server/display/DisplayManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -1328,8 +1328,9 @@ public final class DisplayManagerService extends SystemService { if (projection != null) { try { if (!getProjectionService().isValidMediaProjection(projection)) { throw new SecurityException("Invalid media projection"); if (!getProjectionService().isCurrentProjection(projection)) { throw new SecurityException("Cannot create VirtualDisplay with " + "non-current MediaProjection"); } flags = projection.applyVirtualDisplayFlags(flags); } catch (RemoteException e) { Loading
services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +11 −10 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ import java.util.Map; * The {@link MediaProjectionManagerService} manages the creation and lifetime of MediaProjections, * as well as the capabilities they grant. Any service using MediaProjection tokens as permission * grants <b>must</b> validate the token before use by calling {@link * IMediaProjectionService#isValidMediaProjection}. * IMediaProjectionService#isCurrentProjection}. */ public final class MediaProjectionManagerService extends SystemService implements Watchdog.Monitor { Loading Loading @@ -228,7 +228,7 @@ public final class MediaProjectionManagerService extends SystemService mCallbackDelegate.dispatchStop(projection); } private boolean isValidMediaProjection(IBinder token) { private boolean isCurrentProjection(IBinder token) { synchronized (mLock) { if (mProjectionToken != null) { return mProjectionToken.equals(token); Loading Loading @@ -313,8 +313,8 @@ public final class MediaProjectionManagerService extends SystemService } @Override // Binder call public boolean isValidMediaProjection(IMediaProjection projection) { return MediaProjectionManagerService.this.isValidMediaProjection( public boolean isCurrentProjection(IMediaProjection projection) { return MediaProjectionManagerService.this.isCurrentProjection( projection == null ? null : projection.asBinder()); } Loading Loading @@ -357,7 +357,7 @@ public final class MediaProjectionManagerService extends SystemService throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify " + "on captured content resize"); } if (!isValidMediaProjection(mProjectionGrant)) { if (!isCurrentProjection(mProjectionGrant)) { return; } final long token = Binder.clearCallingIdentity(); Loading @@ -377,7 +377,7 @@ public final class MediaProjectionManagerService extends SystemService throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify " + "on captured content resize"); } if (!isValidMediaProjection(mProjectionGrant)) { if (!isCurrentProjection(mProjectionGrant)) { return; } final long token = Binder.clearCallingIdentity(); Loading Loading @@ -429,8 +429,9 @@ public final class MediaProjectionManagerService extends SystemService final long origId = Binder.clearCallingIdentity(); try { synchronized (mLock) { if (!isValidMediaProjection(projection)) { throw new SecurityException("Invalid media projection"); if (!isCurrentProjection(projection)) { throw new SecurityException("Unable to set ContentRecordingSession on " + "non-current MediaProjection"); } if (!LocalServices.getService( WindowManagerInternal.class).setContentRecordingSession( Loading Loading @@ -536,7 +537,7 @@ public final class MediaProjectionManagerService extends SystemService throw new IllegalArgumentException("callback must not be null"); } synchronized (mLock) { if (isValidMediaProjection(asBinder())) { if (isCurrentProjection(asBinder())) { Slog.w(TAG, "UID " + Binder.getCallingUid() + " attempted to start already started MediaProjection"); return; Loading Loading @@ -603,7 +604,7 @@ public final class MediaProjectionManagerService extends SystemService @Override // Binder call public void stop() { synchronized (mLock) { if (!isValidMediaProjection(asBinder())) { if (!isCurrentProjection(asBinder())) { Slog.w(TAG, "Attempted to stop inactive MediaProjection " + "(uid=" + Binder.getCallingUid() + ", " + "pid=" + Binder.getCallingPid() + ")"); Loading