Loading Android.mk +1 −1 Original line number Original line Diff line number Diff line Loading @@ -183,7 +183,7 @@ LOCAL_SRC_FILES += \ media/java/android/media/IAudioFocusDispatcher.aidl \ media/java/android/media/IAudioFocusDispatcher.aidl \ media/java/android/media/IMediaScannerListener.aidl \ media/java/android/media/IMediaScannerListener.aidl \ media/java/android/media/IMediaScannerService.aidl \ media/java/android/media/IMediaScannerService.aidl \ media/java/android/media/IRemoteControlClient.aidl \ media/java/android/media/IRemoteControlClientDispatcher.aidl \ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ Loading CleanSpec.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -104,6 +104,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P) # ************************************************ # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ # ************************************************ media/java/android/media/AudioManager.java +122 −179 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.database.ContentObserver; import android.database.ContentObserver; import android.graphics.Bitmap; import android.os.Binder; import android.os.Binder; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; Loading Loading @@ -1714,30 +1715,104 @@ public class AudioManager { } } } } /** * Acts as a proxy between AudioService and the RemoteControlClient */ private IRemoteControlClientDispatcher mRcClientDispatcher = new IRemoteControlClientDispatcher.Stub() { public String getMetadataStringForClient(String clientName, int field) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getMetadataString(field); } else { return null; } } public int getPlaybackStateForClient(String clientName) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getPlaybackState(); } else { return 0; } } public int getTransportControlFlagsForClient(String clientName) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getTransportControlFlags(); } else { return 0; } } public Bitmap getAlbumArtForClient(String clientName, int maxWidth, int maxHeight) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getAlbumArt(maxWidth, maxHeight); } else { return null; } } }; private HashMap<String, RemoteControlClient> mRcClientMap = new HashMap<String, RemoteControlClient>(); private String getIdForRcClient(RemoteControlClient client) { // client is guaranteed to be non-null return client.toString(); } /** /** * @hide * @hide * Registers the remote control client for providing information to display on the remotes. * Registers the remote control client for providing information to display on the remote * controls. * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * that will receive the media button intent, and associated with the remote control * that will receive the media button intent, and associated with the remote control * client. This method has no effect if * client. This method has no effect if * {@link #registerMediaButtonEventReceiver(ComponentName)} hasn't been called * {@link #registerMediaButtonEventReceiver(ComponentName)} hasn't been called * with the same eventReceiver, or if * with the same eventReceiver, or if * {@link #unregisterMediaButtonEventReceiver(ComponentName)} has been called. * {@link #unregisterMediaButtonEventReceiver(ComponentName)} has been called. * @param rcClient the client associated with the event receiver, responsible for providing * @param rcClient the remote control client associated with the event receiver, responsible * the information to display on the remote control. * for providing the information to display on the remote control. */ */ public void registerRemoteControlClient(ComponentName eventReceiver, public void registerRemoteControlClient(ComponentName eventReceiver, IRemoteControlClient rcClient) { RemoteControlClient rcClient) { if (eventReceiver == null) { if ((eventReceiver == null) || (rcClient == null)) { return; } String clientKey = getIdForRcClient(rcClient); synchronized(mRcClientMap) { if (mRcClientMap.containsKey(clientKey)) { return; return; } } mRcClientMap.put(clientKey, rcClient); } IAudioService service = getService(); IAudioService service = getService(); try { try { service.registerRemoteControlClient(eventReceiver, rcClient, service.registerRemoteControlClient(eventReceiver, mRcClientDispatcher, clientKey, // used to match media button event receiver and audio focus // used to match media button event receiver and audio focus mContext.getPackageName()); mContext.getPackageName()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlClient"+e); Log.e(TAG, "Dead object in registerRemoteControlClient"+e); synchronized(mRcClientMap) { mRcClientMap.remove(clientKey); } } } } } Loading @@ -1748,17 +1823,28 @@ public class AudioManager { * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * that receives the media button intent, and associated with the remote control * that receives the media button intent, and associated with the remote control * client. * client. * @see #registerRemoteControlClient(ComponentName) * @param rcClient the remote control client to unregister * @see #registerRemoteControlClient(ComponentName, RemoteControlClient) */ */ public void unregisterRemoteControlClient(ComponentName eventReceiver) { public void unregisterRemoteControlClient(ComponentName eventReceiver, if (eventReceiver == null) { RemoteControlClient rcClient) { if ((eventReceiver == null) || (rcClient == null)) { return; return; } } IAudioService service = getService(); IAudioService service = getService(); try { try { // unregistering a IRemoteControlClient is equivalent to setting it to null // remove locally service.registerRemoteControlClient(eventReceiver, null, mContext.getPackageName()); boolean unregister = true; synchronized(mRcClientMap) { if (mRcClientMap.remove(getIdForRcClient(rcClient)) == null) { unregister = false; } } if (unregister) { // unregistering a RemoteControlClient is equivalent to setting it to null service.registerRemoteControlClient(eventReceiver, null, null, mContext.getPackageName()); } } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in unregisterRemoteControlClient"+e); Log.e(TAG, "Dead object in unregisterRemoteControlClient"+e); } } Loading @@ -1767,177 +1853,23 @@ public class AudioManager { /** /** * @hide * @hide * Returns the current remote control client. * Returns the current remote control client. * @param rcClientId the counter value that matches the extra * @param rcClientId the generation counter that matches the extra * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT} in the * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT_GENERATION} in the * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * @return the current IRemoteControlClient from which information to display on the remote * @return the current RemoteControlClient from which information to display on the remote * control can be retrieved, or null if rcClientId doesn't match the current generation * control can be retrieved, or null if rcClientId doesn't match the current generation * counter. * counter. */ */ public IRemoteControlClient getRemoteControlClient(int rcClientId) { public IRemoteControlClientDispatcher getRemoteControlClientDispatcher(int rcClientId) { IAudioService service = getService(); IAudioService service = getService(); try { try { return service.getRemoteControlClient(rcClientId); return service.getRemoteControlClientDispatcher(rcClientId); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in getRemoteControlClient "+e); Log.e(TAG, "Dead object in getRemoteControlClient "+e); return null; return null; } } } } /** * @hide * Definitions of constants to be used in {@link android.media.IRemoteControlClient}. */ public final class RemoteControlParameters { /** * Playback state of an IRemoteControlClient which is stopped. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_STOPPED = 1; /** * Playback state of an IRemoteControlClient which is paused. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_PAUSED = 2; /** * Playback state of an IRemoteControlClient which is playing media. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_PLAYING = 3; /** * Playback state of an IRemoteControlClient which is fast forwarding in the media * it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_FAST_FORWARDING = 4; /** * Playback state of an IRemoteControlClient which is fast rewinding in the media * it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_REWINDING = 5; /** * Playback state of an IRemoteControlClient which is skipping to the next * logical chapter (such as a song in a playlist) in the media it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_SKIPPING_FORWARDS = 6; /** * Playback state of an IRemoteControlClient which is skipping back to the previous * logical chapter (such as a song in a playlist) in the media it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_SKIPPING_BACKWARDS = 7; /** * Playback state of an IRemoteControlClient which is buffering data to play before it can * start or resume playback. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_BUFFERING = 8; /** * Playback state of an IRemoteControlClient which cannot perform any playback related * operation because of an internal error. Examples of such situations are no network * connectivity when attempting to stream data from a server, or expired user credentials * when trying to play subscription-based content. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_ERROR = 9; /** * Flag indicating an IRemoteControlClient makes use of the "previous" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PREVIOUS */ public final static int FLAG_KEY_MEDIA_PREVIOUS = 1 << 0; /** * Flag indicating an IRemoteControlClient makes use of the "rewing" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_REWIND */ public final static int FLAG_KEY_MEDIA_REWIND = 1 << 1; /** * Flag indicating an IRemoteControlClient makes use of the "play" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY */ public final static int FLAG_KEY_MEDIA_PLAY = 1 << 2; /** * Flag indicating an IRemoteControlClient makes use of the "play/pause" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY_PAUSE */ public final static int FLAG_KEY_MEDIA_PLAY_PAUSE = 1 << 3; /** * Flag indicating an IRemoteControlClient makes use of the "pause" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PAUSE */ public final static int FLAG_KEY_MEDIA_PAUSE = 1 << 4; /** * Flag indicating an IRemoteControlClient makes use of the "stop" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_STOP */ public final static int FLAG_KEY_MEDIA_STOP = 1 << 5; /** * Flag indicating an IRemoteControlClient makes use of the "fast forward" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_FAST_FORWARD */ public final static int FLAG_KEY_MEDIA_FAST_FORWARD = 1 << 6; /** * Flag indicating an IRemoteControlClient makes use of the "next" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_NEXT */ public final static int FLAG_KEY_MEDIA_NEXT = 1 << 7; /** * Flag used to signal that the metadata exposed by the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_METADATA = 1 << 0; /** * Flag used to signal that the transport control buttons supported by the * IRemoteControlClient have changed. * This can for instance happen when playback is at the end of a playlist, and the "next" * operation is not supported anymore. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_KEY_MEDIA = 1 << 1; /** * Flag used to signal that the playback state of the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_PLAYSTATE = 1 << 2; /** * Flag used to signal that the album art for the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_ALBUM_ART = 1 << 3; } /** /** * @hide * @hide * Broadcast intent action indicating that the displays on the remote controls * Broadcast intent action indicating that the displays on the remote controls Loading @@ -1952,16 +1884,27 @@ public class AudioManager { /** /** * @hide * @hide * The IRemoteControlClient monotonically increasing generation counter. * The IRemoteControlClientDispatcher monotonically increasing generation counter. * * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION */ public static final String EXTRA_REMOTE_CONTROL_CLIENT_GENERATION = "android.media.EXTRA_REMOTE_CONTROL_CLIENT_GENERATION"; /** * @hide * The name of the RemoteControlClient. * This String is passed as the client name when calling methods from the * IRemoteControlClientDispatcher interface. * * * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION */ */ public static final String EXTRA_REMOTE_CONTROL_CLIENT = public static final String EXTRA_REMOTE_CONTROL_CLIENT_NAME = "android.media.EXTRA_REMOTE_CONTROL_CLIENT"; "android.media.EXTRA_REMOTE_CONTROL_CLIENT_NAME"; /** /** * @hide * @hide * The media button event receiver associated with the IRemoteControlClient. * The media button event receiver associated with the RemoteControlClient. * The {@link android.content.ComponentName} value of the event receiver can be retrieved with * The {@link android.content.ComponentName} value of the event receiver can be retrieved with * {@link android.content.ComponentName#unflattenFromString(String)} * {@link android.content.ComponentName#unflattenFromString(String)} * * Loading Loading @@ -1992,10 +1935,10 @@ public class AudioManager { * @param infoFlag the type of information that has changed since this method was last called, * @param infoFlag the type of information that has changed since this method was last called, * or the event receiver was registered. Use one or multiple of the following flags to * or the event receiver was registered. Use one or multiple of the following flags to * describe what changed: * describe what changed: * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_METADATA}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_METADATA}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_KEY_MEDIA}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_KEY_MEDIA}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_PLAYSTATE}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_PLAYSTATE}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_ALBUM_ART}. * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_ALBUM_ART}. */ */ public void notifyRemoteControlInformationChanged(ComponentName eventReceiver, int infoFlag) { public void notifyRemoteControlInformationChanged(ComponentName eventReceiver, int infoFlag) { IAudioService service = getService(); IAudioService service = getService(); Loading media/java/android/media/AudioService.java +23 −15 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.pm.PackageManager; import android.database.ContentObserver; import android.database.ContentObserver; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnErrorListener; import android.media.IRemoteControlClientDispatcher; import android.os.Binder; import android.os.Binder; import android.os.Environment; import android.os.Environment; import android.os.Handler; import android.os.Handler; Loading Loading @@ -2172,7 +2173,7 @@ public class AudioService extends IAudioService.Stub { // TODO remove log before release // TODO remove log before release Log.i(TAG, "Clear remote control display"); Log.i(TAG, "Clear remote control display"); Intent clearIntent = new Intent(AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); Intent clearIntent = new Intent(AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); // no extra means no IRemoteControlClient, which is a request to clear // no extra means no IRemoteControlClientDispatcher, which is a request to clear clearIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); clearIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcast(clearIntent); mContext.sendBroadcast(clearIntent); break; break; Loading @@ -2192,7 +2193,8 @@ public class AudioService extends IAudioService.Stub { Log.i(TAG, "Display/update remote control "); Log.i(TAG, "Display/update remote control "); Intent rcClientIntent = new Intent( Intent rcClientIntent = new Intent( AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); rcClientIntent.putExtra(AudioManager.EXTRA_REMOTE_CONTROL_CLIENT, rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_GENERATION, mCurrentRcClientGen); mCurrentRcClientGen); rcClientIntent.putExtra( rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_INFO_CHANGED, AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_INFO_CHANGED, Loading @@ -2200,6 +2202,9 @@ public class AudioService extends IAudioService.Stub { rcClientIntent.putExtra( rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER, AudioManager.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER, rcse.mReceiverComponent.flattenToString()); rcse.mReceiverComponent.flattenToString()); rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_NAME, rcse.mRcClientName); rcClientIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); rcClientIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcast(rcClientIntent); mContext.sendBroadcast(rcClientIntent); } } Loading Loading @@ -2895,14 +2900,14 @@ public class AudioService extends IAudioService.Stub { * This object may be null. * This object may be null. * Access protected by mCurrentRcLock. * Access protected by mCurrentRcLock. */ */ private IRemoteControlClient mCurrentRcClient = null; private IRemoteControlClientDispatcher mCurrentRcClient = null; private final static int RC_INFO_NONE = 0; private final static int RC_INFO_NONE = 0; private final static int RC_INFO_ALL = private final static int RC_INFO_ALL = AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_ALBUM_ART | RemoteControlClient.FLAG_INFORMATION_CHANGED_ALBUM_ART | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_KEY_MEDIA | RemoteControlClient.FLAG_INFORMATION_CHANGED_KEY_MEDIA | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_METADATA | RemoteControlClient.FLAG_INFORMATION_CHANGED_METADATA | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_PLAYSTATE; RemoteControlClient.FLAG_INFORMATION_CHANGED_PLAYSTATE; /** /** * A monotonically increasing generation counter for mCurrentRcClient. * A monotonically increasing generation counter for mCurrentRcClient. Loading @@ -2914,13 +2919,13 @@ public class AudioService extends IAudioService.Stub { /** /** * Returns the current remote control client. * Returns the current remote control client. * @param rcClientId the counter value that matches the extra * @param rcClientId the counter value that matches the extra * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT} in the * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT_GENERATION} in the * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * @return the current IRemoteControlClient from which information to display on the remote * @return the current IRemoteControlClientDispatcher from which information to display on the * control can be retrieved, or null if rcClientId doesn't match the current generation * remote control can be retrieved, or null if rcClientId doesn't match the current * counter. * generation counter. */ */ public IRemoteControlClient getRemoteControlClient(int rcClientId) { public IRemoteControlClientDispatcher getRemoteControlClientDispatcher(int rcClientId) { synchronized(mCurrentRcLock) { synchronized(mCurrentRcLock) { if (rcClientId == mCurrentRcClientGen) { if (rcClientId == mCurrentRcClientGen) { return mCurrentRcClient; return mCurrentRcClient; Loading @@ -2947,7 +2952,7 @@ public class AudioService extends IAudioService.Stub { Log.w(TAG, " RemoteControlClient died"); Log.w(TAG, " RemoteControlClient died"); // remote control client died, make sure the displays don't use it anymore // remote control client died, make sure the displays don't use it anymore // by setting its remote control client to null // by setting its remote control client to null registerRemoteControlClient(mRcEventReceiver, null, null/*ignored*/); registerRemoteControlClient(mRcEventReceiver, null, null, null/*ignored*/); } } public IBinder getBinder() { public IBinder getBinder() { Loading @@ -2959,10 +2964,11 @@ public class AudioService extends IAudioService.Stub { /** the target for the ACTION_MEDIA_BUTTON events */ /** the target for the ACTION_MEDIA_BUTTON events */ public ComponentName mReceiverComponent;// always non null public ComponentName mReceiverComponent;// always non null public String mCallingPackageName; public String mCallingPackageName; public String mRcClientName; public int mCallingUid; public int mCallingUid; /** provides access to the information to display on the remote control */ /** provides access to the information to display on the remote control */ public IRemoteControlClient mRcClient; public IRemoteControlClientDispatcher mRcClient; public RcClientDeathHandler mRcClientDeathHandler; public RcClientDeathHandler mRcClientDeathHandler; public RemoteControlStackEntry(ComponentName r) { public RemoteControlStackEntry(ComponentName r) { Loading Loading @@ -3217,7 +3223,7 @@ public class AudioService extends IAudioService.Stub { /** see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...) */ /** see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...) */ public void registerRemoteControlClient(ComponentName eventReceiver, public void registerRemoteControlClient(ComponentName eventReceiver, IRemoteControlClient rcClient, String callingPackageName) { IRemoteControlClientDispatcher rcClient, String clientName, String callingPackageName) { synchronized(mAudioFocusLock) { synchronized(mAudioFocusLock) { synchronized(mRCStack) { synchronized(mRCStack) { // store the new display information // store the new display information Loading @@ -3233,8 +3239,10 @@ public class AudioService extends IAudioService.Stub { // save the new remote control client // save the new remote control client rcse.mRcClient = rcClient; rcse.mRcClient = rcClient; rcse.mCallingPackageName = callingPackageName; rcse.mCallingPackageName = callingPackageName; rcse.mRcClientName = clientName; rcse.mCallingUid = Binder.getCallingUid(); rcse.mCallingUid = Binder.getCallingUid(); if (rcClient == null) { if (rcClient == null) { rcse.mRcClientDeathHandler = null; break; break; } } // monitor the new client's death // monitor the new client's death Loading media/java/android/media/IAudioService.aidl +4 −5 Original line number Original line Diff line number Diff line Loading @@ -18,9 +18,7 @@ package android.media; import android.content.ComponentName; import android.content.ComponentName; import android.media.IAudioFocusDispatcher; import android.media.IAudioFocusDispatcher; import android.media.IRemoteControlClient; import android.media.IRemoteControlClientDispatcher; import android.net.Uri; import android.os.Bundle; /** /** * {@hide} * {@hide} Loading Loading @@ -91,9 +89,10 @@ interface IAudioService { void unregisterMediaButtonEventReceiver(in ComponentName eventReceiver); void unregisterMediaButtonEventReceiver(in ComponentName eventReceiver); void registerRemoteControlClient(in ComponentName eventReceiver, void registerRemoteControlClient(in ComponentName eventReceiver, in IRemoteControlClient rcClient, in String callingPackageName); in IRemoteControlClientDispatcher rcClient, in String clientName, in String callingPackageName); IRemoteControlClient getRemoteControlClient(in int rcClientId); IRemoteControlClientDispatcher getRemoteControlClientDispatcher(in int rcClientId); void notifyRemoteControlInformationChanged(in ComponentName eventReceiver, int infoFlag); void notifyRemoteControlInformationChanged(in ComponentName eventReceiver, int infoFlag); Loading Loading
Android.mk +1 −1 Original line number Original line Diff line number Diff line Loading @@ -183,7 +183,7 @@ LOCAL_SRC_FILES += \ media/java/android/media/IAudioFocusDispatcher.aidl \ media/java/android/media/IAudioFocusDispatcher.aidl \ media/java/android/media/IMediaScannerListener.aidl \ media/java/android/media/IMediaScannerListener.aidl \ media/java/android/media/IMediaScannerService.aidl \ media/java/android/media/IMediaScannerService.aidl \ media/java/android/media/IRemoteControlClient.aidl \ media/java/android/media/IRemoteControlClientDispatcher.aidl \ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ Loading
CleanSpec.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -104,6 +104,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P) # ************************************************ # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ # ************************************************
media/java/android/media/AudioManager.java +122 −179 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.database.ContentObserver; import android.database.ContentObserver; import android.graphics.Bitmap; import android.os.Binder; import android.os.Binder; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; Loading Loading @@ -1714,30 +1715,104 @@ public class AudioManager { } } } } /** * Acts as a proxy between AudioService and the RemoteControlClient */ private IRemoteControlClientDispatcher mRcClientDispatcher = new IRemoteControlClientDispatcher.Stub() { public String getMetadataStringForClient(String clientName, int field) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getMetadataString(field); } else { return null; } } public int getPlaybackStateForClient(String clientName) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getPlaybackState(); } else { return 0; } } public int getTransportControlFlagsForClient(String clientName) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getTransportControlFlags(); } else { return 0; } } public Bitmap getAlbumArtForClient(String clientName, int maxWidth, int maxHeight) { RemoteControlClient realClient; synchronized(mRcClientMap) { realClient = mRcClientMap.get(clientName); } if (realClient != null) { return realClient.getAlbumArt(maxWidth, maxHeight); } else { return null; } } }; private HashMap<String, RemoteControlClient> mRcClientMap = new HashMap<String, RemoteControlClient>(); private String getIdForRcClient(RemoteControlClient client) { // client is guaranteed to be non-null return client.toString(); } /** /** * @hide * @hide * Registers the remote control client for providing information to display on the remotes. * Registers the remote control client for providing information to display on the remote * controls. * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * that will receive the media button intent, and associated with the remote control * that will receive the media button intent, and associated with the remote control * client. This method has no effect if * client. This method has no effect if * {@link #registerMediaButtonEventReceiver(ComponentName)} hasn't been called * {@link #registerMediaButtonEventReceiver(ComponentName)} hasn't been called * with the same eventReceiver, or if * with the same eventReceiver, or if * {@link #unregisterMediaButtonEventReceiver(ComponentName)} has been called. * {@link #unregisterMediaButtonEventReceiver(ComponentName)} has been called. * @param rcClient the client associated with the event receiver, responsible for providing * @param rcClient the remote control client associated with the event receiver, responsible * the information to display on the remote control. * for providing the information to display on the remote control. */ */ public void registerRemoteControlClient(ComponentName eventReceiver, public void registerRemoteControlClient(ComponentName eventReceiver, IRemoteControlClient rcClient) { RemoteControlClient rcClient) { if (eventReceiver == null) { if ((eventReceiver == null) || (rcClient == null)) { return; } String clientKey = getIdForRcClient(rcClient); synchronized(mRcClientMap) { if (mRcClientMap.containsKey(clientKey)) { return; return; } } mRcClientMap.put(clientKey, rcClient); } IAudioService service = getService(); IAudioService service = getService(); try { try { service.registerRemoteControlClient(eventReceiver, rcClient, service.registerRemoteControlClient(eventReceiver, mRcClientDispatcher, clientKey, // used to match media button event receiver and audio focus // used to match media button event receiver and audio focus mContext.getPackageName()); mContext.getPackageName()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlClient"+e); Log.e(TAG, "Dead object in registerRemoteControlClient"+e); synchronized(mRcClientMap) { mRcClientMap.remove(clientKey); } } } } } Loading @@ -1748,17 +1823,28 @@ public class AudioManager { * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver} * that receives the media button intent, and associated with the remote control * that receives the media button intent, and associated with the remote control * client. * client. * @see #registerRemoteControlClient(ComponentName) * @param rcClient the remote control client to unregister * @see #registerRemoteControlClient(ComponentName, RemoteControlClient) */ */ public void unregisterRemoteControlClient(ComponentName eventReceiver) { public void unregisterRemoteControlClient(ComponentName eventReceiver, if (eventReceiver == null) { RemoteControlClient rcClient) { if ((eventReceiver == null) || (rcClient == null)) { return; return; } } IAudioService service = getService(); IAudioService service = getService(); try { try { // unregistering a IRemoteControlClient is equivalent to setting it to null // remove locally service.registerRemoteControlClient(eventReceiver, null, mContext.getPackageName()); boolean unregister = true; synchronized(mRcClientMap) { if (mRcClientMap.remove(getIdForRcClient(rcClient)) == null) { unregister = false; } } if (unregister) { // unregistering a RemoteControlClient is equivalent to setting it to null service.registerRemoteControlClient(eventReceiver, null, null, mContext.getPackageName()); } } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in unregisterRemoteControlClient"+e); Log.e(TAG, "Dead object in unregisterRemoteControlClient"+e); } } Loading @@ -1767,177 +1853,23 @@ public class AudioManager { /** /** * @hide * @hide * Returns the current remote control client. * Returns the current remote control client. * @param rcClientId the counter value that matches the extra * @param rcClientId the generation counter that matches the extra * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT} in the * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT_GENERATION} in the * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * @return the current IRemoteControlClient from which information to display on the remote * @return the current RemoteControlClient from which information to display on the remote * control can be retrieved, or null if rcClientId doesn't match the current generation * control can be retrieved, or null if rcClientId doesn't match the current generation * counter. * counter. */ */ public IRemoteControlClient getRemoteControlClient(int rcClientId) { public IRemoteControlClientDispatcher getRemoteControlClientDispatcher(int rcClientId) { IAudioService service = getService(); IAudioService service = getService(); try { try { return service.getRemoteControlClient(rcClientId); return service.getRemoteControlClientDispatcher(rcClientId); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in getRemoteControlClient "+e); Log.e(TAG, "Dead object in getRemoteControlClient "+e); return null; return null; } } } } /** * @hide * Definitions of constants to be used in {@link android.media.IRemoteControlClient}. */ public final class RemoteControlParameters { /** * Playback state of an IRemoteControlClient which is stopped. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_STOPPED = 1; /** * Playback state of an IRemoteControlClient which is paused. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_PAUSED = 2; /** * Playback state of an IRemoteControlClient which is playing media. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_PLAYING = 3; /** * Playback state of an IRemoteControlClient which is fast forwarding in the media * it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_FAST_FORWARDING = 4; /** * Playback state of an IRemoteControlClient which is fast rewinding in the media * it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_REWINDING = 5; /** * Playback state of an IRemoteControlClient which is skipping to the next * logical chapter (such as a song in a playlist) in the media it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_SKIPPING_FORWARDS = 6; /** * Playback state of an IRemoteControlClient which is skipping back to the previous * logical chapter (such as a song in a playlist) in the media it is currently playing. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_SKIPPING_BACKWARDS = 7; /** * Playback state of an IRemoteControlClient which is buffering data to play before it can * start or resume playback. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_BUFFERING = 8; /** * Playback state of an IRemoteControlClient which cannot perform any playback related * operation because of an internal error. Examples of such situations are no network * connectivity when attempting to stream data from a server, or expired user credentials * when trying to play subscription-based content. * * @see android.media.IRemoteControlClient#getPlaybackState() */ public final static int PLAYSTATE_ERROR = 9; /** * Flag indicating an IRemoteControlClient makes use of the "previous" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PREVIOUS */ public final static int FLAG_KEY_MEDIA_PREVIOUS = 1 << 0; /** * Flag indicating an IRemoteControlClient makes use of the "rewing" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_REWIND */ public final static int FLAG_KEY_MEDIA_REWIND = 1 << 1; /** * Flag indicating an IRemoteControlClient makes use of the "play" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY */ public final static int FLAG_KEY_MEDIA_PLAY = 1 << 2; /** * Flag indicating an IRemoteControlClient makes use of the "play/pause" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY_PAUSE */ public final static int FLAG_KEY_MEDIA_PLAY_PAUSE = 1 << 3; /** * Flag indicating an IRemoteControlClient makes use of the "pause" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_PAUSE */ public final static int FLAG_KEY_MEDIA_PAUSE = 1 << 4; /** * Flag indicating an IRemoteControlClient makes use of the "stop" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_STOP */ public final static int FLAG_KEY_MEDIA_STOP = 1 << 5; /** * Flag indicating an IRemoteControlClient makes use of the "fast forward" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_FAST_FORWARD */ public final static int FLAG_KEY_MEDIA_FAST_FORWARD = 1 << 6; /** * Flag indicating an IRemoteControlClient makes use of the "next" media key. * * @see android.media.IRemoteControlClient#getTransportControlFlags() * @see android.view.KeyEvent#KEYCODE_MEDIA_NEXT */ public final static int FLAG_KEY_MEDIA_NEXT = 1 << 7; /** * Flag used to signal that the metadata exposed by the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_METADATA = 1 << 0; /** * Flag used to signal that the transport control buttons supported by the * IRemoteControlClient have changed. * This can for instance happen when playback is at the end of a playlist, and the "next" * operation is not supported anymore. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_KEY_MEDIA = 1 << 1; /** * Flag used to signal that the playback state of the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_PLAYSTATE = 1 << 2; /** * Flag used to signal that the album art for the IRemoteControlClient has changed. * * @see #notifyRemoteControlInformationChanged(ComponentName, int) */ public final static int FLAG_INFORMATION_CHANGED_ALBUM_ART = 1 << 3; } /** /** * @hide * @hide * Broadcast intent action indicating that the displays on the remote controls * Broadcast intent action indicating that the displays on the remote controls Loading @@ -1952,16 +1884,27 @@ public class AudioManager { /** /** * @hide * @hide * The IRemoteControlClient monotonically increasing generation counter. * The IRemoteControlClientDispatcher monotonically increasing generation counter. * * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION */ public static final String EXTRA_REMOTE_CONTROL_CLIENT_GENERATION = "android.media.EXTRA_REMOTE_CONTROL_CLIENT_GENERATION"; /** * @hide * The name of the RemoteControlClient. * This String is passed as the client name when calling methods from the * IRemoteControlClientDispatcher interface. * * * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION */ */ public static final String EXTRA_REMOTE_CONTROL_CLIENT = public static final String EXTRA_REMOTE_CONTROL_CLIENT_NAME = "android.media.EXTRA_REMOTE_CONTROL_CLIENT"; "android.media.EXTRA_REMOTE_CONTROL_CLIENT_NAME"; /** /** * @hide * @hide * The media button event receiver associated with the IRemoteControlClient. * The media button event receiver associated with the RemoteControlClient. * The {@link android.content.ComponentName} value of the event receiver can be retrieved with * The {@link android.content.ComponentName} value of the event receiver can be retrieved with * {@link android.content.ComponentName#unflattenFromString(String)} * {@link android.content.ComponentName#unflattenFromString(String)} * * Loading Loading @@ -1992,10 +1935,10 @@ public class AudioManager { * @param infoFlag the type of information that has changed since this method was last called, * @param infoFlag the type of information that has changed since this method was last called, * or the event receiver was registered. Use one or multiple of the following flags to * or the event receiver was registered. Use one or multiple of the following flags to * describe what changed: * describe what changed: * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_METADATA}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_METADATA}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_KEY_MEDIA}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_KEY_MEDIA}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_PLAYSTATE}, * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_PLAYSTATE}, * {@link RemoteControlParameters#FLAG_INFORMATION_CHANGED_ALBUM_ART}. * {@link RemoteControlClient#FLAG_INFORMATION_CHANGED_ALBUM_ART}. */ */ public void notifyRemoteControlInformationChanged(ComponentName eventReceiver, int infoFlag) { public void notifyRemoteControlInformationChanged(ComponentName eventReceiver, int infoFlag) { IAudioService service = getService(); IAudioService service = getService(); Loading
media/java/android/media/AudioService.java +23 −15 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.pm.PackageManager; import android.database.ContentObserver; import android.database.ContentObserver; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnErrorListener; import android.media.IRemoteControlClientDispatcher; import android.os.Binder; import android.os.Binder; import android.os.Environment; import android.os.Environment; import android.os.Handler; import android.os.Handler; Loading Loading @@ -2172,7 +2173,7 @@ public class AudioService extends IAudioService.Stub { // TODO remove log before release // TODO remove log before release Log.i(TAG, "Clear remote control display"); Log.i(TAG, "Clear remote control display"); Intent clearIntent = new Intent(AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); Intent clearIntent = new Intent(AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); // no extra means no IRemoteControlClient, which is a request to clear // no extra means no IRemoteControlClientDispatcher, which is a request to clear clearIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); clearIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcast(clearIntent); mContext.sendBroadcast(clearIntent); break; break; Loading @@ -2192,7 +2193,8 @@ public class AudioService extends IAudioService.Stub { Log.i(TAG, "Display/update remote control "); Log.i(TAG, "Display/update remote control "); Intent rcClientIntent = new Intent( Intent rcClientIntent = new Intent( AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); AudioManager.REMOTE_CONTROL_CLIENT_CHANGED); rcClientIntent.putExtra(AudioManager.EXTRA_REMOTE_CONTROL_CLIENT, rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_GENERATION, mCurrentRcClientGen); mCurrentRcClientGen); rcClientIntent.putExtra( rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_INFO_CHANGED, AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_INFO_CHANGED, Loading @@ -2200,6 +2202,9 @@ public class AudioService extends IAudioService.Stub { rcClientIntent.putExtra( rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER, AudioManager.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER, rcse.mReceiverComponent.flattenToString()); rcse.mReceiverComponent.flattenToString()); rcClientIntent.putExtra( AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_NAME, rcse.mRcClientName); rcClientIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); rcClientIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcast(rcClientIntent); mContext.sendBroadcast(rcClientIntent); } } Loading Loading @@ -2895,14 +2900,14 @@ public class AudioService extends IAudioService.Stub { * This object may be null. * This object may be null. * Access protected by mCurrentRcLock. * Access protected by mCurrentRcLock. */ */ private IRemoteControlClient mCurrentRcClient = null; private IRemoteControlClientDispatcher mCurrentRcClient = null; private final static int RC_INFO_NONE = 0; private final static int RC_INFO_NONE = 0; private final static int RC_INFO_ALL = private final static int RC_INFO_ALL = AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_ALBUM_ART | RemoteControlClient.FLAG_INFORMATION_CHANGED_ALBUM_ART | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_KEY_MEDIA | RemoteControlClient.FLAG_INFORMATION_CHANGED_KEY_MEDIA | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_METADATA | RemoteControlClient.FLAG_INFORMATION_CHANGED_METADATA | AudioManager.RemoteControlParameters.FLAG_INFORMATION_CHANGED_PLAYSTATE; RemoteControlClient.FLAG_INFORMATION_CHANGED_PLAYSTATE; /** /** * A monotonically increasing generation counter for mCurrentRcClient. * A monotonically increasing generation counter for mCurrentRcClient. Loading @@ -2914,13 +2919,13 @@ public class AudioService extends IAudioService.Stub { /** /** * Returns the current remote control client. * Returns the current remote control client. * @param rcClientId the counter value that matches the extra * @param rcClientId the counter value that matches the extra * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT} in the * {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT_GENERATION} in the * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event * @return the current IRemoteControlClient from which information to display on the remote * @return the current IRemoteControlClientDispatcher from which information to display on the * control can be retrieved, or null if rcClientId doesn't match the current generation * remote control can be retrieved, or null if rcClientId doesn't match the current * counter. * generation counter. */ */ public IRemoteControlClient getRemoteControlClient(int rcClientId) { public IRemoteControlClientDispatcher getRemoteControlClientDispatcher(int rcClientId) { synchronized(mCurrentRcLock) { synchronized(mCurrentRcLock) { if (rcClientId == mCurrentRcClientGen) { if (rcClientId == mCurrentRcClientGen) { return mCurrentRcClient; return mCurrentRcClient; Loading @@ -2947,7 +2952,7 @@ public class AudioService extends IAudioService.Stub { Log.w(TAG, " RemoteControlClient died"); Log.w(TAG, " RemoteControlClient died"); // remote control client died, make sure the displays don't use it anymore // remote control client died, make sure the displays don't use it anymore // by setting its remote control client to null // by setting its remote control client to null registerRemoteControlClient(mRcEventReceiver, null, null/*ignored*/); registerRemoteControlClient(mRcEventReceiver, null, null, null/*ignored*/); } } public IBinder getBinder() { public IBinder getBinder() { Loading @@ -2959,10 +2964,11 @@ public class AudioService extends IAudioService.Stub { /** the target for the ACTION_MEDIA_BUTTON events */ /** the target for the ACTION_MEDIA_BUTTON events */ public ComponentName mReceiverComponent;// always non null public ComponentName mReceiverComponent;// always non null public String mCallingPackageName; public String mCallingPackageName; public String mRcClientName; public int mCallingUid; public int mCallingUid; /** provides access to the information to display on the remote control */ /** provides access to the information to display on the remote control */ public IRemoteControlClient mRcClient; public IRemoteControlClientDispatcher mRcClient; public RcClientDeathHandler mRcClientDeathHandler; public RcClientDeathHandler mRcClientDeathHandler; public RemoteControlStackEntry(ComponentName r) { public RemoteControlStackEntry(ComponentName r) { Loading Loading @@ -3217,7 +3223,7 @@ public class AudioService extends IAudioService.Stub { /** see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...) */ /** see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...) */ public void registerRemoteControlClient(ComponentName eventReceiver, public void registerRemoteControlClient(ComponentName eventReceiver, IRemoteControlClient rcClient, String callingPackageName) { IRemoteControlClientDispatcher rcClient, String clientName, String callingPackageName) { synchronized(mAudioFocusLock) { synchronized(mAudioFocusLock) { synchronized(mRCStack) { synchronized(mRCStack) { // store the new display information // store the new display information Loading @@ -3233,8 +3239,10 @@ public class AudioService extends IAudioService.Stub { // save the new remote control client // save the new remote control client rcse.mRcClient = rcClient; rcse.mRcClient = rcClient; rcse.mCallingPackageName = callingPackageName; rcse.mCallingPackageName = callingPackageName; rcse.mRcClientName = clientName; rcse.mCallingUid = Binder.getCallingUid(); rcse.mCallingUid = Binder.getCallingUid(); if (rcClient == null) { if (rcClient == null) { rcse.mRcClientDeathHandler = null; break; break; } } // monitor the new client's death // monitor the new client's death Loading
media/java/android/media/IAudioService.aidl +4 −5 Original line number Original line Diff line number Diff line Loading @@ -18,9 +18,7 @@ package android.media; import android.content.ComponentName; import android.content.ComponentName; import android.media.IAudioFocusDispatcher; import android.media.IAudioFocusDispatcher; import android.media.IRemoteControlClient; import android.media.IRemoteControlClientDispatcher; import android.net.Uri; import android.os.Bundle; /** /** * {@hide} * {@hide} Loading Loading @@ -91,9 +89,10 @@ interface IAudioService { void unregisterMediaButtonEventReceiver(in ComponentName eventReceiver); void unregisterMediaButtonEventReceiver(in ComponentName eventReceiver); void registerRemoteControlClient(in ComponentName eventReceiver, void registerRemoteControlClient(in ComponentName eventReceiver, in IRemoteControlClient rcClient, in String callingPackageName); in IRemoteControlClientDispatcher rcClient, in String clientName, in String callingPackageName); IRemoteControlClient getRemoteControlClient(in int rcClientId); IRemoteControlClientDispatcher getRemoteControlClientDispatcher(in int rcClientId); void notifyRemoteControlInformationChanged(in ComponentName eventReceiver, int infoFlag); void notifyRemoteControlInformationChanged(in ComponentName eventReceiver, int infoFlag); Loading