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

Commit b4f6174c authored by Jack Yu's avatar Jack Yu
Browse files

Always send data profile regardless of modem cognative flag

This will allow modem to know the available APN settings for
the current carrier. This is needed for vendor to implement
QualifiedNetworksService to provide available networks for
certain APN types.

Test: Telephony sanity tests
Bug: 73659459
Change-Id: I5c9033f706fc629c704c3b50660f55598184a363
parent a38578a5
Loading
Loading
Loading
Loading
+19 −24
Original line number Diff line number Diff line
@@ -536,19 +536,7 @@ public class DcTracker extends Handler {

    private int mDisconnectPendingCount = 0;

    /** Indicate if metered APNs are disabled.
     *  set to block all the metered APNs from continuously sending requests, which causes
     *  undesired network load */
    private boolean mMeteredApnDisabled = false;

    /**
     * int to remember whether has setDataProfiles and with roaming or not.
     * 0: default, has never set data profile
     * 1: has set data profile with home protocol
     * 2: has set data profile with roaming protocol
     * This is not needed once RIL command is updated to support both home and roaming protocol.
     */
    private int mSetDataProfileStatus = 0;
    private ArrayList<DataProfile> mLastDataProfileList = null;

    /**
     * Handles changes to the APN db.
@@ -3216,20 +3204,27 @@ public class DcTracker extends Handler {

    private void setDataProfilesAsNeeded() {
        if (DBG) log("setDataProfilesAsNeeded");
        if (mAllApnSettings != null && !mAllApnSettings.isEmpty()) {
            ArrayList<DataProfile> dps = new ArrayList<DataProfile>();

        ArrayList<DataProfile> dataProfileList = new ArrayList<>();
        if (mAllApnSettings != null) {
            for (ApnSetting apn : mAllApnSettings) {
                if (apn.getModemCognitive()) {
                DataProfile dp = createDataProfile(apn);
                    if (!dps.contains(dp)) {
                        dps.add(dp);
                if (!dataProfileList.contains(dp)) {
                    dataProfileList.add(dp);
                }
            }
        }
            if (dps.size() > 0) {
                mDataServiceManager.setDataProfile(dps,

        // Check if the data profiles we are sending are same as we did last time. We don't want to
        // send the redundant profiles to the modem. Also note that when no data profiles are
        // available, for example when SIM is not present, we send the empty list to the modem.
        // Also we always send the data profiles once after boot up.
        if (mLastDataProfileList == null
                || dataProfileList.size() != mLastDataProfileList.size()
                || !mLastDataProfileList.containsAll(dataProfileList)) {
            mDataServiceManager.setDataProfile(dataProfileList,
                    mPhone.getServiceState().getDataRoamingFromRegistration(), null);
            }
            mLastDataProfileList = dataProfileList;
        }
    }