Loading packages/MediaComponents/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ LOCAL_PATH := $(call my-dir) ifneq ($(TARGET_BUILD_PDK),true) # Build MediaComponents only if this is not a PDK build. MediaComponents won't # build in PDK builds because frameworks/base/core/java is not available but # IMediaSession2.aidl and IMediaSession2Callback.aidl are using classes from # IMediaSession2.aidl and IMediaController2.aidl are using classes from # frameworks/base/core/java. include $(CLEAR_VARS) Loading packages/MediaComponents/src/com/android/media/IMediaSession2Callback.aidl→packages/MediaComponents/src/com/android/media/IMediaController2.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -23,14 +23,14 @@ import android.os.ResultReceiver; import com.android.media.IMediaSession2; /** * Interface from MediaSession2 to MediaSession2Record. * Interface from MediaSession2 to MediaController2. * <p> * Keep this interface oneway. Otherwise a malicious app may implement fake version of this, * and holds calls from session to make session owner(s) frozen. */ // TODO(jaewan): (Post P) Handle when the playlist becomes too huge. // Note that ParcelledSliceList isn't a good idea for the purpose. (see: b/37493677) oneway interface IMediaSession2Callback { oneway interface IMediaController2 { void onPlaybackStateChanged(in Bundle state); void onPlaylistChanged(in List<Bundle> playlist, in Bundle metadata); void onPlaylistMetadataChanged(in Bundle metadata); Loading packages/MediaComponents/src/com/android/media/IMediaSession2.aidl +27 −27 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import android.os.Bundle; import android.os.ResultReceiver; import android.net.Uri; import com.android.media.IMediaSession2Callback; import com.android.media.IMediaController2; /** * Interface to MediaSession2. * Interface from MediaController2 to MediaSession2. * <p> * Keep this interface oneway. Otherwise a malicious app may implement fake version of this, * and holds calls from session to make session owner(s) frozen. Loading @@ -37,44 +37,44 @@ oneway interface IMediaSession2 { // not to expose other methods to the controller whose connection wasn't accepted. // But this would be enough for now because it's the same as existing // MediaBrowser and MediaBrowserService. void connect(IMediaSession2Callback caller, String callingPackage); void release(IMediaSession2Callback caller); void connect(IMediaController2 caller, String callingPackage); void release(IMediaController2 caller); void setVolumeTo(IMediaSession2Callback caller, int value, int flags); void adjustVolume(IMediaSession2Callback caller, int direction, int flags); void setVolumeTo(IMediaController2 caller, int value, int flags); void adjustVolume(IMediaController2 caller, int direction, int flags); ////////////////////////////////////////////////////////////////////////////////////////////// // send command ////////////////////////////////////////////////////////////////////////////////////////////// void sendTransportControlCommand(IMediaSession2Callback caller, void sendTransportControlCommand(IMediaController2 caller, int commandCode, in Bundle args); void sendCustomCommand(IMediaSession2Callback caller, in Bundle command, in Bundle args, void sendCustomCommand(IMediaController2 caller, in Bundle command, in Bundle args, in ResultReceiver receiver); void prepareFromUri(IMediaSession2Callback caller, in Uri uri, in Bundle extras); void prepareFromSearch(IMediaSession2Callback caller, String query, in Bundle extras); void prepareFromMediaId(IMediaSession2Callback caller, String mediaId, in Bundle extras); void playFromUri(IMediaSession2Callback caller, in Uri uri, in Bundle extras); void playFromSearch(IMediaSession2Callback caller, String query, in Bundle extras); void playFromMediaId(IMediaSession2Callback caller, String mediaId, in Bundle extras); void setRating(IMediaSession2Callback caller, String mediaId, in Bundle rating); void prepareFromUri(IMediaController2 caller, in Uri uri, in Bundle extras); void prepareFromSearch(IMediaController2 caller, String query, in Bundle extras); void prepareFromMediaId(IMediaController2 caller, String mediaId, in Bundle extras); void playFromUri(IMediaController2 caller, in Uri uri, in Bundle extras); void playFromSearch(IMediaController2 caller, String query, in Bundle extras); void playFromMediaId(IMediaController2 caller, String mediaId, in Bundle extras); void setRating(IMediaController2 caller, String mediaId, in Bundle rating); void setPlaylist(IMediaSession2Callback caller, in List<Bundle> playlist, in Bundle metadata); void updatePlaylistMetadata(IMediaSession2Callback caller, in Bundle metadata); void addPlaylistItem(IMediaSession2Callback caller, int index, in Bundle mediaItem); void removePlaylistItem(IMediaSession2Callback caller, in Bundle mediaItem); void replacePlaylistItem(IMediaSession2Callback caller, int index, in Bundle mediaItem); void setPlaylist(IMediaController2 caller, in List<Bundle> playlist, in Bundle metadata); void updatePlaylistMetadata(IMediaController2 caller, in Bundle metadata); void addPlaylistItem(IMediaController2 caller, int index, in Bundle mediaItem); void removePlaylistItem(IMediaController2 caller, in Bundle mediaItem); void replacePlaylistItem(IMediaController2 caller, int index, in Bundle mediaItem); ////////////////////////////////////////////////////////////////////////////////////////////// // library service specific ////////////////////////////////////////////////////////////////////////////////////////////// void getLibraryRoot(IMediaSession2Callback caller, in Bundle rootHints); void getItem(IMediaSession2Callback caller, String mediaId); void getChildren(IMediaSession2Callback caller, String parentId, int page, int pageSize, void getLibraryRoot(IMediaController2 caller, in Bundle rootHints); void getItem(IMediaController2 caller, String mediaId); void getChildren(IMediaController2 caller, String parentId, int page, int pageSize, in Bundle extras); void search(IMediaSession2Callback caller, String query, in Bundle extras); void getSearchResult(IMediaSession2Callback caller, String query, int page, int pageSize, void search(IMediaController2 caller, String query, in Bundle extras); void getSearchResult(IMediaController2 caller, String query, int page, int pageSize, in Bundle extras); void subscribe(IMediaSession2Callback caller, String parentId, in Bundle extras); void unsubscribe(IMediaSession2Callback caller, String parentId); void subscribe(IMediaController2 caller, String parentId, in Bundle extras); void unsubscribe(IMediaController2 caller, String parentId); } packages/MediaComponents/src/com/android/media/MediaController2Impl.java +23 −23 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class MediaController2Impl implements MediaController2Provider { private final Context mContext; private final Object mLock = new Object(); private final MediaSession2CallbackStub mSessionCallbackStub; private final MediaController2Stub mControllerStub; private final SessionToken2 mToken; private final ControllerCallback mCallback; private final Executor mCallbackExecutor; Loading Loading @@ -113,7 +113,7 @@ public class MediaController2Impl implements MediaController2Provider { throw new IllegalArgumentException("executor shouldn't be null"); } mContext = context; mSessionCallbackStub = new MediaSession2CallbackStub(this); mControllerStub = new MediaController2Stub(this); mToken = token; mCallback = callback; mCallbackExecutor = executor; Loading Loading @@ -194,7 +194,7 @@ public class MediaController2Impl implements MediaController2Provider { private void connectToSession(IMediaSession2 sessionBinder) { try { sessionBinder.connect(mSessionCallbackStub, mContext.getPackageName()); sessionBinder.connect(mControllerStub, mContext.getPackageName()); } catch (RemoteException e) { Log.w(TAG, "Failed to call connection request. Framework will retry" + " automatically"); Loading @@ -219,12 +219,12 @@ public class MediaController2Impl implements MediaController2Provider { } binder = mSessionBinder; mSessionBinder = null; mSessionCallbackStub.destroy(); mControllerStub.destroy(); } if (binder != null) { try { binder.asBinder().unlinkToDeath(mDeathRecipient, 0); binder.release(mSessionCallbackStub); binder.release(mControllerStub); } catch (RemoteException e) { // No-op. } Loading @@ -238,8 +238,8 @@ public class MediaController2Impl implements MediaController2Provider { return mSessionBinder; } MediaSession2CallbackStub getControllerStub() { return mSessionCallbackStub; MediaController2Stub getControllerStub() { return mControllerStub; } Executor getCallbackExecutor() { Loading Loading @@ -334,7 +334,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = mSessionBinder; if (binder != null) { try { binder.sendTransportControlCommand(mSessionCallbackStub, commandCode, args); binder.sendTransportControlCommand(mControllerStub, commandCode, args); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -357,7 +357,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME); if (binder != null) { try { binder.setVolumeTo(mSessionCallbackStub, value, flags); binder.setVolumeTo(mControllerStub, value, flags); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -372,7 +372,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME); if (binder != null) { try { binder.adjustVolume(mSessionCallbackStub, direction, flags); binder.adjustVolume(mControllerStub, direction, flags); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -389,7 +389,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromUri(mSessionCallbackStub, uri, extras); binder.prepareFromUri(mControllerStub, uri, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -406,7 +406,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromSearch(mSessionCallbackStub, query, extras); binder.prepareFromSearch(mControllerStub, query, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -423,7 +423,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromMediaId(mSessionCallbackStub, mediaId, extras); binder.prepareFromMediaId(mControllerStub, mediaId, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -440,7 +440,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromUri(mSessionCallbackStub, uri, extras); binder.playFromUri(mControllerStub, uri, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -457,7 +457,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromSearch(mSessionCallbackStub, query, extras); binder.playFromSearch(mControllerStub, query, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -474,7 +474,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromMediaId(mSessionCallbackStub, mediaId, extras); binder.playFromMediaId(mControllerStub, mediaId, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -495,7 +495,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = mSessionBinder; if (binder != null) { try { binder.setRating(mSessionCallbackStub, mediaId, rating.toBundle()); binder.setRating(mControllerStub, mediaId, rating.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -512,7 +512,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(command); if (binder != null) { try { binder.sendCustomCommand(mSessionCallbackStub, command.toBundle(), args, cb); binder.sendCustomCommand(mControllerStub, command.toBundle(), args, cb); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading Loading @@ -541,7 +541,7 @@ public class MediaController2Impl implements MediaController2Provider { } Bundle metadataBundle = (metadata == null) ? null : metadata.toBundle(); try { binder.setPlaylist(mSessionCallbackStub, bundleList, metadataBundle); binder.setPlaylist(mControllerStub, bundleList, metadataBundle); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -564,7 +564,7 @@ public class MediaController2Impl implements MediaController2Provider { if (binder != null) { Bundle metadataBundle = (metadata == null) ? null : metadata.toBundle(); try { binder.updatePlaylistMetadata(mSessionCallbackStub, metadataBundle); binder.updatePlaylistMetadata(mControllerStub, metadataBundle); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading Loading @@ -631,7 +631,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_ADD_ITEM); if (binder != null) { try { binder.addPlaylistItem(mSessionCallbackStub, index, item.toBundle()); binder.addPlaylistItem(mControllerStub, index, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -648,7 +648,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_REMOVE_ITEM); if (binder != null) { try { binder.removePlaylistItem(mSessionCallbackStub, item.toBundle()); binder.removePlaylistItem(mControllerStub, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -668,7 +668,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_REPLACE_ITEM); if (binder != null) { try { binder.replacePlaylistItem(mSessionCallbackStub, index, item.toBundle()); binder.replacePlaylistItem(mControllerStub, index, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading packages/MediaComponents/src/com/android/media/MediaSession2CallbackStub.java→packages/MediaComponents/src/com/android/media/MediaController2Stub.java +3 −3 Original line number Diff line number Diff line Loading @@ -38,13 +38,13 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { private static final String TAG = "MS2CallbackStub"; public class MediaController2Stub extends IMediaController2.Stub { private static final String TAG = "MediaController2Stub"; private static final boolean DEBUG = true; // TODO(jaewan): Change private final WeakReference<MediaController2Impl> mController; MediaSession2CallbackStub(MediaController2Impl controller) { MediaController2Stub(MediaController2Impl controller) { mController = new WeakReference<>(controller); } Loading Loading
packages/MediaComponents/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ LOCAL_PATH := $(call my-dir) ifneq ($(TARGET_BUILD_PDK),true) # Build MediaComponents only if this is not a PDK build. MediaComponents won't # build in PDK builds because frameworks/base/core/java is not available but # IMediaSession2.aidl and IMediaSession2Callback.aidl are using classes from # IMediaSession2.aidl and IMediaController2.aidl are using classes from # frameworks/base/core/java. include $(CLEAR_VARS) Loading
packages/MediaComponents/src/com/android/media/IMediaSession2Callback.aidl→packages/MediaComponents/src/com/android/media/IMediaController2.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -23,14 +23,14 @@ import android.os.ResultReceiver; import com.android.media.IMediaSession2; /** * Interface from MediaSession2 to MediaSession2Record. * Interface from MediaSession2 to MediaController2. * <p> * Keep this interface oneway. Otherwise a malicious app may implement fake version of this, * and holds calls from session to make session owner(s) frozen. */ // TODO(jaewan): (Post P) Handle when the playlist becomes too huge. // Note that ParcelledSliceList isn't a good idea for the purpose. (see: b/37493677) oneway interface IMediaSession2Callback { oneway interface IMediaController2 { void onPlaybackStateChanged(in Bundle state); void onPlaylistChanged(in List<Bundle> playlist, in Bundle metadata); void onPlaylistMetadataChanged(in Bundle metadata); Loading
packages/MediaComponents/src/com/android/media/IMediaSession2.aidl +27 −27 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import android.os.Bundle; import android.os.ResultReceiver; import android.net.Uri; import com.android.media.IMediaSession2Callback; import com.android.media.IMediaController2; /** * Interface to MediaSession2. * Interface from MediaController2 to MediaSession2. * <p> * Keep this interface oneway. Otherwise a malicious app may implement fake version of this, * and holds calls from session to make session owner(s) frozen. Loading @@ -37,44 +37,44 @@ oneway interface IMediaSession2 { // not to expose other methods to the controller whose connection wasn't accepted. // But this would be enough for now because it's the same as existing // MediaBrowser and MediaBrowserService. void connect(IMediaSession2Callback caller, String callingPackage); void release(IMediaSession2Callback caller); void connect(IMediaController2 caller, String callingPackage); void release(IMediaController2 caller); void setVolumeTo(IMediaSession2Callback caller, int value, int flags); void adjustVolume(IMediaSession2Callback caller, int direction, int flags); void setVolumeTo(IMediaController2 caller, int value, int flags); void adjustVolume(IMediaController2 caller, int direction, int flags); ////////////////////////////////////////////////////////////////////////////////////////////// // send command ////////////////////////////////////////////////////////////////////////////////////////////// void sendTransportControlCommand(IMediaSession2Callback caller, void sendTransportControlCommand(IMediaController2 caller, int commandCode, in Bundle args); void sendCustomCommand(IMediaSession2Callback caller, in Bundle command, in Bundle args, void sendCustomCommand(IMediaController2 caller, in Bundle command, in Bundle args, in ResultReceiver receiver); void prepareFromUri(IMediaSession2Callback caller, in Uri uri, in Bundle extras); void prepareFromSearch(IMediaSession2Callback caller, String query, in Bundle extras); void prepareFromMediaId(IMediaSession2Callback caller, String mediaId, in Bundle extras); void playFromUri(IMediaSession2Callback caller, in Uri uri, in Bundle extras); void playFromSearch(IMediaSession2Callback caller, String query, in Bundle extras); void playFromMediaId(IMediaSession2Callback caller, String mediaId, in Bundle extras); void setRating(IMediaSession2Callback caller, String mediaId, in Bundle rating); void prepareFromUri(IMediaController2 caller, in Uri uri, in Bundle extras); void prepareFromSearch(IMediaController2 caller, String query, in Bundle extras); void prepareFromMediaId(IMediaController2 caller, String mediaId, in Bundle extras); void playFromUri(IMediaController2 caller, in Uri uri, in Bundle extras); void playFromSearch(IMediaController2 caller, String query, in Bundle extras); void playFromMediaId(IMediaController2 caller, String mediaId, in Bundle extras); void setRating(IMediaController2 caller, String mediaId, in Bundle rating); void setPlaylist(IMediaSession2Callback caller, in List<Bundle> playlist, in Bundle metadata); void updatePlaylistMetadata(IMediaSession2Callback caller, in Bundle metadata); void addPlaylistItem(IMediaSession2Callback caller, int index, in Bundle mediaItem); void removePlaylistItem(IMediaSession2Callback caller, in Bundle mediaItem); void replacePlaylistItem(IMediaSession2Callback caller, int index, in Bundle mediaItem); void setPlaylist(IMediaController2 caller, in List<Bundle> playlist, in Bundle metadata); void updatePlaylistMetadata(IMediaController2 caller, in Bundle metadata); void addPlaylistItem(IMediaController2 caller, int index, in Bundle mediaItem); void removePlaylistItem(IMediaController2 caller, in Bundle mediaItem); void replacePlaylistItem(IMediaController2 caller, int index, in Bundle mediaItem); ////////////////////////////////////////////////////////////////////////////////////////////// // library service specific ////////////////////////////////////////////////////////////////////////////////////////////// void getLibraryRoot(IMediaSession2Callback caller, in Bundle rootHints); void getItem(IMediaSession2Callback caller, String mediaId); void getChildren(IMediaSession2Callback caller, String parentId, int page, int pageSize, void getLibraryRoot(IMediaController2 caller, in Bundle rootHints); void getItem(IMediaController2 caller, String mediaId); void getChildren(IMediaController2 caller, String parentId, int page, int pageSize, in Bundle extras); void search(IMediaSession2Callback caller, String query, in Bundle extras); void getSearchResult(IMediaSession2Callback caller, String query, int page, int pageSize, void search(IMediaController2 caller, String query, in Bundle extras); void getSearchResult(IMediaController2 caller, String query, int page, int pageSize, in Bundle extras); void subscribe(IMediaSession2Callback caller, String parentId, in Bundle extras); void unsubscribe(IMediaSession2Callback caller, String parentId); void subscribe(IMediaController2 caller, String parentId, in Bundle extras); void unsubscribe(IMediaController2 caller, String parentId); }
packages/MediaComponents/src/com/android/media/MediaController2Impl.java +23 −23 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class MediaController2Impl implements MediaController2Provider { private final Context mContext; private final Object mLock = new Object(); private final MediaSession2CallbackStub mSessionCallbackStub; private final MediaController2Stub mControllerStub; private final SessionToken2 mToken; private final ControllerCallback mCallback; private final Executor mCallbackExecutor; Loading Loading @@ -113,7 +113,7 @@ public class MediaController2Impl implements MediaController2Provider { throw new IllegalArgumentException("executor shouldn't be null"); } mContext = context; mSessionCallbackStub = new MediaSession2CallbackStub(this); mControllerStub = new MediaController2Stub(this); mToken = token; mCallback = callback; mCallbackExecutor = executor; Loading Loading @@ -194,7 +194,7 @@ public class MediaController2Impl implements MediaController2Provider { private void connectToSession(IMediaSession2 sessionBinder) { try { sessionBinder.connect(mSessionCallbackStub, mContext.getPackageName()); sessionBinder.connect(mControllerStub, mContext.getPackageName()); } catch (RemoteException e) { Log.w(TAG, "Failed to call connection request. Framework will retry" + " automatically"); Loading @@ -219,12 +219,12 @@ public class MediaController2Impl implements MediaController2Provider { } binder = mSessionBinder; mSessionBinder = null; mSessionCallbackStub.destroy(); mControllerStub.destroy(); } if (binder != null) { try { binder.asBinder().unlinkToDeath(mDeathRecipient, 0); binder.release(mSessionCallbackStub); binder.release(mControllerStub); } catch (RemoteException e) { // No-op. } Loading @@ -238,8 +238,8 @@ public class MediaController2Impl implements MediaController2Provider { return mSessionBinder; } MediaSession2CallbackStub getControllerStub() { return mSessionCallbackStub; MediaController2Stub getControllerStub() { return mControllerStub; } Executor getCallbackExecutor() { Loading Loading @@ -334,7 +334,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = mSessionBinder; if (binder != null) { try { binder.sendTransportControlCommand(mSessionCallbackStub, commandCode, args); binder.sendTransportControlCommand(mControllerStub, commandCode, args); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -357,7 +357,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME); if (binder != null) { try { binder.setVolumeTo(mSessionCallbackStub, value, flags); binder.setVolumeTo(mControllerStub, value, flags); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -372,7 +372,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME); if (binder != null) { try { binder.adjustVolume(mSessionCallbackStub, direction, flags); binder.adjustVolume(mControllerStub, direction, flags); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -389,7 +389,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromUri(mSessionCallbackStub, uri, extras); binder.prepareFromUri(mControllerStub, uri, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -406,7 +406,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromSearch(mSessionCallbackStub, query, extras); binder.prepareFromSearch(mControllerStub, query, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -423,7 +423,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.prepareFromMediaId(mSessionCallbackStub, mediaId, extras); binder.prepareFromMediaId(mControllerStub, mediaId, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -440,7 +440,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromUri(mSessionCallbackStub, uri, extras); binder.playFromUri(mControllerStub, uri, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -457,7 +457,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromSearch(mSessionCallbackStub, query, extras); binder.playFromSearch(mControllerStub, query, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -474,7 +474,7 @@ public class MediaController2Impl implements MediaController2Provider { } if (binder != null) { try { binder.playFromMediaId(mSessionCallbackStub, mediaId, extras); binder.playFromMediaId(mControllerStub, mediaId, extras); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -495,7 +495,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = mSessionBinder; if (binder != null) { try { binder.setRating(mSessionCallbackStub, mediaId, rating.toBundle()); binder.setRating(mControllerStub, mediaId, rating.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -512,7 +512,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(command); if (binder != null) { try { binder.sendCustomCommand(mSessionCallbackStub, command.toBundle(), args, cb); binder.sendCustomCommand(mControllerStub, command.toBundle(), args, cb); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading Loading @@ -541,7 +541,7 @@ public class MediaController2Impl implements MediaController2Provider { } Bundle metadataBundle = (metadata == null) ? null : metadata.toBundle(); try { binder.setPlaylist(mSessionCallbackStub, bundleList, metadataBundle); binder.setPlaylist(mControllerStub, bundleList, metadataBundle); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -564,7 +564,7 @@ public class MediaController2Impl implements MediaController2Provider { if (binder != null) { Bundle metadataBundle = (metadata == null) ? null : metadata.toBundle(); try { binder.updatePlaylistMetadata(mSessionCallbackStub, metadataBundle); binder.updatePlaylistMetadata(mControllerStub, metadataBundle); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading Loading @@ -631,7 +631,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_ADD_ITEM); if (binder != null) { try { binder.addPlaylistItem(mSessionCallbackStub, index, item.toBundle()); binder.addPlaylistItem(mControllerStub, index, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -648,7 +648,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_REMOVE_ITEM); if (binder != null) { try { binder.removePlaylistItem(mSessionCallbackStub, item.toBundle()); binder.removePlaylistItem(mControllerStub, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading @@ -668,7 +668,7 @@ public class MediaController2Impl implements MediaController2Provider { final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYLIST_REPLACE_ITEM); if (binder != null) { try { binder.replacePlaylistItem(mSessionCallbackStub, index, item.toBundle()); binder.replacePlaylistItem(mControllerStub, index, item.toBundle()); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to the service or the session is gone", e); } Loading
packages/MediaComponents/src/com/android/media/MediaSession2CallbackStub.java→packages/MediaComponents/src/com/android/media/MediaController2Stub.java +3 −3 Original line number Diff line number Diff line Loading @@ -38,13 +38,13 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub { private static final String TAG = "MS2CallbackStub"; public class MediaController2Stub extends IMediaController2.Stub { private static final String TAG = "MediaController2Stub"; private static final boolean DEBUG = true; // TODO(jaewan): Change private final WeakReference<MediaController2Impl> mController; MediaSession2CallbackStub(MediaController2Impl controller) { MediaController2Stub(MediaController2Impl controller) { mController = new WeakReference<>(controller); } Loading