DO NOT MERGE - 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: Ib233ad859aefd97abf742334f2636590644eb374
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 4fa28ab..b23a14b 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -162,8 +162,6 @@
 
     private static final String BUTTON_GSM_UMTS_OPTIONS = "button_gsm_more_expand_key";
     private static final String BUTTON_CDMA_OPTIONS = "button_cdma_more_expand_key";
-    private static final String CALL_FORWARDING_KEY = "call_forwarding_key";
-    private static final String ADDITIONAL_GSM_SETTINGS_KEY = "additional_gsm_call_settings_key";
 
     private static final String PHONE_ACCOUNT_SETTINGS_KEY =
             "phone_account_settings_preference_screen";
@@ -1255,12 +1253,13 @@
             mButtonTTY = null;
         }
 
-        if (!getResources().getBoolean(R.bool.world_phone)) {
-            Preference cdmaOptions = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
+        Preference cdmaOptions = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
+        Preference gsmOptions = prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS);
+        if (getResources().getBoolean(R.bool.world_phone)) {
+            cdmaOptions.setIntent(mSubscriptionInfoHelper.getIntent(CdmaCallOptions.class));
+            gsmOptions.setIntent(mSubscriptionInfoHelper.getIntent(GsmUmtsCallOptions.class));
+        } else {
             prefSet.removePreference(cdmaOptions);
-
-            // TODO: Support MSIM for this preference option.
-            Preference gsmOptions = prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS);
             prefSet.removePreference(gsmOptions);
 
             int phoneType = mPhone.getPhoneType();
@@ -1284,15 +1283,7 @@
 
                     if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
                         addPreferencesFromResource(R.xml.gsm_umts_call_options);
-
-                        Preference callForwardingPref = prefSet.findPreference(CALL_FORWARDING_KEY);
-                        callForwardingPref.setIntent(mSubscriptionInfoHelper.getIntent(
-                                GsmUmtsCallForwardOptions.class));
-
-                        Preference additionalGsmSettingsPref =
-                                prefSet.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
-                        additionalGsmSettingsPref.setIntent(mSubscriptionInfoHelper.getIntent(
-                                GsmUmtsAdditionalCallOptions.class));
+                        GsmUmtsCallOptions.init(prefSet, mSubscriptionInfoHelper);
                     }
                 } else {
                     throw new IllegalStateException("Unexpected phone type: " + phoneType);