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

Commit a6e054c3 authored by jianzhou's avatar jianzhou Committed by Linux Build Service Account
Browse files

Settings: Fix no preferred APN

Add preferred APN if found no match.

CRs-Fixed: 748830

Change-Id: Ibecf88a3e6236de13a0a4291438a6e62159a05e0
parent 1b7fdc3a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ public class ApnSettings extends RestrictedSettingsFragment implements
    }

    private void fillList() {
        boolean isSelectedKeyMatch = false;
        final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        final String mccmnc = mSubscriptionInfo == null ? ""
            : tm.getSimOperator(mSubscriptionInfo.getSubscriptionId());
@@ -294,6 +295,8 @@ public class ApnSettings extends RestrictedSettingsFragment implements
                if (selectable) {
                    if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
                        pref.setChecked();
                        isSelectedKeyMatch = true;
                        Log.d(TAG, "find select key = " + mSelectedKey);
                    }
                    addApnToList(pref, mnoApnList, mvnoApnList, r, mvnoType, mvnoMatchData);
                } else {
@@ -313,6 +316,15 @@ public class ApnSettings extends RestrictedSettingsFragment implements
            for (Preference preference : mnoApnList) {
                apnList.addPreference(preference);
            }

            //if find no selectedKey, set the first one as selected key
            if (!isSelectedKeyMatch && apnList.getPreferenceCount() > 0) {
                ApnPreference pref = (ApnPreference) apnList.getPreference(0);
                pref.setChecked();
                setSelectedApnKey(pref.getKey());
                Log.d(TAG, "set key to  " +pref.getKey());
            }

            for (Preference preference : mnoMmsApnList) {
                apnList.addPreference(preference);
            }