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

Commit 1ae7bab5 authored by Ravindra's avatar Ravindra
Browse files

Remove the LCH on sub having active call

When the DIAL request on a sub fails due to some reason
and if there is a sub which is in lch having a active call
it will continue to be in lch without this change reason being
that incall ui will not be launched for such cases.
So in order to handle those cases check for any sub in lch and release
it.

Change-Id: I5de92db4e0fefd2814de390cf1707f793d767761
CRs-Fixed: 778958,761725,764489
parent ce0d89da
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -919,9 +919,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 &&
@@ -931,10 +934,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);
        }

@@ -957,6 +962,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.
     */