diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2010-10-13 19:11:28 -0700 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-10-13 19:25:33 -0700 |
commit | 41d5c805d96aef0aaa9a2aaa86ccc4b77ca75e11 (patch) | |
tree | d67bf25bf67d4cbee4fdb6ca378018bbbc0d8d95 | |
parent | a9164cbb3092d4edebd9f20e7da533e169e8d3c6 (diff) | |
download | frameworks_base-41d5c805d96aef0aaa9a2aaa86ccc4b77ca75e11.zip frameworks_base-41d5c805d96aef0aaa9a2aaa86ccc4b77ca75e11.tar.gz frameworks_base-41d5c805d96aef0aaa9a2aaa86ccc4b77ca75e11.tar.bz2 |
Add function to check for AVRCP target to send volume keys.
Currently, when A2DP is connected and the user changes volume
keys on the device, we just change the volume on the device.
We are not supposed to do that. The white paper recommendation
is to keep the volume stream at max and just send the volume
keys over. But then not all A2DP headsets act as AVRCP targets,
hence check for that.
So now the media code should use the API and not change the volume
at the device but just send the keys.
Bug: 3071356
Change-Id: I03a8b6f7619cf860c4e63979bf4903ded9ecd314
-rw-r--r-- | core/java/android/bluetooth/BluetoothA2dp.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java index d308a5c..920ef89 100644 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java @@ -20,6 +20,7 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.content.Context; import android.os.IBinder; +import android.os.ParcelUuid; import android.os.RemoteException; import android.os.ServiceManager; import android.server.BluetoothA2dpService; @@ -338,6 +339,26 @@ public final class BluetoothA2dp implements BluetoothProfile { return false; } + /** + * This function checks if the remote device is an AVCRP + * target and thus whether we should send volume keys + * changes or not. + * @hide + */ + public boolean shouldSendVolumeKeys(BluetoothDevice device) { + if (isEnabled() && isValidDevice(device)) { + ParcelUuid[] uuids = device.getUuids(); + if (uuids == null) return false; + + for (ParcelUuid uuid: uuids) { + if (BluetoothUuid.isAvrcpTarget(uuid)) { + return true; + } + } + } + return false; + } + /** * Helper for converting a state to a string. * |