Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4ef7b96 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

MediaController2: Ensure NonNull for parameters of public methods

Bug: 73863865
Test: Passed MediaBrowser2Test
Change-Id: I65cd43045f4e7b9f16b8cf3f43688815e59dc643
parent 3a4f974c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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);
    }

+24 −29
Original line number Diff line number Diff line
@@ -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);
    }

+1 −1
Original line number Diff line number Diff line
@@ -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);