Update WifiCallingSettingsForSub to inherit DashboardFragment. Controller logic will be refactored later

Bug: 372732219
Test: atest
Flag: EXEMPT refactor
Change-Id: I8fc419acd0311cc5b11d78662fb6a13b2c61b169
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
index e5581d3..dddbd63 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
@@ -54,9 +54,9 @@
 import com.android.internal.telephony.flags.Flags;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
-import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
 import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.network.ims.WifiCallingQueryImsState;
 import com.android.settings.network.telephony.wificalling.IWifiCallingRepository;
 import com.android.settings.network.telephony.wificalling.WifiCallingRepository;
@@ -70,7 +70,7 @@
  * This is the inner class of {@link WifiCallingSettings} fragment.
  * The preference screen lets you enable/disable Wi-Fi Calling and change Wi-Fi Calling mode.
  */
-public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
+public class WifiCallingSettingsForSub extends DashboardFragment
         implements OnCheckedChangeListener,
         Preference.OnPreferenceChangeListener {
     private static final String TAG = "WifiCallingForSub";
@@ -266,8 +266,6 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        addPreferencesFromResource(R.xml.wifi_calling_settings);
-
         // SubId should always be specified when creating this fragment. Either through
         // fragment.setArguments() or through savedInstanceState.
         if (getArguments() != null && getArguments().containsKey(FRAGMENT_BUNDLE_SUBID)) {
@@ -447,6 +445,11 @@
     }
 
     @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.wifi_calling_settings;
+    }
+
+    @Override
     public void onPause() {
         super.onPause();
         Context context = getActivity();
@@ -571,6 +574,11 @@
         }
     }
 
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
     private void updateButtonWfcMode(boolean wfcEnabled,
             int wfcMode, int wfcRoamingMode) {
         mButtonWfcMode.setSummary(getWfcModeSummary(wfcMode));
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
index 4440bc9..f34042d 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
@@ -90,6 +90,7 @@
     private static final String PREFERENCE_NO_OPTIONS_DESC = "no_options_description";
     private static final String TEST_EMERGENCY_ADDRESS_CARRIER_APP =
             "com.android.settings/.wifi.calling.TestEmergencyAddressCarrierApp";
+    private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
 
     private TestFragment mFragment;
     private Context mContext;
@@ -138,6 +139,7 @@
         doReturn(mContext.getResources()).when(mFragment).getResources();
         doReturn(mPreferenceScreen).when(mFragment).getPreferenceScreen();
         doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
+        doReturn(mock(LifecycleOwner.class)).when(mFragment).getViewLifecycleOwner();
         final Bundle bundle = new Bundle();
         when(mFragment.getArguments()).thenReturn(bundle);
         doNothing().when(mFragment).addPreferencesFromResource(anyInt());
@@ -380,19 +382,22 @@
 
         @Override
         public <T extends Preference> T findPreference(CharSequence key) {
-            if (SWITCH_BAR.equals(key)) {
+            if (SWITCH_BAR.contentEquals(key)) {
                 return (T) mSwitchPref;
             }
-            if (BUTTON_WFC_MODE.equals(key)) {
+            if (BUTTON_WFC_MODE.contentEquals(key)) {
                 return (T) mButtonWfcMode;
             }
-            if (BUTTON_WFC_ROAMING_MODE.equals(key)) {
+            if (BUTTON_WFC_ROAMING_MODE.contentEquals(key)) {
                 return (T) mButtonWfcRoamingMode;
             }
-            if (PREFERENCE_NO_OPTIONS_DESC.equals(key)) {
+            if (PREFERENCE_NO_OPTIONS_DESC.contentEquals(key)) {
                 return (T) mDescriptionView;
             }
-            return (T) mock(ListWithEntrySummaryPreference.class);
+            if (PREFERENCE_EMERGENCY_ADDRESS.contentEquals(key)) {
+                return (T) mUpdateAddress;
+            }
+            return null;
         }
 
         @Override