summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoboErik <epastern@google.com>2014-09-25 18:46:09 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-25 18:46:09 +0000
commit96900279f59e1a082002b132be8c6c0c677923bf (patch)
treee43dd35aa96190fbac1ad84d8dd4361c6e48449a
parent2e579f299b72259eedeccbee7eceb98aff43cfcf (diff)
parentdf26651ff45838ab8c2927178250a44a30bac4dd (diff)
downloadframeworks_base-96900279f59e1a082002b132be8c6c0c677923bf.zip
frameworks_base-96900279f59e1a082002b132be8c6c0c677923bf.tar.gz
frameworks_base-96900279f59e1a082002b132be8c6c0c677923bf.tar.bz2
am 23df1c46: Merge "Allow null queues to be set in MediaSession" into lmp-dev
* commit '23df1c46b768bb2a1363b6f671b0d0c4879538b7': Allow null queues to be set in MediaSession
-rw-r--r--cmds/media/src/com/android/commands/media/Media.java3
-rw-r--r--media/java/android/media/session/MediaController.java3
-rw-r--r--media/java/android/media/session/MediaSession.java2
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerSession.java12
4 files changed, 17 insertions, 3 deletions
diff --git a/cmds/media/src/com/android/commands/media/Media.java b/cmds/media/src/com/android/commands/media/Media.java
index b37f896..6a8fb05 100644
--- a/cmds/media/src/com/android/commands/media/Media.java
+++ b/cmds/media/src/com/android/commands/media/Media.java
@@ -204,7 +204,8 @@ public class Media extends BaseCommand {
@Override
public void onQueueChanged(ParceledListSlice queue) throws RemoteException {
- System.out.println("onQueueChanged, size=" + queue.getList().size());
+ System.out.println("onQueueChanged, "
+ + (queue == null ? "null queue" : " size=" + queue.getList().size()));
}
@Override
diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java
index cfbf3af..e490c2b 100644
--- a/media/java/android/media/session/MediaController.java
+++ b/media/java/android/media/session/MediaController.java
@@ -918,7 +918,8 @@ public final class MediaController {
@Override
public void onQueueChanged(ParceledListSlice parceledQueue) {
- List<MediaSession.QueueItem> queue = parceledQueue.getList();
+ List<MediaSession.QueueItem> queue = parceledQueue == null ? null : parceledQueue
+ .getList();
MediaController controller = mController.get();
if (controller != null) {
controller.postMessage(MSG_UPDATE_QUEUE, queue, null);
diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java
index 2c38697..ad018ad 100644
--- a/media/java/android/media/session/MediaSession.java
+++ b/media/java/android/media/session/MediaSession.java
@@ -427,7 +427,7 @@ public final class MediaSession {
*/
public void setQueue(@Nullable List<QueueItem> queue) {
try {
- mBinder.setQueue(new ParceledListSlice<QueueItem>(queue));
+ mBinder.setQueue(queue == null ? null : new ParceledListSlice<QueueItem>(queue));
} catch (RemoteException e) {
Log.wtf("Dead object in setQueue.", e);
}
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
index 8b7c883..2455c9c 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
@@ -20,6 +20,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.media.MediaMetadata;
import android.media.session.MediaSession;
+import android.media.session.MediaSession.QueueItem;
import android.media.session.MediaSessionManager;
import android.media.session.PlaybackState;
import android.os.Bundle;
@@ -44,6 +45,8 @@ public class PlayerSession {
protected MediaSession.Callback mCallback;
protected Renderer.Listener mRenderListener;
protected MediaMetadata.Builder mMetadataBuilder;
+ protected ArrayList<MediaSession.QueueItem> mQueue;
+ protected boolean mUseQueue;
protected PlaybackState mPlaybackState;
protected Listener mListener;
@@ -58,6 +61,7 @@ public class PlayerSession {
PlaybackState.Builder psBob = new PlaybackState.Builder();
psBob.setActions(PlaybackState.ACTION_PAUSE | PlaybackState.ACTION_PLAY);
mPlaybackState = psBob.build();
+ mQueue = new ArrayList<MediaSession.QueueItem>();
mRenderer.registerListener(mRenderListener);
@@ -114,6 +118,8 @@ public class PlayerSession {
public void setIcon(Bitmap icon) {
mMetadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_DISPLAY_ICON, icon);
+ mQueue.clear();
+ mQueue.add(new QueueItem(mMetadataBuilder.build().getDescription(), 11));
updateMetadata();
}
@@ -122,6 +128,10 @@ public class PlayerSession {
// code
if (mSession != null && mSession.isActive()) {
mSession.setMetadata(mMetadataBuilder.build());
+ // Just toggle the queue every time we update for testing
+ mSession.setQueue(mUseQueue ? mQueue : null);
+ mSession.setQueueTitle(mUseQueue ? "Queue title" : null);
+ mUseQueue = !mUseQueue;
}
}
@@ -141,6 +151,8 @@ public class PlayerSession {
"OneMedia display title");
mMetadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE,
"OneMedia display subtitle");
+
+ mQueue.add(new QueueItem(mMetadataBuilder.build().getDescription(), 11));
}
public interface Listener {