Loading res/values/arrays.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1430,5 +1430,9 @@ <item>46003</item> <item>46007</item> </string-array> <string-array name="plmn_list_for_apn_disable"> <item>46001</item> <item>46009</item> </string-array> </resources> res/values/bools.xml +0 −3 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ <!-- Whether to switch dm for autoboot --> <bool name="dm_autoboot_setting_visible">false</bool> <!-- Whether to edit APN name--> <bool name="config_name_apn">true</bool> <!-- Whether to show hotspot settings --> <bool name="show_wifi_hotspot_settings">false</bool> Loading src/com/android/settings/ApnEditor.java +20 −11 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class ApnEditor extends PreferenceActivity private Cursor mCursor; private boolean mNewApn; private boolean mFirstTime; private boolean mApnDisable = false; private Resources mRes; private TelephonyManager mTelephonyManager; Loading Loading @@ -207,15 +208,6 @@ public class ApnEditor extends PreferenceActivity SubscriptionManager.getDefaultSubId()); Log.d(TAG,"ApnEditor onCreate received sub: " + mSubId); mDisableEditor = intent.getBooleanExtra("DISABLE_EDITOR",false); if (mDisableEditor) { if (getResources().getBoolean(R.bool.config_name_apn)) { getPreferenceScreen().setEnabled(false); Log.d(TAG, "ApnEditor form is disabled."); } else { mApn.setEnabled(false); Log.d(TAG, "Apn Name can't be edited."); } } mFirstTime = icicle == null; Loading Loading @@ -382,6 +374,23 @@ public class ApnEditor extends PreferenceActivity } else { mCarrierEnabled.setEnabled(false); } String mccMnc = mMcc.getText() + mMnc.getText(); for (String plmn : getResources().getStringArray(R.array.plmn_list_for_apn_disable)) { if (plmn.equals(mccMnc)) { mApnDisable = true; Log.d(TAG, "APN is China Unicom's."); break; } } if (mDisableEditor) { if (mApnDisable ) { getPreferenceScreen().setEnabled(false); Log.d(TAG, "ApnEditor form is disabled."); } else { mApn.setEnabled(false); Log.d(TAG, "Apn Name can't be edited."); } } } /** Loading Loading @@ -497,7 +506,7 @@ public class ApnEditor extends PreferenceActivity @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)) { if (mDisableEditor && mApnDisable ) { Log.d(TAG, "Form is disabled. Do not create the options menu."); return true; } Loading Loading @@ -569,7 +578,7 @@ public class ApnEditor extends PreferenceActivity String mnc = checkNotSet(mMnc.getText()); // If the form is not editable, do nothing and return. if(mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)){ if (mDisableEditor && mApnDisable ) { Log.d(TAG, "Form is disabled. Nothing to save."); return true; } Loading Loading
res/values/arrays.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1430,5 +1430,9 @@ <item>46003</item> <item>46007</item> </string-array> <string-array name="plmn_list_for_apn_disable"> <item>46001</item> <item>46009</item> </string-array> </resources>
res/values/bools.xml +0 −3 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ <!-- Whether to switch dm for autoboot --> <bool name="dm_autoboot_setting_visible">false</bool> <!-- Whether to edit APN name--> <bool name="config_name_apn">true</bool> <!-- Whether to show hotspot settings --> <bool name="show_wifi_hotspot_settings">false</bool> Loading
src/com/android/settings/ApnEditor.java +20 −11 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class ApnEditor extends PreferenceActivity private Cursor mCursor; private boolean mNewApn; private boolean mFirstTime; private boolean mApnDisable = false; private Resources mRes; private TelephonyManager mTelephonyManager; Loading Loading @@ -207,15 +208,6 @@ public class ApnEditor extends PreferenceActivity SubscriptionManager.getDefaultSubId()); Log.d(TAG,"ApnEditor onCreate received sub: " + mSubId); mDisableEditor = intent.getBooleanExtra("DISABLE_EDITOR",false); if (mDisableEditor) { if (getResources().getBoolean(R.bool.config_name_apn)) { getPreferenceScreen().setEnabled(false); Log.d(TAG, "ApnEditor form is disabled."); } else { mApn.setEnabled(false); Log.d(TAG, "Apn Name can't be edited."); } } mFirstTime = icicle == null; Loading Loading @@ -382,6 +374,23 @@ public class ApnEditor extends PreferenceActivity } else { mCarrierEnabled.setEnabled(false); } String mccMnc = mMcc.getText() + mMnc.getText(); for (String plmn : getResources().getStringArray(R.array.plmn_list_for_apn_disable)) { if (plmn.equals(mccMnc)) { mApnDisable = true; Log.d(TAG, "APN is China Unicom's."); break; } } if (mDisableEditor) { if (mApnDisable ) { getPreferenceScreen().setEnabled(false); Log.d(TAG, "ApnEditor form is disabled."); } else { mApn.setEnabled(false); Log.d(TAG, "Apn Name can't be edited."); } } } /** Loading Loading @@ -497,7 +506,7 @@ public class ApnEditor extends PreferenceActivity @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)) { if (mDisableEditor && mApnDisable ) { Log.d(TAG, "Form is disabled. Do not create the options menu."); return true; } Loading Loading @@ -569,7 +578,7 @@ public class ApnEditor extends PreferenceActivity String mnc = checkNotSet(mMnc.getText()); // If the form is not editable, do nothing and return. if(mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)){ if (mDisableEditor && mApnDisable ) { Log.d(TAG, "Form is disabled. Nothing to save."); return true; } Loading