diff options
| author | 2021-03-02 00:46:25 +0000 | |
|---|---|---|
| committer | 2021-03-02 00:46:25 +0000 | |
| commit | 1123c38bec60fde72e27e375a89c945c855e3bcd (patch) | |
| tree | 94cd8e4a49606a2610b365bac3e656134b02940f | |
| parent | 25d3dbc10433d8b45b4bf62ad18c4768f5775f68 (diff) | |
| parent | 0ac9fb2ec7f0ee8d6bb77fc1dfe2cd203d9ce957 (diff) | |
Merge "AudioTrack: Add TunerConfiguration.CONTENT_ID_NONE" into sc-dev
| -rw-r--r-- | core/api/system-current.txt | 3 | ||||
| -rw-r--r-- | media/java/android/media/AudioTrack.java | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 3da6add3a04e..a619f5d46ad3 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -5087,9 +5087,10 @@ package android.media { } public static class AudioTrack.TunerConfiguration { - ctor @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public AudioTrack.TunerConfiguration(@IntRange(from=1) int, @IntRange(from=1) int); + ctor @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public AudioTrack.TunerConfiguration(@IntRange(from=0) int, @IntRange(from=1) int); method @IntRange(from=1) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getContentId(); method @IntRange(from=1) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getSyncId(); + field public static final int CONTENT_ID_NONE = 0; // 0x0 } public class HwAudioSource { diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index 04eaf07d7924..88731d25706c 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -929,12 +929,21 @@ public class AudioTrack extends PlayerBase private final int mSyncId; /** + * A special content id for {@link #TunerConfiguration(int, int)} + * indicating audio is delivered + * from an {@code AudioTrack} write, not tunneled from the tuner stack. + */ + public static final int CONTENT_ID_NONE = 0; + + /** * Constructs a TunerConfiguration instance for use in {@link AudioTrack.Builder} * * @param contentId selects the audio stream to use. * The contentId may be obtained from - * {@link android.media.tv.tuner.filter.Filter#getId()}. - * This is always a positive number. + * {@link android.media.tv.tuner.filter.Filter#getId()}, + * such obtained id is always a positive number. + * If audio is to be delivered through an {@code AudioTrack} write + * then {@code CONTENT_ID_NONE} may be used. * @param syncId selects the clock to use for synchronization * of audio with other streams such as video. * The syncId may be obtained from @@ -943,10 +952,10 @@ public class AudioTrack extends PlayerBase */ @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public TunerConfiguration( - @IntRange(from = 1) int contentId, @IntRange(from = 1)int syncId) { - if (contentId < 1) { + @IntRange(from = 0) int contentId, @IntRange(from = 1)int syncId) { + if (contentId < 0) { throw new IllegalArgumentException( - "contentId " + contentId + " must be positive"); + "contentId " + contentId + " must be positive or CONTENT_ID_NONE"); } if (syncId < 1) { throw new IllegalArgumentException("syncId " + syncId + " must be positive"); |