From 6b2394899f6792528de1636c7a6ed5f85c4573ad Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 9 Mar 2018 17:01:44 -0800 Subject: [PATCH] Audio presentation: Docs & Testability fixes Fix some minor issues in JavaDocs. Make some methods visible for tests. No public API changes. Bug: 63901775 Test: cts-tradefed run cts -m CtsMediaTestCases Change-Id: If3e4d0ac0878408cfa552406a011869b9b8c606e --- media/java/android/media/AudioPresentation.java | 17 +++++++++++++---- media/java/android/media/AudioTrack.java | 5 +++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/media/java/android/media/AudioPresentation.java b/media/java/android/media/AudioPresentation.java index 4652c180936c9..e39cb7db34807 100644 --- a/media/java/android/media/AudioPresentation.java +++ b/media/java/android/media/AudioPresentation.java @@ -17,6 +17,9 @@ package android.media; import android.annotation.IntDef; +import android.annotation.NonNull; + +import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -88,10 +91,14 @@ public final class AudioPresentation { */ public static final int MASTERED_FOR_HEADPHONE = 4; - AudioPresentation(int presentationId, + /** + * @hide + */ + @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) + public AudioPresentation(int presentationId, int programId, - Map labels, - String language, + @NonNull Map labels, + @NonNull String language, @MasteringIndicationType int masteringIndication, boolean audioDescriptionAvailable, boolean spokenSubtitlesAvailable, @@ -112,6 +119,7 @@ public final class AudioPresentation { * decoder. Presentation id is typically sequential, but does not have to be. * @hide */ + @VisibleForTesting public int getPresentationId() { return mPresentationId; } @@ -121,13 +129,14 @@ public final class AudioPresentation { * Program id can be used to further uniquely identify the presentation to a decoder. * @hide */ + @VisibleForTesting public int getProgramId() { return mProgramId; } /** * @return a map of available text labels for this presentation. Each label is indexed by its - * locale corresponding to the language code as specified by ISO 639-2 [42]. Either ISO 639-2/B + * locale corresponding to the language code as specified by ISO 639-2. Either ISO 639-2/B * or ISO 639-2/T could be used. */ public Map getLabels() { diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index 2d5fad5dde5b1..9c48e09ea3991 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -2012,9 +2012,10 @@ public class AudioTrack extends PlayerBase * If the audio presentation is invalid then {@link #ERROR_BAD_VALUE} will be returned. * If a multi-stream decoder (MSD) is not present, or the format does not support * multiple presentations, then {@link #ERROR_INVALID_OPERATION} will be returned. + * {@link #ERROR} is returned in case of any other error. * @param presentation see {@link AudioPresentation}. In particular, id should be set. - * @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE}, - * {@link #ERROR_INVALID_OPERATION} + * @return error code or success, see {@link #SUCCESS}, {@link #ERROR}, + * {@link #ERROR_BAD_VALUE}, {@link #ERROR_INVALID_OPERATION} * @throws IllegalArgumentException if the audio presentation is null. * @throws IllegalStateException if track is not initialized. */