summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/ApnEditor.java
diff options
context:
space:
mode:
authorjianzhou <jianzhou@codeaurora.org>2014-07-31 16:13:25 +0800
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:21:14 -0600
commite0d320fbc18e45d05796db670a12e84d35ab8185 (patch)
tree3263eaa3bfb18d5e1b2242b2578d9efb28517d94 /src/com/android/settings/ApnEditor.java
parent2b37944f5e0ddff1c786b7a3d372edeb4d9bbf15 (diff)
downloadpackages_apps_Settings-e0d320fbc18e45d05796db670a12e84d35ab8185.zip
packages_apps_Settings-e0d320fbc18e45d05796db670a12e84d35ab8185.tar.gz
packages_apps_Settings-e0d320fbc18e45d05796db670a12e84d35ab8185.tar.bz2
Settings: Add the read only APN feature.
Disable the edit screen for read only APNs Some operators don't want their APNs to be edited by end user to avoid mistaken changes. End user should be able to only view the APNs, but not edit. Change-Id: I89f26ccc687d6989c562f164dbe53961a4d8a057
Diffstat (limited to 'src/com/android/settings/ApnEditor.java')
-rw-r--r--src/com/android/settings/ApnEditor.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 2a65f96..013d754 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -90,6 +90,7 @@ public class ApnEditor extends InstrumentedPreferenceActivity
private String mCurMnc;
private String mCurMcc;
+ private boolean mDisableEditor = false;
private Uri mUri;
private Cursor mCursor;
@@ -203,6 +204,11 @@ public class ApnEditor extends InstrumentedPreferenceActivity
final String action = intent.getAction();
mSubId = intent.getIntExtra(ApnSettings.SUB_ID,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+ mDisableEditor = intent.getBooleanExtra("DISABLE_EDITOR", false);
+ if (mDisableEditor) {
+ getPreferenceScreen().setEnabled(false);
+ Log.d(TAG, "ApnEditor form is disabled.");
+ }
mFirstTime = icicle == null;
@@ -537,6 +543,10 @@ public class ApnEditor extends InstrumentedPreferenceActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
+ if (mDisableEditor) {
+ Log.d(TAG, "Form is disabled. Do not create the options menu.");
+ return true;
+ }
// If it's a new APN, then cancel will delete the new entry in onPause
if (!mNewApn) {
menu.add(0, MENU_DELETE, 0, R.string.menu_delete)
@@ -598,6 +608,13 @@ public class ApnEditor extends InstrumentedPreferenceActivity
* @return true if the data was saved
*/
private boolean validateAndSave(boolean force) {
+
+ // If the form is not editable, do nothing and return.
+ if (mDisableEditor){
+ Log.d(TAG, "Form is disabled. Nothing to save.");
+ return true;
+ }
+
String name = checkNotSet(mName.getText());
String apn = checkNotSet(mApn.getText());
String mcc = checkNotSet(mMcc.getText());