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

Commit d1676ecb authored by William Escande's avatar William Escande Committed by Android (Google) Code Review
Browse files

Merge "Add system properties to config headsetclient behaviors" into tm-mainline-prod

parents e451fbc4 94dd272e
Loading
Loading
Loading
Loading
+14 −3
Original line number Original line Diff line number Diff line
@@ -186,6 +186,8 @@ public class HeadsetClientStateMachine extends StateMachine {
    // Indicates whether audio can be routed to the device
    // Indicates whether audio can be routed to the device
    private boolean mAudioRouteAllowed;
    private boolean mAudioRouteAllowed;


    private final boolean mClccPollDuringCall;

    private static final int CALL_AUDIO_POLICY_FEATURE_ID = 1;
    private static final int CALL_AUDIO_POLICY_FEATURE_ID = 1;


    public int mAudioPolicyRemoteSupported;
    public int mAudioPolicyRemoteSupported;
@@ -551,7 +553,7 @@ public class HeadsetClientStateMachine extends StateMachine {
            // a valid call on the phone. The polling would at most continue until
            // a valid call on the phone. The polling would at most continue until
            // OUTGOING_TIMEOUT_MILLI. This handles the potential scenario where the phone creates
            // OUTGOING_TIMEOUT_MILLI. This handles the potential scenario where the phone creates
            // and terminates a call before the first QUERY_CURRENT_CALLS completes.
            // and terminates a call before the first QUERY_CURRENT_CALLS completes.
            if (mService.getResources().getBoolean(R.bool.hfp_clcc_poll_during_call)
            if (mClccPollDuringCall
                    || (mCalls.containsKey(HF_ORIGINATED_CALL_ID))) {
                    || (mCalls.containsKey(HF_ORIGINATED_CALL_ID))) {
                sendMessageDelayed(QUERY_CURRENT_CALLS,
                sendMessageDelayed(QUERY_CURRENT_CALLS,
                        mService.getResources().getInteger(
                        mService.getResources().getInteger(
@@ -885,6 +887,13 @@ public class HeadsetClientStateMachine extends StateMachine {
        mAudioRouteAllowed = context.getResources().getBoolean(
        mAudioRouteAllowed = context.getResources().getBoolean(
            R.bool.headset_client_initial_audio_route_allowed);
            R.bool.headset_client_initial_audio_route_allowed);


        mAudioRouteAllowed = SystemProperties.getBoolean(
            "bluetooth.headset_client.initial_audio_route.enabled", mAudioRouteAllowed);

        mClccPollDuringCall = SystemProperties.getBoolean(
            "bluetooth.hfp.clcc_poll_during_call.enabled",
            mService.getResources().getBoolean(R.bool.hfp_clcc_poll_during_call));

        mHsClientAudioPolicy = new BluetoothSinkAudioPolicy.Builder().build();
        mHsClientAudioPolicy = new BluetoothSinkAudioPolicy.Builder().build();
        mConnectingTimePolicyProperty = getAudioPolicySystemProp(
        mConnectingTimePolicyProperty = getAudioPolicySystemProp(
            "bluetooth.headset_client.audio_policy.connecting_time.config");
            "bluetooth.headset_client.audio_policy.connecting_time.config");
@@ -1509,10 +1518,12 @@ public class HeadsetClientStateMachine extends StateMachine {
                    break;
                    break;
                case QUERY_CURRENT_CALLS:
                case QUERY_CURRENT_CALLS:
                    removeMessages(QUERY_CURRENT_CALLS);
                    removeMessages(QUERY_CURRENT_CALLS);
                    if (DBG) {
                        Log.d(TAG, "mClccPollDuringCall=" + mClccPollDuringCall);
                    }
                    // If there are ongoing calls periodically check their status.
                    // If there are ongoing calls periodically check their status.
                    if (mCalls.size() > 1
                    if (mCalls.size() > 1
                            && mService.getResources().getBoolean(
                            && mClccPollDuringCall) {
                            R.bool.hfp_clcc_poll_during_call)) {
                        sendMessageDelayed(QUERY_CURRENT_CALLS,
                        sendMessageDelayed(QUERY_CURRENT_CALLS,
                                mService.getResources().getInteger(
                                mService.getResources().getInteger(
                                R.integer.hfp_clcc_poll_interval_during_call));
                                R.integer.hfp_clcc_poll_interval_during_call));