Add MSIM support for Call Forwarding.

+ Set subcription info dynamically on intents to open
GsmUmtsCallForwardOptions and GsmUmtsAdditionalCallOptions.

+ Allow phone to be set on initialization for the preferences
used in those settings.

Bug: 18114923
Bug: 18233808
Bug: 18233614
Change-Id: I79a708872ea57ff9ba7a52a61835204caf156733
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 65ca3e5..c99e432 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -163,6 +163,8 @@
 
     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 DEFAULT_OUTGOING_ACCOUNT_KEY = "default_outgoing_account";
     private static final String PHONE_ACCOUNT_SETTINGS_KEY =
@@ -1316,14 +1318,12 @@
         }
 
         if (!getResources().getBoolean(R.bool.world_phone)) {
-            Preference options = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
-            if (options != null) {
-                prefSet.removePreference(options);
-            }
-            options = prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS);
-            if (options != null) {
-                prefSet.removePreference(options);
-            }
+            Preference cdmaOptions = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
+            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();
             Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
@@ -1338,6 +1338,15 @@
 
                 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(
+                            this, GsmUmtsCallForwardOptions.class));
+
+                    Preference additionalGsmSettingsPref =
+                            prefSet.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
+                    additionalGsmSettingsPref.setIntent(mSubscriptionInfoHelper.getIntent(
+                            this, GsmUmtsAdditionalCallOptions.class));
                 }
             } else {
                 throw new IllegalStateException("Unexpected phone type: " + phoneType);