diff options
author | lrichard <richardl@codeaurora.org> | 2013-12-18 17:13:35 +0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2014-09-03 13:56:11 -0700 |
commit | 9cde9e448fde08af95e9cf2fa4c1ed92fa9a6084 (patch) | |
tree | 7c5b69c77850abcc55c65d61cb18551e4a0cfdcc | |
parent | 07f61172905eb6be116b3f3126426f60cedd00ea (diff) | |
download | android_packages_providers_TelephonyProvider-9cde9e448fde08af95e9cf2fa4c1ed92fa9a6084.tar.gz android_packages_providers_TelephonyProvider-9cde9e448fde08af95e9cf2fa4c1ed92fa9a6084.tar.bz2 android_packages_providers_TelephonyProvider-9cde9e448fde08af95e9cf2fa4c1ed92fa9a6084.zip |
APN: Add the read only APN feature.
Add a read only field to the APN database for the read only
APN feature.
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: Ia024088867a3f28d90c015bd728b85e7dacbc673
-rw-r--r-- | res/values/cm_strings.xml | 3 | ||||
-rw-r--r-- | src/com/android/providers/telephony/TelephonyProvider.java | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 6eaea17..70ce492 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -17,4 +17,7 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Apn PPP number --> <string name="ppp_number">ppp_number</string> + + <!-- Apn read only --> + <string name="read_only">read_only</string> </resources> diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java index 4f98549..e2aca81 100644 --- a/src/com/android/providers/telephony/TelephonyProvider.java +++ b/src/com/android/providers/telephony/TelephonyProvider.java @@ -155,6 +155,7 @@ public class TelephonyProvider extends ContentProvider "mvno_type TEXT," + "mvno_match_data TEXT," + "preferred BOOLEAN DEFAULT 0," + + "read_only BOOLEAN DEFAULT 0," + "ppp_number TEXT);"); initDatabase(db); @@ -380,6 +381,12 @@ public class TelephonyProvider extends ContentProvider if (preferred != null) { map.put(Telephony.Carriers.PREFERRED, Boolean.parseBoolean(preferred)); } + + String readOnly = parser.getAttributeValue(null, "read_only"); + if (readOnly != null) { + map.put(mContext.getString(R.string.read_only), Boolean.parseBoolean(readOnly)); + } + return map; } @@ -443,6 +450,11 @@ public class TelephonyProvider extends ContentProvider if (row.containsKey(Telephony.Carriers.PREFERRED) == false) { row.put(Telephony.Carriers.PREFERRED, false); } + + if (row.containsKey(mContext.getString(R.string.read_only)) == false) { + row.put(mContext.getString(R.string.read_only), false); + } + db.insert(CARRIERS_TABLE, null, row); } } @@ -744,6 +756,10 @@ public class TelephonyProvider extends ContentProvider values.put(Telephony.Carriers.PREFERRED, false); } + if (!values.containsKey(getContext().getString(R.string.read_only))) { + values.put(getContext().getString(R.string.read_only), false); + } + long rowID = db.insert(CARRIERS_TABLE, null, values); if (rowID > 0) { |