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

Commit 1af09dcb authored by Sukanya Rajkhowa's avatar Sukanya Rajkhowa
Browse files

Remove dependency on data_roaming setting for IMS APN

- If data_roaming is disabled by user, IMS PDN is not being
  brought up in roaming scenarios even if IMS is registered
- Fix this by allowing IMS PDN to go through irrespective of
  data roaming setting

CRs-Fixed: 915995

Change-Id: I3c690363cc2e3d559a255d9787158f6edd2dc88c
parent 30e06b2c
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -411,7 +411,8 @@ public class DcTracker extends DcTrackerBase {
        boolean isEmergencyApn = apnContext.getApnType().equals(PhoneConstants.APN_TYPE_EMERGENCY);
        // Set the emergency APN availability status as TRUE irrespective of conditions checked in
        // isDataAllowed() like IN_SERVICE, MOBILE DATA status etc.
        boolean dataAllowed = isEmergencyApn || isDataAllowed();
        boolean dataAllowed = isEmergencyApn
                || (isDataAllowed() && isDataRoamingAllowed(apnContext));
        boolean possible = dataAllowed && apnTypePossible;

        if ((apnContext.getApnType().equals(PhoneConstants.APN_TYPE_DEFAULT)
@@ -697,10 +698,22 @@ public class DcTracker extends DcTrackerBase {
            log("Default data call activation not allowed in iwlan.");
            return false;
        } else {
            return apnContext.isReady() && isDataAllowed();
            return apnContext.isReady() && isDataAllowed() && isDataRoamingAllowed(apnContext);
        }
    }

    private boolean isDataRoamingAllowed(ApnContext apnContext) {
        boolean allowDataRoaming = (!mPhone.getServiceState().getDataRoaming()
                || apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)
                || getDataOnRoamingEnabled());
        if (!allowDataRoaming) {
            String reason = " - Roaming and data roaming not enabled";
            if (DBG)
                log("isDataAllowed: not allowed due to" + reason);
        }
        return allowDataRoaming;
    }

    //****** Called from ServiceStateTracker
    /**
     * Invoked when ServiceStateTracker observes a transition from GPRS
@@ -781,7 +794,6 @@ public class DcTracker extends DcTrackerBase {
                     mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) &&
                    internalDataEnabled &&
                    defaultDataSelected &&
                    (!mPhone.getServiceState().getDataRoaming() || getDataOnRoamingEnabled()) &&
                    !mIsPsRestricted &&
                    desiredPowerState;
        if (!allowed && DBG) {
@@ -800,9 +812,6 @@ public class DcTracker extends DcTrackerBase {
            }
            if (!internalDataEnabled) reason += " - mInternalDataEnabled= false";
            if (!defaultDataSelected) reason += " - defaultDataSelected= false";
            if (mPhone.getServiceState().getDataRoaming() && !getDataOnRoamingEnabled()) {
                reason += " - Roaming and data roaming not enabled";
            }
            if (mIsPsRestricted) reason += " - mIsPsRestricted= true";
            if (!desiredPowerState) reason += " - desiredPowerState= false";
            if (DBG) log("isDataAllowed: not allowed due to" + reason);
@@ -992,7 +1001,8 @@ public class DcTracker extends DcTrackerBase {
        boolean specificdisable = false;

        if (!TextUtils.isEmpty(reason)) {
            specificdisable = reason.equals(Phone.REASON_DATA_SPECIFIC_DISABLED);
            specificdisable = reason.equals(Phone.REASON_DATA_SPECIFIC_DISABLED)
                    || reason.equals(Phone.REASON_ROAMING_ON);
        }

        for (ApnContext apnContext : mApnContexts.values()) {