Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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] --> src/com/android/settings/network/ApnPreference.java +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.Log; import android.view.View; import android.widget.CompoundButton; import android.widget.RadioButton; import android.widget.Toast; import com.android.settings.R; Loading @@ -53,6 +54,7 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke private static CompoundButton mCurrentChecked = null; private boolean mProtectFromCheckedChange = false; private boolean mSelectable = true; private boolean mHideDetails = false; @Override public void onBindViewHolder(PreferenceViewHolder view) { Loading Loading @@ -112,6 +114,11 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke 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); Loading @@ -131,4 +138,8 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke public void setSubId(int subId) { mSubId = subId; } public void setHideDetails() { mHideDetails = true; } } src/com/android/settings/network/ApnSettings.java +21 −4 Original line number Diff line number Diff line Loading @@ -77,12 +77,23 @@ public class ApnSettings extends RestrictedSettingsFragment { 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; Loading Loading @@ -115,6 +126,7 @@ public class ApnSettings extends RestrictedSettingsFragment { private boolean mHideImsApn; private boolean mAllowAddingApns; private boolean mHidePresetApnDetails; public ApnSettings() { super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS); Loading Loading @@ -195,6 +207,7 @@ public class ApnSettings extends RestrictedSettingsFragment { mAllowAddingApns = false; } } mHidePresetApnDetails = b.getBoolean(CarrierConfigManager.KEY_HIDE_PRESET_APN_DETAILS_BOOL); mUserManager = UserManager.get(activity); } Loading Loading @@ -276,9 +289,8 @@ public class ApnSettings extends RestrictedSettingsFragment { 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; Loading @@ -303,14 +315,19 @@ public class ApnSettings extends RestrictedSettingsFragment { 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); Loading Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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] -->
src/com/android/settings/network/ApnPreference.java +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.Log; import android.view.View; import android.widget.CompoundButton; import android.widget.RadioButton; import android.widget.Toast; import com.android.settings.R; Loading @@ -53,6 +54,7 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke private static CompoundButton mCurrentChecked = null; private boolean mProtectFromCheckedChange = false; private boolean mSelectable = true; private boolean mHideDetails = false; @Override public void onBindViewHolder(PreferenceViewHolder view) { Loading Loading @@ -112,6 +114,11 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke 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); Loading @@ -131,4 +138,8 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke public void setSubId(int subId) { mSubId = subId; } public void setHideDetails() { mHideDetails = true; } }
src/com/android/settings/network/ApnSettings.java +21 −4 Original line number Diff line number Diff line Loading @@ -77,12 +77,23 @@ public class ApnSettings extends RestrictedSettingsFragment { 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; Loading Loading @@ -115,6 +126,7 @@ public class ApnSettings extends RestrictedSettingsFragment { private boolean mHideImsApn; private boolean mAllowAddingApns; private boolean mHidePresetApnDetails; public ApnSettings() { super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS); Loading Loading @@ -195,6 +207,7 @@ public class ApnSettings extends RestrictedSettingsFragment { mAllowAddingApns = false; } } mHidePresetApnDetails = b.getBoolean(CarrierConfigManager.KEY_HIDE_PRESET_APN_DETAILS_BOOL); mUserManager = UserManager.get(activity); } Loading Loading @@ -276,9 +289,8 @@ public class ApnSettings extends RestrictedSettingsFragment { 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; Loading @@ -303,14 +315,19 @@ public class ApnSettings extends RestrictedSettingsFragment { 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); Loading