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

Commit f43a8c5e authored by Matt Garnes's avatar Matt Garnes
Browse files

Merge CAF branch 'LA.BR.1.2.1_rb2.18' into caf/cm-12.0.

parents 724e2184 6f0d5cc1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1433,6 +1433,9 @@ public final class BluetoothPhoneService extends Service {
                        callsManager.answerCall(ringingCall, 0);
                    } else if (backgroundCall != null) {
                        callsManager.unholdCall(backgroundCall);
                    } else if (activeCall != null && activeCall.can(PhoneCapabilities.HOLD)) {
                        Log.i(TAG, "Only active call, put that to hold");
                        callsManager.holdCall(activeCall);
                    }
                }
                status = true;
+3 −8
Original line number Diff line number Diff line
@@ -98,14 +98,9 @@ final class CallAudioManager extends CallsManagerListenerBase
    public void onIncomingCallAnswered(Call call) {
        int route = mAudioState.route;

        // We do two things:
        // (1) If this is the first call, then we can to turn on bluetooth if available.
        // (2) Unmute the audio for the new incoming call.
        boolean isOnlyCall = CallsManager.getInstance().getCalls().size() == 1;
        if (isOnlyCall && mBluetoothManager.isBluetoothAvailable()) {
            mBluetoothManager.connectBluetoothAudio();
            route = AudioState.ROUTE_BLUETOOTH;
        }
        // BT stack will connect audio upon receiving active call state.
        // We unmute the audio for the new incoming call.

        setSystemAudioState(false /* isMute */, route, mAudioState.supportedRouteMask);

        if (mContext == null) {
+27 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public final class CallsManager extends Call.ListenerBase {
    private static final int MAXIMUM_OUTGOING_CALLS = 1;
    private static final int MAXIMUM_DSDA_LIVE_CALLS = 2;
    private static final int MAXIMUM_DSDA_HOLD_CALLS = 2;
    private static final int MAXIMUM_TOP_LEVEL_CALLS = 10;
    private static final int MAXIMUM_TOP_LEVEL_CALLS = 2;

    private static final int[] OUTGOING_CALL_STATES =
            {CallState.CONNECTING, CallState.DIALING};
@@ -411,6 +411,8 @@ public final class CallsManager extends Call.ListenerBase {

    void addNewUnknownCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) {
        Uri handle = extras.getParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE);
        String state = extras.getString(TelecomManager.EXTRA_UNKNOWN_CALL_STATE);

        Log.i(this, "addNewUnknownCall with handle: %s", Log.pii(handle));
        Call call = new Call(
                mContext,
@@ -425,11 +427,35 @@ public final class CallsManager extends Call.ListenerBase {
                false /* isConference */);
        call.setConnectTimeMillis(System.currentTimeMillis());
        call.setIsUnknown(true);
        call.setState(convertState(state));
        call.setExtras(extras);
        call.addListener(this);
        call.startCreateConnection(mPhoneAccountRegistrar);
    }


    private int convertState(String state) {
        if (state == null) {
            return CallState.RINGING;
        } else if (state.compareTo("ACTIVE") == 0) {
            return CallState.ACTIVE;
        } else if (state.compareTo("HOLDING") == 0) {
            return CallState.ON_HOLD;
        } else if (state.compareTo("DIALING") == 0) {
            return CallState.DIALING;
        }  else if (state.compareTo("ALERTING") == 0) {
            return CallState.RINGING;
        }  else if (state.compareTo("INCOMING") == 0) {
            return CallState.RINGING;
        }  else if (state.compareTo("DISCONNECTED") == 0) {
            return CallState.DISCONNECTED;
        }  else if (state.compareTo("DISCONNECTING") == 0) {
            return CallState.DISCONNECTING;
        } else {
            return CallState.RINGING;
        }
    }

    /**
     * Kicks off the first steps to creating an outgoing call so that InCallUI can launch.
     *