Loading media/java/android/media/AudioManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -2359,6 +2359,24 @@ public class AudioManager { } } /** * @hide * Notify the user of a RemoteControlClient that it should update its metadata * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param value the new metadata value */ public void updateRemoteControlClientMetadata(int generationId, int key, long value) { IAudioService service = getService(); try { service.updateRemoteControlClientMetadata(generationId, key, value); } catch (RemoteException e) { Log.e(TAG, "Dead object in updateRemoteControlClientMetadata("+ generationId + ", " + key +", " + value + ")", e); } } /** * @hide * Reload audio settings. This method is called by Settings backup Loading media/java/android/media/AudioService.java +5 −1 Original line number Diff line number Diff line Loading @@ -4189,6 +4189,10 @@ public class AudioService extends IAudioService.Stub { mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); } public void updateRemoteControlClientMetadata(int generationId, int key, long value) { mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); } public void registerRemoteVolumeObserverForRcc(int rccId, IRemoteVolumeObserver rvo) { mMediaFocusControl.registerRemoteVolumeObserverForRcc(rccId, rvo); } Loading media/java/android/media/IAudioService.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,14 @@ interface IAudioService { * @param timeMs the time in ms to seek to, must be positive. */ void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); /** * Notify the user of a RemoteControlClient that it should update its metadata * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param value the new metadata value */ void updateRemoteControlClientMetadata(int generationId, int key, long value); /** * Do not use directly, use instead Loading media/java/android/media/IRemoteControlClient.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,5 @@ oneway interface IRemoteControlClient void setBitmapSizeForDisplay(IRemoteControlDisplay rcd, int w, int h); void setWantsSyncForDisplay(IRemoteControlDisplay rcd, boolean wantsSync); void seekTo(int clientGeneration, long timeMs); void updateMetadata(int clientGeneration, int key, long value); } No newline at end of file media/java/android/media/MediaFocusControl.java +40 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ public class MediaFocusControl implements OnFinished { private static final int MSG_PROMOTE_RCC = 6; private static final int MSG_RCC_NEW_PLAYBACK_STATE = 7; private static final int MSG_RCC_SEEK_REQUEST = 8; private static final int MSG_RCC_UPDATE_METADATA_LONG = 9; // sendMsg() flags /** If the msg is already queued, replace it with this one. */ Loading Loading @@ -188,18 +189,27 @@ public class MediaFocusControl implements OnFinished { onNewPlaybackInfoForRcc(msg.arg1 /* rccId */, msg.arg2 /* key */, ((Integer)msg.obj).intValue() /* value */); break; case MSG_RCC_NEW_VOLUME_OBS: onRegisterVolumeObserverForRcc(msg.arg1 /* rccId */, (IRemoteVolumeObserver)msg.obj /* rvo */); break; case MSG_RCC_NEW_PLAYBACK_STATE: onNewPlaybackStateForRcc(msg.arg1 /* rccId */, msg.arg2 /* state */, (RccPlaybackState)msg.obj /* newState */); break; case MSG_RCC_SEEK_REQUEST: onSetRemoteControlClientPlaybackPosition( msg.arg1 /* generationId */, ((Long)msg.obj).longValue() /* timeMs */); break; case MSG_RCC_UPDATE_METADATA_LONG: onUpdateRemoteControlClientMetadataLong(msg.arg1 /*genId*/, msg.arg2 /*key*/, ((Long)msg.obj).longValue() /* value */); break; case MSG_PROMOTE_RCC: onPromoteRcc(msg.arg1); Loading Loading @@ -2070,6 +2080,36 @@ public class MediaFocusControl implements OnFinished { } } protected void updateRemoteControlClientMetadata(int genId, int key, long value) { sendMsg(mEventHandler, MSG_RCC_UPDATE_METADATA_LONG, SENDMSG_QUEUE, genId /* arg1 */, key /* arg2 */, Long.valueOf(value) /* obj */, 0 /* delay */); } private void onUpdateRemoteControlClientMetadataLong(int genId, int key, long value) { if(DEBUG_RC) Log.d(TAG, "onUpdateRemoteControlClientMetadataLong(genId=" + genId + ", what=" + key + ",val=" + value + ")"); synchronized(mRCStack) { synchronized(mCurrentRcLock) { if ((mCurrentRcClient != null) && (mCurrentRcClientGen == genId)) { try { switch (key) { case RemoteControlClient.MetadataEditor.LONG_KEY_RATING_BY_USER: mCurrentRcClient.updateMetadata(genId, key, value); break; default: Log.e(TAG, "unhandled metadata key " + key + " update for RCC " + genId); break; } } catch (RemoteException e) { Log.e(TAG, "Current valid remote client is dead", e); mCurrentRcClient = null; } } } } } protected void setPlaybackInfoForRcc(int rccId, int what, int value) { sendMsg(mEventHandler, MSG_RCC_NEW_PLAYBACK_INFO, SENDMSG_QUEUE, rccId /* arg1 */, what /* arg2 */, Integer.valueOf(value) /* obj */, 0 /* delay */); Loading Loading
media/java/android/media/AudioManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -2359,6 +2359,24 @@ public class AudioManager { } } /** * @hide * Notify the user of a RemoteControlClient that it should update its metadata * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param value the new metadata value */ public void updateRemoteControlClientMetadata(int generationId, int key, long value) { IAudioService service = getService(); try { service.updateRemoteControlClientMetadata(generationId, key, value); } catch (RemoteException e) { Log.e(TAG, "Dead object in updateRemoteControlClientMetadata("+ generationId + ", " + key +", " + value + ")", e); } } /** * @hide * Reload audio settings. This method is called by Settings backup Loading
media/java/android/media/AudioService.java +5 −1 Original line number Diff line number Diff line Loading @@ -4189,6 +4189,10 @@ public class AudioService extends IAudioService.Stub { mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); } public void updateRemoteControlClientMetadata(int generationId, int key, long value) { mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); } public void registerRemoteVolumeObserverForRcc(int rccId, IRemoteVolumeObserver rvo) { mMediaFocusControl.registerRemoteVolumeObserverForRcc(rccId, rvo); } Loading
media/java/android/media/IAudioService.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,14 @@ interface IAudioService { * @param timeMs the time in ms to seek to, must be positive. */ void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); /** * Notify the user of a RemoteControlClient that it should update its metadata * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param value the new metadata value */ void updateRemoteControlClientMetadata(int generationId, int key, long value); /** * Do not use directly, use instead Loading
media/java/android/media/IRemoteControlClient.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,5 @@ oneway interface IRemoteControlClient void setBitmapSizeForDisplay(IRemoteControlDisplay rcd, int w, int h); void setWantsSyncForDisplay(IRemoteControlDisplay rcd, boolean wantsSync); void seekTo(int clientGeneration, long timeMs); void updateMetadata(int clientGeneration, int key, long value); } No newline at end of file
media/java/android/media/MediaFocusControl.java +40 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ public class MediaFocusControl implements OnFinished { private static final int MSG_PROMOTE_RCC = 6; private static final int MSG_RCC_NEW_PLAYBACK_STATE = 7; private static final int MSG_RCC_SEEK_REQUEST = 8; private static final int MSG_RCC_UPDATE_METADATA_LONG = 9; // sendMsg() flags /** If the msg is already queued, replace it with this one. */ Loading Loading @@ -188,18 +189,27 @@ public class MediaFocusControl implements OnFinished { onNewPlaybackInfoForRcc(msg.arg1 /* rccId */, msg.arg2 /* key */, ((Integer)msg.obj).intValue() /* value */); break; case MSG_RCC_NEW_VOLUME_OBS: onRegisterVolumeObserverForRcc(msg.arg1 /* rccId */, (IRemoteVolumeObserver)msg.obj /* rvo */); break; case MSG_RCC_NEW_PLAYBACK_STATE: onNewPlaybackStateForRcc(msg.arg1 /* rccId */, msg.arg2 /* state */, (RccPlaybackState)msg.obj /* newState */); break; case MSG_RCC_SEEK_REQUEST: onSetRemoteControlClientPlaybackPosition( msg.arg1 /* generationId */, ((Long)msg.obj).longValue() /* timeMs */); break; case MSG_RCC_UPDATE_METADATA_LONG: onUpdateRemoteControlClientMetadataLong(msg.arg1 /*genId*/, msg.arg2 /*key*/, ((Long)msg.obj).longValue() /* value */); break; case MSG_PROMOTE_RCC: onPromoteRcc(msg.arg1); Loading Loading @@ -2070,6 +2080,36 @@ public class MediaFocusControl implements OnFinished { } } protected void updateRemoteControlClientMetadata(int genId, int key, long value) { sendMsg(mEventHandler, MSG_RCC_UPDATE_METADATA_LONG, SENDMSG_QUEUE, genId /* arg1 */, key /* arg2 */, Long.valueOf(value) /* obj */, 0 /* delay */); } private void onUpdateRemoteControlClientMetadataLong(int genId, int key, long value) { if(DEBUG_RC) Log.d(TAG, "onUpdateRemoteControlClientMetadataLong(genId=" + genId + ", what=" + key + ",val=" + value + ")"); synchronized(mRCStack) { synchronized(mCurrentRcLock) { if ((mCurrentRcClient != null) && (mCurrentRcClientGen == genId)) { try { switch (key) { case RemoteControlClient.MetadataEditor.LONG_KEY_RATING_BY_USER: mCurrentRcClient.updateMetadata(genId, key, value); break; default: Log.e(TAG, "unhandled metadata key " + key + " update for RCC " + genId); break; } } catch (RemoteException e) { Log.e(TAG, "Current valid remote client is dead", e); mCurrentRcClient = null; } } } } } protected void setPlaybackInfoForRcc(int rccId, int what, int value) { sendMsg(mEventHandler, MSG_RCC_NEW_PLAYBACK_INFO, SENDMSG_QUEUE, rccId /* arg1 */, what /* arg2 */, Integer.valueOf(value) /* obj */, 0 /* delay */); Loading