Loading packages/MediaComponents/src/com/android/media/IMediaSession2.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ oneway interface IMediaSession2 { ////////////////////////////////////////////////////////////////////////////////////////////// // library service specific ////////////////////////////////////////////////////////////////////////////////////////////// void getBrowserRoot(IMediaSession2Callback caller, in Bundle rootHints); void getLibraryRoot(IMediaSession2Callback caller, in Bundle rootHints); void getItem(IMediaSession2Callback caller, String mediaId); void getChildren(IMediaSession2Callback caller, String parentId, int page, int pageSize, in Bundle extras); Loading packages/MediaComponents/src/com/android/media/MediaBrowser2Impl.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { binder.getBrowserRoot(getControllerStub(), rootHints); binder.getLibraryRoot(getControllerStub(), rootHints); } catch (RemoteException e) { // TODO(jaewan): Handle disconnect. if (DEBUG) { Loading packages/MediaComponents/src/com/android/media/MediaLibraryService2Impl.java +3 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,8 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement VolumeProvider2 volumeProvider, PendingIntent sessionActivity, Executor callbackExecutor, MediaLibrarySessionCallback callback) { super(context, player, id, playlistAgent, volumeProvider, sessionActivity, callbackExecutor, callback); super(context, player, id, playlistAgent, volumeProvider, sessionActivity, callbackExecutor, callback); // Don't put any extra initialization here. Here's the reason. // System service will recognize this session inside of the super constructor and would // connect to this session assuming that initialization is finished. However, if any Loading Loading @@ -154,8 +154,7 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement public LibraryRootImpl(Context context, LibraryRoot instance, String rootId, Bundle extras) { if (rootId == null) { throw new IllegalArgumentException("The root id in BrowserRoot cannot be null. " + "Use null for BrowserRoot instead."); throw new IllegalArgumentException("rootId shouldn't be null."); } mInstance = instance; mRootId = rootId; Loading packages/MediaComponents/src/com/android/media/MediaMetadata2Impl.java +43 −2 Original line number Diff line number Diff line Loading @@ -123,11 +123,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public boolean containsKey_impl(String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.containsKey(key); } @Override public CharSequence getText_impl(@TextKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getCharSequence(key); } Loading @@ -138,6 +144,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public String getString_impl(@TextKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } CharSequence text = mBundle.getCharSequence(key); if (text != null) { return text.toString(); Loading @@ -147,11 +156,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public long getLong_impl(@LongKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getLong(key, 0); } @Override public Rating2 getRating_impl(@RatingKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } // TODO(jaewan): Add backward compatibility Rating2 rating = null; try { Loading @@ -165,11 +180,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public float getFloat_impl(@FloatKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getFloat(key); } @Override public Bitmap getBitmap_impl(@BitmapKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } Bitmap bmp = null; try { bmp = mBundle.getParcelable(key); Loading Loading @@ -221,7 +242,8 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { mBundle = new Bundle(); } public BuilderImpl(Context context, MediaMetadata2.Builder instance, MediaMetadata2 source) { public BuilderImpl(Context context, MediaMetadata2.Builder instance, MediaMetadata2 source) { if (source == null) { throw new IllegalArgumentException("source shouldn't be null"); } Loading @@ -248,6 +270,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putText_impl(@TextKey String key, CharSequence value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_TEXT) { throw new IllegalArgumentException("The " + key Loading @@ -260,6 +285,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putString_impl(@TextKey String key, String value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_TEXT) { throw new IllegalArgumentException("The " + key Loading @@ -272,6 +300,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putLong_impl(@LongKey String key, long value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_LONG) { throw new IllegalArgumentException("The " + key Loading @@ -284,6 +315,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putRating_impl(@RatingKey String key, Rating2 value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_RATING) { throw new IllegalArgumentException("The " + key Loading @@ -296,6 +330,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putBitmap_impl(@BitmapKey String key, Bitmap value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_BITMAP) { throw new IllegalArgumentException("The " + key Loading @@ -308,6 +345,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putFloat_impl(@FloatKey String key, float value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_FLOAT) { throw new IllegalArgumentException("The " + key Loading @@ -329,7 +369,8 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { return new MediaMetadata2Impl(mContext, mBundle).getInstance(); } private Bitmap scaleBitmap(Bitmap bmp, int maxSize) { float maxSizeF = maxSize; private Bitmap scaleBitmap(Bitmap bmp, int maxSize) { float maxSizeF = maxSize; float widthScale = maxSizeF / bmp.getWidth(); float heightScale = maxSizeF / bmp.getHeight(); float scale = Math.min(widthScale, heightScale); Loading packages/MediaComponents/src/com/android/media/MediaSession2Impl.java +57 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.media.AudioAttributes; import android.media.AudioFocusRequest; import android.media.AudioManager; import android.media.DataSourceDesc; import android.media.MediaController2; Loading Loading @@ -346,7 +347,7 @@ public class MediaSession2Impl implements MediaSession2Provider { } @Override public void setAudioFocusRequest_impl(int focusGain) { public void setAudioFocusRequest_impl(AudioFocusRequest afr) { // implement } Loading Loading @@ -477,11 +478,20 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void sendCustomCommand_impl(ControllerInfo controller, Command command, Bundle args, ResultReceiver receiver) { if (controller == null) { throw new IllegalArgumentException("controller shouldn't be null"); } if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mSessionStub.sendCustomCommand(controller, command, args, receiver); } @Override public void sendCustomCommand_impl(Command command, Bundle args) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mSessionStub.sendCustomCommand(command, args); } Loading @@ -506,21 +516,39 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void addPlaylistItem_impl(int index, MediaItem2 item) { if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void removePlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void editPlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void replacePlaylistItem_impl(int index, MediaItem2 item) { if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } Loading Loading @@ -603,6 +631,9 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void skipToPlaylistItem_impl(MediaItem2 item) { ensureCallingThread(); if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO: Uncomment or remove /* final MediaPlayerBase player = mPlayer; Loading Loading @@ -887,6 +918,9 @@ public class MediaSession2Impl implements MediaSession2Provider { * @return a new Command instance from the Bundle */ public static Command fromBundle_impl(Context context, Bundle command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } int code = command.getInt(KEY_COMMAND_CODE); if (code != COMMAND_CODE_CUSTOM) { return new Command(context, code); Loading Loading @@ -939,6 +973,9 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void addCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mCommands.add(command); } Loading @@ -951,11 +988,17 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void removeCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mCommands.remove(command); } @Override public boolean hasCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } return mCommands.contains(command); } Loading Loading @@ -1029,6 +1072,13 @@ public class MediaSession2Impl implements MediaSession2Provider { public ControllerInfoImpl(Context context, ControllerInfo instance, int uid, int pid, String packageName, IMediaSession2Callback callback) { if (TextUtils.isEmpty(packageName)) { throw new IllegalArgumentException("packageName shouldn't be empty"); } if (callback == null) { throw new IllegalArgumentException("callback shouldn't be null"); } mInstance = instance; mUid = uid; mPackageName = packageName; Loading Loading @@ -1351,6 +1401,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mId = ""; } @Override public void setPlayer_impl(MediaPlayerBase player) { if (player == null) { throw new IllegalArgumentException("player shouldn't be null"); Loading @@ -1366,17 +1417,17 @@ public class MediaSession2Impl implements MediaSession2Provider { mPlaylistAgent = playlistAgent; } @Override public void setVolumeProvider_impl(VolumeProvider2 volumeProvider) { if (volumeProvider == null) { throw new IllegalArgumentException("volumeProvider shouldn't be null"); } mVolumeProvider = volumeProvider; } @Override public void setSessionActivity_impl(PendingIntent pi) { mSessionActivity = pi; } @Override public void setId_impl(String id) { if (id == null) { throw new IllegalArgumentException("id shouldn't be null"); Loading @@ -1384,6 +1435,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mId = id; } @Override public void setSessionCallback_impl(Executor executor, C callback) { if (executor == null) { throw new IllegalArgumentException("executor shouldn't be null"); Loading @@ -1395,6 +1447,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mCallback = callback; } @Override public abstract T build_impl(); } Loading @@ -1411,7 +1464,6 @@ public class MediaSession2Impl implements MediaSession2Provider { if (mCallback == null) { mCallback = new SessionCallback(mContext) {}; } return new MediaSession2Impl(mContext, mPlayer, mId, mPlaylistAgent, mVolumeProvider, mSessionActivity, mCallbackExecutor, mCallback).getInstance(); } Loading Loading
packages/MediaComponents/src/com/android/media/IMediaSession2.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ oneway interface IMediaSession2 { ////////////////////////////////////////////////////////////////////////////////////////////// // library service specific ////////////////////////////////////////////////////////////////////////////////////////////// void getBrowserRoot(IMediaSession2Callback caller, in Bundle rootHints); void getLibraryRoot(IMediaSession2Callback caller, in Bundle rootHints); void getItem(IMediaSession2Callback caller, String mediaId); void getChildren(IMediaSession2Callback caller, String parentId, int page, int pageSize, in Bundle extras); Loading
packages/MediaComponents/src/com/android/media/MediaBrowser2Impl.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow final IMediaSession2 binder = getSessionBinder(); if (binder != null) { try { binder.getBrowserRoot(getControllerStub(), rootHints); binder.getLibraryRoot(getControllerStub(), rootHints); } catch (RemoteException e) { // TODO(jaewan): Handle disconnect. if (DEBUG) { Loading
packages/MediaComponents/src/com/android/media/MediaLibraryService2Impl.java +3 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,8 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement VolumeProvider2 volumeProvider, PendingIntent sessionActivity, Executor callbackExecutor, MediaLibrarySessionCallback callback) { super(context, player, id, playlistAgent, volumeProvider, sessionActivity, callbackExecutor, callback); super(context, player, id, playlistAgent, volumeProvider, sessionActivity, callbackExecutor, callback); // Don't put any extra initialization here. Here's the reason. // System service will recognize this session inside of the super constructor and would // connect to this session assuming that initialization is finished. However, if any Loading Loading @@ -154,8 +154,7 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement public LibraryRootImpl(Context context, LibraryRoot instance, String rootId, Bundle extras) { if (rootId == null) { throw new IllegalArgumentException("The root id in BrowserRoot cannot be null. " + "Use null for BrowserRoot instead."); throw new IllegalArgumentException("rootId shouldn't be null."); } mInstance = instance; mRootId = rootId; Loading
packages/MediaComponents/src/com/android/media/MediaMetadata2Impl.java +43 −2 Original line number Diff line number Diff line Loading @@ -123,11 +123,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public boolean containsKey_impl(String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.containsKey(key); } @Override public CharSequence getText_impl(@TextKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getCharSequence(key); } Loading @@ -138,6 +144,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public String getString_impl(@TextKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } CharSequence text = mBundle.getCharSequence(key); if (text != null) { return text.toString(); Loading @@ -147,11 +156,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public long getLong_impl(@LongKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getLong(key, 0); } @Override public Rating2 getRating_impl(@RatingKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } // TODO(jaewan): Add backward compatibility Rating2 rating = null; try { Loading @@ -165,11 +180,17 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public float getFloat_impl(@FloatKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } return mBundle.getFloat(key); } @Override public Bitmap getBitmap_impl(@BitmapKey String key) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } Bitmap bmp = null; try { bmp = mBundle.getParcelable(key); Loading Loading @@ -221,7 +242,8 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { mBundle = new Bundle(); } public BuilderImpl(Context context, MediaMetadata2.Builder instance, MediaMetadata2 source) { public BuilderImpl(Context context, MediaMetadata2.Builder instance, MediaMetadata2 source) { if (source == null) { throw new IllegalArgumentException("source shouldn't be null"); } Loading @@ -248,6 +270,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putText_impl(@TextKey String key, CharSequence value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_TEXT) { throw new IllegalArgumentException("The " + key Loading @@ -260,6 +285,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putString_impl(@TextKey String key, String value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_TEXT) { throw new IllegalArgumentException("The " + key Loading @@ -272,6 +300,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putLong_impl(@LongKey String key, long value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_LONG) { throw new IllegalArgumentException("The " + key Loading @@ -284,6 +315,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putRating_impl(@RatingKey String key, Rating2 value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_RATING) { throw new IllegalArgumentException("The " + key Loading @@ -296,6 +330,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putBitmap_impl(@BitmapKey String key, Bitmap value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_BITMAP) { throw new IllegalArgumentException("The " + key Loading @@ -308,6 +345,9 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { @Override public Builder putFloat_impl(@FloatKey String key, float value) { if (key == null) { throw new IllegalArgumentException("key shouldn't be null"); } if (METADATA_KEYS_TYPE.containsKey(key)) { if (METADATA_KEYS_TYPE.get(key) != METADATA_TYPE_FLOAT) { throw new IllegalArgumentException("The " + key Loading @@ -329,7 +369,8 @@ public class MediaMetadata2Impl implements MediaMetadata2Provider { return new MediaMetadata2Impl(mContext, mBundle).getInstance(); } private Bitmap scaleBitmap(Bitmap bmp, int maxSize) { float maxSizeF = maxSize; private Bitmap scaleBitmap(Bitmap bmp, int maxSize) { float maxSizeF = maxSize; float widthScale = maxSizeF / bmp.getWidth(); float heightScale = maxSizeF / bmp.getHeight(); float scale = Math.min(widthScale, heightScale); Loading
packages/MediaComponents/src/com/android/media/MediaSession2Impl.java +57 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.media.AudioAttributes; import android.media.AudioFocusRequest; import android.media.AudioManager; import android.media.DataSourceDesc; import android.media.MediaController2; Loading Loading @@ -346,7 +347,7 @@ public class MediaSession2Impl implements MediaSession2Provider { } @Override public void setAudioFocusRequest_impl(int focusGain) { public void setAudioFocusRequest_impl(AudioFocusRequest afr) { // implement } Loading Loading @@ -477,11 +478,20 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void sendCustomCommand_impl(ControllerInfo controller, Command command, Bundle args, ResultReceiver receiver) { if (controller == null) { throw new IllegalArgumentException("controller shouldn't be null"); } if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mSessionStub.sendCustomCommand(controller, command, args, receiver); } @Override public void sendCustomCommand_impl(Command command, Bundle args) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mSessionStub.sendCustomCommand(command, args); } Loading @@ -506,21 +516,39 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void addPlaylistItem_impl(int index, MediaItem2 item) { if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void removePlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void editPlaylistItem_impl(MediaItem2 item) { if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } @Override public void replacePlaylistItem_impl(int index, MediaItem2 item) { if (index < 0) { throw new IllegalArgumentException("index shouldn't be negative"); } if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO(jaewan): Implement } Loading Loading @@ -603,6 +631,9 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void skipToPlaylistItem_impl(MediaItem2 item) { ensureCallingThread(); if (item == null) { throw new IllegalArgumentException("item shouldn't be null"); } // TODO: Uncomment or remove /* final MediaPlayerBase player = mPlayer; Loading Loading @@ -887,6 +918,9 @@ public class MediaSession2Impl implements MediaSession2Provider { * @return a new Command instance from the Bundle */ public static Command fromBundle_impl(Context context, Bundle command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } int code = command.getInt(KEY_COMMAND_CODE); if (code != COMMAND_CODE_CUSTOM) { return new Command(context, code); Loading Loading @@ -939,6 +973,9 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void addCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mCommands.add(command); } Loading @@ -951,11 +988,17 @@ public class MediaSession2Impl implements MediaSession2Provider { @Override public void removeCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } mCommands.remove(command); } @Override public boolean hasCommand_impl(Command command) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } return mCommands.contains(command); } Loading Loading @@ -1029,6 +1072,13 @@ public class MediaSession2Impl implements MediaSession2Provider { public ControllerInfoImpl(Context context, ControllerInfo instance, int uid, int pid, String packageName, IMediaSession2Callback callback) { if (TextUtils.isEmpty(packageName)) { throw new IllegalArgumentException("packageName shouldn't be empty"); } if (callback == null) { throw new IllegalArgumentException("callback shouldn't be null"); } mInstance = instance; mUid = uid; mPackageName = packageName; Loading Loading @@ -1351,6 +1401,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mId = ""; } @Override public void setPlayer_impl(MediaPlayerBase player) { if (player == null) { throw new IllegalArgumentException("player shouldn't be null"); Loading @@ -1366,17 +1417,17 @@ public class MediaSession2Impl implements MediaSession2Provider { mPlaylistAgent = playlistAgent; } @Override public void setVolumeProvider_impl(VolumeProvider2 volumeProvider) { if (volumeProvider == null) { throw new IllegalArgumentException("volumeProvider shouldn't be null"); } mVolumeProvider = volumeProvider; } @Override public void setSessionActivity_impl(PendingIntent pi) { mSessionActivity = pi; } @Override public void setId_impl(String id) { if (id == null) { throw new IllegalArgumentException("id shouldn't be null"); Loading @@ -1384,6 +1435,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mId = id; } @Override public void setSessionCallback_impl(Executor executor, C callback) { if (executor == null) { throw new IllegalArgumentException("executor shouldn't be null"); Loading @@ -1395,6 +1447,7 @@ public class MediaSession2Impl implements MediaSession2Provider { mCallback = callback; } @Override public abstract T build_impl(); } Loading @@ -1411,7 +1464,6 @@ public class MediaSession2Impl implements MediaSession2Provider { if (mCallback == null) { mCallback = new SessionCallback(mContext) {}; } return new MediaSession2Impl(mContext, mPlayer, mId, mPlaylistAgent, mVolumeProvider, mSessionActivity, mCallbackExecutor, mCallback).getInstance(); } Loading