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); }