Loading src/com/android/server/telecom/CallAudioManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -364,7 +364,13 @@ public class CallAudioManager extends CallsManagerListenerBase { return null; } void toggleMute() { @VisibleForTesting public void toggleMute() { // Don't mute if there are any emergency calls. if (mCallsManager.hasEmergencyCall()) { Log.v(this, "ignoring toggleMute for emergency call"); return; } mCallAudioRouteStateMachine.sendMessageWithSessionInfo( CallAudioRouteStateMachine.TOGGLE_MUTE); } Loading src/com/android/server/telecom/CallsManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -1858,6 +1858,7 @@ public class CallsManager extends Call.ListenerBase void markCallAsDialing(Call call) { setCallState(call, CallState.DIALING, "dialing set explicitly"); maybeMoveToSpeakerPhone(call); maybeTurnOffMute(call); } void markCallAsPulling(Call call) { Loading Loading @@ -2852,6 +2853,15 @@ public class CallsManager extends Call.ListenerBase } } /** * Checks to see if the call is an emergency call and if so, turn off mute. */ private void maybeTurnOffMute(Call call) { if (call.isEmergencyCall()) { mute(false); } } /** * Creates a new call for an existing connection. * Loading tests/src/com/android/server/telecom/tests/BasicCallTests.java +46 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.never; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; Loading Loading @@ -68,6 +69,7 @@ import org.junit.runners.JUnit4; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.List; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; Loading Loading @@ -1068,4 +1070,48 @@ public class BasicCallTests extends TelecomSystemTest { .deflect(eq(ids.mConnectionId), eq(deflectAddress), any()); mInCallServiceFixtureX.mInCallAdapter.disconnectCall(ids.mCallId); } /** * Test to make sure to unmute automatically when making an emergency call and keep unmute * during the emergency call. * @throws Exception */ @LargeTest @Test public void testUnmuteDuringEmergencyCall() throws Exception { // Make an outgoing call and turn ON mute. IdPair outgoingCall = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(outgoingCall.mCallId) .getState()); mInCallServiceFixtureX.mInCallAdapter.mute(true); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); assertTrue(mTelecomSystem.getCallsManager().getAudioState().isMuted()); // Make an emergency call. IdPair emergencyCall = startAndMakeDialingEmergencyCall("650-555-1213", mPhoneAccountE0.getAccountHandle(), mConnectionServiceFixtureA); assertEquals(Call.STATE_DIALING, mInCallServiceFixtureX.getCall(emergencyCall.mCallId) .getState()); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); // Should be unmute automatically. assertFalse(mTelecomSystem.getCallsManager().getAudioState().isMuted()); // Toggle mute during an emergency call. mTelecomSystem.getCallsManager().getCallAudioManager().toggleMute(); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); // Should keep unmute. assertFalse(mTelecomSystem.getCallsManager().getAudioState().isMuted()); ArgumentCaptor<Boolean> muteValueCaptor = ArgumentCaptor.forClass(Boolean.class); verify(mAudioService, times(2)).setMicrophoneMute(muteValueCaptor.capture(), any(String.class), any(Integer.class)); List<Boolean> muteValues = muteValueCaptor.getAllValues(); // Check mute status was changed twice with true and false. assertTrue(muteValues.get(0)); assertFalse(muteValues.get(1)); } } Loading
src/com/android/server/telecom/CallAudioManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -364,7 +364,13 @@ public class CallAudioManager extends CallsManagerListenerBase { return null; } void toggleMute() { @VisibleForTesting public void toggleMute() { // Don't mute if there are any emergency calls. if (mCallsManager.hasEmergencyCall()) { Log.v(this, "ignoring toggleMute for emergency call"); return; } mCallAudioRouteStateMachine.sendMessageWithSessionInfo( CallAudioRouteStateMachine.TOGGLE_MUTE); } Loading
src/com/android/server/telecom/CallsManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -1858,6 +1858,7 @@ public class CallsManager extends Call.ListenerBase void markCallAsDialing(Call call) { setCallState(call, CallState.DIALING, "dialing set explicitly"); maybeMoveToSpeakerPhone(call); maybeTurnOffMute(call); } void markCallAsPulling(Call call) { Loading Loading @@ -2852,6 +2853,15 @@ public class CallsManager extends Call.ListenerBase } } /** * Checks to see if the call is an emergency call and if so, turn off mute. */ private void maybeTurnOffMute(Call call) { if (call.isEmergencyCall()) { mute(false); } } /** * Creates a new call for an existing connection. * Loading
tests/src/com/android/server/telecom/tests/BasicCallTests.java +46 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.never; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; Loading Loading @@ -68,6 +69,7 @@ import org.junit.runners.JUnit4; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.List; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; Loading Loading @@ -1068,4 +1070,48 @@ public class BasicCallTests extends TelecomSystemTest { .deflect(eq(ids.mConnectionId), eq(deflectAddress), any()); mInCallServiceFixtureX.mInCallAdapter.disconnectCall(ids.mCallId); } /** * Test to make sure to unmute automatically when making an emergency call and keep unmute * during the emergency call. * @throws Exception */ @LargeTest @Test public void testUnmuteDuringEmergencyCall() throws Exception { // Make an outgoing call and turn ON mute. IdPair outgoingCall = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(outgoingCall.mCallId) .getState()); mInCallServiceFixtureX.mInCallAdapter.mute(true); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); assertTrue(mTelecomSystem.getCallsManager().getAudioState().isMuted()); // Make an emergency call. IdPair emergencyCall = startAndMakeDialingEmergencyCall("650-555-1213", mPhoneAccountE0.getAccountHandle(), mConnectionServiceFixtureA); assertEquals(Call.STATE_DIALING, mInCallServiceFixtureX.getCall(emergencyCall.mCallId) .getState()); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); // Should be unmute automatically. assertFalse(mTelecomSystem.getCallsManager().getAudioState().isMuted()); // Toggle mute during an emergency call. mTelecomSystem.getCallsManager().getCallAudioManager().toggleMute(); waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager() .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT); // Should keep unmute. assertFalse(mTelecomSystem.getCallsManager().getAudioState().isMuted()); ArgumentCaptor<Boolean> muteValueCaptor = ArgumentCaptor.forClass(Boolean.class); verify(mAudioService, times(2)).setMicrophoneMute(muteValueCaptor.capture(), any(String.class), any(Integer.class)); List<Boolean> muteValues = muteValueCaptor.getAllValues(); // Check mute status was changed twice with true and false. assertTrue(muteValues.get(0)); assertFalse(muteValues.get(1)); } }