diff options
author | Michael Wright <michaelwr@google.com> | 2014-07-29 19:14:16 -0700 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2014-08-07 20:07:04 +0000 |
commit | 6720be4e8c65e90d4453ddad5cef192bc3820038 (patch) | |
tree | 8262673e0a2c54e58011025e609f668d5ae650b3 /services/core/java/com/android/server/media/projection | |
parent | d5324e4183c97ae7271b6eda4204d9f0dc003023 (diff) | |
download | frameworks_base-6720be4e8c65e90d4453ddad5cef192bc3820038.zip frameworks_base-6720be4e8c65e90d4453ddad5cef192bc3820038.tar.gz frameworks_base-6720be4e8c65e90d4453ddad5cef192bc3820038.tar.bz2 |
Allow media projections to create public presentations.
Change-Id: I3b6e0b54d658352942a38be6a24486bdfc179efd
Diffstat (limited to 'services/core/java/com/android/server/media/projection')
-rw-r--r-- | services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java index 7b28699..289b5aa 100644 --- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java @@ -103,7 +103,7 @@ public final class MediaProjectionManagerService extends SystemService try { hasPermission |= checkPermission(packageName, android.Manifest.permission.CAPTURE_VIDEO_OUTPUT) - || mAppOps.checkOpNoThrow( + || mAppOps.noteOpNoThrow( AppOpsManager.OP_PROJECT_MEDIA, uid, packageName) == AppOpsManager.MODE_ALLOWED; } finally { @@ -196,18 +196,27 @@ public final class MediaProjectionManagerService extends SystemService } @Override // Binder call - public int getVirtualDisplayFlags() { - switch (mType) { - case MediaProjectionManager.TYPE_SCREEN_CAPTURE: - return DisplayManager.VIRTUAL_DISPLAY_FLAG_SCREEN_SHARE; - case MediaProjectionManager.TYPE_MIRRORING: - return DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | - DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION; - case MediaProjectionManager.TYPE_PRESENTATION: - return DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION | - DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; + public int applyVirtualDisplayFlags(int flags) { + if (mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE) { + flags &= ~DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; + flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR + | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION; + return flags; + } else if (mType == MediaProjectionManager.TYPE_MIRRORING) { + flags &= ~(DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | + DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR); + flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | + DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION; + return flags; + } else if (mType == MediaProjectionManager.TYPE_PRESENTATION) { + flags &= ~DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; + flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | + DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION | + DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; + return flags; + } else { + throw new RuntimeException("Unknown MediaProjection type"); } - throw new RuntimeException("Unknown MediaProjection type"); } @Override // Binder call |