From 03fce072cac092923e10a6b5f09fcde333375f9e Mon Sep 17 00:00:00 2001 From: RoboErik Date: Wed, 24 Sep 2014 09:46:57 -0700 Subject: Allow null queues to be set in MediaSession Also add some test code for it to OneMedia. bug:17593962 Change-Id: I074e2bb0329d9a97f623e4309bb7dada157b8324 --- media/java/android/media/session/MediaController.java | 3 ++- media/java/android/media/session/MediaSession.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'media/java') 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 queue = parceledQueue.getList(); + List 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 queue) { try { - mBinder.setQueue(new ParceledListSlice(queue)); + mBinder.setQueue(queue == null ? null : new ParceledListSlice(queue)); } catch (RemoteException e) { Log.wtf("Dead object in setQueue.", e); } -- cgit v1.1