Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d5a63c5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix issue where incoming call ringing persiste on BT headset." into main

parents 0f6e00fa e3b7edcc
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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);
@@ -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);
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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,