diff --git a/res/values/arrays.xml b/res/values/arrays.xml index b722b78c1fa..44db767fff3 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -520,6 +520,22 @@ IPV4V6 + + + LTE + eHRPD + Unspecified + + + + + 14 + + 13 + + 0 + + Internal device storage diff --git a/res/values/strings.xml b/res/values/strings.xml index ba02ee8f640..c541dcaf23c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1881,6 +1881,12 @@ APN type APN protocol + + APN Enable/Disable + APN Enabled + APN Disabled + + Bearer Delete APN diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml index f000dd06bf0..e3ba934d2f1 100644 --- a/res/xml/apn_editor.xml +++ b/res/xml/apn_editor.xml @@ -121,4 +121,17 @@ android:entries="@array/apn_protocol_entries" android:entryValues="@array/apn_protocol_values" /> + + diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index 13b7aa56fab..751fd170c60 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -29,6 +29,7 @@ import android.os.Bundle; import android.os.SystemProperties; import android.preference.EditTextPreference; import android.preference.ListPreference; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.provider.Telephony; @@ -50,6 +51,8 @@ public class ApnEditor extends PreferenceActivity private final static String SAVED_POS = "pos"; private final static String KEY_AUTH_TYPE = "auth_type"; private final static String KEY_PROTOCOL = "apn_protocol"; + private final static String KEY_CARRIER_ENABLED = "carrier_enabled"; + private final static String KEY_BEARER = "bearer"; private static final int MENU_DELETE = Menu.FIRST; private static final int MENU_SAVE = Menu.FIRST + 1; @@ -72,6 +75,8 @@ public class ApnEditor extends PreferenceActivity private ListPreference mAuthType; private EditTextPreference mApnType; private ListPreference mProtocol; + private CheckBoxPreference mCarrierEnabled; + private ListPreference mBearer; private String mCurMnc; private String mCurMcc; @@ -103,6 +108,8 @@ public class ApnEditor extends PreferenceActivity Telephony.Carriers.AUTH_TYPE, // 14 Telephony.Carriers.TYPE, // 15 Telephony.Carriers.PROTOCOL, // 16 + Telephony.Carriers.CARRIER_ENABLED, // 17 + Telephony.Carriers.BEARER, // 18 }; private static final int ID_INDEX = 0; @@ -121,6 +128,8 @@ public class ApnEditor extends PreferenceActivity private static final int AUTH_TYPE_INDEX = 14; private static final int TYPE_INDEX = 15; private static final int PROTOCOL_INDEX = 16; + private static final int CARRIER_ENABLED_INDEX = 17; + private static final int BEARER_INDEX = 18; @Override @@ -150,6 +159,11 @@ public class ApnEditor extends PreferenceActivity mProtocol = (ListPreference) findPreference(KEY_PROTOCOL); mProtocol.setOnPreferenceChangeListener(this); + mCarrierEnabled = (CheckBoxPreference) findPreference(KEY_CARRIER_ENABLED); + + mBearer = (ListPreference) findPreference(KEY_BEARER); + mBearer.setOnPreferenceChangeListener(this); + mRes = getResources(); final Intent intent = getIntent(); @@ -247,6 +261,8 @@ public class ApnEditor extends PreferenceActivity } mProtocol.setValue(mCursor.getString(PROTOCOL_INDEX)); + mCarrierEnabled.setChecked(mCursor.getInt(CARRIER_ENABLED_INDEX)==1); + mBearer.setValue(mCursor.getString(BEARER_INDEX)); } mName.setSummary(checkNull(mName.getText())); @@ -276,6 +292,8 @@ public class ApnEditor extends PreferenceActivity mProtocol.setSummary( checkNull(protocolDescription(mProtocol.getValue()))); + mBearer.setSummary( + checkNull(bearerDescription(mBearer.getValue()))); } /** @@ -297,6 +315,20 @@ public class ApnEditor extends PreferenceActivity } } + private String bearerDescription(String raw) { + int mBearerIndex = mBearer.findIndexOfValue(raw); + if (mBearerIndex == -1) { + return null; + } else { + String[] values = mRes.getStringArray(R.array.bearer_entries); + try { + return values[mBearerIndex]; + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + } + } + public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); if (KEY_AUTH_TYPE.equals(key)) { @@ -320,6 +352,16 @@ public class ApnEditor extends PreferenceActivity mProtocol.setSummary(protocol); mProtocol.setValue((String) newValue); } + + if (KEY_BEARER.equals(key)) { + String bearer = bearerDescription((String) newValue); + if (bearer == null) { + return false; + } + mBearer.setValue((String) newValue); + mBearer.setSummary(bearer); + } + return true; } @@ -450,6 +492,11 @@ public class ApnEditor extends PreferenceActivity } } + String bearerVal = mBearer.getValue(); + if (bearerVal != null) { + values.put(Telephony.Carriers.BEARER, Integer.parseInt(bearerVal)); + } + getContentResolver().update(mUri, values, null, null); return true;