diff options
author | Sungmin Choi <sungmin.choi@lge.com> | 2013-03-21 15:42:27 +0900 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2013-04-01 16:44:15 -0700 |
commit | cd1cb16bad2686990014430197cf7cdd56190c86 (patch) | |
tree | 4831249dc903e7ed9e5b73506310b1aea62c318a /src/com/android/settings/ApnEditor.java | |
parent | 358d1825a4f51b9d28b437cbf02df842a56a6d15 (diff) | |
download | packages_apps_Settings-cd1cb16bad2686990014430197cf7cdd56190c86.zip packages_apps_Settings-cd1cb16bad2686990014430197cf7cdd56190c86.tar.gz packages_apps_Settings-cd1cb16bad2686990014430197cf7cdd56190c86.tar.bz2 |
pre-provide the mvno data of the edited apn
For mvno, user can add or edit mvno data field.
Pre-provide the mvno data of the edited apn when the user selects
one of the mvno types.
For example if user choose gid, populate the data field with the
current sim's gid1 data, or if user choose the SPN option, fill
in data with the current carrier string. If IMSI, fill in imsi data.
Change-Id: I1bc280054cc7cd37e78a279866cefd62872a19fb
Diffstat (limited to 'src/com/android/settings/ApnEditor.java')
-rw-r--r-- | src/com/android/settings/ApnEditor.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index f34abfa..2da2d76 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -94,6 +94,7 @@ public class ApnEditor extends PreferenceActivity private boolean mNewApn; private boolean mFirstTime; private Resources mRes; + private TelephonyManager mTelephonyManager; /** * Standard projection for the interesting columns of a normal note. @@ -224,6 +225,8 @@ public class ApnEditor extends PreferenceActivity mCursor = managedQuery(mUri, sProjection, null, null); mCursor.moveToFirst(); + mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); + fillUi(); } @@ -359,18 +362,30 @@ public class ApnEditor extends PreferenceActivity } } - private String mvnoDescription(String raw) { - int mvnoIndex = mMvnoType.findIndexOfValue(raw); + private String mvnoDescription(String newValue) { + int mvnoIndex = mMvnoType.findIndexOfValue(newValue); + String oldValue = mMvnoType.getValue(); + if (mvnoIndex == -1) { return null; } else { String[] values = mRes.getStringArray(R.array.mvno_type_entries); if (values[mvnoIndex].equals("None")) { mMvnoMatchData.setEnabled(false); - mMvnoMatchData.setText(""); } else { mMvnoMatchData.setEnabled(true); } + if (newValue != null && newValue.equals(oldValue) == false) { + if (values[mvnoIndex].equals("SPN")) { + mMvnoMatchData.setText(mTelephonyManager.getSimOperatorName()); + } else if (values[mvnoIndex].equals("IMSI")) { + String numeric = + SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC); + mMvnoMatchData.setText(numeric + "x"); + } else if (values[mvnoIndex].equals("GID")) { + mMvnoMatchData.setText(mTelephonyManager.getGroupIdLevel1()); + } + } try { return values[mvnoIndex]; |