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

Commit 27acf32d authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Merge "Update public function documentation and address removed spacing" into tm-dev am: 5099a522

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/17017465

Change-Id: If7a815bf4add488dfa2ddbe7d13081ef6aa8abe6
parents a0d0e311 5099a522
Loading
Loading
Loading
Loading
+129 −17
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    private static final boolean DBG = true;
    private static final boolean DBG = true;
    private static final boolean VDBG = false;
    private static final boolean VDBG = false;
    private final CloseGuard mCloseGuard;
    private final CloseGuard mCloseGuard;

    /**
    /**
     * Intent used to broadcast the change in connection state of the HFP Client profile.
     * Intent used to broadcast the change in connection state of the HFP Client profile.
     *
     *
@@ -85,6 +86,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CONNECTION_STATE_CHANGED =
    public static final String ACTION_CONNECTION_STATE_CHANGED =
            "android.bluetooth.headsetclient.profile.action.CONNECTION_STATE_CHANGED";
            "android.bluetooth.headsetclient.profile.action.CONNECTION_STATE_CHANGED";

    /**
    /**
     * Intent sent whenever audio state changes.
     * Intent sent whenever audio state changes.
     *
     *
@@ -109,6 +111,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SuppressLint("ActionValue")
    @SuppressLint("ActionValue")
    public static final String ACTION_AUDIO_STATE_CHANGED =
    public static final String ACTION_AUDIO_STATE_CHANGED =
            "android.bluetooth.headsetclient.profile.action.AUDIO_STATE_CHANGED";
            "android.bluetooth.headsetclient.profile.action.AUDIO_STATE_CHANGED";

    /**
    /**
     * Intent sending updates of the Audio Gateway state.
     * Intent sending updates of the Audio Gateway state.
     * Each extra is being sent only when value it
     * Each extra is being sent only when value it
@@ -129,6 +132,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_AG_EVENT =
    public static final String ACTION_AG_EVENT =
            "android.bluetooth.headsetclient.profile.action.AG_EVENT";
            "android.bluetooth.headsetclient.profile.action.AG_EVENT";

    /**
    /**
     * Intent sent whenever state of a call changes.
     * Intent sent whenever state of a call changes.
     *
     *
@@ -144,6 +148,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CALL_CHANGED =
    public static final String ACTION_CALL_CHANGED =
            "android.bluetooth.headsetclient.profile.action.AG_CALL_CHANGED";
            "android.bluetooth.headsetclient.profile.action.AG_CALL_CHANGED";

    /**
    /**
     * Intent that notifies about the result of the last issued action.
     * Intent that notifies about the result of the last issued action.
     * Please note that not every action results in explicit action result code being sent.
     * Please note that not every action results in explicit action result code being sent.
@@ -158,6 +163,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_RESULT =
    public static final String ACTION_RESULT =
            "android.bluetooth.headsetclient.profile.action.RESULT";
            "android.bluetooth.headsetclient.profile.action.RESULT";

    /**
    /**
     * Intent that notifies about vendor specific event arrival. Events not defined in
     * Intent that notifies about vendor specific event arrival. Events not defined in
     * HFP spec will be matched with supported vendor event list and this intent will
     * HFP spec will be matched with supported vendor event list and this intent will
@@ -172,6 +178,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_VENDOR_SPECIFIC_HEADSETCLIENT_EVENT =
    public static final String ACTION_VENDOR_SPECIFIC_HEADSETCLIENT_EVENT =
            "android.bluetooth.headsetclient.profile.action.VENDOR_SPECIFIC_EVENT";
            "android.bluetooth.headsetclient.profile.action.VENDOR_SPECIFIC_EVENT";

    /**
    /**
     * Intent that notifies about the number attached to the last voice tag
     * Intent that notifies about the number attached to the last voice tag
     * recorded on AG.
     * recorded on AG.
@@ -187,21 +194,25 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_LAST_VTAG =
    public static final String ACTION_LAST_VTAG =
            "android.bluetooth.headsetclient.profile.action.LAST_VTAG";
            "android.bluetooth.headsetclient.profile.action.LAST_VTAG";

    /**
    /**
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final int STATE_AUDIO_DISCONNECTED = 0;
    public static final int STATE_AUDIO_DISCONNECTED = 0;

    /**
    /**
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final int STATE_AUDIO_CONNECTING = 1;
    public static final int STATE_AUDIO_CONNECTING = 1;

    /**
    /**
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final int STATE_AUDIO_CONNECTED = 2;
    public static final int STATE_AUDIO_CONNECTED = 2;

    /**
    /**
     * Extra with information if connected audio is WBS.
     * Extra with information if connected audio is WBS.
     * <p>Possible values: <code>true</code>,
     * <p>Possible values: <code>true</code>,
@@ -211,6 +222,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AUDIO_WBS =
    public static final String EXTRA_AUDIO_WBS =
            "android.bluetooth.headsetclient.extra.AUDIO_WBS";
            "android.bluetooth.headsetclient.extra.AUDIO_WBS";

    /**
    /**
     * Extra for AG_EVENT indicates network status.
     * Extra for AG_EVENT indicates network status.
     * <p>Value: 0 - network unavailable,
     * <p>Value: 0 - network unavailable,
@@ -220,6 +232,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_NETWORK_STATUS =
    public static final String EXTRA_NETWORK_STATUS =
            "android.bluetooth.headsetclient.extra.NETWORK_STATUS";
            "android.bluetooth.headsetclient.extra.NETWORK_STATUS";

    /**
    /**
     * Extra for AG_EVENT intent indicates network signal strength.
     * Extra for AG_EVENT intent indicates network signal strength.
     * <p>Value: <code>Integer</code> representing signal strength.</p>
     * <p>Value: <code>Integer</code> representing signal strength.</p>
@@ -228,6 +241,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_NETWORK_SIGNAL_STRENGTH =
    public static final String EXTRA_NETWORK_SIGNAL_STRENGTH =
            "android.bluetooth.headsetclient.extra.NETWORK_SIGNAL_STRENGTH";
            "android.bluetooth.headsetclient.extra.NETWORK_SIGNAL_STRENGTH";

    /**
    /**
     * Extra for AG_EVENT intent indicates roaming state.
     * Extra for AG_EVENT intent indicates roaming state.
     * <p>Value: 0 - no roaming
     * <p>Value: 0 - no roaming
@@ -237,6 +251,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_NETWORK_ROAMING =
    public static final String EXTRA_NETWORK_ROAMING =
            "android.bluetooth.headsetclient.extra.NETWORK_ROAMING";
            "android.bluetooth.headsetclient.extra.NETWORK_ROAMING";

    /**
    /**
     * Extra for AG_EVENT intent indicates the battery level.
     * Extra for AG_EVENT intent indicates the battery level.
     * <p>Value: <code>Integer</code> representing signal strength.</p>
     * <p>Value: <code>Integer</code> representing signal strength.</p>
@@ -245,6 +260,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_BATTERY_LEVEL =
    public static final String EXTRA_BATTERY_LEVEL =
            "android.bluetooth.headsetclient.extra.BATTERY_LEVEL";
            "android.bluetooth.headsetclient.extra.BATTERY_LEVEL";

    /**
    /**
     * Extra for AG_EVENT intent indicates operator name.
     * Extra for AG_EVENT intent indicates operator name.
     * <p>Value: <code>String</code> representing operator name.</p>
     * <p>Value: <code>String</code> representing operator name.</p>
@@ -253,6 +269,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_OPERATOR_NAME =
    public static final String EXTRA_OPERATOR_NAME =
            "android.bluetooth.headsetclient.extra.OPERATOR_NAME";
            "android.bluetooth.headsetclient.extra.OPERATOR_NAME";

    /**
    /**
     * Extra for AG_EVENT intent indicates voice recognition state.
     * Extra for AG_EVENT intent indicates voice recognition state.
     * <p>Value:
     * <p>Value:
@@ -263,6 +280,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_VOICE_RECOGNITION =
    public static final String EXTRA_VOICE_RECOGNITION =
            "android.bluetooth.headsetclient.extra.VOICE_RECOGNITION";
            "android.bluetooth.headsetclient.extra.VOICE_RECOGNITION";

    /**
    /**
     * Extra for AG_EVENT intent indicates in band ring state.
     * Extra for AG_EVENT intent indicates in band ring state.
     * <p>Value:
     * <p>Value:
@@ -273,6 +291,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_IN_BAND_RING =
    public static final String EXTRA_IN_BAND_RING =
            "android.bluetooth.headsetclient.extra.IN_BAND_RING";
            "android.bluetooth.headsetclient.extra.IN_BAND_RING";

    /**
    /**
     * Extra for AG_EVENT intent indicates subscriber info.
     * Extra for AG_EVENT intent indicates subscriber info.
     * <p>Value: <code>String</code> containing subscriber information.</p>
     * <p>Value: <code>String</code> containing subscriber information.</p>
@@ -281,6 +300,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_SUBSCRIBER_INFO =
    public static final String EXTRA_SUBSCRIBER_INFO =
            "android.bluetooth.headsetclient.extra.SUBSCRIBER_INFO";
            "android.bluetooth.headsetclient.extra.SUBSCRIBER_INFO";

    /**
    /**
     * Extra for AG_CALL_CHANGED intent indicates the
     * Extra for AG_CALL_CHANGED intent indicates the
     * {@link BluetoothHeadsetClientCall} object that has changed.
     * {@link BluetoothHeadsetClientCall} object that has changed.
@@ -289,6 +309,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_CALL =
    public static final String EXTRA_CALL =
            "android.bluetooth.headsetclient.extra.CALL";
            "android.bluetooth.headsetclient.extra.CALL";

    /**
    /**
     * Extra for ACTION_LAST_VTAG intent.
     * Extra for ACTION_LAST_VTAG intent.
     * <p>Value: <code>String</code> representing phone number
     * <p>Value: <code>String</code> representing phone number
@@ -298,6 +319,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_NUMBER =
    public static final String EXTRA_NUMBER =
            "android.bluetooth.headsetclient.extra.NUMBER";
            "android.bluetooth.headsetclient.extra.NUMBER";

    /**
    /**
     * Extra for ACTION_RESULT intent that shows the result code of
     * Extra for ACTION_RESULT intent that shows the result code of
     * last issued action.
     * last issued action.
@@ -315,6 +337,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_RESULT_CODE =
    public static final String EXTRA_RESULT_CODE =
            "android.bluetooth.headsetclient.extra.RESULT_CODE";
            "android.bluetooth.headsetclient.extra.RESULT_CODE";

    /**
    /**
     * Extra for ACTION_RESULT intent that shows the extended result code of
     * Extra for ACTION_RESULT intent that shows the extended result code of
     * last issued action.
     * last issued action.
@@ -324,6 +347,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_CME_CODE =
    public static final String EXTRA_CME_CODE =
            "android.bluetooth.headsetclient.extra.CME_CODE";
            "android.bluetooth.headsetclient.extra.CME_CODE";

    /**
    /**
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * indicates vendor ID.
     * indicates vendor ID.
@@ -332,6 +356,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_VENDOR_ID =
    public static final String EXTRA_VENDOR_ID =
            "android.bluetooth.headsetclient.extra.VENDOR_ID";
            "android.bluetooth.headsetclient.extra.VENDOR_ID";

    /**
    /**
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * indicates vendor event code.
     * indicates vendor event code.
@@ -340,6 +365,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_VENDOR_EVENT_CODE =
    public static final String EXTRA_VENDOR_EVENT_CODE =
            "android.bluetooth.headsetclient.extra.VENDOR_EVENT_CODE";
            "android.bluetooth.headsetclient.extra.VENDOR_EVENT_CODE";

    /**
    /**
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that
     * contains full vendor event including event code and full arguments.
     * contains full vendor event including event code and full arguments.
@@ -348,6 +374,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_VENDOR_EVENT_FULL_ARGS =
    public static final String EXTRA_VENDOR_EVENT_FULL_ARGS =
            "android.bluetooth.headsetclient.extra.VENDOR_EVENT_FULL_ARGS";
            "android.bluetooth.headsetclient.extra.VENDOR_EVENT_FULL_ARGS";

    /* Extras for AG_FEATURES, extras type is boolean */
    /* Extras for AG_FEATURES, extras type is boolean */
    // TODO verify if all of those are actually useful
    // TODO verify if all of those are actually useful
    /**
    /**
@@ -357,6 +384,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_3WAY_CALLING =
    public static final String EXTRA_AG_FEATURE_3WAY_CALLING =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_3WAY_CALLING";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_3WAY_CALLING";

    /**
    /**
     * AG feature: voice recognition.
     * AG feature: voice recognition.
     *
     *
@@ -364,6 +392,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_VOICE_RECOGNITION =
    public static final String EXTRA_AG_FEATURE_VOICE_RECOGNITION =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_VOICE_RECOGNITION";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_VOICE_RECOGNITION";

    /**
    /**
     * AG feature: fetching phone number for voice tagging procedure.
     * AG feature: fetching phone number for voice tagging procedure.
     *
     *
@@ -371,6 +400,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT =
    public static final String EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT";

    /**
    /**
     * AG feature: ability to reject incoming call.
     * AG feature: ability to reject incoming call.
     *
     *
@@ -378,6 +408,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_REJECT_CALL =
    public static final String EXTRA_AG_FEATURE_REJECT_CALL =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_REJECT_CALL";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_REJECT_CALL";

    /**
    /**
     * AG feature: enhanced call handling (terminate specific call, private consultation).
     * AG feature: enhanced call handling (terminate specific call, private consultation).
     *
     *
@@ -385,6 +416,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_ECC =
    public static final String EXTRA_AG_FEATURE_ECC =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ECC";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ECC";

    /**
    /**
     * AG feature: response and hold.
     * AG feature: response and hold.
     *
     *
@@ -392,6 +424,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_RESPONSE_AND_HOLD =
    public static final String EXTRA_AG_FEATURE_RESPONSE_AND_HOLD =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RESPONSE_AND_HOLD";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RESPONSE_AND_HOLD";

    /**
    /**
     * AG call handling feature: accept held or waiting call in three way calling scenarios.
     * AG call handling feature: accept held or waiting call in three way calling scenarios.
     *
     *
@@ -399,6 +432,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL =
    public static final String EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL";

    /**
    /**
     * AG call handling feature: release held or waiting call in three way calling scenarios.
     * AG call handling feature: release held or waiting call in three way calling scenarios.
     *
     *
@@ -406,6 +440,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL =
    public static final String EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL";

    /**
    /**
     * AG call handling feature: release active call and accept held or waiting call in three way
     * AG call handling feature: release active call and accept held or waiting call in three way
     * calling scenarios.
     * calling scenarios.
@@ -414,6 +449,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT =
    public static final String EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT";

    /**
    /**
     * AG call handling feature: merge two calls, held and active - multi party conference mode.
     * AG call handling feature: merge two calls, held and active - multi party conference mode.
     *
     *
@@ -421,6 +457,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_MERGE =
    public static final String EXTRA_AG_FEATURE_MERGE =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE";

    /**
    /**
     * AG call handling feature: merge calls and disconnect from multi party
     * AG call handling feature: merge calls and disconnect from multi party
     * conversation leaving peers connected to each other.
     * conversation leaving peers connected to each other.
@@ -431,152 +468,189 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     */
     */
    public static final String EXTRA_AG_FEATURE_MERGE_AND_DETACH =
    public static final String EXTRA_AG_FEATURE_MERGE_AND_DETACH =
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE_AND_DETACH";
            "android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE_AND_DETACH";

    /* Action result codes */
    /* Action result codes */
    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_OK = 0;
    public static final int ACTION_RESULT_OK = 0;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR = 1;
    public static final int ACTION_RESULT_ERROR = 1;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_NO_CARRIER = 2;
    public static final int ACTION_RESULT_ERROR_NO_CARRIER = 2;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_BUSY = 3;
    public static final int ACTION_RESULT_ERROR_BUSY = 3;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_NO_ANSWER = 4;
    public static final int ACTION_RESULT_ERROR_NO_ANSWER = 4;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_DELAYED = 5;
    public static final int ACTION_RESULT_ERROR_DELAYED = 5;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_BLACKLISTED = 6;
    public static final int ACTION_RESULT_ERROR_BLACKLISTED = 6;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int ACTION_RESULT_ERROR_CME = 7;
    public static final int ACTION_RESULT_ERROR_CME = 7;

    /* Detailed CME error codes */
    /* Detailed CME error codes */
    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_PHONE_FAILURE = 0;
    public static final int CME_PHONE_FAILURE = 0;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NO_CONNECTION_TO_PHONE = 1;
    public static final int CME_NO_CONNECTION_TO_PHONE = 1;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_OPERATION_NOT_ALLOWED = 3;
    public static final int CME_OPERATION_NOT_ALLOWED = 3;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_OPERATION_NOT_SUPPORTED = 4;
    public static final int CME_OPERATION_NOT_SUPPORTED = 4;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_PHSIM_PIN_REQUIRED = 5;
    public static final int CME_PHSIM_PIN_REQUIRED = 5;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_PHFSIM_PIN_REQUIRED = 6;
    public static final int CME_PHFSIM_PIN_REQUIRED = 6;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_PHFSIM_PUK_REQUIRED = 7;
    public static final int CME_PHFSIM_PUK_REQUIRED = 7;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_NOT_INSERTED = 10;
    public static final int CME_SIM_NOT_INSERTED = 10;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_PIN_REQUIRED = 11;
    public static final int CME_SIM_PIN_REQUIRED = 11;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_PUK_REQUIRED = 12;
    public static final int CME_SIM_PUK_REQUIRED = 12;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_FAILURE = 13;
    public static final int CME_SIM_FAILURE = 13;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_BUSY = 14;
    public static final int CME_SIM_BUSY = 14;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_WRONG = 15;
    public static final int CME_SIM_WRONG = 15;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_INCORRECT_PASSWORD = 16;
    public static final int CME_INCORRECT_PASSWORD = 16;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_PIN2_REQUIRED = 17;
    public static final int CME_SIM_PIN2_REQUIRED = 17;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SIM_PUK2_REQUIRED = 18;
    public static final int CME_SIM_PUK2_REQUIRED = 18;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_MEMORY_FULL = 20;
    public static final int CME_MEMORY_FULL = 20;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_INVALID_INDEX = 21;
    public static final int CME_INVALID_INDEX = 21;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NOT_FOUND = 22;
    public static final int CME_NOT_FOUND = 22;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_MEMORY_FAILURE = 23;
    public static final int CME_MEMORY_FAILURE = 23;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_TEXT_STRING_TOO_LONG = 24;
    public static final int CME_TEXT_STRING_TOO_LONG = 24;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_INVALID_CHARACTER_IN_TEXT_STRING = 25;
    public static final int CME_INVALID_CHARACTER_IN_TEXT_STRING = 25;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_DIAL_STRING_TOO_LONG = 26;
    public static final int CME_DIAL_STRING_TOO_LONG = 26;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_INVALID_CHARACTER_IN_DIAL_STRING = 27;
    public static final int CME_INVALID_CHARACTER_IN_DIAL_STRING = 27;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NO_NETWORK_SERVICE = 30;
    public static final int CME_NO_NETWORK_SERVICE = 30;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NETWORK_TIMEOUT = 31;
    public static final int CME_NETWORK_TIMEOUT = 31;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_EMERGENCY_SERVICE_ONLY = 32;
    public static final int CME_EMERGENCY_SERVICE_ONLY = 32;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NO_SIMULTANOUS_VOIP_CS_CALLS = 33;
    public static final int CME_NO_SIMULTANOUS_VOIP_CS_CALLS = 33;

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -585,63 +659,78 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
     * @hide
     * @hide
     */
     */
    public static final int CME_SIP_RESPONSE_CODE = 35;
    public static final int CME_SIP_RESPONSE_CODE = 35;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NETWORK_PERSONALIZATION_PIN_REQUIRED = 40;
    public static final int CME_NETWORK_PERSONALIZATION_PIN_REQUIRED = 40;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NETWORK_PERSONALIZATION_PUK_REQUIRED = 41;
    public static final int CME_NETWORK_PERSONALIZATION_PUK_REQUIRED = 41;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PIN_REQUIRED = 42;
    public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PIN_REQUIRED = 42;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PUK_REQUIRED = 43;
    public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PUK_REQUIRED = 43;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PIN_REQUIRED = 44;
    public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PIN_REQUIRED = 44;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PUK_REQUIRED = 45;
    public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PUK_REQUIRED = 45;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_CORPORATE_PERSONALIZATION_PIN_REQUIRED = 46;
    public static final int CME_CORPORATE_PERSONALIZATION_PIN_REQUIRED = 46;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_CORPORATE_PERSONALIZATION_PUK_REQUIRED = 47;
    public static final int CME_CORPORATE_PERSONALIZATION_PUK_REQUIRED = 47;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_HIDDEN_KEY_REQUIRED = 48;
    public static final int CME_HIDDEN_KEY_REQUIRED = 48;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_EAP_NOT_SUPPORTED = 49;
    public static final int CME_EAP_NOT_SUPPORTED = 49;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CME_INCORRECT_PARAMETERS = 50;
    public static final int CME_INCORRECT_PARAMETERS = 50;

    /* Action policy for other calls when accepting call */
    /* Action policy for other calls when accepting call */
    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CALL_ACCEPT_NONE = 0;
    public static final int CALL_ACCEPT_NONE = 0;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CALL_ACCEPT_HOLD = 1;
    public static final int CALL_ACCEPT_HOLD = 1;

    /**
    /**
     * @hide
     * @hide
     */
     */
    public static final int CALL_ACCEPT_TERMINATE = 2;
    public static final int CALL_ACCEPT_TERMINATE = 2;

    private final BluetoothAdapter mAdapter;
    private final BluetoothAdapter mAdapter;
    private final AttributionSource mAttributionSource;
    private final AttributionSource mAttributionSource;
    private final BluetoothProfileConnector<IBluetoothHeadsetClient> mProfileConnector =
    private final BluetoothProfileConnector<IBluetoothHeadsetClient> mProfileConnector =
