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

Commit 2aa19e1a authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Always send data profile regardless of modem cognative flag"

am: f0c07145

Change-Id: Ic8eafa14f4ae8edcd30d33591653bbbb7a492691
parents 4cd489fb f0c07145
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;
        }
    }