summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jean-Michel Trivi <jmtrivi@google.com> 2017-02-04 16:35:25 -0800
committer Jean-Michel Trivi <jmtrivi@google.com> 2017-02-04 16:35:25 -0800
commita690473348c6182fa2f0ef1ef1ba75fec7d7d688 (patch)
treeba758ee9a3f481f999ba57a7b5fba297c4a2d922
parentddb80216b9d536be0f2af287f44a41872aa1d809 (diff)
API for app to know what to set in Activity.setVolumeControlStream()
Stream types are deprecated to describe an audio playback use case. But they are used for volume control. This API helps the developer go from an AudioAttributes instance used for playback, to a stream type used to describe which volume stream type should be used when the user presses on the volume keys. Test: see AudioAttributes cts test Bug 21267880 Change-Id: I2b9da5b282e8ed2342c61c14a7f59b874d0ce979
-rw-r--r--api/current.txt1
-rw-r--r--api/system-current.txt1
-rw-r--r--api/test-current.txt1
-rw-r--r--media/java/android/media/AudioAttributes.java8
4 files changed, 7 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt
index 4f63ff6f2329..4344d385e167 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -20440,6 +20440,7 @@ package android.media {
method public int getContentType();
method public int getFlags();
method public int getUsage();
+ method public static int getVolumeControlStream(android.media.AudioAttributes);
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
diff --git a/api/system-current.txt b/api/system-current.txt
index 03710e6ce034..4d399f2e9eef 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -21996,6 +21996,7 @@ package android.media {
method public int getContentType();
method public int getFlags();
method public int getUsage();
+ method public static int getVolumeControlStream(android.media.AudioAttributes);
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
diff --git a/api/test-current.txt b/api/test-current.txt
index 29d152ae388e..082af17f7956 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -20532,6 +20532,7 @@ package android.media {
method public int getContentType();
method public int getFlags();
method public int getUsage();
+ method public static int getVolumeControlStream(android.media.AudioAttributes);
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
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index 391a905d0419..ce58a9c4b91e 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -913,13 +913,13 @@ public final class AudioAttributes implements Parcelable {
}
}
/**
- * @hide
- * CANDIDATE FOR PUBLIC (or at least SYSTEM) API
* Returns the stream type matching the given attributes for volume control.
* Use this method to derive the stream type needed to configure the volume
- * control slider in an {@link Activity} with {@link Activity#setVolumeControlStream(int)}.
+ * control slider in an {@link android.app.Activity} with
+ * {@link android.app.Activity#setVolumeControlStream(int)}.
* <BR>Do not use this method to set the stream type on an audio player object
- * (e.g. {@link AudioTrack}, {@link MediaPlayer}), use <code>AudioAttributes</code> instead.
+ * (e.g. {@link AudioTrack}, {@link MediaPlayer}) as this is deprecated,
+ * use <code>AudioAttributes</code> instead.
* @param aa non-null AudioAttributes.
* @return a valid stream type for <code>Activity</code> or stream volume control that matches
* the attributes, or {@link AudioManager#USE_DEFAULT_STREAM_TYPE} if there isn't a direct