From 16f0a6ac2df62a4808fcd48802e6767c8b6819f1 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Sat, 2 Mar 2019 12:24:56 -0800 Subject: [PATCH] Audio APIs: deprecate deprecateStreamTypeForPlayback method The method deprecateStreamTypeForPlayback() is inherited from android.media.PlayerBase, which is hidden. This method was never intended to be in the SDK, but somehow ended up in the public SDK. Bug: 126701135 Bug: 126702126 Bug: 126702177 Test: make -j api-stubs-docs-update-current-api Change-Id: Ibdd7898f18432c2179f81cd53b132164bcd4c670 --- api/current.txt | 6 +++--- media/java/android/media/PlayerBase.java | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 968811d85d310..24893744505c0 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23565,7 +23565,7 @@ package android.media { method @Deprecated public void addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler); method public int attachAuxEffect(int); method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration); - method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException; + method @Deprecated public static void deprecateStreamTypeForPlayback(int, @NonNull String, @NonNull String) throws java.lang.IllegalArgumentException; method protected void finalize(); method public void flush(); method @NonNull public android.media.AudioAttributes getAudioAttributes(); @@ -25319,7 +25319,7 @@ package android.media { method public static android.media.MediaPlayer create(android.content.Context, int); method public static android.media.MediaPlayer create(android.content.Context, int, android.media.AudioAttributes, int); method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration); - method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException; + method @Deprecated public static void deprecateStreamTypeForPlayback(int, @NonNull String, @NonNull String) throws java.lang.IllegalArgumentException; method public void deselectTrack(int) throws java.lang.IllegalStateException; method protected void finalize(); method public int getAudioSessionId(); @@ -26414,7 +26414,7 @@ package android.media { ctor @Deprecated public SoundPool(int, int, int); method public final void autoPause(); method public final void autoResume(); - method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException; + method @Deprecated public static void deprecateStreamTypeForPlayback(int, @NonNull String, @NonNull String) throws java.lang.IllegalArgumentException; method protected void finalize(); method public int load(String, int); method public int load(android.content.Context, int, int); diff --git a/media/java/android/media/PlayerBase.java b/media/java/android/media/PlayerBase.java index 7c6367e8123ac..2b768dd0f46b0 100644 --- a/media/java/android/media/PlayerBase.java +++ b/media/java/android/media/PlayerBase.java @@ -21,8 +21,6 @@ import android.annotation.Nullable; import android.app.ActivityThread; import android.app.AppOpsManager; import android.content.Context; -import android.media.VolumeShaper; -import android.os.Binder; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; @@ -35,7 +33,6 @@ import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IAppOpsCallback; import com.android.internal.app.IAppOpsService; -import java.lang.IllegalArgumentException; import java.lang.ref.WeakReference; import java.util.Objects; @@ -578,9 +575,11 @@ public abstract class PlayerBase { * to qualify audio playback. * @param streamType the stream type to check * @throws IllegalArgumentException + * @deprecated This method is not intended to be used by applications. */ - public static void deprecateStreamTypeForPlayback(int streamType, String className, - String opName) throws IllegalArgumentException { + @java.lang.Deprecated + public static void deprecateStreamTypeForPlayback(int streamType, @NonNull String className, + @NonNull String opName) throws IllegalArgumentException { // STREAM_ACCESSIBILITY was introduced at the same time the use of stream types // for audio playback was deprecated, so it is not allowed at all to qualify a playback // use case