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

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

MediaController2: Implement setRating()

Bug: 73146284
Test: Passed MediaController2Test
Change-Id: Iaff4f5b58d0bbd7105a39763cd6fee7c6c621df8
parent 8dc8a59f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -570,14 +570,14 @@ public class MediaController2 implements AutoCloseable {
    }

    /**
     * Rate the current content. This will cause the rating to be set for
     * the current user. The Rating type must match the type returned by
     * {@link #getRatingType()}.
     * Rate the media. This will cause the rating to be set for the current user.
     * The Rating type must match the type returned by {@link #getRatingType()}.
     *
     * @param rating The rating to set for the current content
     * @param mediaId The id of the media
     * @param rating The rating to set
     */
    public void setRating(Rating2 rating) {
        mProvider.setRating_impl(rating);
    public void setRating(String mediaId, Rating2 rating) {
        mProvider.setRating_impl(mediaId, rating);
    }

    /**
+5 −3
Original line number Diff line number Diff line
@@ -452,13 +452,15 @@ public class MediaSession2 implements AutoCloseable {
        }

        /**
         * Called when a controller set rating on the currently playing contents by
         * {@link MediaController2#setRating(Rating2)}.
         * Called when a controller set rating of a media item through
         * {@link MediaController2#setRating(String, Rating2)}.
         *
         * @param controller controller information
         * @param mediaId media id from the controller
         * @param rating new rating from the controller
         */
        public void onSetRating(@NonNull ControllerInfo controller, @NonNull Rating2 rating) { }
        public void onSetRating(@NonNull ControllerInfo controller, @NonNull String mediaId,
                @NonNull Rating2 rating) { }

        /**
         * Called when a controller sent a custom command through
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public interface MediaController2Provider extends TransportControlProvider {
    void playFromUri_impl(Uri uri, Bundle extras);
    void playFromMediaId_impl(String mediaId, Bundle extras);

    void setRating_impl(Rating2 rating);
    void setRating_impl(String mediaId, Rating2 rating);
    void sendCustomCommand_impl(Command command, Bundle args, ResultReceiver cb);
    List<MediaItem2> getPlaylist_impl();