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

Commit 63743932 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Settings: Fix no preferred APN"

parents 074e6de6 d5001e67
Loading
Loading
Loading
Loading

res/values/arrays.xml

100644 → 100755
+8 −0
Original line number Diff line number Diff line
@@ -1301,4 +1301,12 @@
        <item>Cached (activity client)</item>
        <item>Cached (empty)</item>
    </string-array>

    <string-array name="hidedm_plmn_list">
        <item>46000</item>
        <item>46002</item>
        <item>46003</item>
        <item>46007</item>
    </string-array>

</resources>
+3 −0
Original line number Diff line number Diff line
@@ -34,4 +34,7 @@

    <!-- Carrier_enabled editable -->
    <bool name="config_allow_edit_carrier_enabled" translatable="false">false</bool>

    <!-- Whether to hide dm apn for carrier -->
    <bool name="config_hide_dm_enabled">true</bool>
</resources>
+16 −0
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ public class ApnSettings extends SettingsPreferenceFragment implements

    public static final String APN_ID = "apn_id";

    private static final String APN_TYPE_DM = "dm";

    private static final int ID_INDEX = 0;
    private static final int NAME_INDEX = 1;
    private static final int APN_INDEX = 2;
@@ -216,6 +218,19 @@ public class ApnSettings extends SettingsPreferenceFragment implements
    private void fillList() {
        boolean isSelectedKeyMatch = false;
        String where = getOperatorNumericSelection();

        // Filer fota and dm for specail carrier
        if (getResources().getBoolean(R.bool.config_hide_dm_enabled)) {
            String operatorMccMnc = TelephonyManager.getDefault().getIccOperatorNumeric(mSubId);
            for (String plmn : getResources().getStringArray(R.array.hidedm_plmn_list)) {
                if (plmn.equals(operatorMccMnc)) {
                    where += " and type <>\"" + PhoneConstants.APN_TYPE_FOTA + "\"";
                    where += " and type <>\"" + APN_TYPE_DM + "\"";
                    break;
                }
            }
        }

        Cursor cursor = getContentResolver().query(getUri(Telephony.Carriers.CONTENT_URI),
                new String[] {"_id", "name", "apn", "type"}, where, null,
                Telephony.Carriers.DEFAULT_SORT_ORDER);
@@ -259,6 +274,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
            //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, "find no select key = " + mSelectedKey);
                Log.d(TAG, "set key to  " +pref.getKey());