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

Commit 38696ba7 authored by RoboErik's avatar RoboErik
Browse files

Set the metadata rating correctly in RCC

We weren't setting the ratings in the new MediaMetadata from RCC.
This adds some code to set them correctly.

bug:18051829
Change-Id: I358eeb2b25b3fb9bd9a5d207eb3314bb2cdff25e
parent 040d89bb
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -535,6 +535,21 @@ import java.lang.IllegalArgumentException;
            return this;
        }

        @Override
        public synchronized MetadataEditor putObject(int key, Object object)
                throws IllegalArgumentException {
            super.putObject(key, object);
            if (mMetadataBuilder != null &&
                    (key == MediaMetadataEditor.RATING_KEY_BY_USER ||
                    key == MediaMetadataEditor.RATING_KEY_BY_OTHERS)) {
                String metadataKey = MediaMetadata.getKeyFromMetadataEditorKey(key);
                if (metadataKey != null) {
                    mMetadataBuilder.putRating(metadataKey, (Rating) object);
                }
            }
            return this;
        }

        /**
         * Clears all the metadata that has been set since the MetadataEditor instance was created
         * (with {@link RemoteControlClient#editMetadata(boolean)}).