Fix bug #16703191 APN settings shows back button even when you intent into it
- need to pass thru code the new ":settings:show_fragment_as_subsetting"
Intent extra
- some code cleaning
Change-Id: I0f5262c0fa1d62ac4e782169a32d3a5e724b08c8
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
index 6791f27..5e0c324 100644
--- a/src/com/android/phone/GsmUmtsOptions.java
+++ b/src/com/android/phone/GsmUmtsOptions.java
@@ -16,6 +16,7 @@
package com.android.phone;
+import android.content.Intent;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
@@ -49,6 +50,18 @@
protected void create() {
mPrefActivity.addPreferencesFromResource(R.xml.gsm_umts_options);
mButtonAPNExpand = (PreferenceScreen) mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
+ mButtonAPNExpand.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ // We need to build the Intent by hand as the Preference Framework does not allow
+ // to add an Intent with some extras into a Preference XML file
+ final Intent intent = new Intent("android.settings.APN_SETTINGS");
+ // This will setup the Home and Search affordance
+ intent.putExtra(":settings:show_fragment_as_subsetting", true);
+ mPrefActivity.startActivity(intent);
+ return true;
+ }
+ });
mButtonOperatorSelectionExpand =
(PreferenceScreen) mPrefScreen.findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY);
if (PhoneFactory.getDefaultPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
@@ -62,9 +75,9 @@
// Determine which options to display, for GSM these are defaulted
// are defaulted to true in Phone/res/values/config.xml. But for
// some operators like verizon they maybe overriden in operator
- // specific resources or device specifc overlays.
- if (!res.getBoolean(R.bool.config_apn_expand)) {
- mPrefScreen.removePreference(mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY));
+ // specific resources or device specific overlays.
+ if (!res.getBoolean(R.bool.config_apn_expand) && mButtonAPNExpand != null) {
+ mPrefScreen.removePreference(mButtonAPNExpand);
}
if (!res.getBoolean(R.bool.config_operator_selection_expand)) {
mPrefScreen.removePreference(mPrefScreen