@@ -652,6 +741,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
                    return IBluetoothHeadsetClient.Stub.asInterface(service);
                    return IBluetoothHeadsetClient.Stub.asInterface(service);
                }
                }
    };
    };

    /**
    /**
     * Create a BluetoothHeadsetClient proxy object.
     * Create a BluetoothHeadsetClient proxy object.
     */
     */
@@ -663,6 +753,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        mCloseGuard = new CloseGuard();
        mCloseGuard = new CloseGuard();
        mCloseGuard.open("close");
        mCloseGuard.open("close");
    }
    }

    /**
    /**
     * Close the connection to the backing service.
     * Close the connection to the backing service.
     * Other public functions of BluetoothHeadsetClient will return default error
     * Other public functions of BluetoothHeadsetClient will return default error
@@ -678,9 +769,11 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
            mCloseGuard.close();
            mCloseGuard.close();
        }
        }
    }
    }

    private IBluetoothHeadsetClient getService() {
    private IBluetoothHeadsetClient getService() {
        return mProfileConnector.getService();
        return mProfileConnector.getService();
    }
    }

    /** @hide */
    /** @hide */
    protected void finalize() {
    protected void finalize() {
        if (mCloseGuard != null) {
        if (mCloseGuard != null) {
@@ -688,6 +781,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        close();
        close();
    }
    }

    /**
    /**
     * Connects to remote device.
     * Connects to remote device.
     *
     *
@@ -722,6 +816,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Disconnects remote device
     * Disconnects remote device
     *
     *
@@ -752,11 +847,9 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Return the list of connected remote devices
     * {@inheritDoc}
     *
     * @return list of connected devices; empty list if nothing is connected.
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
@@ -790,13 +883,9 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Returns list of remote devices in a particular state
     * {@inheritDoc}
     *
     * @param states collection of states
     * @return list of devices that state matches the states listed in <code>states</code>; empty
     * list if nothing matches the <code>states</code>
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
@@ -831,12 +920,9 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Returns state of the <code>device</code>
     * {@inheritDoc}
     *
     * @param device a remote device
     * @return the state of connection of the device
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
@@ -867,6 +953,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Set priority of the profile
     * Set priority of the profile
     *
     *
@@ -884,6 +971,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        if (DBG) log("setPriority(" + device + ", " + priority + ")");
        if (DBG) log("setPriority(" + device + ", " + priority + ")");
        return setConnectionPolicy(device, BluetoothAdapter.priorityToConnectionPolicy(priority));
        return setConnectionPolicy(device, BluetoothAdapter.priorityToConnectionPolicy(priority));
    }
    }

    /**
    /**
     * Set connection policy of the profile
     * Set connection policy of the profile
     *
     *
@@ -926,6 +1014,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Get the priority of the profile.
     * Get the priority of the profile.
     *
     *
@@ -943,6 +1032,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        if (VDBG) log("getPriority(" + device + ")");
        if (VDBG) log("getPriority(" + device + ")");
        return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
        return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
    }
    }

    /**
    /**
     * Get the connection policy of the profile.
     * Get the connection policy of the profile.
     *
     *
@@ -982,6 +1072,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Starts voice recognition.
     * Starts voice recognition.
     *
     *
@@ -1015,6 +1106,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Send vendor specific AT command.
     * Send vendor specific AT command.
     *
     *
@@ -1046,6 +1138,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Stops voice recognition.
     * Stops voice recognition.
     *
     *
@@ -1079,6 +1172,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Returns list of all calls in any state.
     * Returns list of all calls in any state.
     *
     *
@@ -1110,6 +1204,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Returns list of current values of AG indicators.
     * Returns list of current values of AG indicators.
     *
     *
@@ -1138,6 +1233,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Accepts a call
     * Accepts a call
     *
     *
@@ -1170,6 +1266,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Holds a call.
     * Holds a call.
     *
     *
@@ -1199,6 +1296,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Rejects a call.
     * Rejects a call.
     *
     *
@@ -1233,6 +1331,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Terminates a specified call.
     * Terminates a specified call.
     *
     *
@@ -1271,6 +1370,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Enters private mode with a specified call.
     * Enters private mode with a specified call.
     *
     *
@@ -1307,6 +1407,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Performs explicit call transfer.
     * Performs explicit call transfer.
     *
     *
@@ -1342,6 +1443,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Places a call with specified number.
     * Places a call with specified number.
     *
     *
@@ -1376,6 +1478,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Sends DTMF code.
     * Sends DTMF code.
     *
     *
@@ -1408,6 +1511,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Get a number corresponding to last voice tag recorded on AG.
     * Get a number corresponding to last voice tag recorded on AG.
     *
     *
@@ -1442,6 +1546,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Returns current audio state of Audio Gateway.
     * Returns current audio state of Audio Gateway.
     *
     *
@@ -1472,6 +1577,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return BluetoothHeadsetClient.STATE_AUDIO_DISCONNECTED;
        return BluetoothHeadsetClient.STATE_AUDIO_DISCONNECTED;
    }
    }

    /**
    /**
     * Sets whether audio routing is allowed.
     * Sets whether audio routing is allowed.
     *
     *
@@ -1499,6 +1605,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
            }
            }
        }
        }
    }
    }

    /**
    /**
     * Returns whether audio routing is allowed.
     * Returns whether audio routing is allowed.
     *
     *
@@ -1528,6 +1635,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Initiates a connection of audio channel.
     * Initiates a connection of audio channel.
     *
     *
@@ -1559,6 +1667,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Disconnects audio channel.
     * Disconnects audio channel.
     *
     *
@@ -1590,6 +1699,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
        }
        }
        return defaultValue;
        return defaultValue;
    }
    }

    /**
    /**
     * Get Audio Gateway features
     * Get Audio Gateway features
     *
     *
@@ -1833,9 +1943,11 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
    private boolean isEnabled() {
    private boolean isEnabled() {
        return mAdapter.getState() == BluetoothAdapter.STATE_ON;
        return mAdapter.getState() == BluetoothAdapter.STATE_ON;
    }
    }

    private static boolean isValidDevice(BluetoothDevice device) {
    private static boolean isValidDevice(BluetoothDevice device) {
        return device != null && BluetoothAdapter.checkBluetoothAddress(device.getAddress());
        return device != null && BluetoothAdapter.checkBluetoothAddress(device.getAddress());
    }
    }

    private static void log(String msg) {
    private static void log(String msg) {
        Log.d(TAG, msg);
        Log.d(TAG, msg);
    }
    }