summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-06-11 15:03:52 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-06-18 18:37:17 -0700
commit3114ce3861f20f9a5c2c59dd2629197a1f4874a8 (patch)
treec23f8f5c493fecd904022333cac099451fb20d6b /core/java/android/content
parent4cb3b76caa004867bac43f0001072e24bfa8c120 (diff)
downloadframeworks_base-3114ce3861f20f9a5c2c59dd2629197a1f4874a8.zip
frameworks_base-3114ce3861f20f9a5c2c59dd2629197a1f4874a8.tar.gz
frameworks_base-3114ce3861f20f9a5c2c59dd2629197a1f4874a8.tar.bz2
Remote volume handling
Extend RemoteControlClient class to enable an applicaton to specify more information about how it's playing media, now covering usecases where media playback happens "remotely". This playback information can be used to set the volume and maximum volume used remotely. Declare a new intent and associated extras in Intent, ACTION_VOLUME_UPDATE, so an application can be notified that the volume it handles should be updated. It can then use the new RemoteControlClient.setPlaybackInformation() method to notify AudioService what the volume is. Extend AudioService to maintain playback information associated with the RemoteControlClient information in the stack of media button event receivers (mRCStack). The information about the active remote is cached so the stack doesn't have to be iterated over in order to retrieve remote playback info. Events to "adjust" the remote volume based on hardware key presses cause the client application to be notified of volume updates, and the volume panel to display the volume set by the app. Revise which stream type is controlled when none is specified according to latest guidelines for remote playback. Update VolumePanel class to support a new pseudo stream type, AudioService.STREAM_REMOTE_MUSIC, that corresponds to the remote playback volume, and uses the new "media route" icon. Enable it to receive asynchronously new volume values for the remote that will be displayed if the UI is still up, and ignored otherwise. Now supports hiding/showing sliders dynamically so remote volume only appears when AudioService has a remote control client handling remote volume. Define new java symbols for the two media route icons. Modify lockscreen behavior: don't automatically control music volume when music is active, consider also remote playback. Still to do: - playback information set by RemoteControlClient should post a message for AudioService to update playback information instead of updating it synchronously Change-Id: I557aa687239f9acfe33a609f05876c67fa7eb967
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/Intent.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index edd509b..50972e8 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -27,6 +27,7 @@ import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
+import android.media.RemoteControlClient;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
@@ -2152,6 +2153,19 @@ public class Intent implements Parcelable, Cloneable {
"android.intent.action.USB_AUDIO_DEVICE_PLUG";
/**
+ * @hide (to be un-hidden)
+ * Broadcast Action: the volume handled by the receiver should be updated based on the
+ * mutually exclusive extras, {@link #EXTRA_VOLUME_UPDATE_DIRECTION}
+ * and {@link #EXTRA_VOLUME_UPDATE_VALUE}.
+ *
+ * @see #EXTRA_VOLUME_UPDATE_DIRECTION
+ * @see #EXTRA_VOLUME_UPDATE_VALUE
+ * @see android.media.RemoteControlClient
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_VOLUME_UPDATE = "android.intent.action.VOLUME_UPDATE";
+
+ /**
* <p>Broadcast Action: The user has switched on advanced settings in the settings app:</p>
* <ul>
* <li><em>state</em> - A boolean value indicating whether the settings is on or off.</li>
@@ -2839,6 +2853,27 @@ public class Intent implements Parcelable, Cloneable {
*/
public static final String EXTRA_USERID =
"android.intent.extra.user_id";
+
+ /**
+ * @hide (to be un-hidden)
+ * An integer indicating whether the volume is to be increased (positive value) or decreased
+ * (negative value). For bundled changes, the absolute value indicates the number of changes
+ * in the same direction, e.g. +3 corresponds to three "volume up" changes.
+ * @see #ACTION_VOLUME_UPDATE
+ */
+ public static final String EXTRA_VOLUME_UPDATE_DIRECTION =
+ "android.intent.extra.VOLUME_UPDATE_DIRECTION";
+
+ /**
+ * @hide (to be un-hidden)
+ * An integer indicating the new volume value, always between 0 and the value set for
+ * {@link RemoteControlClient#PLAYBACKINFO_VOLUME_MAX} with
+ * {@link RemoteControlClient#setPlaybackInformation(int, int)}
+ * @see #ACTION_VOLUME_UPDATE
+ */
+ public static final String EXTRA_VOLUME_UPDATE_VALUE =
+ "android.intent.extra.VOLUME_UPDATE_VALUE";
+
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Intent flags (see mFlags variable).