Loading packages/MediaComponents/src/com/android/media/IMediaSession2Callback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ oneway interface IMediaSession2Callback { void onCustomLayoutChanged(in List<Bundle> commandButtonlist); void sendCustomCommand(in Bundle command, in Bundle args, in ResultReceiver receiver); void onCustomCommand(in Bundle command, in Bundle args, in ResultReceiver receiver); ////////////////////////////////////////////////////////////////////////////////////////////// // Browser sepcific Loading packages/MediaComponents/src/com/android/media/MediaBrowser2Impl.java +11 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,10 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow @Override public void subscribe_impl(String parentId, Bundle extras) { if (parentId == null) { throw new IllegalArgumentException("parentId shouldn't be null"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading @@ -85,6 +89,10 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow @Override public void unsubscribe_impl(String parentId) { if (parentId == null) { throw new IllegalArgumentException("parentId shouldn't be null"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading Loading @@ -170,6 +178,9 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (page < 1 || pageSize < 1) { throw new IllegalArgumentException("Neither page nor pageSize should be less than 1"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading packages/MediaComponents/src/com/android/media/MediaController2Impl.java +44 −11 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.UserHandle; import android.support.annotation.GuardedBy; import android.text.TextUtils; import android.util.Log; import java.util.ArrayList; Loading Loading @@ -380,6 +381,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void prepareFromUri_impl(Uri uri, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_URI); if (uri == null) { throw new IllegalArgumentException("uri shouldn't be null"); } if (binder != null) { try { binder.prepareFromUri(mSessionCallbackStub, uri, extras); Loading @@ -394,6 +398,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void prepareFromSearch_impl(String query, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_SEARCH); if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (binder != null) { try { binder.prepareFromSearch(mSessionCallbackStub, query, extras); Loading @@ -406,8 +413,11 @@ public class MediaController2Impl implements MediaController2Provider { } @Override public void prepareMediaId_impl(String mediaId, Bundle extras) { public void prepareFromMediaId_impl(String mediaId, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_MEDIA_ID); if (mediaId == null) { throw new IllegalArgumentException("mediaId shouldn't be null"); } if (binder != null) { try { binder.prepareFromMediaId(mSessionCallbackStub, mediaId, extras); Loading @@ -422,6 +432,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromUri_impl(Uri uri, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_URI); if (uri == null) { throw new IllegalArgumentException("uri shouldn't be null"); } if (binder != null) { try { binder.playFromUri(mSessionCallbackStub, uri, extras); Loading @@ -436,6 +449,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromSearch_impl(String query, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_SEARCH); if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (binder != null) { try { binder.playFromSearch(mSessionCallbackStub, query, extras); Loading @@ -450,6 +466,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromMediaId_impl(String mediaId, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_MEDIA_ID); if (mediaId == null) { throw new IllegalArgumentException("mediaId shouldn't be null"); } if (binder != null) { try { binder.playFromMediaId(mSessionCallbackStub, mediaId, extras); Loading Loading @@ -523,6 +542,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void seekTo_impl(long pos) { if (pos < 0) { throw new IllegalArgumentException("position shouldn't be negative"); } Bundle args = new Bundle(); args.putLong(MediaSession2Stub.ARGUMENT_KEY_POSITION, pos); sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_SEEK_TO, args); Loading @@ -530,6 +552,10 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void skipToPlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement this /* Bundle args = new Bundle(); Loading @@ -549,16 +575,31 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void addPlaylistItem_impl(int index, MediaItem2 item) { // TODO(jaewan): Implement (b/73149584) if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override public void removePlaylistItem_impl(MediaItem2 item) { // TODO(jaewan): Implement (b/73149584) if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override public void replacePlaylistItem_impl(int index, MediaItem2 item) { // TODO: Implement this (b/73149407) if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override Loading @@ -578,7 +619,7 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void setPlaylistParams_impl(PlaylistParams params) { if (params == null) { throw new IllegalArgumentException("PlaylistParams should not be null!"); throw new IllegalArgumentException("params shouldn't be null"); } Bundle args = new Bundle(); args.putBundle(MediaSession2Stub.ARGUMENT_KEY_PLAYLIST_PARAMS, params.toBundle()); Loading Loading @@ -651,15 +692,7 @@ public class MediaController2Impl implements MediaController2Provider { }); } void pushPlaylistChanges(final List<Bundle> list) { final List<MediaItem2> playlist = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { MediaItem2 item = MediaItem2.fromBundle(mContext, list.get(i)); if (item != null) { playlist.add(item); } } void pushPlaylistChanges(final List<MediaItem2> playlist) { synchronized (mLock) { mPlaylist = playlist; mCallbackExecutor.execute(() -> { Loading packages/MediaComponents/src/com/android/media/MediaSession2CallbackStub.java +50 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.media; import android.app.PendingIntent; import android.content.Context; import android.media.MediaController2; import android.media.MediaItem2; import android.media.MediaSession2.Command; import android.media.MediaSession2.CommandButton; Loading @@ -26,6 +27,7 @@ import android.media.MediaSession2.PlaylistParams; import android.media.PlaybackState2; import android.os.Bundle; import android.os.ResultReceiver; import android.text.TextUtils; import android.util.Log; import com.android.media.MediaController2Impl.PlaybackInfoImpl; Loading Loading @@ -79,7 +81,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } @Override public void onPlaylistChanged(List<Bundle> playlist) throws RuntimeException { public void onPlaylistChanged(List<Bundle> playlistBundle) throws RuntimeException { final MediaController2Impl controller; try { controller = getController(); Loading @@ -87,14 +89,24 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } if (playlist == null) { if (playlistBundle == null) { Log.w(TAG, "onPlaylistChanged(): Ignoring null playlist"); return; } List<MediaItem2> playlist = new ArrayList<>(); for (Bundle bundle : playlistBundle) { MediaItem2 item = MediaItem2.fromBundle(controller.getContext(), bundle); if (item == null) { Log.w(TAG, "onPlaylistChanged(): Ignoring null item in playlist"); } else { playlist.add(item); } } controller.pushPlaylistChanges(playlist); } @Override public void onPlaylistParamsChanged(Bundle params) throws RuntimeException { public void onPlaylistParamsChanged(Bundle paramsBundle) throws RuntimeException { final MediaController2Impl controller; try { controller = getController(); Loading @@ -102,8 +114,12 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } controller.pushPlaylistParamsChanges( PlaylistParams.fromBundle(controller.getContext(), params)); PlaylistParams params = PlaylistParams.fromBundle(controller.getContext(), paramsBundle); if (params == null) { Log.w(TAG, "onPlaylistParamsChanged(): Ignoring null playlistParams"); return; } controller.pushPlaylistParamsChanges(params); } @Override Loading @@ -118,6 +134,12 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } MediaController2.PlaybackInfo info = PlaybackInfoImpl.fromBundle(controller.getContext(), playbackInfo); if (info == null) { Log.w(TAG, "onPlaybackInfoChanged(): Ignoring null playbackInfo"); return; } controller.pushPlaybackInfoChanges( PlaybackInfoImpl.fromBundle(controller.getContext(), playbackInfo)); } Loading Loading @@ -167,7 +189,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onCustomLayoutChanged(List<Bundle> commandButtonlist) { if (commandButtonlist == null) { // Illegal call. Ignore Log.w(TAG, "onCustomLayoutChanged(): Ignoring null commandButtonlist"); return; } final MediaController2Impl controller; Loading @@ -193,7 +215,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } @Override public void sendCustomCommand(Bundle commandBundle, Bundle args, ResultReceiver receiver) { public void onCustomCommand(Bundle commandBundle, Bundle args, ResultReceiver receiver) { final MediaController2Impl controller; try { controller = getController(); Loading @@ -203,6 +225,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } Command command = Command.fromBundle(controller.getContext(), commandBundle); if (command == null) { Log.w(TAG, "onCustomCommand(): Ignoring null command"); return; } controller.onCustomCommand(command, args, receiver); Loading Loading @@ -231,6 +254,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetItemDone(String mediaId, Bundle itemBundle) throws RuntimeException { if (mediaId == null) { Log.w(TAG, "onGetItemDone(): Ignoring null mediaId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -249,6 +276,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetChildrenDone(String parentId, int page, int pageSize, List<Bundle> itemBundleList, Bundle extras) throws RuntimeException { if (parentId == null) { Log.w(TAG, "onGetChildrenDone(): Ignoring null parentId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -274,6 +305,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onSearchResultChanged(String query, int itemCount, Bundle extras) throws RuntimeException { if (TextUtils.isEmpty(query)) { Log.w(TAG, "onSearchResultChanged(): Ignoring empty query"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -291,6 +326,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetSearchResultDone(String query, int page, int pageSize, List<Bundle> itemBundleList, Bundle extras) throws RuntimeException { if (TextUtils.isEmpty(query)) { Log.w(TAG, "onGetSearchResultDone(): Ignoring empty query"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -315,6 +354,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onChildrenChanged(String parentId, int itemCount, Bundle extras) { if (parentId == null) { Log.w(TAG, "onChildrenChanged(): Ignoring null parentId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading packages/MediaComponents/src/com/android/media/MediaSession2Stub.java +1 −1 Original line number Diff line number Diff line Loading @@ -985,7 +985,7 @@ public class MediaSession2Stub extends IMediaSession2.Stub { } try { Bundle commandBundle = command.toBundle(); controllerBinder.sendCustomCommand(commandBundle, args, receiver); controllerBinder.onCustomCommand(commandBundle, args, receiver); } catch (RemoteException e) { Log.w(TAG, "Controller is gone", e); // TODO(jaewan): What to do when the controller is gone? Loading Loading
packages/MediaComponents/src/com/android/media/IMediaSession2Callback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ oneway interface IMediaSession2Callback { void onCustomLayoutChanged(in List<Bundle> commandButtonlist); void sendCustomCommand(in Bundle command, in Bundle args, in ResultReceiver receiver); void onCustomCommand(in Bundle command, in Bundle args, in ResultReceiver receiver); ////////////////////////////////////////////////////////////////////////////////////////////// // Browser sepcific Loading
packages/MediaComponents/src/com/android/media/MediaBrowser2Impl.java +11 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,10 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow @Override public void subscribe_impl(String parentId, Bundle extras) { if (parentId == null) { throw new IllegalArgumentException("parentId shouldn't be null"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading @@ -85,6 +89,10 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow @Override public void unsubscribe_impl(String parentId) { if (parentId == null) { throw new IllegalArgumentException("parentId shouldn't be null"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading Loading @@ -170,6 +178,9 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (page < 1 || pageSize < 1) { throw new IllegalArgumentException("Neither page nor pageSize should be less than 1"); } final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { Loading
packages/MediaComponents/src/com/android/media/MediaController2Impl.java +44 −11 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.UserHandle; import android.support.annotation.GuardedBy; import android.text.TextUtils; import android.util.Log; import java.util.ArrayList; Loading Loading @@ -380,6 +381,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void prepareFromUri_impl(Uri uri, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_URI); if (uri == null) { throw new IllegalArgumentException("uri shouldn't be null"); } if (binder != null) { try { binder.prepareFromUri(mSessionCallbackStub, uri, extras); Loading @@ -394,6 +398,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void prepareFromSearch_impl(String query, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_SEARCH); if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (binder != null) { try { binder.prepareFromSearch(mSessionCallbackStub, query, extras); Loading @@ -406,8 +413,11 @@ public class MediaController2Impl implements MediaController2Provider { } @Override public void prepareMediaId_impl(String mediaId, Bundle extras) { public void prepareFromMediaId_impl(String mediaId, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PREPARE_FROM_MEDIA_ID); if (mediaId == null) { throw new IllegalArgumentException("mediaId shouldn't be null"); } if (binder != null) { try { binder.prepareFromMediaId(mSessionCallbackStub, mediaId, extras); Loading @@ -422,6 +432,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromUri_impl(Uri uri, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_URI); if (uri == null) { throw new IllegalArgumentException("uri shouldn't be null"); } if (binder != null) { try { binder.playFromUri(mSessionCallbackStub, uri, extras); Loading @@ -436,6 +449,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromSearch_impl(String query, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_SEARCH); if (TextUtils.isEmpty(query)) { throw new IllegalArgumentException("query shouldn't be empty"); } if (binder != null) { try { binder.playFromSearch(mSessionCallbackStub, query, extras); Loading @@ -450,6 +466,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void playFromMediaId_impl(String mediaId, Bundle extras) { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAY_FROM_MEDIA_ID); if (mediaId == null) { throw new IllegalArgumentException("mediaId shouldn't be null"); } if (binder != null) { try { binder.playFromMediaId(mSessionCallbackStub, mediaId, extras); Loading Loading @@ -523,6 +542,9 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void seekTo_impl(long pos) { if (pos < 0) { throw new IllegalArgumentException("position shouldn't be negative"); } Bundle args = new Bundle(); args.putLong(MediaSession2Stub.ARGUMENT_KEY_POSITION, pos); sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_SEEK_TO, args); Loading @@ -530,6 +552,10 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void skipToPlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement this /* Bundle args = new Bundle(); Loading @@ -549,16 +575,31 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void addPlaylistItem_impl(int index, MediaItem2 item) { // TODO(jaewan): Implement (b/73149584) if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override public void removePlaylistItem_impl(MediaItem2 item) { // TODO(jaewan): Implement (b/73149584) if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override public void replacePlaylistItem_impl(int index, MediaItem2 item) { // TODO: Implement this (b/73149407) if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } } @Override Loading @@ -578,7 +619,7 @@ public class MediaController2Impl implements MediaController2Provider { @Override public void setPlaylistParams_impl(PlaylistParams params) { if (params == null) { throw new IllegalArgumentException("PlaylistParams should not be null!"); throw new IllegalArgumentException("params shouldn't be null"); } Bundle args = new Bundle(); args.putBundle(MediaSession2Stub.ARGUMENT_KEY_PLAYLIST_PARAMS, params.toBundle()); Loading Loading @@ -651,15 +692,7 @@ public class MediaController2Impl implements MediaController2Provider { }); } void pushPlaylistChanges(final List<Bundle> list) { final List<MediaItem2> playlist = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { MediaItem2 item = MediaItem2.fromBundle(mContext, list.get(i)); if (item != null) { playlist.add(item); } } void pushPlaylistChanges(final List<MediaItem2> playlist) { synchronized (mLock) { mPlaylist = playlist; mCallbackExecutor.execute(() -> { Loading
packages/MediaComponents/src/com/android/media/MediaSession2CallbackStub.java +50 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.media; import android.app.PendingIntent; import android.content.Context; import android.media.MediaController2; import android.media.MediaItem2; import android.media.MediaSession2.Command; import android.media.MediaSession2.CommandButton; Loading @@ -26,6 +27,7 @@ import android.media.MediaSession2.PlaylistParams; import android.media.PlaybackState2; import android.os.Bundle; import android.os.ResultReceiver; import android.text.TextUtils; import android.util.Log; import com.android.media.MediaController2Impl.PlaybackInfoImpl; Loading Loading @@ -79,7 +81,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } @Override public void onPlaylistChanged(List<Bundle> playlist) throws RuntimeException { public void onPlaylistChanged(List<Bundle> playlistBundle) throws RuntimeException { final MediaController2Impl controller; try { controller = getController(); Loading @@ -87,14 +89,24 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } if (playlist == null) { if (playlistBundle == null) { Log.w(TAG, "onPlaylistChanged(): Ignoring null playlist"); return; } List<MediaItem2> playlist = new ArrayList<>(); for (Bundle bundle : playlistBundle) { MediaItem2 item = MediaItem2.fromBundle(controller.getContext(), bundle); if (item == null) { Log.w(TAG, "onPlaylistChanged(): Ignoring null item in playlist"); } else { playlist.add(item); } } controller.pushPlaylistChanges(playlist); } @Override public void onPlaylistParamsChanged(Bundle params) throws RuntimeException { public void onPlaylistParamsChanged(Bundle paramsBundle) throws RuntimeException { final MediaController2Impl controller; try { controller = getController(); Loading @@ -102,8 +114,12 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } controller.pushPlaylistParamsChanges( PlaylistParams.fromBundle(controller.getContext(), params)); PlaylistParams params = PlaylistParams.fromBundle(controller.getContext(), paramsBundle); if (params == null) { Log.w(TAG, "onPlaylistParamsChanged(): Ignoring null playlistParams"); return; } controller.pushPlaylistParamsChanges(params); } @Override Loading @@ -118,6 +134,12 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { Log.w(TAG, "Don't fail silently here. Highly likely a bug"); return; } MediaController2.PlaybackInfo info = PlaybackInfoImpl.fromBundle(controller.getContext(), playbackInfo); if (info == null) { Log.w(TAG, "onPlaybackInfoChanged(): Ignoring null playbackInfo"); return; } controller.pushPlaybackInfoChanges( PlaybackInfoImpl.fromBundle(controller.getContext(), playbackInfo)); } Loading Loading @@ -167,7 +189,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onCustomLayoutChanged(List<Bundle> commandButtonlist) { if (commandButtonlist == null) { // Illegal call. Ignore Log.w(TAG, "onCustomLayoutChanged(): Ignoring null commandButtonlist"); return; } final MediaController2Impl controller; Loading @@ -193,7 +215,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } @Override public void sendCustomCommand(Bundle commandBundle, Bundle args, ResultReceiver receiver) { public void onCustomCommand(Bundle commandBundle, Bundle args, ResultReceiver receiver) { final MediaController2Impl controller; try { controller = getController(); Loading @@ -203,6 +225,7 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { } Command command = Command.fromBundle(controller.getContext(), commandBundle); if (command == null) { Log.w(TAG, "onCustomCommand(): Ignoring null command"); return; } controller.onCustomCommand(command, args, receiver); Loading Loading @@ -231,6 +254,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetItemDone(String mediaId, Bundle itemBundle) throws RuntimeException { if (mediaId == null) { Log.w(TAG, "onGetItemDone(): Ignoring null mediaId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -249,6 +276,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetChildrenDone(String parentId, int page, int pageSize, List<Bundle> itemBundleList, Bundle extras) throws RuntimeException { if (parentId == null) { Log.w(TAG, "onGetChildrenDone(): Ignoring null parentId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -274,6 +305,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onSearchResultChanged(String query, int itemCount, Bundle extras) throws RuntimeException { if (TextUtils.isEmpty(query)) { Log.w(TAG, "onSearchResultChanged(): Ignoring empty query"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -291,6 +326,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onGetSearchResultDone(String query, int page, int pageSize, List<Bundle> itemBundleList, Bundle extras) throws RuntimeException { if (TextUtils.isEmpty(query)) { Log.w(TAG, "onGetSearchResultDone(): Ignoring empty query"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading @@ -315,6 +354,10 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { @Override public void onChildrenChanged(String parentId, int itemCount, Bundle extras) { if (parentId == null) { Log.w(TAG, "onChildrenChanged(): Ignoring null parentId"); return; } final MediaBrowser2Impl browser; try { browser = getBrowser(); Loading
packages/MediaComponents/src/com/android/media/MediaSession2Stub.java +1 −1 Original line number Diff line number Diff line Loading @@ -985,7 +985,7 @@ public class MediaSession2Stub extends IMediaSession2.Stub { } try { Bundle commandBundle = command.toBundle(); controllerBinder.sendCustomCommand(commandBundle, args, receiver); controllerBinder.onCustomCommand(commandBundle, args, receiver); } catch (RemoteException e) { Log.w(TAG, "Controller is gone", e); // TODO(jaewan): What to do when the controller is gone? Loading