summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorNeel Parekh <neel@google.com>2011-08-05 14:32:49 -0700
committerNeel Parekh <neel@google.com>2011-08-05 14:36:31 -0700
commitced110ec5970c632f523dfc0350b6071461ea9bc (patch)
tree4a7212d798a0cc1b3714f2265efe3a129d793977 /media
parentfb87cf606a22ab1056fd7caf9bf1f6d9f9190f51 (diff)
downloadframeworks_base-ced110ec5970c632f523dfc0350b6071461ea9bc.zip
frameworks_base-ced110ec5970c632f523dfc0350b6071461ea9bc.tar.gz
frameworks_base-ced110ec5970c632f523dfc0350b6071461ea9bc.tar.bz2
Make retrieving remote control client go through binder interface
The way the old way worked relied on the process retrieving the current remote control client to be in the exact same process as the AudioService. This removes that dependency. Change-Id: I1ba8bf32b61ec1e979ef7eee9661ba801aa19690
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java20
-rw-r--r--media/java/android/media/AudioService.java8
-rw-r--r--media/java/android/media/IAudioService.aidl2
3 files changed, 26 insertions, 4 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index e7a306b..ed6d87e 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1757,6 +1757,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}.
*/
public final class RemoteControlParameters {
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index bf1585d..cb56bc6 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -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();
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 9afe553..25b9a1b 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -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);