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

Commit f8462eb1 authored by Daniel Bright's avatar Daniel Bright Committed by Amit Mahajan
Browse files

Always allow unmetered APNs when romaing

We should allow data when roaming when either it is enabled through settings
or when the apn is unmetered.

This fix will only applied in cases where the workflow makes it all the way
to DataConnection.  There are some other cases that may still not work
for other reasons.

Test: Sent out mms and checked logs
Test: atest DcTrackerTest, atest DataConnectionTest
Test: verified by QA that this fixes the issue
Bug: 152718337
Change-Id: I8d623c138a594bf0ff8f6a07fcabffa6f408e805
parent 6034eb5a
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -694,11 +694,26 @@ public class DataConnection extends StateMachine {
        // old modem backward compatibility).
        boolean isModemRoaming = mPhone.getServiceState().getDataRoamingFromRegistration();

        // If the apn is NOT metered, we will allow data roaming regardless of the setting.
        boolean isUnmeteredApnType = !ApnSettingUtils.isMeteredApnType(
                cp.mApnContext.getApnTypeBitmask(), mPhone);

        // Set this flag to true if the user turns on data roaming. Or if we override the roaming
        // state in framework, we should set this flag to true as well so the modem will not reject
        // the data call setup (because the modem actually thinks the device is roaming).
        boolean allowRoaming = mPhone.getDataRoamingEnabled()
                || (isModemRoaming && !mPhone.getServiceState().getDataRoaming());
                || (isModemRoaming && (!mPhone.getServiceState().getDataRoaming()
                || isUnmeteredApnType));

        if (DBG) {
            log("allowRoaming=" + allowRoaming
                    + ", mPhone.getDataRoamingEnabled()=" + mPhone.getDataRoamingEnabled()
                    + ", isModemRoaming=" + isModemRoaming
                    + ", mPhone.getServiceState().getDataRoaming()="
                    + mPhone.getServiceState().getDataRoaming()
                    + ", isUnmeteredApnType=" + isUnmeteredApnType
            );
        }

        // Check if this data setup is a handover.
        LinkProperties linkProperties = null;