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

Commit 05a9e40b authored by Nancy Chen's avatar Nancy Chen
Browse files

Ensure bluetooth does not get hangup sound when calling through gvoice

Because Google Voice works by canceling an outgoing call and starting up
its own outgoing call, telecom registers the first call as a
disconnecting call and sends a signal to the bluetooth device that the
call was disconnected. This causes a hangup sound from the bluetooth
device. This fix works by having bluetooth ignore a call until it gets
into the dialing state, which only happens after the google voice call
has connected.

Bug: 17662993
Change-Id: I52c504f615534c59ede8c0de520f755484922730
parent 9019ebc5
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -498,10 +498,15 @@ public final class BluetoothPhoneService extends Service {
     * Sends a single clcc (C* List Current Calls) event for the specified call.
     */
    private void sendClccForCall(Call call) {
        int index = getIndexForCall(call);
        int direction = call.isIncoming() ? 1 : 0;
        boolean isForeground = getCallsManager().getForegroundCall() == call;
        int state = convertCallState(call.getState(), isForeground);

        if (state == CALL_STATE_IDLE) {
            return;
        }

        int index = getIndexForCall(call);
        int direction = call.isIncoming() ? 1 : 0;
        boolean isPartOfConference = call.getParentCall() != null;
        Uri addressUri = call.getHandle();
        String address = addressUri == null ? null : addressUri.getSchemeSpecificPart();
@@ -583,6 +588,7 @@ public final class BluetoothPhoneService extends Service {
    private int getBluetoothCallStateForUpdate() {
        CallsManager callsManager = getCallsManager();
        Call ringingCall = callsManager.getRingingCall();
        Call dialingCall = callsManager.getDialingCall();

        //
        // !! WARNING !!
@@ -596,7 +602,7 @@ public final class BluetoothPhoneService extends Service {
        int bluetoothCallState = CALL_STATE_IDLE;
        if (ringingCall != null) {
            bluetoothCallState = CALL_STATE_INCOMING;
        } else if (callsManager.getDialingOrConnectingCall() != null) {
        } else if (dialingCall != null) {
            bluetoothCallState = CALL_STATE_ALERTING;
        }
        return bluetoothCallState;
@@ -607,15 +613,17 @@ public final class BluetoothPhoneService extends Service {
            case CallState.NEW:
            case CallState.ABORTED:
            case CallState.DISCONNECTED:
            case CallState.CONNECTING:
            case CallState.PRE_DIAL_WAIT:
                if (callState == CallState.CONNECTING || callState == CallState.PRE_DIAL_WAIT) {
                    Log.w(this, "convertCallState: unexpected state %s",
                            CallState.toString(callState));
                }
                return CALL_STATE_IDLE;

            case CallState.ACTIVE:
                return CALL_STATE_ACTIVE;

            case CallState.CONNECTING:
            case CallState.PRE_DIAL_WAIT:
                return CALL_STATE_DIALING;

            case CallState.DIALING:
                // Yes, this is correctly returning ALERTING.
                // "Dialing" for BT means that we have sent information to the service provider
+2 −2
Original line number Diff line number Diff line
@@ -810,8 +810,8 @@ public final class CallsManager extends Call.ListenerBase {
        return getFirstCallWithState(CallState.ACTIVE);
    }

    Call getDialingOrConnectingCall() {
        return getFirstCallWithState(CallState.DIALING, CallState.CONNECTING);
    Call getDialingCall() {
        return getFirstCallWithState(CallState.DIALING);
    }

    Call getHeldCall() {