diff options
author | 2018-03-05 05:44:41 +0000 | |
---|---|---|
committer | 2018-03-05 05:44:41 +0000 | |
commit | 999e97f405b8f01b12a6fb8e844d33dc807813fa (patch) | |
tree | a2115956b3301bbe1b144fbc797c35c5c982fca7 | |
parent | 076eebfb3d5c2db573972817a6ef587237975d07 (diff) | |
parent | d4ef7b96ed08f374537f1d506d728a8bfe0a1caa (diff) |
Merge "MediaController2: Ensure NonNull for parameters of public methods"
-rw-r--r-- | media/java/android/media/MediaBrowser2.java | 11 | ||||
-rw-r--r-- | media/java/android/media/MediaController2.java | 53 | ||||
-rw-r--r-- | media/java/android/media/update/MediaController2Provider.java | 2 |
3 files changed, 31 insertions, 35 deletions
diff --git a/media/java/android/media/MediaBrowser2.java b/media/java/android/media/MediaBrowser2.java index 35edc4afe24e..cf3395858534 100644 --- a/media/java/android/media/MediaBrowser2.java +++ b/media/java/android/media/MediaBrowser2.java @@ -153,7 +153,7 @@ public class MediaBrowser2 extends MediaController2 { * @param rootHints hint for the root * @see BrowserCallback#onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle) */ - public void getLibraryRoot(Bundle rootHints) { + public void getLibraryRoot(@Nullable Bundle rootHints) { mProvider.getLibraryRoot_impl(rootHints); } @@ -166,7 +166,7 @@ public class MediaBrowser2 extends MediaController2 { * @param parentId parent id * @param extras extra bundle */ - public void subscribe(String parentId, @Nullable Bundle extras) { + public void subscribe(@NonNull String parentId, @Nullable Bundle extras) { mProvider.subscribe_impl(parentId, extras); } @@ -179,7 +179,7 @@ public class MediaBrowser2 extends MediaController2 { * * @param parentId parent id */ - public void unsubscribe(String parentId) { + public void unsubscribe(@NonNull String parentId) { mProvider.unsubscribe_impl(parentId); } @@ -192,7 +192,8 @@ public class MediaBrowser2 extends MediaController2 { * @param pageSize page size. Should be greater or equal to {@code 1} * @param extras extra bundle */ - public void getChildren(String parentId, int page, int pageSize, @Nullable Bundle extras) { + public void getChildren(@NonNull String parentId, int page, int pageSize, + @Nullable Bundle extras) { mProvider.getChildren_impl(parentId, page, pageSize, extras); } @@ -202,7 +203,7 @@ public class MediaBrowser2 extends MediaController2 { * * @param mediaId media id for specifying the item */ - public void getItem(String mediaId) { + public void getItem(@NonNull String mediaId) { mProvider.getItem_impl(mediaId); } diff --git a/media/java/android/media/MediaController2.java b/media/java/android/media/MediaController2.java index da2b8e08b6a3..df7b5afc83e3 100644 --- a/media/java/android/media/MediaController2.java +++ b/media/java/android/media/MediaController2.java @@ -144,9 +144,9 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * * @param controller the controller for this event * @param playlist A new playlist set by the session. - * @see #onPositionChanged(long, long) - * @see #onBufferedPositionChanged(long) - * @see #onCurrentPlaylistItemChanged(MediaItem2) + * @see #onPositionChanged(MediaController2, long, long) + * @see #onBufferedPositionChanged(MediaController2, long) + * @see #onCurrentPlaylistItemChanged(MediaController2, MediaItem2) */ public void onPlaylistChanged(@NonNull MediaController2 controller, @NonNull List<MediaItem2> playlist) { } @@ -216,9 +216,9 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * * @param controller the controller for this event * @param item new item - * @see #onPositionChanged(long, long) - * @see #onBufferedPositionChanged(long) - * @see #onCurrentPlaylistItemChanged(MediaItem2) + * @see #onPositionChanged(MediaController2, long, long) + * @see #onBufferedPositionChanged(MediaController2, long) + * @see #onCurrentPlaylistItemChanged(MediaController2, MediaItem2) */ public void onCurrentPlaylistItemChanged(@NonNull MediaController2 controller, @NonNull MediaItem2 item) { } @@ -325,8 +325,8 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController private final MediaController2Provider mProvider; /** - * Create a {@link MediaController2} from the {@link SessionToken2}. This connects to the session - * and may wake up the service if it's not available. + * Create a {@link MediaController2} from the {@link SessionToken2}. + * This connects to the session and may wake up the service if it's not available. * * @param context Context * @param token token to connect to @@ -372,8 +372,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * @return token */ - public @NonNull - SessionToken2 getSessionToken() { + public @NonNull SessionToken2 getSessionToken() { return mProvider.getSessionToken_impl(); } @@ -408,8 +407,8 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * Request that the player prepare its playback. In other words, other sessions can continue * to play during the preparation of this session. This method can be used to speed up the * start of the playback. Once the preparation is done, the session will change its playback - * state to {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. Afterwards, {@link #play} can be called to - * start playback. + * state to {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. Afterwards, {@link #play} can be called + * to start playback. */ public void prepare() { mProvider.prepare_impl(); @@ -490,12 +489,9 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * Request that the player start playback for a specific search query. - * An empty or null query should be treated as a request to play any - * music. * - * @param query The search query. - * @param extras Optional extras that can include extra information - * about the query. + * @param query The search query. Should not be an empty string. + * @param extras Optional extras that can include extra information about the query. */ public void playFromSearch(@NonNull String query, @Nullable Bundle extras) { mProvider.playFromSearch_impl(query, extras); @@ -525,21 +521,20 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * to be prepared. */ public void prepareFromMediaId(@NonNull String mediaId, @Nullable Bundle extras) { - mProvider.prepareMediaId_impl(mediaId, extras); + mProvider.prepareFromMediaId_impl(mediaId, extras); } /** - * Request that the player prepare playback for a specific search query. An empty or null - * query should be treated as a request to prepare any music. In other words, other sessions - * can continue to play during the preparation of this session. This method can be used to - * speed up the start of the playback. Once the preparation is done, the session will - * change its playback state to {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. Afterwards, + * Request that the player prepare playback for a specific search query. + * In other words, other sessions can continue to play during the preparation of this session. + * This method can be used to speed up the start of the playback. + * Once the preparation is done, the session will change its playback state to + * {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. Afterwards, * {@link #play} can be called to start playback. If the preparation is not needed, * {@link #playFromSearch} can be directly called without this method. * - * @param query The search query. - * @param extras Optional extras that can include extra information - * about the query. + * @param query The search query. Should not be an empty string. + * @param extras Optional extras that can include extra information about the query. */ public void prepareFromSearch(@NonNull String query, @Nullable Bundle extras) { mProvider.prepareFromSearch_impl(query, extras); @@ -549,8 +544,8 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * Request that the player prepare playback for a specific {@link Uri}. In other words, * other sessions can continue to play during the preparation of this session. This method * can be used to speed up the start of the playback. Once the preparation is done, the - * session will change its playback state to {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. Afterwards, - * {@link #play} can be called to start playback. If the preparation is not needed, + * session will change its playback state to {@link MediaPlayerBase#PLAYER_STATE_PAUSED}. + * Afterwards, {@link #play} can be called to start playback. If the preparation is not needed, * {@link #playFromUri} can be directly called without this method. * * @param uri The URI of the requested media. @@ -708,7 +703,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * @param mediaId The id of the media * @param rating The rating to set */ - public void setRating(String mediaId, Rating2 rating) { + public void setRating(@NonNull String mediaId, @NonNull Rating2 rating) { mProvider.setRating_impl(mediaId, rating); } diff --git a/media/java/android/media/update/MediaController2Provider.java b/media/java/android/media/update/MediaController2Provider.java index 8d036be2c3aa..b3d4e0cc2de1 100644 --- a/media/java/android/media/update/MediaController2Provider.java +++ b/media/java/android/media/update/MediaController2Provider.java @@ -50,7 +50,7 @@ public interface MediaController2Provider extends TransportControlProvider { void prepareFromUri_impl(Uri uri, Bundle extras); void prepareFromSearch_impl(String query, Bundle extras); - void prepareMediaId_impl(String mediaId, Bundle extras); + void prepareFromMediaId_impl(String mediaId, Bundle extras); void playFromSearch_impl(String query, Bundle extras); void playFromUri_impl(Uri uri, Bundle extras); void playFromMediaId_impl(String mediaId, Bundle extras); |