Loading src/com/android/server/telecom/CallAudioManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,12 @@ public class CallAudioManager extends CallsManagerListenerBase { updateForegroundCall(); if (shouldPlayDisconnectTone(oldState, newState)) { playToneForDisconnectedCall(call); } else { if (newState == CallState.DISCONNECTED) { // This call is not disconnected, but it won't generate a disconnect tone, so // complete the future to ensure we unbind from BT promptly. completeDisconnectToneFuture(call); } } onCallLeavingState(call, oldState); Loading Loading @@ -1089,6 +1095,10 @@ public class CallAudioManager extends CallsManagerListenerBase { CompletableFuture<Void> disconnectedToneFuture = mCallsManager.getInCallController() .getDisconnectedToneBtFutures().get(call.getId()); if (disconnectedToneFuture != null) { Log.i(this, "completeDisconnectToneFuture: completing deferred disconnect tone future for" + " call %s", call.getId()); disconnectedToneFuture.complete(null); } } Loading tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.server.telecom.CallAudioRouteStateMachine; import com.android.server.telecom.CallState; import com.android.server.telecom.CallsManager; import com.android.server.telecom.DtmfLocalTonePlayer; import com.android.server.telecom.InCallController; import com.android.server.telecom.InCallTonePlayer; import com.android.server.telecom.RingbackPlayer; import com.android.server.telecom.Ringer; Loading @@ -77,6 +78,7 @@ import java.util.stream.Collectors; @RunWith(JUnit4.class) public class CallAudioManagerTest extends TelecomTestCase { @Mock private CallAudioRouteStateMachine mCallAudioRouteStateMachine; @Mock private InCallController mInCallController; @Mock private CallsManager mCallsManager; @Mock private CallAudioModeStateMachine mCallAudioModeStateMachine; @Mock private InCallTonePlayer.Factory mPlayerFactory; Loading @@ -103,6 +105,8 @@ public class CallAudioManagerTest extends TelecomTestCase { return mockInCallTonePlayer; }).when(mPlayerFactory).createPlayer(any(Call.class), anyInt()); when(mCallsManager.getLock()).thenReturn(mLock); when(mCallsManager.getInCallController()).thenReturn(mInCallController); when(mInCallController.getBtBindingFuture(any(Call.class))).thenReturn(null); when(mFlags.ensureAudioModeUpdatesOnForegroundCallChange()).thenReturn(true); mCallAudioManager = new CallAudioManager( mCallAudioRouteStateMachine, Loading Loading
src/com/android/server/telecom/CallAudioManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,12 @@ public class CallAudioManager extends CallsManagerListenerBase { updateForegroundCall(); if (shouldPlayDisconnectTone(oldState, newState)) { playToneForDisconnectedCall(call); } else { if (newState == CallState.DISCONNECTED) { // This call is not disconnected, but it won't generate a disconnect tone, so // complete the future to ensure we unbind from BT promptly. completeDisconnectToneFuture(call); } } onCallLeavingState(call, oldState); Loading Loading @@ -1089,6 +1095,10 @@ public class CallAudioManager extends CallsManagerListenerBase { CompletableFuture<Void> disconnectedToneFuture = mCallsManager.getInCallController() .getDisconnectedToneBtFutures().get(call.getId()); if (disconnectedToneFuture != null) { Log.i(this, "completeDisconnectToneFuture: completing deferred disconnect tone future for" + " call %s", call.getId()); disconnectedToneFuture.complete(null); } } Loading
tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.server.telecom.CallAudioRouteStateMachine; import com.android.server.telecom.CallState; import com.android.server.telecom.CallsManager; import com.android.server.telecom.DtmfLocalTonePlayer; import com.android.server.telecom.InCallController; import com.android.server.telecom.InCallTonePlayer; import com.android.server.telecom.RingbackPlayer; import com.android.server.telecom.Ringer; Loading @@ -77,6 +78,7 @@ import java.util.stream.Collectors; @RunWith(JUnit4.class) public class CallAudioManagerTest extends TelecomTestCase { @Mock private CallAudioRouteStateMachine mCallAudioRouteStateMachine; @Mock private InCallController mInCallController; @Mock private CallsManager mCallsManager; @Mock private CallAudioModeStateMachine mCallAudioModeStateMachine; @Mock private InCallTonePlayer.Factory mPlayerFactory; Loading @@ -103,6 +105,8 @@ public class CallAudioManagerTest extends TelecomTestCase { return mockInCallTonePlayer; }).when(mPlayerFactory).createPlayer(any(Call.class), anyInt()); when(mCallsManager.getLock()).thenReturn(mLock); when(mCallsManager.getInCallController()).thenReturn(mInCallController); when(mInCallController.getBtBindingFuture(any(Call.class))).thenReturn(null); when(mFlags.ensureAudioModeUpdatesOnForegroundCallChange()).thenReturn(true); mCallAudioManager = new CallAudioManager( mCallAudioRouteStateMachine, Loading