diff options
Diffstat (limited to 'tests/OneMedia/src/com/android/onemedia/PlayerController.java')
-rw-r--r-- | tests/OneMedia/src/com/android/onemedia/PlayerController.java | 28 |
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); + } } } |