method public int getContentType();
method public int getFlags();
method public int getUsage();
- method public static int getVolumeControlStream(android.media.AudioAttributes);
+ method public static deprecated int getVolumeControlStream(android.media.AudioAttributes);
+ method public int getVolumeControlStream();
method public void writeToParcel(android.os.Parcel, int);
field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
method public int getContentType();
method public int getFlags();
method public int getUsage();
- method public static int getVolumeControlStream(android.media.AudioAttributes);
+ method public static deprecated int getVolumeControlStream(android.media.AudioAttributes);
+ method public int getVolumeControlStream();
method public void writeToParcel(android.os.Parcel, int);
field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
method public int getContentType();
method public int getFlags();
method public int getUsage();
- method public static int getVolumeControlStream(android.media.AudioAttributes);
+ method public static deprecated int getVolumeControlStream(android.media.AudioAttributes);
+ method public int getVolumeControlStream();
method public void writeToParcel(android.os.Parcel, int);
field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
return USAGE_UNKNOWN;
}
}
+
+ // TODO remove, replaced by non-static API getVolumeControlStream()
/**
* Returns the stream type matching the given attributes for volume control.
* Use this method to derive the stream type needed to configure the volume
* the attributes, or {@link AudioManager#USE_DEFAULT_STREAM_TYPE} if there isn't a direct
* match. Note that <code>USE_DEFAULT_STREAM_TYPE</code> is not a valid value
* for {@link AudioManager#setStreamVolume(int, int, int)}.
+ * @deprecated use {@link #getVolumeControlStream()}
*/
public static int getVolumeControlStream(@NonNull AudioAttributes aa) {
if (aa == null) {
}
/**
+ * Returns the stream type matching this {@code AudioAttributes} instance for volume control.
+ * Use this method to derive the stream type needed to configure the volume
+ * control slider in an {@link android.app.Activity} with
+ * {@link android.app.Activity#setVolumeControlStream(int)} for playback conducted with these
+ * attributes.
+ * <BR>Do not use this method to set the stream type on an audio player object
+ * (e.g. {@link AudioTrack}, {@link MediaPlayer}) as this is deprecated,
+ * use {@code AudioAttributes} instead.
+ * @return a valid stream type for {@code Activity} or stream volume control that matches
+ * the attributes, or {@link AudioManager#USE_DEFAULT_STREAM_TYPE} if there isn't a direct
+ * match. Note that {@code USE_DEFAULT_STREAM_TYPE} is not a valid value
+ * for {@link AudioManager#setStreamVolume(int, int, int)}.
+ */
+ public int getVolumeControlStream() {
+ return toVolumeStreamType(true /*fromGetVolumeControlStream*/, this);
+ }
+
+ /**
* @hide
* Only use to get which stream type should be used for volume control, NOT for audio playback
* (all audio playback APIs are supposed to take AudioAttributes as input parameters)