Add Support for AVRCP Controller Feature
- Provide support for AVRCP Controller CAT 1 and CAT 2
passthrough commands.
Change-Id: Iefbb7fcd6273c49dc8a305b7a25ec6e94c60a5a9
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 7b709ac..927aa21 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -90,6 +90,11 @@
public static final String ACTION_PLAYING_STATE_CHANGED =
"android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED";
+ /** @hide */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_AVRCP_CONNECTION_STATE_CHANGED =
+ "android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED";
+
/**
* A2DP sink device is streaming music. This state can be one of
* {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of
@@ -547,4 +552,34 @@
private static void log(String msg) {
Log.d(TAG, msg);
}
+
+ /** @hide */
+ public void sendPassThroughCmd(int keyCode, int keyState) {
+ if (DBG) Log.d(TAG, "sendPassThroughCmd");
+ if (mService != null && isEnabled()) {
+ try {
+ mService.sendPassThroughCmd(keyCode, keyState);
+ return;
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error talking to BT service in sendPassThroughCmd()", e);
+ return;
+ }
+ }
+ if (mService == null) Log.w(TAG, "Proxy not attached to service");
+ }
+
+ /** @hide */
+ public boolean isAvrcpConnected(BluetoothDevice device) {
+ if (DBG) Log.d(TAG, "isAvrcpConnected");
+ if (mService != null && isEnabled()) {
+ try {
+ return mService.isAvrcpConnected(device);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error talking to BT service in isAvrcpConnected()", e);
+ return false;
+ }
+ }
+ if (mService == null) Log.w(TAG, "Proxy not attached to service");
+ return false;
+ }
}