Loading src/com/android/server/telecom/CallAudioRouteStateMachine.java +8 −3 Original line number Diff line number Diff line Loading @@ -847,6 +847,14 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi if (msg.arg1 == NO_FOCUS) { // Only disconnect audio here instead of routing away from BT entirely. if (mFeatureFlags.transitRouteBeforeAudioDisconnectBt()) { // Note: We have to turn off mute here rather than when entering the // QuiescentBluetooth route because setMuteOn will only work when there the // current state is active. // We don't need to do this in the unflagged path since reinitialize // will turn off mute. if (mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()) { setMuteOn(false); } transitionTo(mQuiescentBluetoothRoute); mBluetoothRouteManager.disconnectAudio(); } else { Loading Loading @@ -977,9 +985,6 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi public void enter() { super.enter(); mHasUserExplicitlyLeftBluetooth = false; if (mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()) { setMuteOn(false); } updateInternalCallAudioState(); } Loading tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.nullable; Loading Loading @@ -1230,8 +1231,9 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { @SmallTest @Test public void testQuiescentBluetoothRouteResetMute() { public void testQuiescentBluetoothRouteResetMute() throws Exception { when(mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()).thenReturn(true); when(mFeatureFlags.transitRouteBeforeAudioDisconnectBt()).thenReturn(true); CallAudioRouteStateMachine stateMachine = new CallAudioRouteStateMachine( mContext, mockCallsManager, Loading Loading @@ -1264,6 +1266,7 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { CallAudioState.ROUTE_BLUETOOTH, CallAudioState.ROUTE_SPEAKER | CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH); assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); when(mockAudioManager.isMicrophoneMute()).thenReturn(true); stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.NO_FOCUS); Loading @@ -1272,9 +1275,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { expectedState = new CallAudioState(false, CallAudioState.ROUTE_BLUETOOTH, CallAudioState.ROUTE_SPEAKER | CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH); // TODO: Re-enable this part of the test; this is now failing because we have to // revert ag/23783145. // assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); verify(mockAudioService).setMicrophoneMute(eq(false), anyString(), anyInt(), eq(null)); } @SmallTest Loading Loading
src/com/android/server/telecom/CallAudioRouteStateMachine.java +8 −3 Original line number Diff line number Diff line Loading @@ -847,6 +847,14 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi if (msg.arg1 == NO_FOCUS) { // Only disconnect audio here instead of routing away from BT entirely. if (mFeatureFlags.transitRouteBeforeAudioDisconnectBt()) { // Note: We have to turn off mute here rather than when entering the // QuiescentBluetooth route because setMuteOn will only work when there the // current state is active. // We don't need to do this in the unflagged path since reinitialize // will turn off mute. if (mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()) { setMuteOn(false); } transitionTo(mQuiescentBluetoothRoute); mBluetoothRouteManager.disconnectAudio(); } else { Loading Loading @@ -977,9 +985,6 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi public void enter() { super.enter(); mHasUserExplicitlyLeftBluetooth = false; if (mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()) { setMuteOn(false); } updateInternalCallAudioState(); } Loading
tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.nullable; Loading Loading @@ -1230,8 +1231,9 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { @SmallTest @Test public void testQuiescentBluetoothRouteResetMute() { public void testQuiescentBluetoothRouteResetMute() throws Exception { when(mFeatureFlags.resetMuteWhenEnteringQuiescentBtRoute()).thenReturn(true); when(mFeatureFlags.transitRouteBeforeAudioDisconnectBt()).thenReturn(true); CallAudioRouteStateMachine stateMachine = new CallAudioRouteStateMachine( mContext, mockCallsManager, Loading Loading @@ -1264,6 +1266,7 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { CallAudioState.ROUTE_BLUETOOTH, CallAudioState.ROUTE_SPEAKER | CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH); assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); when(mockAudioManager.isMicrophoneMute()).thenReturn(true); stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.NO_FOCUS); Loading @@ -1272,9 +1275,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase { expectedState = new CallAudioState(false, CallAudioState.ROUTE_BLUETOOTH, CallAudioState.ROUTE_SPEAKER | CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH); // TODO: Re-enable this part of the test; this is now failing because we have to // revert ag/23783145. // assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); assertEquals(expectedState, stateMachine.getCurrentCallAudioState()); verify(mockAudioService).setMicrophoneMute(eq(false), anyString(), anyInt(), eq(null)); } @SmallTest Loading