Loading api/current.txt +25 −14 Original line number Diff line number Diff line Loading @@ -15358,6 +15358,19 @@ package android.media { ctor public UnsupportedSchemeException(java.lang.String); } public abstract class VolumeProvider { ctor public VolumeProvider(int, int); method public final int getMaxVolume(); method public final int getVolumeControl(); method public final void notifyVolumeChanged(); method public void onAdjustVolumeBy(int); method public abstract int onGetCurrentVolume(); method public void onSetVolumeTo(int); field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2 field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0 field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1 } } package android.media.audiofx { Loading Loading @@ -15724,6 +15737,7 @@ package android.media.session { method public android.media.session.PlaybackState getPlaybackState(); method public int getRatingType(); method public android.media.session.MediaController.TransportControls getTransportControls(); method public android.media.session.MediaController.VolumeInfo getVolumeInfo(); method public void removeCallback(android.media.session.MediaController.Callback); method public void sendControlCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver); } Loading @@ -15747,6 +15761,14 @@ package android.media.session { method public void stop(); } public static final class MediaController.VolumeInfo { method public int getAudioStream(); method public int getCurrentVolume(); method public int getMaxVolume(); method public int getVolumeControl(); method public int getVolumeType(); } public final class MediaSession { method public void addCallback(android.media.session.MediaSession.Callback); method public void addCallback(android.media.session.MediaSession.Callback, android.os.Handler); Loading @@ -15764,9 +15786,11 @@ package android.media.session { method public void setMetadata(android.media.MediaMetadata); method public void setPlaybackState(android.media.session.PlaybackState); method public void setPlaybackToLocal(int); method public void setPlaybackToRemote(android.media.session.RemoteVolumeProvider); method public void setPlaybackToRemote(android.media.VolumeProvider); field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1 field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2 field public static final int VOLUME_TYPE_LOCAL = 1; // 0x1 field public static final int VOLUME_TYPE_REMOTE = 2; // 0x2 } public static abstract class MediaSession.Callback { Loading Loading @@ -15837,19 +15861,6 @@ package android.media.session { field public static final int STATE_STOPPED = 1; // 0x1 } public abstract class RemoteVolumeProvider { ctor public RemoteVolumeProvider(int, int); method public final int getMaxVolume(); method public final int getVolumeControl(); method public final void notifyVolumeChanged(); method public void onAdjustVolumeBy(int); method public abstract int onGetCurrentVolume(); method public void onSetVolumeTo(int); field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2 field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0 field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1 } } package android.media.tv { media/java/android/media/MediaRouter.java +3 −4 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.hardware.display.DisplayManager; import android.hardware.display.WifiDisplay; import android.hardware.display.WifiDisplayStatus; import android.media.session.MediaSession; import android.media.session.RemoteVolumeProvider; import android.os.Handler; import android.os.IBinder; import android.os.Process; Loading Loading @@ -2204,10 +2203,10 @@ public class MediaRouter { return; } if (mPlaybackType == RemoteControlClient.PLAYBACK_TYPE_REMOTE) { int volumeControl = RemoteVolumeProvider.VOLUME_CONTROL_FIXED; int volumeControl = VolumeProvider.VOLUME_CONTROL_FIXED; switch (mVolumeHandling) { case RemoteControlClient.PLAYBACK_VOLUME_VARIABLE: volumeControl = RemoteVolumeProvider.VOLUME_CONTROL_ABSOLUTE; volumeControl = VolumeProvider.VOLUME_CONTROL_ABSOLUTE; break; case RemoteControlClient.PLAYBACK_VOLUME_FIXED: default: Loading @@ -2226,7 +2225,7 @@ public class MediaRouter { } } class SessionVolumeProvider extends RemoteVolumeProvider { class SessionVolumeProvider extends VolumeProvider { public SessionVolumeProvider(int volumeControl, int maxVolume) { super(volumeControl, maxVolume); Loading media/java/android/media/session/RemoteVolumeProvider.java→media/java/android/media/VolumeProvider.java +6 −5 Original line number Diff line number Diff line Loading @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package android.media.session; package android.media; import android.media.session.MediaSession; import android.os.RemoteException; import android.util.Log; Loading @@ -24,8 +25,8 @@ import android.util.Log; * You can set a volume provider on a session by calling * {@link MediaSession#setPlaybackToRemote}. */ public abstract class RemoteVolumeProvider { private static final String TAG = "RemoteVolumeProvider"; public abstract class VolumeProvider { private static final String TAG = "VolumeProvider"; /** * The volume is fixed and can not be modified. Requests to change volume Loading Loading @@ -60,7 +61,7 @@ public abstract class RemoteVolumeProvider { * this provider. * @param maxVolume The maximum allowed volume. */ public RemoteVolumeProvider(int volumeControl, int maxVolume) { public VolumeProvider(int volumeControl, int maxVolume) { mControlType = volumeControl; mMaxVolume = maxVolume; } Loading Loading @@ -117,7 +118,7 @@ public abstract class RemoteVolumeProvider { /** * @hide */ void setSession(MediaSession session) { public void setSession(MediaSession session) { mSession = session; } } No newline at end of file media/java/android/media/session/ISessionController.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.media.MediaMetadata; import android.media.Rating; import android.media.session.ISessionControllerCallback; import android.media.session.MediaSessionInfo; import android.media.session.ParcelableVolumeInfo; import android.media.session.PlaybackState; import android.os.Bundle; import android.os.ResultReceiver; Loading @@ -38,6 +39,9 @@ interface ISessionController { void showRoutePicker(); MediaSessionInfo getSessionInfo(); long getFlags(); ParcelableVolumeInfo getVolumeAttributes(); void adjustVolumeBy(int delta, int flags); void setVolumeTo(int value, int flags); // These commands are for the TransportController void play(); Loading media/java/android/media/session/MediaController.java +97 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.media.session; import android.media.MediaMetadata; import android.media.Rating; import android.media.VolumeProvider; import android.os.Bundle; import android.os.Handler; import android.os.Looper; Loading Loading @@ -182,6 +183,23 @@ public final class MediaController { return 0; } /** * Get the current volume info for this session. * * @return The current volume info or null. */ public VolumeInfo getVolumeInfo() { try { ParcelableVolumeInfo result = mSessionBinder.getVolumeAttributes(); return new VolumeInfo(result.volumeType, result.audioStream, result.controlType, result.maxVolume, result.currentVolume); } catch (RemoteException e) { Log.wtf(TAG, "Error calling getVolumeInfo.", e); } return null; } /** * Adds a callback to receive updates from the Session. Updates will be * posted on the caller's thread. Loading Loading @@ -509,6 +527,85 @@ public final class MediaController { } } /** * Holds information about the way volume is handled for this session. */ public static final class VolumeInfo { private final int mVolumeType; private final int mAudioStream; private final int mVolumeControl; private final int mMaxVolume; private final int mCurrentVolume; /** * @hide */ public VolumeInfo(int type, int stream, int control, int max, int current) { mVolumeType = type; mAudioStream = stream; mVolumeControl = control; mMaxVolume = max; mCurrentVolume = current; } /** * Get the type of volume handling, either local or remote. One of: * <ul> * <li>{@link MediaSession#VOLUME_TYPE_LOCAL}</li> * <li>{@link MediaSession#VOLUME_TYPE_REMOTE}</li> * </ul> * * @return The type of volume handling this session is using. */ public int getVolumeType() { return mVolumeType; } /** * Get the stream this is currently controlling volume on. When the volume * type is {@link MediaSession#VOLUME_TYPE_REMOTE} this value does not * have meaning and should be ignored. * * @return The stream this session is playing on. */ public int getAudioStream() { return mAudioStream; } /** * Get the type of volume control that can be used. One of: * <ul> * <li>{@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}</li> * <li>{@link VolumeProvider#VOLUME_CONTROL_RELATIVE}</li> * <li>{@link VolumeProvider#VOLUME_CONTROL_FIXED}</li> * </ul> * * @return The type of volume control that may be used with this * session. */ public int getVolumeControl() { return mVolumeControl; } /** * Get the maximum volume that may be set for this session. * * @return The maximum allowed volume where this session is playing. */ public int getMaxVolume() { return mMaxVolume; } /** * Get the current volume for this session. * * @return The current volume where this session is playing. */ public int getCurrentVolume() { return mCurrentVolume; } } private final static class CallbackStub extends ISessionControllerCallback.Stub { private final WeakReference<MediaController> mController; Loading Loading
api/current.txt +25 −14 Original line number Diff line number Diff line Loading @@ -15358,6 +15358,19 @@ package android.media { ctor public UnsupportedSchemeException(java.lang.String); } public abstract class VolumeProvider { ctor public VolumeProvider(int, int); method public final int getMaxVolume(); method public final int getVolumeControl(); method public final void notifyVolumeChanged(); method public void onAdjustVolumeBy(int); method public abstract int onGetCurrentVolume(); method public void onSetVolumeTo(int); field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2 field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0 field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1 } } package android.media.audiofx { Loading Loading @@ -15724,6 +15737,7 @@ package android.media.session { method public android.media.session.PlaybackState getPlaybackState(); method public int getRatingType(); method public android.media.session.MediaController.TransportControls getTransportControls(); method public android.media.session.MediaController.VolumeInfo getVolumeInfo(); method public void removeCallback(android.media.session.MediaController.Callback); method public void sendControlCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver); } Loading @@ -15747,6 +15761,14 @@ package android.media.session { method public void stop(); } public static final class MediaController.VolumeInfo { method public int getAudioStream(); method public int getCurrentVolume(); method public int getMaxVolume(); method public int getVolumeControl(); method public int getVolumeType(); } public final class MediaSession { method public void addCallback(android.media.session.MediaSession.Callback); method public void addCallback(android.media.session.MediaSession.Callback, android.os.Handler); Loading @@ -15764,9 +15786,11 @@ package android.media.session { method public void setMetadata(android.media.MediaMetadata); method public void setPlaybackState(android.media.session.PlaybackState); method public void setPlaybackToLocal(int); method public void setPlaybackToRemote(android.media.session.RemoteVolumeProvider); method public void setPlaybackToRemote(android.media.VolumeProvider); field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1 field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2 field public static final int VOLUME_TYPE_LOCAL = 1; // 0x1 field public static final int VOLUME_TYPE_REMOTE = 2; // 0x2 } public static abstract class MediaSession.Callback { Loading Loading @@ -15837,19 +15861,6 @@ package android.media.session { field public static final int STATE_STOPPED = 1; // 0x1 } public abstract class RemoteVolumeProvider { ctor public RemoteVolumeProvider(int, int); method public final int getMaxVolume(); method public final int getVolumeControl(); method public final void notifyVolumeChanged(); method public void onAdjustVolumeBy(int); method public abstract int onGetCurrentVolume(); method public void onSetVolumeTo(int); field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2 field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0 field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1 } } package android.media.tv {
media/java/android/media/MediaRouter.java +3 −4 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.hardware.display.DisplayManager; import android.hardware.display.WifiDisplay; import android.hardware.display.WifiDisplayStatus; import android.media.session.MediaSession; import android.media.session.RemoteVolumeProvider; import android.os.Handler; import android.os.IBinder; import android.os.Process; Loading Loading @@ -2204,10 +2203,10 @@ public class MediaRouter { return; } if (mPlaybackType == RemoteControlClient.PLAYBACK_TYPE_REMOTE) { int volumeControl = RemoteVolumeProvider.VOLUME_CONTROL_FIXED; int volumeControl = VolumeProvider.VOLUME_CONTROL_FIXED; switch (mVolumeHandling) { case RemoteControlClient.PLAYBACK_VOLUME_VARIABLE: volumeControl = RemoteVolumeProvider.VOLUME_CONTROL_ABSOLUTE; volumeControl = VolumeProvider.VOLUME_CONTROL_ABSOLUTE; break; case RemoteControlClient.PLAYBACK_VOLUME_FIXED: default: Loading @@ -2226,7 +2225,7 @@ public class MediaRouter { } } class SessionVolumeProvider extends RemoteVolumeProvider { class SessionVolumeProvider extends VolumeProvider { public SessionVolumeProvider(int volumeControl, int maxVolume) { super(volumeControl, maxVolume); Loading
media/java/android/media/session/RemoteVolumeProvider.java→media/java/android/media/VolumeProvider.java +6 −5 Original line number Diff line number Diff line Loading @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package android.media.session; package android.media; import android.media.session.MediaSession; import android.os.RemoteException; import android.util.Log; Loading @@ -24,8 +25,8 @@ import android.util.Log; * You can set a volume provider on a session by calling * {@link MediaSession#setPlaybackToRemote}. */ public abstract class RemoteVolumeProvider { private static final String TAG = "RemoteVolumeProvider"; public abstract class VolumeProvider { private static final String TAG = "VolumeProvider"; /** * The volume is fixed and can not be modified. Requests to change volume Loading Loading @@ -60,7 +61,7 @@ public abstract class RemoteVolumeProvider { * this provider. * @param maxVolume The maximum allowed volume. */ public RemoteVolumeProvider(int volumeControl, int maxVolume) { public VolumeProvider(int volumeControl, int maxVolume) { mControlType = volumeControl; mMaxVolume = maxVolume; } Loading Loading @@ -117,7 +118,7 @@ public abstract class RemoteVolumeProvider { /** * @hide */ void setSession(MediaSession session) { public void setSession(MediaSession session) { mSession = session; } } No newline at end of file
media/java/android/media/session/ISessionController.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.media.MediaMetadata; import android.media.Rating; import android.media.session.ISessionControllerCallback; import android.media.session.MediaSessionInfo; import android.media.session.ParcelableVolumeInfo; import android.media.session.PlaybackState; import android.os.Bundle; import android.os.ResultReceiver; Loading @@ -38,6 +39,9 @@ interface ISessionController { void showRoutePicker(); MediaSessionInfo getSessionInfo(); long getFlags(); ParcelableVolumeInfo getVolumeAttributes(); void adjustVolumeBy(int delta, int flags); void setVolumeTo(int value, int flags); // These commands are for the TransportController void play(); Loading
media/java/android/media/session/MediaController.java +97 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.media.session; import android.media.MediaMetadata; import android.media.Rating; import android.media.VolumeProvider; import android.os.Bundle; import android.os.Handler; import android.os.Looper; Loading Loading @@ -182,6 +183,23 @@ public final class MediaController { return 0; } /** * Get the current volume info for this session. * * @return The current volume info or null. */ public VolumeInfo getVolumeInfo() { try { ParcelableVolumeInfo result = mSessionBinder.getVolumeAttributes(); return new VolumeInfo(result.volumeType, result.audioStream, result.controlType, result.maxVolume, result.currentVolume); } catch (RemoteException e) { Log.wtf(TAG, "Error calling getVolumeInfo.", e); } return null; } /** * Adds a callback to receive updates from the Session. Updates will be * posted on the caller's thread. Loading Loading @@ -509,6 +527,85 @@ public final class MediaController { } } /** * Holds information about the way volume is handled for this session. */ public static final class VolumeInfo { private final int mVolumeType; private final int mAudioStream; private final int mVolumeControl; private final int mMaxVolume; private final int mCurrentVolume; /** * @hide */ public VolumeInfo(int type, int stream, int control, int max, int current) { mVolumeType = type; mAudioStream = stream; mVolumeControl = control; mMaxVolume = max; mCurrentVolume = current; } /** * Get the type of volume handling, either local or remote. One of: * <ul> * <li>{@link MediaSession#VOLUME_TYPE_LOCAL}</li> * <li>{@link MediaSession#VOLUME_TYPE_REMOTE}</li> * </ul> * * @return The type of volume handling this session is using. */ public int getVolumeType() { return mVolumeType; } /** * Get the stream this is currently controlling volume on. When the volume * type is {@link MediaSession#VOLUME_TYPE_REMOTE} this value does not * have meaning and should be ignored. * * @return The stream this session is playing on. */ public int getAudioStream() { return mAudioStream; } /** * Get the type of volume control that can be used. One of: * <ul> * <li>{@link VolumeProvider#VOLUME_CONTROL_ABSOLUTE}</li> * <li>{@link VolumeProvider#VOLUME_CONTROL_RELATIVE}</li> * <li>{@link VolumeProvider#VOLUME_CONTROL_FIXED}</li> * </ul> * * @return The type of volume control that may be used with this * session. */ public int getVolumeControl() { return mVolumeControl; } /** * Get the maximum volume that may be set for this session. * * @return The maximum allowed volume where this session is playing. */ public int getMaxVolume() { return mMaxVolume; } /** * Get the current volume for this session. * * @return The current volume where this session is playing. */ public int getCurrentVolume() { return mCurrentVolume; } } private final static class CallbackStub extends ISessionControllerCallback.Stub { private final WeakReference<MediaController> mController; Loading