Merge "AudioTrack: Add TunerConfiguration.CONTENT_ID_NONE" am: 1e21d8530b

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1611744

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6df3daaaf31834d5d9eb2084a46f1d9576761be4
This commit is contained in:
Andy Hung
2021-03-02 21:45:38 +00:00
committed by Automerger Merge Worker
2 changed files with 16 additions and 6 deletions

View File

@@ -4309,9 +4309,10 @@ package android.media {
} }
public static class AudioTrack.TunerConfiguration { 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 getContentId();
method @IntRange(from=1) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getSyncId(); 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 { public class HwAudioSource {

View File

@@ -921,13 +921,22 @@ public class AudioTrack extends PlayerBase
private final int mContentId; private final int mContentId;
private final int mSyncId; 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} * Constructs a TunerConfiguration instance for use in {@link AudioTrack.Builder}
* *
* @param contentId selects the audio stream to use. * @param contentId selects the audio stream to use.
* The contentId may be obtained from * The contentId may be obtained from
* {@link android.media.tv.tuner.filter.Filter#getId()}. * {@link android.media.tv.tuner.filter.Filter#getId()},
* This is always a positive number. * 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 * @param syncId selects the clock to use for synchronization
* of audio with other streams such as video. * of audio with other streams such as video.
* The syncId may be obtained from * The syncId may be obtained from
@@ -936,10 +945,10 @@ public class AudioTrack extends PlayerBase
*/ */
@RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
public TunerConfiguration( public TunerConfiguration(
@IntRange(from = 1) int contentId, @IntRange(from = 1)int syncId) { @IntRange(from = 0) int contentId, @IntRange(from = 1)int syncId) {
if (contentId < 1) { if (contentId < 0) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"contentId " + contentId + " must be positive"); "contentId " + contentId + " must be positive or CONTENT_ID_NONE");
} }
if (syncId < 1) { if (syncId < 1) {
throw new IllegalArgumentException("syncId " + syncId + " must be positive"); throw new IllegalArgumentException("syncId " + syncId + " must be positive");