summaryrefslogtreecommitdiffstats
path: root/tests/OneMedia/src/com/android/onemedia/PlayerController.java
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2014-06-05 02:54:13 -0400
committerRoboErik <epastern@google.com>2014-08-14 16:18:15 -0700
commit45f7ee8201efbda59b57b1fe637a1b9ffef25bb6 (patch)
tree3cae0465b42aeca12ed8ae7864592c3d40cbe01b /tests/OneMedia/src/com/android/onemedia/PlayerController.java
parent1d2a1c917f46b6854e91f9867a20abb76ecb794d (diff)
downloadframeworks_base-45f7ee8201efbda59b57b1fe637a1b9ffef25bb6.zip
frameworks_base-45f7ee8201efbda59b57b1fe637a1b9ffef25bb6.tar.gz
frameworks_base-45f7ee8201efbda59b57b1fe637a1b9ffef25bb6.tar.bz2
Add metadata and notifications to OneMedia
This wires up a notification and some basic metadata for testing in OneMedia. Change-Id: I0f2e922536c85caa63f66dae7deb55ffe94fe231
Diffstat (limited to 'tests/OneMedia/src/com/android/onemedia/PlayerController.java')
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerController.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerController.java b/tests/OneMedia/src/com/android/onemedia/PlayerController.java
index c0799fc..c8d72ca 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerController.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerController.java
@@ -30,6 +30,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.graphics.Bitmap;
import android.util.Log;
import com.android.onemedia.playback.RequestUtils;
@@ -52,6 +53,7 @@ public class PlayerController {
private Handler mHandler = new Handler();
private boolean mResumed;
+ private Bitmap mArt;
public PlayerController(Activity context, Intent serviceIntent) {
mContext = context;
@@ -89,6 +91,16 @@ public class PlayerController {
unbindFromService();
}
+ public void setArt(Bitmap art) {
+ mArt = art;
+ if (mBinder != null) {
+ try {
+ mBinder.setIcon(art);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
public void play() {
if (mTransportControls != null) {
mTransportControls.play();
@@ -125,6 +137,16 @@ public class PlayerController {
// TODO
}
+ public MediaSession.Token getSessionToken() {
+ if (mBinder != null) {
+ try {
+ return mBinder.getSessionToken();
+ } catch (RemoteException e) {
+ }
+ }
+ return null;
+ }
+
private void unbindFromService() {
mContext.unbindService(mServiceConnection);
}
@@ -165,6 +187,9 @@ public class PlayerController {
mContext.setMediaController(mController);
mController.addCallback(mControllerCb, mHandler);
mTransportControls = mController.getTransportControls();
+ if (mArt != null) {
+ setArt(mArt);
+ }
Log.d(TAG, "Ready to use PlayerService");
if (mListener != null) {
@@ -194,6 +219,9 @@ public class PlayerController {
return;
}
Log.d(TAG, "Received metadata change, " + metadata.getDescription());
+ if (mListener != null) {
+ mListener.onMetadataChange(metadata);
+ }
}
}