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

Commit a2fc9c2f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Remove the LCH on sub having active call"

parents 199b959d 1ae7bab5
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -920,9 +920,12 @@ public final class CallsManager extends Call.ListenerBase {
     */
    void markCallAsDisconnected(Call call, DisconnectCause disconnectCause) {
        call.setDisconnectCause(disconnectCause);
        int prevState = call.getState();
        setCallState(call, CallState.DISCONNECTED);
        String activeSub = getActiveSubscription();
        String conversationSub = getConversationSub();
        String lchSub = IsAnySubInLch();

        PhoneAccount phAcc =
                 getPhoneAccountRegistrar().getPhoneAccount(call.getTargetPhoneAccount());
        if ((call.getTargetPhoneAccount() != null &&
@@ -932,10 +935,12 @@ public final class CallsManager extends Call.ListenerBase {
                    (!conversationSub.equals(activeSub))) {
            Log.d(this,"Set active sub to conversation sub");
            setActiveSubscription(conversationSub);
        } else if ((conversationSub == null) && (call.getTargetPhoneAccount() != null) &&
                (activeSub != null) && (!call.getTargetPhoneAccount().getId().equals(activeSub))) {
            Log.d(this,"remove active sub from LCH");
            updateLchStatus(activeSub);
        } else if ((conversationSub == null) && (lchSub != null) &&
                ((prevState == CallState.CONNECTING) || (prevState == CallState.PRE_DIAL_WAIT)) &&
                (call.getState() == CallState.DISCONNECTED)) {
            Log.d(this,"remove sub with call from LCH");
            updateLchStatus(lchSub);
            setActiveSubscription(lchSub);
            manageMSimInCallTones(false);
        }

@@ -958,6 +963,16 @@ public final class CallsManager extends Call.ListenerBase {
        }
    }

    private String IsAnySubInLch() {
        for (PhoneAccountHandle ph : getPhoneAccountRegistrar().getCallCapablePhoneAccounts()) {
            if (getPhoneAccountRegistrar().getPhoneAccount(ph).isSet(PhoneAccount.LCH)) {
                Log.d(this, "Sub in LCH: " + ph.getId());
                return ph.getId();
            }
        }
        return null;
    }

    /**
     * Removes an existing disconnected call, and notifies the in-call app.
     */