Add wifi calling setting in phone's call settings.

+ Redirects to the MobileNetworkSettings activity.
+ Remove preference if WFC is not supported.

Bug: 18977746
Change-Id: Id4e1f3f089414d1120195a9271e31983a12c957a
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a1dd09a..22715d8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -147,7 +147,7 @@
     <string name="phone_accounts_configure_account_settings">Configure account settings</string>
 
     <!-- Title for setting to select Wi-Fi call manager account -->
-    <string name="phone_account_wifi_calling">Wi-Fi calling</string>
+    <string name="wifi_calling">Wi-Fi calling</string>
     <!-- Indication for option to not use a Wi-Fi call manager -->
     <string name="wifi_calling_do_not_use">Do not use Wi-Fi calling</string>
     <!-- Indication for option to not use a call assistant. -->
@@ -1313,4 +1313,6 @@
     <string name="voicemail_notification_vibrate_key">voicemail_notification_vibrate_key</string>
     <!-- DO NOT TRANSLATE. Internal key for tty mode preference. -->
     <string name="tty_mode_key">button_tty_mode_key</string>
+    <!-- DO NOT TRANSLATE. Internal key for a voicemail notification preference. -->
+    <string name="wifi_calling_settings_key">button_wifi_calling_settings_key</string>
 </resources>
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 4ae0bf6..ab91394 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -82,6 +82,16 @@
         android:title="@string/fdn"
         android:persistent="false" />
 
+    <PreferenceScreen
+        android:key="@string/wifi_calling_settings_key"
+        android:title="@string/wifi_calling">
+
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.phone"
+            android:targetClass="com.android.phone.MobileNetworkSettings"/>
+
+    </PreferenceScreen>
+
     <CheckBoxPreference
         android:key="button_enable_video_calling"
         android:title="@string/enable_video_calling_title"
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index eae9bfc..ba77dd0 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -1337,6 +1337,12 @@
             TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
             tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
         }
+
+        if (!ImsManager.isWfcEnabledByPlatform(mPhone.getContext())) {
+            Preference wifiCallingSettings = findPreference(
+                    getResources().getString(R.string.wifi_calling_settings_key));
+            prefSet.removePreference(wifiCallingSettings);
+        }
     }
 
     @Override