Loading android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +9 −0 Original line number Diff line number Diff line Loading @@ -2389,6 +2389,15 @@ class HeadsetStateMachine extends StateMachine { Log.d(TAG, "Processing command: " + atString); if (processAndroidAtSinkAudioPolicy(args, device)) { mNativeInterface.atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_OK, 0); if (getHfpCallAudioPolicy().getActiveDevicePolicyAfterConnection() == BluetoothSinkAudioPolicy.POLICY_NOT_ALLOWED && mDevice.equals(mHeadsetService.getActiveDevice())) { Log.d( TAG, "Remove the active device because the active device policy after" + " connection is not allowed"); mHeadsetService.setActiveDevice(null); } } else { Log.w(TAG, "Invalid SinkAudioPolicy parameters!"); mNativeInterface.atResponseCode( Loading android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -1923,6 +1923,14 @@ public class HeadsetStateMachineTest { .atResponseCode(mTestDevice, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); } @Test public void testCheckAndProcessAndroidAt_handleConnectingTimePolicyNotAllowed() { when(mHeadsetService.getActiveDevice()).thenReturn(mTestDevice); mHeadsetStateMachine.checkAndProcessAndroidAt( "+ANDROID=SINKAUDIOPOLICY,0,2,2", mTestDevice); verify(mHeadsetService).setActiveDevice(null); } @Test public void testCheckAndProcessAndroidAt_replyAndroidAtFeatureRequest() { // Commands that will be handled Loading Loading
android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +9 −0 Original line number Diff line number Diff line Loading @@ -2389,6 +2389,15 @@ class HeadsetStateMachine extends StateMachine { Log.d(TAG, "Processing command: " + atString); if (processAndroidAtSinkAudioPolicy(args, device)) { mNativeInterface.atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_OK, 0); if (getHfpCallAudioPolicy().getActiveDevicePolicyAfterConnection() == BluetoothSinkAudioPolicy.POLICY_NOT_ALLOWED && mDevice.equals(mHeadsetService.getActiveDevice())) { Log.d( TAG, "Remove the active device because the active device policy after" + " connection is not allowed"); mHeadsetService.setActiveDevice(null); } } else { Log.w(TAG, "Invalid SinkAudioPolicy parameters!"); mNativeInterface.atResponseCode( Loading
android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -1923,6 +1923,14 @@ public class HeadsetStateMachineTest { .atResponseCode(mTestDevice, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); } @Test public void testCheckAndProcessAndroidAt_handleConnectingTimePolicyNotAllowed() { when(mHeadsetService.getActiveDevice()).thenReturn(mTestDevice); mHeadsetStateMachine.checkAndProcessAndroidAt( "+ANDROID=SINKAUDIOPOLICY,0,2,2", mTestDevice); verify(mHeadsetService).setActiveDevice(null); } @Test public void testCheckAndProcessAndroidAt_replyAndroidAtFeatureRequest() { // Commands that will be handled Loading