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

Commit 29049d4e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Set connectingTimePolicy to 1 if audio is allowed" am: 2c4845ed

parents 7a08ea3a 2c4845ed
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -2246,9 +2246,17 @@ public class HeadsetClientStateMachine extends StateMachine {
         *  2. remote device supports audio policy
         */
        if (getForceSetAudioPolicyProperty()) {
            setAudioPolicy(new BluetoothSinkAudioPolicy.Builder(mHsClientAudioPolicy)
            // set call establish policy and connecting policy to POLICY_ALLOWED if allowed=true,
            // otherwise set them to the default values
            int connectingTimePolicy =
                    allowed
                            ? BluetoothSinkAudioPolicy.POLICY_ALLOWED
                            : getConnectingTimePolicyProperty();

            setAudioPolicy(
                    new BluetoothSinkAudioPolicy.Builder(mHsClientAudioPolicy)
                            .setCallEstablishPolicy(establishPolicy)
                    .setActiveDevicePolicyAfterConnection(getConnectingTimePolicyProperty())
                            .setActiveDevicePolicyAfterConnection(connectingTimePolicy)
                            .setInBandRingtonePolicy(getInBandRingtonePolicyProperty())
                            .build());
        } else {
+1 −7
Original line number Diff line number Diff line
@@ -16,10 +16,7 @@

package com.android.bluetooth.hfpclient;

import static android.bluetooth.BluetoothProfile.STATE_CONNECTED;
import static android.bluetooth.BluetoothProfile.STATE_CONNECTING;
import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED;
import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTING;

import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.AT_OK;
import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.ENTER_PRIVATE_MODE;
@@ -58,16 +55,13 @@ import androidx.test.runner.AndroidJUnit4;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.hfp.HeadsetStackEvent;

import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsInstanceOf;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -935,7 +929,7 @@ public class HeadsetClientStateMachineTest {
        // Expect: Should send +ANDROID=SINKAUDIOPOLICY,1,2,1 to remote
        mHeadsetClientStateMachine.setForceSetAudioPolicyProperty(true);
        mHeadsetClientStateMachine.setAudioRouteAllowed(true);
        verify(mNativeInterface).sendAndroidAt(mTestDevice, "+ANDROID=SINKAUDIOPOLICY,1,2,1");
        verify(mNativeInterface).sendAndroidAt(mTestDevice, "+ANDROID=SINKAUDIOPOLICY,1,1,1");
    }

    @Test