OSDN Git Service

Propagate to apps capture opt-in
authorKevin Rocard <krocard@google.com>
Tue, 9 Apr 2019 23:26:06 +0000 (16:26 -0700)
committerKevin Rocard <krocard@google.com>
Fri, 26 Apr 2019 21:52:29 +0000 (21:52 +0000)
Allows public apps to detect if playback have opted-out of being
capture.

Bug: 129948989
Test: atest AudioPlaybackConfigurationTest
Change-Id: Id2c2ad195e5fdeba89926dcdbbe9fa22c2d25891
Signed-off-by: Kevin Rocard <krocard@google.com>
media/java/android/media/AudioPlaybackConfiguration.java

index b2ebfa9..ab80b3a 100644 (file)
@@ -16,6 +16,9 @@
 
 package android.media;
 
+import static android.media.AudioAttributes.ALLOW_CAPTURE_BY_ALL;
+import static android.media.AudioAttributes.ALLOW_CAPTURE_BY_NONE;
+
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.SystemApi;
@@ -235,6 +238,9 @@ public final class AudioPlaybackConfiguration implements Parcelable {
                 .setUsage(in.mPlayerAttr.getUsage())
                 .setContentType(in.mPlayerAttr.getContentType())
                 .setFlags(in.mPlayerAttr.getFlags())
+                .setAllowedCapturePolicy(
+                        in.mPlayerAttr.getAllowedCapturePolicy() == ALLOW_CAPTURE_BY_ALL
+                        ? ALLOW_CAPTURE_BY_ALL : ALLOW_CAPTURE_BY_NONE)
                 .build();
         // anonymized data
         anonymCopy.mPlayerType = PLAYER_TYPE_UNKNOWN;