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

Commit 0198a40a authored by Suresh Koleti's avatar Suresh Koleti Committed by dianlujitao
Browse files

IMS: Use proper phone to route emergency calls

-- By default emergency calls will be dialed using ImsPhone.
   For multi-sim use cases if tried to dial emergency calls
   using ImsPhone where feature state is NOT_READY then will
   end up in not sending DIAL request to lower layers as
   ImsServiceProxy will not allow creating call profile if
   feature state is NOT_READY.
-- Check feature state before routing emergency calls to ImsPhone.

Change-Id: I92d3802bdf57e72689d4e52d6a17e391ef52f8d2
CRs-Fixed: 2078200
parent 574722a4
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.provider.Telephony;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.CellLocation;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.PhoneNumberUtils;
@@ -68,6 +69,7 @@ import android.telephony.cdma.CdmaCellLocation;
import android.text.TextUtils;
import android.util.Log;

import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.cdma.CdmaMmiCode;
@@ -1069,7 +1071,18 @@ public class GsmCdmaPhone extends Phone {
                 (imsPhone.isVideoEnabled() && VideoProfile.isVideo(videoState)))
                 && (imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE);

        int imsFeatureState = ImsFeature.STATE_NOT_AVAILABLE;
        try {
            if (imsPhone != null) {
                imsFeatureState = ImsManager.getInstance(imsPhone.getContext(),
                        imsPhone.getPhoneId()).getImsServiceStatus();
            }
        } catch (ImsException e) {
            Log.e(LOG_TAG, "Got ImsException for phoneId " + imsPhone.getPhoneId());
        }

        boolean useImsForEmergency = imsPhone != null
                && (imsFeatureState == ImsFeature.STATE_READY)
                && isEmergency
                && alwaysTryImsForEmergencyCarrierConfig
                && ImsManager.getInstance(mContext, mPhoneId).isNonTtyOrTtyOnVolteEnabledForSlot()
@@ -1095,7 +1108,8 @@ 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")
                    + ", imsphone feature state = " + imsFeatureState);
        }

        checkWfcWifiOnlyModeBeforeDial();