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

Commit d760a9c8 authored by kaiyiz's avatar kaiyiz
Browse files

Telecom: Retain LCH on conversation sub after remote hang up

After switching to other active sub due to remote hang up,
the LCH status of active sub is unset.

Retain LCH on conversation sub after remote hang up when
update LCH status and set mute, then if user clicks the
unmute button, the LCH status will be unset.

CRs-Fixed: 761742

Change-Id: I4e877e936d43e47c02c0ef12bad363c4a0ceaddc
parent 5bdbc3ef
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -821,6 +821,15 @@ public final class CallsManager extends Call.ListenerBase {
    /** Called by the in-call UI to change the mute state. */
    void mute(boolean shouldMute) {
        mCallAudioManager.mute(shouldMute);
        if (!shouldMute) {
            // if the current active sub is in lch state and user
            // has clicked the unmute button, deactivate this sub's
            // lch state.
            String activeSub = getActiveSubscription();
            if (activeSub != null && activeSub.equals(getLchSub())) {
                updateLchStatus(activeSub);
            }
        }
    }

    /**
@@ -1697,6 +1706,21 @@ public final class CallsManager extends Call.ListenerBase {
                + " retainLch:" + retainLch);
        setActiveSubscription(subId);
        updateLchStatus(subId);
        if (retainLch) {
            Call call = getNonRingingLiveCall(subId);
            if (call != null) {
                call.setLocalCallHold(1);
                PhoneAccountHandle ph = call.getTargetPhoneAccount();
                PhoneAccount phAcc = getPhoneAccountRegistrar().getPhoneAccount(ph);
                // Update state only if the new state is not true
                if (!phAcc.isSet(PhoneAccount.LCH)) {
                    phAcc.setBit(PhoneAccount.LCH);
                }
            }
            // lch state should be retained on active subscription, hence enable
            // mute so that user is aware that call is in lch.
            mute(true);
        }
        manageMSimInCallTones(true);
        updateForegroundCall();
    }