From 3e5a34ea8e90e013c7edd39675746130a6eea954 Mon Sep 17 00:00:00 2001 From: Sungsoo Date: Tue, 4 Apr 2017 13:35:24 +0900 Subject: [PATCH] Revert "MediaSession: Add methods for setting shuffle and repeat modes" This reverts commit ba11085635ea3ef9383b34dd44c43f2a6cd832ff. Bug: 36844917, Bug: 36525228, Bug: 36525325 Test: Pass MediaSessionTest and MediaControllerTest Change-Id: I4805ea58107b5fab8c9f5f0fcaffd1e0e4882ed8 --- api/current.txt | 15 --- api/system-current.txt | 15 --- api/test-current.txt | 15 --- .../src/com/android/commands/media/Media.java | 10 -- .../java/android/media/session/ISession.aidl | 2 - .../media/session/ISessionCallback.aidl | 2 - .../media/session/ISessionController.aidl | 16 +-- .../session/ISessionControllerCallback.aidl | 2 - .../media/session/MediaController.java | 102 +-------------- .../android/media/session/MediaSession.java | 102 +-------------- .../android/media/session/PlaybackState.java | 45 +------ .../server/media/MediaSessionRecord.java | 117 +----------------- 12 files changed, 14 insertions(+), 429 deletions(-) diff --git a/api/current.txt b/api/current.txt index 59e1570263527..9ade18a964c03 100644 --- a/api/current.txt +++ b/api/current.txt @@ -24231,11 +24231,9 @@ package android.media.session { method public java.util.List 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); @@ -24251,10 +24249,8 @@ package android.media.session { method public void onPlaybackStateChanged(android.media.session.PlaybackState); method public void onQueueChanged(java.util.List); 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 { @@ -24283,8 +24279,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); @@ -24311,9 +24305,7 @@ package android.media.session { method public void setQueue(java.util.List); 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 } @@ -24336,8 +24328,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); @@ -24398,17 +24388,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 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 diff --git a/api/system-current.txt b/api/system-current.txt index 7e5c9861e7d7c..0288829a3bd31 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -26143,11 +26143,9 @@ package android.media.session { method public java.util.List 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); @@ -26163,10 +26161,8 @@ package android.media.session { method public void onPlaybackStateChanged(android.media.session.PlaybackState); method public void onQueueChanged(java.util.List); 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 { @@ -26195,8 +26191,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); @@ -26223,9 +26217,7 @@ package android.media.session { method public void setQueue(java.util.List); 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 } @@ -26248,8 +26240,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); @@ -26320,17 +26310,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 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 diff --git a/api/test-current.txt b/api/test-current.txt index bcbfd6344dd7c..a3275fbadf06d 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -24344,11 +24344,9 @@ package android.media.session { method public java.util.List 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); @@ -24364,10 +24362,8 @@ package android.media.session { method public void onPlaybackStateChanged(android.media.session.PlaybackState); method public void onQueueChanged(java.util.List); 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 { @@ -24396,8 +24392,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); @@ -24424,9 +24418,7 @@ package android.media.session { method public void setQueue(java.util.List); 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 } @@ -24449,8 +24441,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); @@ -24511,17 +24501,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 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 diff --git a/cmds/media/src/com/android/commands/media/Media.java b/cmds/media/src/com/android/commands/media/Media.java index 4be46540e19b5..9df229cbf490d 100644 --- a/cmds/media/src/com/android/commands/media/Media.java +++ b/cmds/media/src/com/android/commands/media/Media.java @@ -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() diff --git a/media/java/android/media/session/ISession.aidl b/media/java/android/media/session/ISession.aidl index 4f3314c1e8ab6..3affee5c0aa79 100644 --- a/media/java/android/media/session/ISession.aidl +++ b/media/java/android/media/session/ISession.aidl @@ -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); diff --git a/media/java/android/media/session/ISessionCallback.aidl b/media/java/android/media/session/ISessionCallback.aidl index 2f6e260741c45..893bd3c8cbb13 100644 --- a/media/java/android/media/session/ISessionCallback.aidl +++ b/media/java/android/media/session/ISessionCallback.aidl @@ -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 diff --git a/media/java/android/media/session/ISessionController.aidl b/media/java/android/media/session/ISessionController.aidl index e92758c950af7..249bcdc802cea 100644 --- a/media/java/android/media/session/ISessionController.aidl +++ b/media/java/android/media/session/ISessionController.aidl @@ -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(); } diff --git a/media/java/android/media/session/ISessionControllerCallback.aidl b/media/java/android/media/session/ISessionControllerCallback.aidl index 9517c088bcf35..cf3176706d7ed 100644 --- a/media/java/android/media/session/ISessionControllerCallback.aidl +++ b/media/java/android/media/session/ISessionControllerCallback.aidl @@ -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); } diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java index 8cbf8e1eccdfb..622900f5c7f94 100644 --- a/media/java/android/media/session/MediaController.java +++ b/media/java/android/media/session/MediaController.java @@ -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; diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java index 6688840d25ae4..dfd2bb35d6eae 100644 --- a/media/java/android/media/session/MediaSession.java +++ b/media/java/android/media/session/MediaSession.java @@ -485,41 +485,6 @@ public final class MediaSession { } } - /** - * Set the repeat mode for this session. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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; diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java index 1ea61093d869b..8283c8b967e80 100644 --- a/media/java/android/media/session/PlaybackState.java +++ b/media/java/android/media/session/PlaybackState.java @@ -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 { *

  • {@link PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID}
  • *
  • {@link PlaybackState#ACTION_PREPARE_FROM_SEARCH}
  • *
  • {@link PlaybackState#ACTION_PREPARE_FROM_URI}
  • - *
  • {@link PlaybackState#ACTION_SET_REPEAT_MODE}
  • - *
  • {@link PlaybackState#ACTION_SET_SHUFFLE_MODE_ENABLED}
  • * */ @Actions @@ -1002,8 +961,6 @@ public final class PlaybackState implements Parcelable { *
  • {@link PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID}
  • *
  • {@link PlaybackState#ACTION_PREPARE_FROM_SEARCH}
  • *
  • {@link PlaybackState#ACTION_PREPARE_FROM_URI}
  • - *
  • {@link PlaybackState#ACTION_SET_REPEAT_MODE}
  • - *
  • {@link PlaybackState#ACTION_SET_SHUFFLE_MODE_ENABLED}
  • * * * @param actions The set of actions allowed. diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java index cd70c78770417..ee348cf71c883 100644 --- a/services/core/java/com/android/server/media/MediaSessionRecord.java +++ b/services/core/java/com/android/server/media/MediaSessionRecord.java @@ -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(); }