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

Commit f581d403 authored by Fang Yunong's avatar Fang Yunong Committed by Gerrit - the friendly Code Review server
Browse files

IMS: Add the support of IMS call preferred capability

If IMS call preferred, force the call to be dialed via IMS phone,
except emergence calls and UT call.

Change-Id: Ia9438c837912e0534996fb474df76071ab3652cc
CRs-Fixed: 1063183
parent 8055aee6
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -116,6 +116,9 @@ public class GsmCdmaPhone extends Phone {
    /** List of Registrants to receive Supplementary Service Notifications. */
    private RegistrantList mSsnRegistrants = new RegistrantList();

    // the state value for VoltPreferred (0->off, 1->on)
    private static final int VOLTE_PREFERRED_ON = 1;

    //CDMA
    // Default Emergency Callback Mode exit timer
    private static final int DEFAULT_ECM_EXIT_TIMER_VALUE = 300000;
@@ -1096,6 +1099,20 @@ public class GsmCdmaPhone extends Phone {

        boolean useImsForUt = imsPhone != null && imsPhone.isUtEnabled();

        // when Volte preferred is set to "yes"(which is the default setting),
        // MO calls would be done over IMS (per existing MO procedures).
        // The VoLTE Preferred settings shall not change the Emergency/911 call logic.
        // Volte preferred setting is applicable for both VT and VoLTE calls.
        // Volte prefeered setting is a global ims setting that determines the call
        // path for all IMS calls (eg. volte/vt).
        boolean useImsPrefer = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_volte_preferred)
                && (Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.VOLTE_PREFERRED_ON, VOLTE_PREFERRED_ON) == VOLTE_PREFERRED_ON)
                && (imsPhone != null) && !(isEmergency || isUt)
                && ImsManager.isNonTtyOrTtyOnVolteEnabled(mContext)
                && (imsPhone.getServiceState().getState() != ServiceState.STATE_POWER_OFF);

        if (DBG) {
            logd("imsUseEnabled=" + imsUseEnabled
                    + ", useImsForEmergency=" + useImsForEmergency
@@ -1109,12 +1126,13 @@ public class GsmCdmaPhone extends Phone {
                    + ", imsPhone.isVideoEnabled()="
                    + ((imsPhone != null) ? imsPhone.isVideoEnabled() : "N/A")
                    + ", imsPhone.getServiceState().getState()="
                    + ((imsPhone != null) ? imsPhone.getServiceState().getState() : "N/A"));
                    + ((imsPhone != null) ? imsPhone.getServiceState().getState() : "N/A")
                    + ", useImsPrefer=" + useImsPrefer);
        }

        Phone.checkWfcWifiOnlyModeBeforeDial(mImsPhone, mContext);

        if ((imsUseEnabled && (!isUt || useImsForUt)) || useImsForEmergency) {
        if ((imsUseEnabled && (!isUt || useImsForUt)) || useImsForEmergency || useImsPrefer) {
            try {
                if (DBG) logd("Trying IMS PS call");
                return imsPhone.dial(dialString, uusInfo, videoState, intentExtras);