From 709b11ef7ac2594af78483004f9698325693995c Mon Sep 17 00:00:00 2001 From: Mudumba Ananth Date: Mon, 29 Feb 2016 02:14:36 -0800 Subject: [PATCH] HFP 1.7 profile update (3/4) -> Android Framework changes to add support for an API to send indicator change in AG. -> Added a system intent for broadcasting assigned number(ID) of the supported HF indicators and their values (if received) Bug: 19983867 Change-Id: If26a7ae5da5686da72ebca9ec3decfe086e2ffb6 (cherry picked from commit 0d98ebf997b24e96d0328b4195a22832f9ae2664) --- .../android/bluetooth/BluetoothHeadset.java | 63 +++++++++++++++++++ .../android/bluetooth/IBluetoothHeadset.aidl | 1 + 2 files changed, 64 insertions(+) diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 09a15de8778e5..f46a3b3c733ab 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -220,6 +220,46 @@ public final class BluetoothHeadset implements BluetoothProfile { * {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of * {@link #ACTION_AUDIO_STATE_CHANGED} intent. */ + + /** + * Intent used to broadcast the headset's indicator status + * + *

This intent will have 3 extras: + *

+ *

{@link #EXTRA_IND_ID} is defined by Bluetooth SIG and each of the indicators are + * given an assigned number. Below shows the assigned number of Indicator added so far + * - Enhanced Safety - 1 + *

Requires {@link android.Manifest.permission#BLUETOOTH} permission to + * receive. + * @hide + */ + public static final String ACTION_HF_INDICATORS_VALUE_CHANGED = + "android.bluetooth.headset.action.HF_INDICATORS_VALUE_CHANGED"; + + /** + * A String extra field in {@link #ACTION_HF_INDICATORS_VALUE_CHANGED} + * intents that contains the UUID of the headset indicator (as defined by Bluetooth SIG) + * that is being sent. + * @hide + */ + public static final String EXTRA_HF_INDICATORS_IND_ID = + "android.bluetooth.headset.extra.HF_INDICATORS_IND_ID"; + + /** + * A int extra field in {@link #ACTION_HF_INDICATORS_VALUE_CHANGED} + * intents that contains the value of the Headset indicator that is being sent. + * @hide + */ + public static final String EXTRA_HF_INDICATORS_IND_VALUE = + "android.bluetooth.headset.extra.HF_INDICATORS_IND_VALUE"; + public static final int STATE_AUDIO_CONNECTED = 12; private static final int MESSAGE_HEADSET_SERVICE_CONNECTED = 100; @@ -969,6 +1009,29 @@ public final class BluetoothHeadset implements BluetoothProfile { return false; } + /** + * Send Headset the BIND response from AG to report change in the status of the + * HF indicators to the headset + * + * @param ind_id Assigned Number of the indicator (defined by SIG) + * @param ind_status + * possible values- false-Indicator is disabled, no value changes shall be sent for this indicator + * true-Indicator is enabled, value changes may be sent for this indicator + * @hide + */ + public void bindResponse(int ind_id, boolean ind_status) { + if (mService != null && isEnabled()) { + try { + mService.bindResponse(ind_id, ind_status); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + } + private final IBluetoothProfileServiceConnection mConnection = new IBluetoothProfileServiceConnection.Stub() { @Override diff --git a/core/java/android/bluetooth/IBluetoothHeadset.aidl b/core/java/android/bluetooth/IBluetoothHeadset.aidl index 0bb4088f62c93..6ad442b6138d8 100755 --- a/core/java/android/bluetooth/IBluetoothHeadset.aidl +++ b/core/java/android/bluetooth/IBluetoothHeadset.aidl @@ -59,4 +59,5 @@ interface IBluetoothHeadset { String number, int type); boolean enableWBS(); boolean disableWBS(); + void bindResponse(int ind_id, boolean ind_status); }