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
This commit is contained in:
RoboErik
2014-10-20 09:48:13 -07:00
parent 040d89bb0a
commit 38696ba77d

View File

@@ -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)}).