Loading src/com/android/server/telecom/CallAudioManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -418,6 +418,17 @@ public class CallAudioManager extends CallsManagerListenerBase { } } /** * Switch call audio routing to the baseline route, including bluetooth headsets if there are * any connected. */ void switchBaseline() { Log.i(this, "switchBaseline"); mCallAudioRouteStateMachine.sendMessageWithSessionInfo( CallAudioRouteStateMachine.USER_SWITCH_BASELINE_ROUTE, CallAudioRouteStateMachine.INCLUDE_BLUETOOTH_IN_BASELINE); } void silenceRingers() { for (Call call : mRingingCalls) { call.silence(); Loading src/com/android/server/telecom/CallsManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -3092,6 +3092,12 @@ public class CallsManager extends Call.ListenerBase mCalls.stream() .filter(c -> c.isSelfManaged()) .forEach(c -> c.disconnect()); // When disconnecting all self-managed calls, switch audio routing back to the baseline // route. This ensures if, for example, the self-managed ConnectionService was routed to // speakerphone that we'll switch back to earpiece for the managed call which necessitated // disconnecting the self-managed calls. mCallAudioManager.switchBaseline(); } /** Loading tests/src/com/android/server/telecom/tests/BasicCallTests.java +26 −0 Original line number Diff line number Diff line Loading @@ -955,4 +955,30 @@ public class BasicCallTests extends TelecomSystemTest { assertFalse(mTelecomSystem.getTelecomServiceImpl().getBinder() .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle())); } /** * Basic to verify audio route gets reset to baseline when emergency call placed while a * self-managed call is underway. * @throws Exception */ @LargeTest public void testDisconnectSelfManaged() throws Exception { // Add a self-managed call. PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); startAndMakeActiveIncomingCall("650-555-1212", phoneAccountHandle, mConnectionServiceFixtureA); Connection connection = mConnectionServiceFixtureA.mLatestConnection; // Route self-managed call to speaker. connection.setAudioRoute(CallAudioState.ROUTE_SPEAKER); waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT); // Place an emergency call. startAndMakeDialingEmergencyCall("650-555-1212", mPhoneAccountE0.getAccountHandle(), mConnectionServiceFixtureA); // Should have reverted back to earpiece. assertEquals(CallAudioState.ROUTE_EARPIECE, mInCallServiceFixtureX.mCallAudioState.getRoute()); } } Loading
src/com/android/server/telecom/CallAudioManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -418,6 +418,17 @@ public class CallAudioManager extends CallsManagerListenerBase { } } /** * Switch call audio routing to the baseline route, including bluetooth headsets if there are * any connected. */ void switchBaseline() { Log.i(this, "switchBaseline"); mCallAudioRouteStateMachine.sendMessageWithSessionInfo( CallAudioRouteStateMachine.USER_SWITCH_BASELINE_ROUTE, CallAudioRouteStateMachine.INCLUDE_BLUETOOTH_IN_BASELINE); } void silenceRingers() { for (Call call : mRingingCalls) { call.silence(); Loading
src/com/android/server/telecom/CallsManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -3092,6 +3092,12 @@ public class CallsManager extends Call.ListenerBase mCalls.stream() .filter(c -> c.isSelfManaged()) .forEach(c -> c.disconnect()); // When disconnecting all self-managed calls, switch audio routing back to the baseline // route. This ensures if, for example, the self-managed ConnectionService was routed to // speakerphone that we'll switch back to earpiece for the managed call which necessitated // disconnecting the self-managed calls. mCallAudioManager.switchBaseline(); } /** Loading
tests/src/com/android/server/telecom/tests/BasicCallTests.java +26 −0 Original line number Diff line number Diff line Loading @@ -955,4 +955,30 @@ public class BasicCallTests extends TelecomSystemTest { assertFalse(mTelecomSystem.getTelecomServiceImpl().getBinder() .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle())); } /** * Basic to verify audio route gets reset to baseline when emergency call placed while a * self-managed call is underway. * @throws Exception */ @LargeTest public void testDisconnectSelfManaged() throws Exception { // Add a self-managed call. PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); startAndMakeActiveIncomingCall("650-555-1212", phoneAccountHandle, mConnectionServiceFixtureA); Connection connection = mConnectionServiceFixtureA.mLatestConnection; // Route self-managed call to speaker. connection.setAudioRoute(CallAudioState.ROUTE_SPEAKER); waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT); // Place an emergency call. startAndMakeDialingEmergencyCall("650-555-1212", mPhoneAccountE0.getAccountHandle(), mConnectionServiceFixtureA); // Should have reverted back to earpiece. assertEquals(CallAudioState.ROUTE_EARPIECE, mInCallServiceFixtureX.mCallAudioState.getRoute()); } }