From 6d298811ef642bc4f179ca3e9f4de028fb1ddb74 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 23 Sep 2013 18:34:23 -0700 Subject: [PATCH] Fix artwork not received in RemoteController metadata update. Regardless of the artwork value, always update the metadata. When updating the metadata, make sure the artwork is stored in the artwork field, not in the bundle of the MetadataEditor. Bug 10862527 Change-Id: Iec83fd9bb358a91c852099b30bb6d307a52a034c --- media/java/android/media/RemoteController.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/media/java/android/media/RemoteController.java b/media/java/android/media/RemoteController.java index 29e505cc05f2f..10e1c700d34a6 100644 --- a/media/java/android/media/RemoteController.java +++ b/media/java/android/media/RemoteController.java @@ -418,6 +418,12 @@ public final class RemoteController mApplied = false; } + private void cleanupBitmapFromBundle(int key) { + if (METADATA_KEYS_TYPE.get(key, METADATA_TYPE_INVALID) == METADATA_TYPE_BITMAP) { + mEditorMetadata.remove(String.valueOf(key)); + } + } + /** * Applies all of the metadata changes that have been set since the MediaMetadataEditor * instance was created with {@link RemoteController#editMetadata()} @@ -529,9 +535,6 @@ public final class RemoteController public void setArtwork(int genId, Bitmap artwork) { if (DEBUG) { Log.v(TAG, "setArtwork("+genId+")"); } - if (artwork == null) { - return; - } synchronized(mGenLock) { if (mClientGenerationIdCurrent != genId) { return; @@ -700,6 +703,10 @@ public final class RemoteController // existing metadata, merge existing and new mMetadataEditor.mEditorMetadata.putAll(metadata); } + mMetadataEditor.putBitmap(MediaMetadataEditor.BITMAP_KEY_ARTWORK, + (Bitmap)metadata.getParcelable( + String.valueOf(MediaMetadataEditor.BITMAP_KEY_ARTWORK))); + mMetadataEditor.cleanupBitmapFromBundle(MediaMetadataEditor.BITMAP_KEY_ARTWORK); } else { mMetadataEditor = new MetadataEditor(metadata, editableKeys); }