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

Commit bdf077bd authored by Hyundo Moon's avatar Hyundo Moon Committed by Jaewan Kim
Browse files

MediaSession2: Remove rating style from session

Bug: 73615699
Test: Passed MediaController2Test
Change-Id: Icc35bf982e0943ba7586003bf30dd6dfa90d747e
parent efee606e
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
@@ -520,24 +520,6 @@ public class MediaController2 implements AutoCloseable {
        mProvider.adjustVolume_impl(direction, flags);
    }

    /**
     * Get the rating type supported by the session. One of:
     * <ul>
     * <li>{@link Rating2#RATING_NONE}</li>
     * <li>{@link Rating2#RATING_HEART}</li>
     * <li>{@link Rating2#RATING_THUMB_UP_DOWN}</li>
     * <li>{@link Rating2#RATING_3_STARS}</li>
     * <li>{@link Rating2#RATING_4_STARS}</li>
     * <li>{@link Rating2#RATING_5_STARS}</li>
     * <li>{@link Rating2#RATING_PERCENTAGE}</li>
     * </ul>
     *
     * @return The supported rating type
     */
    public int getRatingType() {
        return mProvider.getRatingType_impl();
    }

    /**
     * Get an intent for launching UI associated with this session if one exists.
     *
@@ -571,7 +553,12 @@ public class MediaController2 implements AutoCloseable {

    /**
     * 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()}.
     * The rating style must follow the user rating style from the session.
     * You can get the rating style from the session through the
     * {@link MediaMetadata#getRating(String)} with the key
     * {@link MediaMetadata#METADATA_KEY_USER_RATING}.
     * <p>
     * If the user rating was {@code null}, the media item does not accept setting user rating.
     *
     * @param mediaId The id of the media
     * @param rating The rating to set
+0 −5
Original line number Diff line number Diff line
@@ -251,11 +251,6 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
            return super.setVolumeProvider(volumeProvider);
        }

        @Override
        public MediaLibrarySessionBuilder setRatingType(int type) {
            return super.setRatingType(type);
        }

        @Override
        public MediaLibrarySessionBuilder setSessionActivity(@Nullable PendingIntent pi) {
            return super.setSessionActivity(pi);
+3 −0
Original line number Diff line number Diff line
@@ -436,6 +436,9 @@ public final class MediaMetadata2 {
    /**
     * Return a {@link Rating2} for the given key or null if no rating exists for
     * the given key.
     * <p>
     * For the {@link #METADATA_KEY_USER_RATING}, A {@code null} return value means that user rating
     * cannot be set by {@link MediaController2}.
     *
     * @param key The key the value is stored under
     * @return A {@link Rating2} or {@code null}
+6 −25
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ public class MediaSession2 implements AutoCloseable {
    // TODO(jaewan): Should we define IntDef? Currently we don't have to allow subclass to add more.
    // TODO(jaewan): Shouldn't we pull out?
    // TODO(jaewan): Should we also protect getters not related with metadata?
    //               Getters are getRatingType(), getPlaybackState(), getSessionActivity(),
    //               getPlaylistParams())
    //               Getters are getPlaybackState(), getSessionActivity(), getPlaylistParams()
    // Next ID: 23
    /**
     * Command code for the custom command which can be defined by string action in the
@@ -454,6 +453,11 @@ public class MediaSession2 implements AutoCloseable {
        /**
         * Called when a controller set rating of a media item through
         * {@link MediaController2#setRating(String, Rating2)}.
         * <p>
         * To allow setting user rating for a {@link MediaItem2}, the media item's metadata
         * should have {@link Rating2} with the key {@link MediaMetadata#METADATA_KEY_USER_RATING},
         * in order to provide possible rating style for controller. Controller will follow the
         * rating style.
         *
         * @param controller controller information
         * @param mediaId media id from the controller
@@ -620,24 +624,6 @@ public class MediaSession2 implements AutoCloseable {
            return (U) this;
        }

        /**
         * Set the style of rating used by this session. Apps trying to set the
         * rating should use this style. Must be one of the following:
         * <ul>
         * <li>{@link Rating2#RATING_NONE}</li>
         * <li>{@link Rating2#RATING_3_STARS}</li>
         * <li>{@link Rating2#RATING_4_STARS}</li>
         * <li>{@link Rating2#RATING_5_STARS}</li>
         * <li>{@link Rating2#RATING_HEART}</li>
         * <li>{@link Rating2#RATING_PERCENTAGE}</li>
         * <li>{@link Rating2#RATING_THUMB_UP_DOWN}</li>
         * </ul>
         */
        U setRatingType(@Rating2.Style int type) {
            mProvider.setRatingType_impl(type);
            return (U) this;
        }

        /**
         * Set an intent for launching UI for this Session. This can be used as a
         * quick link to an ongoing media screen. The intent should be for an
@@ -709,11 +695,6 @@ public class MediaSession2 implements AutoCloseable {
            return super.setVolumeProvider(volumeProvider);
        }

        @Override
        public Builder setRatingType(@Rating2.Style int type) {
            return super.setRatingType(type);
        }

        @Override
        public Builder setSessionActivity(@Nullable PendingIntent pi) {
            return super.setSessionActivity(pi);
+0 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ public interface MediaController2Provider extends TransportControlProvider {
    boolean isConnected_impl();

    PendingIntent getSessionActivity_impl();
    int getRatingType_impl();

    void setVolumeTo_impl(int value, int flags);
    void adjustVolume_impl(int direction, int flags);
Loading