Merge "Track move of timezone classes to libcore.timezone"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 533c130..21bec16 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10041,6 +10041,9 @@
<!-- Title for HFP(hands free profile) output switch button in settings. -->
<string name="take_call_on_title">Take call on</string>
+ <!-- Toast that appears when users tap an APN for which parameters cannot be viewed. [CHAR LIMIT=NONE] -->
+ <string name="cannot_change_apn_toast">This APN cannot be changed.</string>
+
<!-- Title for battery Suggestion. (tablet) [CHAR LIMIT=46] -->
<string name="battery_suggestion_title" product="tablet" >Improve tablet\'s battery life</string>
<!-- Title for battery Suggestion. (device) [CHAR LIMIT=46] -->
diff --git a/src/com/android/settings/network/ApnPreference.java b/src/com/android/settings/network/ApnPreference.java
index 27d275f..73837af 100755
--- a/src/com/android/settings/network/ApnPreference.java
+++ b/src/com/android/settings/network/ApnPreference.java
@@ -29,6 +29,7 @@
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioButton;
+import android.widget.Toast;
import com.android.settings.R;
@@ -53,6 +54,7 @@
private static CompoundButton mCurrentChecked = null;
private boolean mProtectFromCheckedChange = false;
private boolean mSelectable = true;
+ private boolean mHideDetails = false;
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
@@ -112,6 +114,11 @@
super.onClick();
Context context = getContext();
if (context != null) {
+ if (mHideDetails) {
+ Toast.makeText(context, context.getString(
+ R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show();
+ return;
+ }
int pos = Integer.parseInt(getKey());
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
@@ -131,4 +138,8 @@
public void setSubId(int subId) {
mSubId = subId;
}
+
+ public void setHideDetails() {
+ mHideDetails = true;
+ }
}
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index 5bc52cc..ad7f463 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -77,12 +77,23 @@
public static final String MVNO_TYPE = "mvno_type";
public static final String MVNO_MATCH_DATA = "mvno_match_data";
+ private static final String[] CARRIERS_PROJECTION = new String[] {
+ Telephony.Carriers._ID,
+ Telephony.Carriers.NAME,
+ Telephony.Carriers.APN,
+ Telephony.Carriers.TYPE,
+ Telephony.Carriers.MVNO_TYPE,
+ Telephony.Carriers.MVNO_MATCH_DATA,
+ Telephony.Carriers.EDITED,
+ };
+
private static final int ID_INDEX = 0;
private static final int NAME_INDEX = 1;
private static final int APN_INDEX = 2;
private static final int TYPES_INDEX = 3;
private static final int MVNO_TYPE_INDEX = 4;
private static final int MVNO_MATCH_DATA_INDEX = 5;
+ private static final int EDITED_INDEX = 6;
private static final int MENU_NEW = Menu.FIRST;
private static final int MENU_RESTORE = Menu.FIRST + 1;
@@ -115,6 +126,7 @@
private boolean mHideImsApn;
private boolean mAllowAddingApns;
+ private boolean mHidePresetApnDetails;
public ApnSettings() {
super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS);
@@ -195,6 +207,7 @@
mAllowAddingApns = false;
}
}
+ mHidePresetApnDetails = b.getBoolean(CarrierConfigManager.KEY_HIDE_PRESET_APN_DETAILS_BOOL);
mUserManager = UserManager.get(activity);
}
@@ -276,9 +289,8 @@
where.append(" AND NOT (type='ims')");
}
- Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
- "_id", "name", "apn", "type", "mvno_type", "mvno_match_data"}, where.toString(),
- null, Telephony.Carriers.DEFAULT_SORT_ORDER);
+ Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI,
+ CARRIERS_PROJECTION, where.toString(), null, Telephony.Carriers.DEFAULT_SORT_ORDER);
if (cursor != null) {
IccRecords r = null;
@@ -303,14 +315,19 @@
String type = cursor.getString(TYPES_INDEX);
String mvnoType = cursor.getString(MVNO_TYPE_INDEX);
String mvnoMatchData = cursor.getString(MVNO_MATCH_DATA_INDEX);
+ int edited = cursor.getInt(EDITED_INDEX);
ApnPreference pref = new ApnPreference(getPrefContext());
pref.setKey(key);
pref.setTitle(name);
- pref.setSummary(apn);
pref.setPersistent(false);
pref.setSubId(subId);
+ if (mHidePresetApnDetails && edited == Telephony.Carriers.UNEDITED) {
+ pref.setHideDetails();
+ } else {
+ pref.setSummary(apn);
+ }
boolean selectable = ((type == null) || !type.equals("mms"));
pref.setSelectable(selectable);