Fix MSIM for CDMA and GSM Call Options.
This scenario was just... pretty broken before. Update, to pass
the right subscription ids to the right menus, display the right
strings, and obtain the correct phone reference for the sub id.
In particular, moved some initialization code into
GsmUmtsCallOptions so that initialization of its layout can be
shared between it and CallFeatureSettings.
Bug: 19301753
Change-Id: I00954c14f386f3e60b3824138b651c28a40a5c06
diff --git a/src/com/android/phone/GsmUmtsCallOptions.java b/src/com/android/phone/GsmUmtsCallOptions.java
index a9a1940..419e72c 100644
--- a/src/com/android/phone/GsmUmtsCallOptions.java
+++ b/src/com/android/phone/GsmUmtsCallOptions.java
@@ -21,6 +21,7 @@
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
+import android.view.MenuItem;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
@@ -29,15 +30,43 @@
private static final String LOG_TAG = "GsmUmtsCallOptions";
private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
+ private static final String CALL_FORWARDING_KEY = "call_forwarding_key";
+ private static final String ADDITIONAL_GSM_SETTINGS_KEY = "additional_gsm_call_settings_key";
+
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.gsm_umts_call_options);
- if (PhoneGlobals.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
+ SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent());
+ subInfoHelper.setActionBarTitle(
+ getActionBar(), getResources(), R.string.labelGsmMore_with_label);
+ init(getPreferenceScreen(), subInfoHelper);
+
+ if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
//disable the entire screen
getPreferenceScreen().setEnabled(false);
}
}
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ final int itemId = item.getItemId();
+ if (itemId == android.R.id.home) {
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ public static void init(PreferenceScreen prefScreen, SubscriptionInfoHelper subInfoHelper) {
+ Preference callForwardingPref = prefScreen.findPreference(CALL_FORWARDING_KEY);
+ callForwardingPref.setIntent(subInfoHelper.getIntent(GsmUmtsCallForwardOptions.class));
+
+ Preference additionalGsmSettingsPref =
+ prefScreen.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
+ additionalGsmSettingsPref.setIntent(
+ subInfoHelper.getIntent(GsmUmtsAdditionalCallOptions.class));
+ }
}