Merge "Revert "MediaSession: Add methods for setting shuffle and repeat modes"" into oc-dev
This commit is contained in:
@@ -24265,11 +24265,9 @@ package android.media.session {
|
||||
method public java.util.List<android.media.session.MediaSession.QueueItem> getQueue();
|
||||
method public java.lang.CharSequence getQueueTitle();
|
||||
method public int getRatingType();
|
||||
method public int getRepeatMode();
|
||||
method public android.app.PendingIntent getSessionActivity();
|
||||
method public android.media.session.MediaSession.Token getSessionToken();
|
||||
method public android.media.session.MediaController.TransportControls getTransportControls();
|
||||
method public boolean isShuffleModeEnabled();
|
||||
method public void registerCallback(android.media.session.MediaController.Callback);
|
||||
method public void registerCallback(android.media.session.MediaController.Callback, android.os.Handler);
|
||||
method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
|
||||
@@ -24285,10 +24283,8 @@ package android.media.session {
|
||||
method public void onPlaybackStateChanged(android.media.session.PlaybackState);
|
||||
method public void onQueueChanged(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void onQueueTitleChanged(java.lang.CharSequence);
|
||||
method public void onRepeatModeChanged(int);
|
||||
method public void onSessionDestroyed();
|
||||
method public void onSessionEvent(java.lang.String, android.os.Bundle);
|
||||
method public void onShuffleModeChanged(boolean);
|
||||
}
|
||||
|
||||
public static final class MediaController.PlaybackInfo {
|
||||
@@ -24317,8 +24313,6 @@ package android.media.session {
|
||||
method public void sendCustomAction(android.media.session.PlaybackState.CustomAction, android.os.Bundle);
|
||||
method public void sendCustomAction(java.lang.String, android.os.Bundle);
|
||||
method public void setRating(android.media.Rating);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
method public void skipToNext();
|
||||
method public void skipToPrevious();
|
||||
method public void skipToQueueItem(long);
|
||||
@@ -24345,9 +24339,7 @@ package android.media.session {
|
||||
method public void setQueue(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void setQueueTitle(java.lang.CharSequence);
|
||||
method public void setRatingType(int);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setSessionActivity(android.app.PendingIntent);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
field public static final deprecated int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
|
||||
field public static final deprecated int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
|
||||
}
|
||||
@@ -24370,8 +24362,6 @@ package android.media.session {
|
||||
method public void onRewind();
|
||||
method public void onSeekTo(long);
|
||||
method public void onSetRating(android.media.Rating);
|
||||
method public void onSetRepeatMode(int);
|
||||
method public void onSetShuffleModeEnabled(boolean);
|
||||
method public void onSkipToNext();
|
||||
method public void onSkipToPrevious();
|
||||
method public void onSkipToQueueItem(long);
|
||||
@@ -24432,17 +24422,12 @@ package android.media.session {
|
||||
field public static final long ACTION_REWIND = 8L; // 0x8L
|
||||
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
|
||||
field public static final long ACTION_SET_RATING = 128L; // 0x80L
|
||||
field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
|
||||
field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
|
||||
field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
|
||||
field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
|
||||
field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
|
||||
field public static final long ACTION_STOP = 1L; // 0x1L
|
||||
field public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
|
||||
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
|
||||
field public static final int REPEAT_MODE_ALL = 2; // 0x2
|
||||
field public static final int REPEAT_MODE_NONE = 0; // 0x0
|
||||
field public static final int REPEAT_MODE_ONE = 1; // 0x1
|
||||
field public static final int STATE_BUFFERING = 6; // 0x6
|
||||
field public static final int STATE_CONNECTING = 8; // 0x8
|
||||
field public static final int STATE_ERROR = 7; // 0x7
|
||||
|
||||
@@ -26187,11 +26187,9 @@ package android.media.session {
|
||||
method public java.util.List<android.media.session.MediaSession.QueueItem> getQueue();
|
||||
method public java.lang.CharSequence getQueueTitle();
|
||||
method public int getRatingType();
|
||||
method public int getRepeatMode();
|
||||
method public android.app.PendingIntent getSessionActivity();
|
||||
method public android.media.session.MediaSession.Token getSessionToken();
|
||||
method public android.media.session.MediaController.TransportControls getTransportControls();
|
||||
method public boolean isShuffleModeEnabled();
|
||||
method public void registerCallback(android.media.session.MediaController.Callback);
|
||||
method public void registerCallback(android.media.session.MediaController.Callback, android.os.Handler);
|
||||
method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
|
||||
@@ -26207,10 +26205,8 @@ package android.media.session {
|
||||
method public void onPlaybackStateChanged(android.media.session.PlaybackState);
|
||||
method public void onQueueChanged(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void onQueueTitleChanged(java.lang.CharSequence);
|
||||
method public void onRepeatModeChanged(int);
|
||||
method public void onSessionDestroyed();
|
||||
method public void onSessionEvent(java.lang.String, android.os.Bundle);
|
||||
method public void onShuffleModeChanged(boolean);
|
||||
}
|
||||
|
||||
public static final class MediaController.PlaybackInfo {
|
||||
@@ -26239,8 +26235,6 @@ package android.media.session {
|
||||
method public void sendCustomAction(android.media.session.PlaybackState.CustomAction, android.os.Bundle);
|
||||
method public void sendCustomAction(java.lang.String, android.os.Bundle);
|
||||
method public void setRating(android.media.Rating);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
method public void skipToNext();
|
||||
method public void skipToPrevious();
|
||||
method public void skipToQueueItem(long);
|
||||
@@ -26267,9 +26261,7 @@ package android.media.session {
|
||||
method public void setQueue(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void setQueueTitle(java.lang.CharSequence);
|
||||
method public void setRatingType(int);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setSessionActivity(android.app.PendingIntent);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
field public static final deprecated int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
|
||||
field public static final deprecated int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
|
||||
}
|
||||
@@ -26292,8 +26284,6 @@ package android.media.session {
|
||||
method public void onRewind();
|
||||
method public void onSeekTo(long);
|
||||
method public void onSetRating(android.media.Rating);
|
||||
method public void onSetRepeatMode(int);
|
||||
method public void onSetShuffleModeEnabled(boolean);
|
||||
method public void onSkipToNext();
|
||||
method public void onSkipToPrevious();
|
||||
method public void onSkipToQueueItem(long);
|
||||
@@ -26364,17 +26354,12 @@ package android.media.session {
|
||||
field public static final long ACTION_REWIND = 8L; // 0x8L
|
||||
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
|
||||
field public static final long ACTION_SET_RATING = 128L; // 0x80L
|
||||
field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
|
||||
field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
|
||||
field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
|
||||
field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
|
||||
field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
|
||||
field public static final long ACTION_STOP = 1L; // 0x1L
|
||||
field public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
|
||||
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
|
||||
field public static final int REPEAT_MODE_ALL = 2; // 0x2
|
||||
field public static final int REPEAT_MODE_NONE = 0; // 0x0
|
||||
field public static final int REPEAT_MODE_ONE = 1; // 0x1
|
||||
field public static final int STATE_BUFFERING = 6; // 0x6
|
||||
field public static final int STATE_CONNECTING = 8; // 0x8
|
||||
field public static final int STATE_ERROR = 7; // 0x7
|
||||
|
||||
@@ -24372,11 +24372,9 @@ package android.media.session {
|
||||
method public java.util.List<android.media.session.MediaSession.QueueItem> getQueue();
|
||||
method public java.lang.CharSequence getQueueTitle();
|
||||
method public int getRatingType();
|
||||
method public int getRepeatMode();
|
||||
method public android.app.PendingIntent getSessionActivity();
|
||||
method public android.media.session.MediaSession.Token getSessionToken();
|
||||
method public android.media.session.MediaController.TransportControls getTransportControls();
|
||||
method public boolean isShuffleModeEnabled();
|
||||
method public void registerCallback(android.media.session.MediaController.Callback);
|
||||
method public void registerCallback(android.media.session.MediaController.Callback, android.os.Handler);
|
||||
method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
|
||||
@@ -24392,10 +24390,8 @@ package android.media.session {
|
||||
method public void onPlaybackStateChanged(android.media.session.PlaybackState);
|
||||
method public void onQueueChanged(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void onQueueTitleChanged(java.lang.CharSequence);
|
||||
method public void onRepeatModeChanged(int);
|
||||
method public void onSessionDestroyed();
|
||||
method public void onSessionEvent(java.lang.String, android.os.Bundle);
|
||||
method public void onShuffleModeChanged(boolean);
|
||||
}
|
||||
|
||||
public static final class MediaController.PlaybackInfo {
|
||||
@@ -24424,8 +24420,6 @@ package android.media.session {
|
||||
method public void sendCustomAction(android.media.session.PlaybackState.CustomAction, android.os.Bundle);
|
||||
method public void sendCustomAction(java.lang.String, android.os.Bundle);
|
||||
method public void setRating(android.media.Rating);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
method public void skipToNext();
|
||||
method public void skipToPrevious();
|
||||
method public void skipToQueueItem(long);
|
||||
@@ -24452,9 +24446,7 @@ package android.media.session {
|
||||
method public void setQueue(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||
method public void setQueueTitle(java.lang.CharSequence);
|
||||
method public void setRatingType(int);
|
||||
method public void setRepeatMode(int);
|
||||
method public void setSessionActivity(android.app.PendingIntent);
|
||||
method public void setShuffleModeEnabled(boolean);
|
||||
field public static final deprecated int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
|
||||
field public static final deprecated int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
|
||||
}
|
||||
@@ -24477,8 +24469,6 @@ package android.media.session {
|
||||
method public void onRewind();
|
||||
method public void onSeekTo(long);
|
||||
method public void onSetRating(android.media.Rating);
|
||||
method public void onSetRepeatMode(int);
|
||||
method public void onSetShuffleModeEnabled(boolean);
|
||||
method public void onSkipToNext();
|
||||
method public void onSkipToPrevious();
|
||||
method public void onSkipToQueueItem(long);
|
||||
@@ -24539,17 +24529,12 @@ package android.media.session {
|
||||
field public static final long ACTION_REWIND = 8L; // 0x8L
|
||||
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
|
||||
field public static final long ACTION_SET_RATING = 128L; // 0x80L
|
||||
field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
|
||||
field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
|
||||
field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
|
||||
field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
|
||||
field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
|
||||
field public static final long ACTION_STOP = 1L; // 0x1L
|
||||
field public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
|
||||
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
|
||||
field public static final int REPEAT_MODE_ALL = 2; // 0x2
|
||||
field public static final int REPEAT_MODE_NONE = 0; // 0x0
|
||||
field public static final int REPEAT_MODE_ONE = 1; // 0x1
|
||||
field public static final int STATE_BUFFERING = 6; // 0x6
|
||||
field public static final int STATE_CONNECTING = 8; // 0x8
|
||||
field public static final int STATE_ERROR = 7; // 0x7
|
||||
|
||||
@@ -228,16 +228,6 @@ public class Media extends BaseCommand {
|
||||
System.out.println("onVolumeInfoChanged " + info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeatModeChanged(int repeatMode) throws RemoteException {
|
||||
System.out.println("onRepeatModeChanged " + repeatMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShuffleModeChanged(boolean enabled) throws RemoteException {
|
||||
System.out.println("onShuffleModeChanged " + enabled);
|
||||
}
|
||||
|
||||
void printUsageMessage() {
|
||||
try {
|
||||
System.out.println("V2Monitoring session " + mController.getTag()
|
||||
|
||||
@@ -45,8 +45,6 @@ interface ISession {
|
||||
void setQueueTitle(CharSequence title);
|
||||
void setExtras(in Bundle extras);
|
||||
void setRatingType(int type);
|
||||
void setRepeatMode(int repeatMode);
|
||||
void setShuffleModeEnabled(boolean enabled);
|
||||
|
||||
// These commands relate to volume handling
|
||||
void setPlaybackToLocal(in AudioAttributes attributes);
|
||||
|
||||
@@ -46,8 +46,6 @@ oneway interface ISessionCallback {
|
||||
void onRewind();
|
||||
void onSeekTo(long pos);
|
||||
void onRate(in Rating rating);
|
||||
void onRepeatMode(int repeatMode);
|
||||
void onShuffleMode(boolean enabled);
|
||||
void onCustomAction(String action, in Bundle args);
|
||||
|
||||
// These callbacks are for volume handling
|
||||
|
||||
@@ -48,14 +48,6 @@ interface ISessionController {
|
||||
ParcelableVolumeInfo getVolumeAttributes();
|
||||
void adjustVolume(int direction, int flags, String packageName);
|
||||
void setVolumeTo(int value, int flags, String packageName);
|
||||
MediaMetadata getMetadata();
|
||||
PlaybackState getPlaybackState();
|
||||
ParceledListSlice getQueue();
|
||||
CharSequence getQueueTitle();
|
||||
Bundle getExtras();
|
||||
int getRatingType();
|
||||
int getRepeatMode();
|
||||
boolean isShuffleModeEnabled();
|
||||
|
||||
// These commands are for the TransportControls
|
||||
void prepare();
|
||||
@@ -75,7 +67,11 @@ interface ISessionController {
|
||||
void rewind();
|
||||
void seekTo(long pos);
|
||||
void rate(in Rating rating);
|
||||
void repeatMode(int repeatMode);
|
||||
void shuffleMode(boolean enabled);
|
||||
void sendCustomAction(String action, in Bundle args);
|
||||
MediaMetadata getMetadata();
|
||||
PlaybackState getPlaybackState();
|
||||
ParceledListSlice getQueue();
|
||||
CharSequence getQueueTitle();
|
||||
Bundle getExtras();
|
||||
int getRatingType();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,4 @@ oneway interface ISessionControllerCallback {
|
||||
void onQueueTitleChanged(CharSequence title);
|
||||
void onExtrasChanged(in Bundle extras);
|
||||
void onVolumeInfoChanged(in ParcelableVolumeInfo info);
|
||||
void onRepeatModeChanged(int repeatMode);
|
||||
void onShuffleModeChanged(boolean shuffleMode);
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ public final class MediaController {
|
||||
private static final int MSG_UPDATE_QUEUE = 5;
|
||||
private static final int MSG_UPDATE_QUEUE_TITLE = 6;
|
||||
private static final int MSG_UPDATE_EXTRAS = 7;
|
||||
private static final int MSG_UPDATE_REPEAT_MODE = 8;
|
||||
private static final int MSG_UPDATE_SHUFFLE_MODE = 9;
|
||||
private static final int MSG_DESTROYED = 10;
|
||||
private static final int MSG_DESTROYED = 8;
|
||||
|
||||
private final ISessionController mSessionBinder;
|
||||
|
||||
@@ -235,35 +233,6 @@ public final class MediaController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the repeat mode for this session.
|
||||
*
|
||||
* @return The latest repeat mode set to the session, or
|
||||
* {@link PlaybackState#REPEAT_MODE_NONE} if not set.
|
||||
*/
|
||||
public int getRepeatMode() {
|
||||
try {
|
||||
return mSessionBinder.getRepeatMode();
|
||||
} catch (RemoteException e) {
|
||||
Log.wtf(TAG, "Error calling getRepeatMode.", e);
|
||||
return PlaybackState.REPEAT_MODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the shuffle mode is enabled for this session.
|
||||
*
|
||||
* @return {@code true} if the shuffle mode is enabled, {@code false} if disabled or not set.
|
||||
*/
|
||||
public boolean isShuffleModeEnabled() {
|
||||
try {
|
||||
return mSessionBinder.isShuffleModeEnabled();
|
||||
} catch (RemoteException e) {
|
||||
Log.wtf(TAG, "Error calling isShuffleModeEnabled.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flags for this session. Flags are defined in {@link MediaSession}.
|
||||
*
|
||||
@@ -610,25 +579,6 @@ public final class MediaController {
|
||||
*/
|
||||
public void onAudioInfoChanged(PlaybackInfo info) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to handle changes to the repeat mode.
|
||||
*
|
||||
* @param repeatMode The repeat mode. It should be one of followings:
|
||||
* {@link PlaybackState#REPEAT_MODE_NONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ALL}
|
||||
*/
|
||||
public void onRepeatModeChanged(@PlaybackState.RepeatMode int repeatMode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to handle changes to the shuffle mode.
|
||||
*
|
||||
* @param enabled {@code true} if the shuffle mode is enabled, {@code false} otherwise.
|
||||
*/
|
||||
public void onShuffleModeChanged(boolean enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,35 +861,6 @@ public final class MediaController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repeat mode for this session.
|
||||
*
|
||||
* @param repeatMode The repeat mode. Must be one of the followings:
|
||||
* {@link PlaybackState#REPEAT_MODE_NONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ALL}
|
||||
*/
|
||||
public void setRepeatMode(@PlaybackState.RepeatMode int repeatMode) {
|
||||
try {
|
||||
mSessionBinder.repeatMode(repeatMode);
|
||||
} catch (RemoteException e) {
|
||||
Log.wtf(TAG, "Error calling setRepeatMode.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the shuffle mode for this session.
|
||||
*
|
||||
* @param enabled {@code true} to enable the shuffle mode, {@code false} to disable.
|
||||
*/
|
||||
public void setShuffleModeEnabled(boolean enabled) {
|
||||
try {
|
||||
mSessionBinder.shuffleMode(enabled);
|
||||
} catch (RemoteException e) {
|
||||
Log.wtf(TAG, "Error calling shuffleMode.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a custom action back for the {@link MediaSession} to perform.
|
||||
*
|
||||
@@ -1141,21 +1062,6 @@ public final class MediaController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeatModeChanged(int repeatMode) {
|
||||
MediaController controller = mController.get();
|
||||
if (controller != null) {
|
||||
controller.postMessage(MSG_UPDATE_REPEAT_MODE, repeatMode, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShuffleModeChanged(boolean enabled) {
|
||||
MediaController controller = mController.get();
|
||||
if (controller != null) {
|
||||
controller.postMessage(MSG_UPDATE_SHUFFLE_MODE, enabled, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final static class MessageHandler extends Handler {
|
||||
@@ -1194,12 +1100,6 @@ public final class MediaController {
|
||||
case MSG_UPDATE_VOLUME:
|
||||
mCallback.onAudioInfoChanged((PlaybackInfo) msg.obj);
|
||||
break;
|
||||
case MSG_UPDATE_REPEAT_MODE:
|
||||
mCallback.onRepeatModeChanged((int) msg.obj);
|
||||
break;
|
||||
case MSG_UPDATE_SHUFFLE_MODE:
|
||||
mCallback.onShuffleModeChanged((boolean) msg.obj);
|
||||
break;
|
||||
case MSG_DESTROYED:
|
||||
mCallback.onSessionDestroyed();
|
||||
break;
|
||||
|
||||
@@ -485,41 +485,6 @@ public final class MediaSession {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repeat mode for this session.
|
||||
* <p>
|
||||
* Note that if this method is not called before, {@link MediaController#getRepeatMode}
|
||||
* will return {@link PlaybackState#REPEAT_MODE_NONE}.
|
||||
*
|
||||
* @param repeatMode The repeat mode. Must be one of the followings:
|
||||
* {@link PlaybackState#REPEAT_MODE_NONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ALL}
|
||||
*/
|
||||
public void setRepeatMode(@PlaybackState.RepeatMode int repeatMode) {
|
||||
try {
|
||||
mBinder.setRepeatMode(repeatMode);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error in setRepeatMode.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the shuffle mode for this session.
|
||||
* <p>
|
||||
* Note that if this method is not called before, {@link MediaController#isShuffleModeEnabled}
|
||||
* will return {@code false}.
|
||||
*
|
||||
* @param enabled {@code true} to enable the shuffle mode, {@code false} to disable.
|
||||
*/
|
||||
public void setShuffleModeEnabled(boolean enabled) {
|
||||
try {
|
||||
mBinder.setShuffleModeEnabled(enabled);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error in setShuffleModeEnabled.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set some extras that can be associated with the {@link MediaSession}. No assumptions should
|
||||
* be made as to how a {@link MediaController} will handle these extras.
|
||||
@@ -639,14 +604,6 @@ public final class MediaSession {
|
||||
postToCallback(CallbackMessageHandler.MSG_RATE, rating);
|
||||
}
|
||||
|
||||
private void dispatchRepeatMode(int repeatMode) {
|
||||
postToCallback(CallbackMessageHandler.MSG_REPEAT_MODE, repeatMode);
|
||||
}
|
||||
|
||||
private void dispatchShuffleMode(boolean enabled) {
|
||||
postToCallback(CallbackMessageHandler.MSG_SHUFFLE_MODE, enabled);
|
||||
}
|
||||
|
||||
private void dispatchCustomAction(String action, Bundle args) {
|
||||
postToCallback(CallbackMessageHandler.MSG_CUSTOM_ACTION, action, args);
|
||||
}
|
||||
@@ -1012,33 +969,6 @@ public final class MediaSession {
|
||||
public void onSetRating(@NonNull Rating rating) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to handle the setting of the repeat mode.
|
||||
* <p>
|
||||
* You should call {@link #setRepeatMode} before end of this method in order to notify
|
||||
* the change to the {@link MediaController}, or {@link MediaController#getRepeatMode}
|
||||
* could return an invalid value.
|
||||
*
|
||||
* @param repeatMode The repeat mode which is one of followings:
|
||||
* {@link PlaybackState#REPEAT_MODE_NONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ONE},
|
||||
* {@link PlaybackState#REPEAT_MODE_ALL}
|
||||
*/
|
||||
public void onSetRepeatMode(@PlaybackState.RepeatMode int repeatMode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to handle the setting of the shuffle mode.
|
||||
* <p>
|
||||
* You should call {@link #setShuffleModeEnabled} before the end of this method in order to
|
||||
* notify the change to the {@link MediaController}, or
|
||||
* {@link MediaController#isShuffleModeEnabled} could return an invalid value.
|
||||
*
|
||||
* @param enabled true when the shuffle mode is enabled, false otherwise.
|
||||
*/
|
||||
public void onSetShuffleModeEnabled(boolean enabled) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a {@link MediaController} wants a {@link PlaybackState.CustomAction} to be
|
||||
* performed.
|
||||
@@ -1220,22 +1150,6 @@ public final class MediaSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeatMode(int repeatMode) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchRepeatMode(repeatMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShuffleMode(boolean enabled) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchShuffleMode(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCustomAction(String action, Bundle args) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
@@ -1268,7 +1182,7 @@ public final class MediaSession {
|
||||
*/
|
||||
public static final class QueueItem implements Parcelable {
|
||||
/**
|
||||
* This id is reserved. No items can be explicitly asigned this id.
|
||||
* This id is reserved. No items can be explicitly assigned this id.
|
||||
*/
|
||||
public static final int UNKNOWN_ID = -1;
|
||||
|
||||
@@ -1377,11 +1291,9 @@ public final class MediaSession {
|
||||
private static final int MSG_REWIND = 17;
|
||||
private static final int MSG_SEEK_TO = 18;
|
||||
private static final int MSG_RATE = 19;
|
||||
private static final int MSG_REPEAT_MODE = 20;
|
||||
private static final int MSG_SHUFFLE_MODE = 21;
|
||||
private static final int MSG_CUSTOM_ACTION = 22;
|
||||
private static final int MSG_ADJUST_VOLUME = 23;
|
||||
private static final int MSG_SET_VOLUME = 24;
|
||||
private static final int MSG_CUSTOM_ACTION = 20;
|
||||
private static final int MSG_ADJUST_VOLUME = 21;
|
||||
private static final int MSG_SET_VOLUME = 22;
|
||||
|
||||
private MediaSession.Callback mCallback;
|
||||
|
||||
@@ -1470,12 +1382,6 @@ public final class MediaSession {
|
||||
case MSG_RATE:
|
||||
mCallback.onSetRating((Rating) msg.obj);
|
||||
break;
|
||||
case MSG_REPEAT_MODE:
|
||||
mCallback.onSetRepeatMode((int) msg.obj);
|
||||
break;
|
||||
case MSG_SHUFFLE_MODE:
|
||||
mCallback.onSetShuffleModeEnabled((boolean) msg.obj);
|
||||
break;
|
||||
case MSG_CUSTOM_ACTION:
|
||||
mCallback.onCustomAction((String) msg.obj, msg.getData());
|
||||
break;
|
||||
|
||||
@@ -45,8 +45,7 @@ public final class PlaybackState implements Parcelable {
|
||||
ACTION_SKIP_TO_PREVIOUS, ACTION_SKIP_TO_NEXT, ACTION_FAST_FORWARD, ACTION_SET_RATING,
|
||||
ACTION_SEEK_TO, ACTION_PLAY_PAUSE, ACTION_PLAY_FROM_MEDIA_ID, ACTION_PLAY_FROM_SEARCH,
|
||||
ACTION_SKIP_TO_QUEUE_ITEM, ACTION_PLAY_FROM_URI, ACTION_PREPARE,
|
||||
ACTION_PREPARE_FROM_MEDIA_ID, ACTION_PREPARE_FROM_SEARCH, ACTION_PREPARE_FROM_URI,
|
||||
ACTION_SET_REPEAT_MODE, ACTION_SET_SHUFFLE_MODE_ENABLED})
|
||||
ACTION_PREPARE_FROM_MEDIA_ID, ACTION_PREPARE_FROM_SEARCH, ACTION_PREPARE_FROM_URI})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Actions {}
|
||||
|
||||
@@ -176,20 +175,6 @@ public final class PlaybackState implements Parcelable {
|
||||
*/
|
||||
public static final long ACTION_PREPARE_FROM_URI = 1 << 17;
|
||||
|
||||
/**
|
||||
* Indicates this session supports the set repeat mode command.
|
||||
*
|
||||
* @see Builder#setActions(long)
|
||||
*/
|
||||
public static final long ACTION_SET_REPEAT_MODE = 1 << 18;
|
||||
|
||||
/**
|
||||
* Indicates this session supports the set shuffle mode enabled command.
|
||||
*
|
||||
* @see Builder#setActions(long)
|
||||
*/
|
||||
public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 1 << 19;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -296,30 +281,6 @@ public final class PlaybackState implements Parcelable {
|
||||
*/
|
||||
public final static long PLAYBACK_POSITION_UNKNOWN = -1;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@IntDef({REPEAT_MODE_NONE, REPEAT_MODE_ONE, REPEAT_MODE_ALL})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface RepeatMode {}
|
||||
/**
|
||||
* Use this value with {@link MediaController.TransportControls#setRepeatMode}
|
||||
* to indicate that the playback will be stopped at the end of the playing media list.
|
||||
*/
|
||||
public final static int REPEAT_MODE_NONE = 0;
|
||||
|
||||
/**
|
||||
* Use this value with {@link MediaController.TransportControls#setRepeatMode}
|
||||
* to indicate that the playback of the current playing media item will be repeated.
|
||||
*/
|
||||
public final static int REPEAT_MODE_ONE = 1;
|
||||
|
||||
/**
|
||||
* Use this value with {@link MediaController.TransportControls#setRepeatMode}
|
||||
* to indicate that the playback of the playing media list will be repeated.
|
||||
*/
|
||||
public final static int REPEAT_MODE_ALL = 2;
|
||||
|
||||
private final int mState;
|
||||
private final long mPosition;
|
||||
private final long mBufferedPosition;
|
||||
@@ -466,8 +427,6 @@ public final class PlaybackState implements Parcelable {
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID}</li>
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_SEARCH}</li>
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_URI}</li>
|
||||
* <li> {@link PlaybackState#ACTION_SET_REPEAT_MODE}</li>
|
||||
* <li> {@link PlaybackState#ACTION_SET_SHUFFLE_MODE_ENABLED}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Actions
|
||||
@@ -1002,8 +961,6 @@ public final class PlaybackState implements Parcelable {
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID}</li>
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_SEARCH}</li>
|
||||
* <li> {@link PlaybackState#ACTION_PREPARE_FROM_URI}</li>
|
||||
* <li> {@link PlaybackState#ACTION_SET_REPEAT_MODE}</li>
|
||||
* <li> {@link PlaybackState#ACTION_SET_SHUFFLE_MODE_ENABLED}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param actions The set of actions allowed.
|
||||
|
||||
@@ -101,8 +101,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
private ParceledListSlice mQueue;
|
||||
private CharSequence mQueueTitle;
|
||||
private int mRatingType;
|
||||
private int mRepeatMode;
|
||||
private boolean mShuffleModeEnabled;
|
||||
// End TransportPerformer fields
|
||||
|
||||
// Volume handling fields
|
||||
@@ -622,47 +620,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
private void pushRepeatModeUpdate() {
|
||||
synchronized (mLock) {
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.onRepeatModeChanged(mRepeatMode);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removed dead callback in pushRepeatModeUpdate",
|
||||
holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushRepeatModeUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pushShuffleModeUpdate() {
|
||||
synchronized (mLock) {
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.onShuffleModeChanged(mShuffleModeEnabled);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removed dead callback in pushShuffleModeUpdate",
|
||||
holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushShuffleModeUpdate",
|
||||
holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pushSessionDestroyed() {
|
||||
synchronized (mLock) {
|
||||
// This is the only method that may be (and can only be) called
|
||||
@@ -886,30 +843,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
mRatingType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepeatMode(int repeatMode) {
|
||||
boolean changed;
|
||||
synchronized (mLock) {
|
||||
changed = mRepeatMode != repeatMode;
|
||||
mRepeatMode = repeatMode;
|
||||
}
|
||||
if (changed) {
|
||||
mHandler.post(MessageHandler.MSG_UPDATE_REPEAT_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShuffleModeEnabled(boolean enabled) {
|
||||
boolean changed;
|
||||
synchronized (mLock) {
|
||||
changed = mShuffleModeEnabled != enabled;
|
||||
mShuffleModeEnabled = enabled;
|
||||
}
|
||||
if (changed) {
|
||||
mHandler.post(MessageHandler.MSG_UPDATE_SHUFFLE_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentVolume(int volume) {
|
||||
mCurrentVolume = volume;
|
||||
@@ -1126,22 +1059,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void repeatMode(int repeatMode) {
|
||||
try {
|
||||
mCb.onRepeatMode(repeatMode);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote failure in repeatMode.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void shuffleMode(boolean enabled) {
|
||||
try {
|
||||
mCb.onShuffleMode(enabled);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote failure in shuffleMode.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void adjustVolume(int direction) {
|
||||
try {
|
||||
mCb.onAdjustVolume(direction);
|
||||
@@ -1377,19 +1294,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
mSessionCb.rate(rating);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repeatMode(int repeatMode) {
|
||||
updateCallingPackage();
|
||||
mSessionCb.repeatMode(repeatMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shuffleMode(boolean enabled) throws RemoteException {
|
||||
updateCallingPackage();
|
||||
mSessionCb.shuffleMode(enabled);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCustomAction(String action, Bundle args)
|
||||
throws RemoteException {
|
||||
@@ -1397,6 +1301,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
mSessionCb.sendCustomAction(action, args);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MediaMetadata getMetadata() {
|
||||
synchronized (mLock) {
|
||||
@@ -1433,16 +1338,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return mRatingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRepeatMode() {
|
||||
return mRepeatMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShuffleModeEnabled() {
|
||||
return mShuffleModeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransportControlEnabled() {
|
||||
return MediaSessionRecord.this.isTransportControlEnabled();
|
||||
@@ -1468,9 +1363,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
private static final int MSG_SEND_EVENT = 6;
|
||||
private static final int MSG_UPDATE_SESSION_STATE = 7;
|
||||
private static final int MSG_UPDATE_VOLUME = 8;
|
||||
private static final int MSG_UPDATE_REPEAT_MODE = 9;
|
||||
private static final int MSG_UPDATE_SHUFFLE_MODE = 10;
|
||||
private static final int MSG_DESTROYED = 11;
|
||||
private static final int MSG_DESTROYED = 9;
|
||||
|
||||
public MessageHandler(Looper looper) {
|
||||
super(looper);
|
||||
@@ -1502,12 +1395,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
case MSG_UPDATE_VOLUME:
|
||||
pushVolumeUpdate();
|
||||
break;
|
||||
case MSG_UPDATE_REPEAT_MODE:
|
||||
pushRepeatModeUpdate();
|
||||
break;
|
||||
case MSG_UPDATE_SHUFFLE_MODE:
|
||||
pushShuffleModeUpdate();
|
||||
break;
|
||||
case MSG_DESTROYED:
|
||||
pushSessionDestroyed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user