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

Commit 2dc3018f authored by Jack Yu's avatar Jack Yu
Browse files

Proper handling of roaming override case

If the roaming state is overridden by the framework, we should
pass allowRoaming=true down to the modem so the data call will
not be rejected. Also we should pass the actual roaming state
to ril_service so it can pick the correct protocol (for old
modem backward compatibility support).

Test: Telephony sanity tests
bug: 62807105, 62285365
Merged-In: Ida93e6aa3949c8434aa58468f12e4512c9a02351
Change-Id: Ida93e6aa3949c8434aa58468f12e4512c9a02351
parent eef3bbab
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2055,14 +2055,16 @@ public class ServiceStateTracker extends Handler {
             * agreements and MVNO's.
             */
            boolean roaming = (mGsmRoaming || mDataRoaming);

            // Save the data roaming state reported by modem registration before resource overlay or
            // carrier config possibly overrides it.
            mNewSS.setDataRoamingFromRegistration(roaming);

            if (mGsmRoaming && !isOperatorConsideredRoaming(mNewSS) &&
                    (isSameNamedOperators(mNewSS) || isOperatorConsideredNonRoaming(mNewSS))) {
                roaming = false;
            }

            // Save the roaming state before carrier config possibly overrides it.
            mNewSS.setDataRoamingFromRegistration(roaming);

            CarrierConfigManager configLoader = (CarrierConfigManager)
                    mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);

+12 −3
Original line number Diff line number Diff line
@@ -467,9 +467,18 @@ public class DataConnection extends StateMachine {

        DataProfile dp = new DataProfile(mApnSetting, cp.mProfileId);

        mPhone.mCi.setupDataCall(cp.mRilRat, dp,
                mPhone.getServiceState().getDataRoamingFromRegistration(),
                mPhone.getDataRoamingEnabled(), msg);
        // We need to use the actual modem roaming state instead of the framework roaming state
        // here. This flag is only passed down to ril_service for picking the correct protocol (for
        // old modem backward compatibility).
        boolean isModemRoaming = mPhone.getServiceState().getDataRoamingFromRegistration();

        // 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());

        mPhone.mCi.setupDataCall(cp.mRilRat, dp, isModemRoaming, allowRoaming, msg);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -2115,7 +2115,7 @@ public class DcTracker extends Handler {
            if (DBG) log("setInitialAttachApn: X selected Apn=" + initialAttachApnSetting);

            mPhone.mCi.setInitialAttachApn(new DataProfile(initialAttachApnSetting),
                    mPhone.getServiceState().getDataRoaming(), null);
                    mPhone.getServiceState().getDataRoamingFromRegistration(), null);
        }
    }

@@ -3324,7 +3324,7 @@ public class DcTracker extends Handler {
            }
            if (dps.size() > 0) {
                mPhone.mCi.setDataProfile(dps.toArray(new DataProfile[0]),
                        mPhone.getServiceState().getDataRoaming(), null);
                        mPhone.getServiceState().getDataRoamingFromRegistration(), null);
            }
        }
    }