summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-10-08 00:45:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-08 00:45:54 +0000
commit1a1e24f18ea6bdcc7ad1335a6edf6b6740e6e39b (patch)
tree9b3f65f83e6cea72f530a534c9fba0df50959422 /media
parent5dadf8389eed7b0bf04bcbf89d10f13d366b2d68 (diff)
parent19566543c4833f50e7c22aff0c707388f8a338d2 (diff)
downloadframeworks_base-1a1e24f18ea6bdcc7ad1335a6edf6b6740e6e39b.zip
frameworks_base-1a1e24f18ea6bdcc7ad1335a6edf6b6740e6e39b.tar.gz
frameworks_base-1a1e24f18ea6bdcc7ad1335a6edf6b6740e6e39b.tar.bz2
Merge "Update RemoteController info when enabling/disabling it" into klp-dev
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaFocusControl.java7
-rw-r--r--media/java/android/media/RemoteController.java26
2 files changed, 33 insertions, 0 deletions
diff --git a/media/java/android/media/MediaFocusControl.java b/media/java/android/media/MediaFocusControl.java
index d185321..07d91ac 100644
--- a/media/java/android/media/MediaFocusControl.java
+++ b/media/java/android/media/MediaFocusControl.java
@@ -275,6 +275,13 @@ public class MediaFocusControl implements OnFinished {
// tell the RCCs about the change for this RCD
enableRemoteControlDisplayForClient_syncRcStack(
di.mRcDisplay, di.mEnabled);
+ // when enabling, refresh the information on the display
+ if (di.mEnabled) {
+ sendMsg(mEventHandler, MSG_RCDISPLAY_INIT_INFO, SENDMSG_QUEUE,
+ di.mArtworkExpectedWidth /*arg1*/,
+ di.mArtworkExpectedHeight/*arg2*/,
+ di.mRcDisplay /*obj*/, 0/*delay*/);
+ }
} catch (RemoteException e) {
Log.e(TAG, "Error en/disabling RCD: ", e);
}
diff --git a/media/java/android/media/RemoteController.java b/media/java/android/media/RemoteController.java
index c6d6296..32e85d9 100644
--- a/media/java/android/media/RemoteController.java
+++ b/media/java/android/media/RemoteController.java
@@ -784,8 +784,34 @@ public final class RemoteController
}
private void onDisplayEnable(boolean enabled) {
+ final OnClientUpdateListener l;
synchronized(mInfoLock) {
mEnabled = enabled;
+ l = this.mOnClientUpdateListener;
+ }
+ if (!enabled) {
+ // when disabling, reset all info sent to the user
+ final int genId;
+ synchronized (mGenLock) {
+ genId = mClientGenerationIdCurrent;
+ }
+ // send "stopped" state, happened "now", playback position is 0, speed 0.0f
+ final PlaybackInfo pi = new PlaybackInfo(RemoteControlClient.PLAYSTATE_STOPPED,
+ SystemClock.elapsedRealtime() /*stateChangeTimeMs*/,
+ 0 /*currentPosMs*/, 0.0f /*speed*/);
+ sendMsg(mEventHandler, MSG_NEW_PLAYBACK_INFO, SENDMSG_REPLACE,
+ genId /*arg1*/, 0 /*arg2, ignored*/, pi /*obj*/, 0 /*delay*/);
+ // send "blank" transport control info: no controls are supported
+ sendMsg(mEventHandler, MSG_NEW_TRANSPORT_INFO, SENDMSG_REPLACE,
+ genId /*arg1*/, 0 /*arg2, no flags*/,
+ null /*obj, ignored*/, 0 /*delay*/);
+ // send dummy metadata with empty string for title and artist, duration of 0
+ Bundle metadata = new Bundle(3);
+ metadata.putString(String.valueOf(MediaMetadataRetriever.METADATA_KEY_TITLE), "");
+ metadata.putString(String.valueOf(MediaMetadataRetriever.METADATA_KEY_ARTIST), "");
+ metadata.putLong(String.valueOf(MediaMetadataRetriever.METADATA_KEY_DURATION), 0);
+ sendMsg(mEventHandler, MSG_NEW_METADATA, SENDMSG_QUEUE,
+ genId /*arg1*/, 0 /*arg2, ignored*/, metadata /*obj*/, 0 /*delay*/);
}
}