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

Commit 15b7740d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Introduce playback capture opt-out"

parents 3ffadce8 9ce6e56c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23045,6 +23045,7 @@ package android.media {
    ctor public AudioAttributes.Builder();
    ctor public AudioAttributes.Builder(android.media.AudioAttributes);
    method public android.media.AudioAttributes build();
    method public android.media.AudioAttributes.Builder setAllowCapture(boolean);
    method public android.media.AudioAttributes.Builder setContentType(int);
    method public android.media.AudioAttributes.Builder setFlags(int);
    method public android.media.AudioAttributes.Builder setLegacyStreamType(int);
+22 −0
Original line number Diff line number Diff line
@@ -368,6 +368,12 @@ public final class AudioAttributes implements Parcelable {
     */
    public final static int FLAG_DEEP_BUFFER = 0x1 << 9;

    /**
     * @hide
     * Flag specifying that the audio shall not be captured by other apps.
     */
    public static final int FLAG_NO_CAPTURE = 0x1 << 10;

    private final static int FLAG_ALL = FLAG_AUDIBILITY_ENFORCED | FLAG_SECURE | FLAG_SCO |
            FLAG_BEACON | FLAG_HW_AV_SYNC | FLAG_HW_HOTWORD | FLAG_BYPASS_INTERRUPTION_POLICY |
            FLAG_BYPASS_MUTE | FLAG_LOW_LATENCY | FLAG_DEEP_BUFFER;
@@ -617,6 +623,22 @@ public final class AudioAttributes implements Parcelable {
            return this;
        }

        /**
         * Specifying if audio shall or shall not be captured by other apps.
         * By default, capture is allowed.
         * @param allowCapture false to forbid capture of the audio by any apps,
         *                     true to allow apps to capture the audio
         * @return the same Builder instance
         */
        public Builder setAllowCapture(boolean allowCapture) {
            if (allowCapture) {
                mFlags &= ~FLAG_NO_CAPTURE;
            } else {
                mFlags |= FLAG_NO_CAPTURE;
            }
            return this;
        }

        /**
         * @hide
         * Replaces flags.