Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3246de65 authored by Mudumba Ananth's avatar Mudumba Ananth Committed by Andre Eisenbach
Browse files

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
parent 5e6485e5
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
@@ -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
     *
     * <p>This intent will have 3 extras:
     * <ul>
     *   <li> {@link #EXTRA_IND_ID} - The Assigned number of headset Indicator which is supported by
                                        the headset ( as indicated by AT+BIND
                                        command in the SLC sequence).or whose value
                                        is changed (indicated by AT+BIEV command)</li>
     *   <li> {@link #EXTRA_IND_VALUE}- The updated value of headset indicator. </li>
     *   <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
     * </ul>
     * <p>{@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
     * <p>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
+1 −0
Original line number Diff line number Diff line
@@ -59,4 +59,5 @@ interface IBluetoothHeadset {
                      String number, int type);
    boolean enableWBS();
    boolean disableWBS();
    void bindResponse(int ind_id, boolean ind_status);
}