summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorRoboErik <epastern@google.com>2014-07-15 17:23:18 -0700
committerRoboErik <epastern@google.com>2014-07-16 12:03:45 -0700
commit1ff5b1648a051e9650614f0c0f1b3f449777db81 (patch)
treef24d5542c8532a4db1331b1c02c77d76ab6e3948 /media/java
parent8b4bffcac996b4083e720310a09d315ca1c4a000 (diff)
downloadframeworks_base-1ff5b1648a051e9650614f0c0f1b3f449777db81.zip
frameworks_base-1ff5b1648a051e9650614f0c0f1b3f449777db81.tar.gz
frameworks_base-1ff5b1648a051e9650614f0c0f1b3f449777db81.tar.bz2
Change adjustVolumeBy to adjustVolume
This makes volume adjustments take a direction instead of a number of steps and renames the API appropriately. Change-Id: I6a31cbc42d889a38aa63446686a424cb2b8b2270
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaRouter.java4
-rw-r--r--media/java/android/media/VolumeProvider.java15
-rw-r--r--media/java/android/media/session/ISessionCallback.aidl2
-rw-r--r--media/java/android/media/session/ISessionController.aidl2
-rw-r--r--media/java/android/media/session/ISessionManager.aidl2
-rw-r--r--media/java/android/media/session/MediaController.java14
-rw-r--r--media/java/android/media/session/MediaSession.java4
-rw-r--r--media/java/android/media/session/MediaSessionLegacyHelper.java4
-rw-r--r--media/java/android/media/session/MediaSessionManager.java11
9 files changed, 32 insertions, 26 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 3336694..7d1de24 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -2249,12 +2249,12 @@ public class MediaRouter {
}
@Override
- public void onAdjustVolumeBy(final int delta) {
+ public void onAdjustVolume(final int direction) {
sStatic.mHandler.post(new Runnable() {
@Override
public void run() {
if (mVcb != null) {
- mVcb.vcb.onVolumeUpdateRequest(mVcb.route, delta);
+ mVcb.vcb.onVolumeUpdateRequest(mVcb.route, direction);
}
}
});
diff --git a/media/java/android/media/VolumeProvider.java b/media/java/android/media/VolumeProvider.java
index d151e66..9bda1d4 100644
--- a/media/java/android/media/VolumeProvider.java
+++ b/media/java/android/media/VolumeProvider.java
@@ -32,14 +32,14 @@ public abstract class VolumeProvider {
/**
* The volume control uses relative adjustment via
- * {@link #onAdjustVolumeBy(int)}. Attempts to set the volume to a specific
+ * {@link #onAdjustVolume(int)}. Attempts to set the volume to a specific
* value should be ignored.
*/
public static final int VOLUME_CONTROL_RELATIVE = 1;
/**
* The volume control uses an absolute value. It may be adjusted using
- * {@link #onAdjustVolumeBy(int)} or set directly using
+ * {@link #onAdjustVolume(int)} or set directly using
* {@link #onSetVolumeTo(int)}.
*/
public static final int VOLUME_CONTROL_ABSOLUTE = 2;
@@ -104,12 +104,13 @@ public abstract class VolumeProvider {
}
/**
- * Override to handle requests to adjust the volume of the current
- * output.
- *
- * @param delta The amount to change the volume
+ * Override to handle requests to adjust the volume of the current output.
+ * Direction will be one of {@link AudioManager#ADJUST_LOWER},
+ * {@link AudioManager#ADJUST_RAISE}, {@link AudioManager#ADJUST_SAME}.
+ *
+ * @param direction The direction to change the volume in.
*/
- public void onAdjustVolumeBy(int delta) {
+ public void onAdjustVolume(int direction) {
}
/**
diff --git a/media/java/android/media/session/ISessionCallback.aidl b/media/java/android/media/session/ISessionCallback.aidl
index e554e27..39391b6 100644
--- a/media/java/android/media/session/ISessionCallback.aidl
+++ b/media/java/android/media/session/ISessionCallback.aidl
@@ -39,6 +39,6 @@ oneway interface ISessionCallback {
void onRate(in Rating rating);
// These callbacks are for volume handling
- void onAdjustVolumeBy(int delta);
+ void onAdjustVolume(int direction);
void onSetVolumeTo(int value);
}
diff --git a/media/java/android/media/session/ISessionController.aidl b/media/java/android/media/session/ISessionController.aidl
index 6cf5ef2..b555220 100644
--- a/media/java/android/media/session/ISessionController.aidl
+++ b/media/java/android/media/session/ISessionController.aidl
@@ -41,7 +41,7 @@ interface ISessionController {
MediaSessionInfo getSessionInfo();
long getFlags();
ParcelableVolumeInfo getVolumeAttributes();
- void adjustVolumeBy(int delta, int flags);
+ void adjustVolume(int direction, int flags);
void setVolumeTo(int value, int flags);
IMediaRouterDelegate createMediaRouterDelegate(IMediaRouterStateCallback callback);
diff --git a/media/java/android/media/session/ISessionManager.aidl b/media/java/android/media/session/ISessionManager.aidl
index dce84d4..95c2d61 100644
--- a/media/java/android/media/session/ISessionManager.aidl
+++ b/media/java/android/media/session/ISessionManager.aidl
@@ -31,7 +31,7 @@ interface ISessionManager {
ISession createSession(String packageName, in ISessionCallback cb, String tag, int userId);
List<IBinder> getSessions(in ComponentName compName, int userId);
void dispatchMediaKeyEvent(in KeyEvent keyEvent, boolean needWakeLock);
- void dispatchAdjustVolumeBy(int suggestedStream, int delta, int flags);
+ void dispatchAdjustVolume(int suggestedStream, int delta, int flags);
void addSessionsListener(in IActiveSessionsListener listener, in ComponentName compName,
int userId);
void removeSessionsListener(in IActiveSessionsListener listener);
diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java
index ed45a08..7fedd82 100644
--- a/media/java/android/media/session/MediaController.java
+++ b/media/java/android/media/session/MediaController.java
@@ -234,19 +234,21 @@ public final class MediaController {
}
/**
- * Adjust the volume of the stream or output this session is playing on.
- * Negative values will lower the volume. The command will be ignored if it
- * does not support {@link VolumeProvider#VOLUME_CONTROL_RELATIVE} or
+ * Adjust the volume of the stream or output this session is playing on. The
+ * direction must be one of {@link AudioManager#ADJUST_LOWER},
+ * {@link AudioManager#ADJUST_RAISE}, or {@link AudioManager#ADJUST_SAME}.
+ * The command will be ignored if the session does not support
+ * {@link VolumeProvider#VOLUME_CONTROL_RELATIVE} or
* {@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}. The flags in
* {@link AudioManager} may be used to affect the handling.
*
* @see #getVolumeInfo()
- * @param delta The number of steps to adjust the volume by.
+ * @param direction The direction to adjust the volume in.
* @param flags Any flags to pass with the command.
*/
- public void adjustVolumeBy(int delta, int flags) {
+ public void adjustVolume(int direction, int flags) {
try {
- mSessionBinder.adjustVolumeBy(delta, flags);
+ mSessionBinder.adjustVolume(direction, flags);
} catch (RemoteException e) {
Log.wtf(TAG, "Error calling adjustVolumeBy.", e);
}
diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java
index cdb61e1..4841360 100644
--- a/media/java/android/media/session/MediaSession.java
+++ b/media/java/android/media/session/MediaSession.java
@@ -869,11 +869,11 @@ public final class MediaSession {
}
@Override
- public void onAdjustVolumeBy(int delta) {
+ public void onAdjustVolume(int direction) {
MediaSession session = mMediaSession.get();
if (session != null) {
if (session.mVolumeProvider != null) {
- session.mVolumeProvider.onAdjustVolumeBy(delta);
+ session.mVolumeProvider.onAdjustVolume(direction);
}
}
}
diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java
index 5af793f..da1a6ed 100644
--- a/media/java/android/media/session/MediaSessionLegacyHelper.java
+++ b/media/java/android/media/session/MediaSessionLegacyHelper.java
@@ -209,13 +209,13 @@ public class MediaSessionLegacyHelper {
}
}
- mSessionManager.dispatchAdjustVolumeBy(AudioManager.USE_DEFAULT_STREAM_TYPE,
+ mSessionManager.dispatchAdjustVolume(AudioManager.USE_DEFAULT_STREAM_TYPE,
direction, flags);
}
}
public void sendAdjustVolumeBy(int suggestedStream, int delta, int flags) {
- mSessionManager.dispatchAdjustVolumeBy(suggestedStream, delta, flags);
+ mSessionManager.dispatchAdjustVolume(suggestedStream, delta, flags);
if (DEBUG) {
Log.d(TAG, "dispatched volume adjustment");
}
diff --git a/media/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java
index 12013b6..824b397 100644
--- a/media/java/android/media/session/MediaSessionManager.java
+++ b/media/java/android/media/session/MediaSessionManager.java
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
+import android.media.AudioManager;
import android.media.IRemoteVolumeController;
import android.media.session.ISessionManager;
import android.os.IBinder;
@@ -229,17 +230,19 @@ public final class MediaSessionManager {
/**
* Dispatch an adjust volume request to the system. It will be sent to the
- * most relevant audio stream or media session.
+ * most relevant audio stream or media session. The direction must be one of
+ * {@link AudioManager#ADJUST_LOWER}, {@link AudioManager#ADJUST_RAISE},
+ * {@link AudioManager#ADJUST_SAME}.
*
* @param suggestedStream The stream to fall back to if there isn't a
* relevant stream
- * @param delta The amount to adjust the volume by.
+ * @param direction The direction to adjust volume in.
* @param flags Any flags to include with the volume change.
* @hide
*/
- public void dispatchAdjustVolumeBy(int suggestedStream, int delta, int flags) {
+ public void dispatchAdjustVolume(int suggestedStream, int direction, int flags) {
try {
- mService.dispatchAdjustVolumeBy(suggestedStream, delta, flags);
+ mService.dispatchAdjustVolume(suggestedStream, direction, flags);
} catch (RemoteException e) {
Log.e(TAG, "Failed to send adjust volume.", e);
}