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
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.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 @@
             "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 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).