Loading android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +13 −5 Original line number Diff line number Diff line Loading @@ -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 { Loading android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +1 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading
android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +13 −5 Original line number Diff line number Diff line Loading @@ -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 { Loading
android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +1 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading