Merge "Make retrieving remote control client go through binder interface"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5d49678841
@@ -1755,6 +1755,26 @@ public class AudioManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Returns the current remote control client.
|
||||
* @param rcClientId the counter value that matches the extra
|
||||
* {@link AudioManager#EXTRA_REMOTE_CONTROL_CLIENT} in the
|
||||
* {@link AudioManager#REMOTE_CONTROL_CLIENT_CHANGED} event
|
||||
* @return the current IRemoteControlClient from which information to display on the remote
|
||||
* control can be retrieved, or null if rcClientId doesn't match the current generation
|
||||
* counter.
|
||||
*/
|
||||
public IRemoteControlClient getRemoteControlClient(int rcClientId) {
|
||||
IAudioService service = getService();
|
||||
try {
|
||||
return service.getRemoteControlClient(rcClientId);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Dead object in getRemoteControlClient "+e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Definitions of constants to be used in {@link android.media.IRemoteControlClient}.
|
||||
|
||||
@@ -2845,20 +2845,20 @@ public class AudioService extends IAudioService.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private final static Object mCurrentRcLock = new Object();
|
||||
private final Object mCurrentRcLock = new Object();
|
||||
/**
|
||||
* The one remote control client to be polled for display information.
|
||||
* This object is never null, but its reference might.
|
||||
* Access protected by mCurrentRcLock.
|
||||
*/
|
||||
private static SoftReference<IRemoteControlClient> mCurrentRcClientRef =
|
||||
private SoftReference<IRemoteControlClient> mCurrentRcClientRef =
|
||||
new SoftReference<IRemoteControlClient>(null);
|
||||
|
||||
/**
|
||||
* A monotonically increasing generation counter for mCurrentRcClientRef.
|
||||
* Only accessed with a lock on mCurrentRcLock.
|
||||
*/
|
||||
private static int mCurrentRcClientGen = 0;
|
||||
private int mCurrentRcClientGen = 0;
|
||||
|
||||
/**
|
||||
* Returns the current remote control client.
|
||||
@@ -2869,7 +2869,7 @@ public class AudioService extends IAudioService.Stub {
|
||||
* control can be retrieved, or null if rcClientId doesn't match the current generation
|
||||
* counter.
|
||||
*/
|
||||
public static IRemoteControlClient getRemoteControlClient(int rcClientId) {
|
||||
public IRemoteControlClient getRemoteControlClient(int rcClientId) {
|
||||
synchronized(mCurrentRcLock) {
|
||||
if (rcClientId == mCurrentRcClientGen) {
|
||||
return mCurrentRcClientRef.get();
|
||||
|
||||
@@ -93,6 +93,8 @@ interface IAudioService {
|
||||
void registerRemoteControlClient(in ComponentName eventReceiver,
|
||||
in IRemoteControlClient rcClient, in String callingPackageName);
|
||||
|
||||
IRemoteControlClient getRemoteControlClient(in int rcClientId);
|
||||
|
||||
void notifyRemoteControlInformationChanged(in ComponentName eventReceiver);
|
||||
|
||||
void startBluetoothSco(IBinder cb);
|
||||
|
||||
Reference in New Issue
Block a user