Merge "Use FooterPreference in xml explicitly"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2b24a4c..c88eec9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -966,7 +966,7 @@
     <!-- Button text in face settings which lets the user enroll their face [CHAR LIMIT=40] -->
     <string name="security_settings_face_settings_enroll">Set up face unlock</string>
     <!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
-    <string name="security_settings_face_settings_footer">Use face unlock to unlock your device, sign in to apps, and confirm payments.\n\nKeep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face while your eyes are open.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
+    <string name="security_settings_face_settings_footer">Use face unlock to unlock your device, sign in to apps, and confirm payments.\n\nKeep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face, even if your eyes are closed.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
     <!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
     <string name="security_settings_face_settings_remove_dialog_title">Delete face data?</string>
     <!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
diff --git a/res/xml/restricted_apps_detail.xml b/res/xml/restricted_apps_detail.xml
index 1e08a7e..76c656e 100644
--- a/res/xml/restricted_apps_detail.xml
+++ b/res/xml/restricted_apps_detail.xml
@@ -16,9 +16,15 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:title="@string/restricted_app_title">
 
     <PreferenceCategory
         android:key="restrict_app_list"/>
 
+    <com.android.settingslib.widget.FooterPreference
+        android:key="restricted_app_footer"
+        android:title="@string/restricted_app_detail_footer"
+        android:selectable="false"
+        settings:searchable="false"/>
 </PreferenceScreen>
diff --git a/res/xml/smart_battery_detail.xml b/res/xml/smart_battery_detail.xml
index fa1b20b..87eeb86 100644
--- a/res/xml/smart_battery_detail.xml
+++ b/res/xml/smart_battery_detail.xml
@@ -46,4 +46,9 @@
         android:key="restricted_app"
         android:title="@string/restricted_app_title"/>
 
+    <com.android.settingslib.widget.FooterPreference
+        android:key="smart_battery_detail_footer"
+        android:title="@string/smart_battery_footer"
+        android:selectable="false"
+        settings:searchable="false"/>
 </PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/wifi_tether_settings.xml b/res/xml/wifi_tether_settings.xml
index 81e60a2..3a3bdc4 100644
--- a/res/xml/wifi_tether_settings.xml
+++ b/res/xml/wifi_tether_settings.xml
@@ -20,8 +20,7 @@
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="wifi_tether_settings_screen"
     android:title="@string/wifi_hotspot_checkbox_text"
-    settings:searchable="false"
-    settings:initialExpandedChildrenCount="3">
+    settings:searchable="false">
 
     <com.android.settings.wifi.tether.WifiTetherSsidPreference
         android:key="wifi_tether_network_name"
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 011cc12..e1253c1 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -16,7 +16,6 @@
 
 package com.android.settings.biometrics.face;
 
-import static android.provider.Settings.Secure.FACE_UNLOCK_EDUCATION_INFO_DISPLAYED;
 import static android.security.KeyStore.getApplicationContext;
 
 import android.app.settings.SettingsEnums;
@@ -50,8 +49,6 @@
     private static final String TAG = "FaceEducation";
     private static final int ON = 1;
     private static final int OFF = 0;
-    // 8 seconds.
-    private static final long FACE_ENROLL_EDUCATION_DELAY = 3000;
 
     private FaceManager mFaceManager;
     private FaceEnrollAccessibilityToggle mSwitchDiversity;
@@ -140,21 +137,9 @@
                     && accessibilityManager.isTouchExplorationEnabled();
         }
         mFooterBarMixin.setPrimaryButton(footerButton);
-        final Context context = getApplicationContext();
-        final boolean didDisplayEdu = Settings.Secure.getIntForUser(context.getContentResolver(),
-                FACE_UNLOCK_EDUCATION_INFO_DISPLAYED, OFF, mUserId) == ON;
-        if (!didDisplayEdu && !accessibilityEnabled) {
-            Settings.Secure.putIntForUser(context.getContentResolver(),
-                    FACE_UNLOCK_EDUCATION_INFO_DISPLAYED, ON, mUserId);
-            footerButton.setEnabled(false);
-            mHandler.postDelayed(() -> {
-                footerButton.setEnabled(true);
-            }, FACE_ENROLL_EDUCATION_DELAY);
-        }
 
         final Button accessibilityButton = findViewById(R.id.accessibility_button);
         accessibilityButton.setOnClickListener(view -> {
-            footerButton.setEnabled(true);
             mSwitchDiversity.setChecked(true);
             accessibilityButton.setVisibility(View.GONE);
             mSwitchDiversity.setVisibility(View.VISIBLE);
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index c56c50e..a8b1c97 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -221,7 +221,7 @@
                 return mCachedDevice
                         .compareTo(((BluetoothDevicePreference) another).mCachedDevice);
             case SortType.TYPE_FIFO:
-                return (int)(mCurrentTime - ((BluetoothDevicePreference) another).mCurrentTime);
+                return mCurrentTime > ((BluetoothDevicePreference) another).mCurrentTime ? 1 : -1;
             default:
                 return super.compareTo(another);
         }
diff --git a/src/com/android/settings/fuelgauge/RestrictedAppDetails.java b/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
index 6722b4a..db83140 100644
--- a/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
+++ b/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
@@ -47,7 +47,6 @@
 import com.android.settings.widget.AppCheckBoxPreference;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.utils.StringUtil;
-import com.android.settingslib.widget.FooterPreferenceMixinCompat;
 
 import java.util.List;
 
@@ -76,8 +75,6 @@
     PackageManager mPackageManager;
     @VisibleForTesting
     BatteryDatabaseManager mBatteryDatabaseManager;
-    private final FooterPreferenceMixinCompat mFooterPreferenceMixin =
-            new FooterPreferenceMixinCompat(this, getSettingsLifecycle());
 
     public static void startRestrictedAppDetails(InstrumentedPreferenceFragment fragment,
             List<AppInfo> appInfos) {
@@ -97,8 +94,6 @@
         super.onCreate(icicle);
         final Context context = getContext();
 
-        mFooterPreferenceMixin.createFooterPreference().setTitle(
-                R.string.restricted_app_detail_footer);
         mRestrictedAppListGroup = (PreferenceGroup) findPreference(KEY_PREF_RESTRICTED_APP_LIST);
         mAppInfos = getArguments().getParcelableArrayList(EXTRA_APP_INFO_LIST);
         mPackageManager = context.getPackageManager();
diff --git a/src/com/android/settings/fuelgauge/SmartBatterySettings.java b/src/com/android/settings/fuelgauge/SmartBatterySettings.java
index 5fddbac..8fc8f87 100644
--- a/src/com/android/settings/fuelgauge/SmartBatterySettings.java
+++ b/src/com/android/settings/fuelgauge/SmartBatterySettings.java
@@ -18,7 +18,6 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.os.Bundle;
 import android.provider.SearchIndexableResource;
 
 import com.android.settings.R;
@@ -41,12 +40,6 @@
     public static final String TAG = "SmartBatterySettings";
 
     @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.smart_battery_footer);
-    }
-
-    @Override
     public int getMetricsCategory() {
         return SettingsEnums.FUELGAUGE_SMART_BATTERY;
     }
diff --git a/src/com/android/settings/wifi/CellularFallbackPreferenceController.java b/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
index c411aba..659ddbe 100644
--- a/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
+++ b/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -37,7 +36,7 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return !avoidBadWifiConfig() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+        return avoidBadWifiConfig() ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
     }
 
     @Override
@@ -53,20 +52,18 @@
     }
 
     private boolean avoidBadWifiConfig() {
-        boolean avoidBadWifiConfig = true;
-        final SubscriptionManager subscriptionManager =
-                mContext.getSystemService(SubscriptionManager.class);
-
-        for (SubscriptionInfo subscriptionInfo :
-                subscriptionManager.getActiveSubscriptionInfoList()) {
-            final Resources resources = getResourcesForSubId(subscriptionInfo.getSubscriptionId());
-            if (resources.getInteger(
-                    com.android.internal.R.integer.config_networkAvoidBadWifi) == 0) {
-                avoidBadWifiConfig = false;
-                break;
-            }
+        final int activeDataSubscriptionId = getActiveDataSubscriptionId();
+        if (activeDataSubscriptionId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            return true;
         }
-        return avoidBadWifiConfig;
+
+        final Resources resources = getResourcesForSubId(activeDataSubscriptionId);
+        return resources.getInteger(com.android.internal.R.integer.config_networkAvoidBadWifi) == 1;
+    }
+
+    @VisibleForTesting
+    int getActiveDataSubscriptionId() {
+        return SubscriptionManager.getActiveDataSubscriptionId();
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
index 3a85f7b..388cbf2 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
@@ -90,7 +90,7 @@
         mBandIndex = validateSelection(Integer.parseInt((String) newValue));
         Log.d(TAG, "Band preference changed, updating band index to " + mBandIndex);
         preference.setSummary(getConfigSummary());
-        mListener.onTetherConfigUpdated();
+        mListener.onTetherConfigUpdated(this);
         return true;
     }
 
diff --git a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
index 94e9209..2a5dea9 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
@@ -30,7 +30,7 @@
         implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
 
     public interface OnTetherConfigUpdateListener {
-        void onTetherConfigUpdated();
+        void onTetherConfigUpdated(AbstractPreferenceController context);
     }
 
     protected final WifiManager mWifiManager;
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
index 8d9e858..81239a8 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
@@ -65,7 +65,7 @@
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         mPassword = (String) newValue;
         updatePasswordDisplay((EditTextPreference) mPreference);
-        mListener.onTetherConfigUpdated();
+        mListener.onTetherConfigUpdated(this);
         return true;
     }
 
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
index 1197db4..a35450f 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
@@ -93,7 +93,7 @@
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         mSSID = (String) newValue;
         updateSsidDisplay((EditTextPreference) preference);
-        mListener.onTetherConfigUpdated();
+        mListener.onTetherConfigUpdated(this);
         return true;
     }
 
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceController.java
index f97a209..9ce05ed 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceController.java
@@ -45,7 +45,7 @@
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         mSecurityValue = Integer.parseInt((String) newValue);
         preference.setSummary(getSummaryForSecurityType(mSecurityValue));
-        mListener.onTetherConfigUpdated();
+        mListener.onTetherConfigUpdated(this);
         return true;
     }
 
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index aecc053..3636eb8 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -30,9 +30,8 @@
 import android.os.UserManager;
 import android.provider.SearchIndexableResource;
 import android.util.Log;
-
 import androidx.annotation.VisibleForTesting;
-
+import androidx.preference.PreferenceGroup;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.dashboard.RestrictedDashboardFragment;
@@ -42,7 +41,6 @@
 import com.android.settingslib.TetherUtil;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.search.SearchIndexable;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -54,6 +52,9 @@
     private static final String TAG = "WifiTetherSettings";
     private static final IntentFilter TETHER_STATE_CHANGE_FILTER;
     private static final String KEY_WIFI_TETHER_SCREEN = "wifi_tether_settings_screen";
+    private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
+    private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
+
     @VisibleForTesting
     static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
     @VisibleForTesting
@@ -185,7 +186,7 @@
     }
 
     @Override
-    public void onTetherConfigUpdated() {
+    public void onTetherConfigUpdated(AbstractPreferenceController context) {
         final WifiConfiguration config = buildNewConfig();
         mPasswordPreferenceController.updateVisibility(config.getAuthType());
 
@@ -201,6 +202,10 @@
             mSwitchBarController.stopTether();
         }
         mWifiManager.setWifiApConfiguration(config);
+
+        if (context instanceof WifiTetherSecurityPreferenceController) {
+            reConfigInitialExpandedChildCount();
+        }
     }
 
     private WifiConfiguration buildNewConfig() {
@@ -285,4 +290,23 @@
             }
         }
     }
+
+    private void reConfigInitialExpandedChildCount() {
+        final PreferenceGroup screen = getPreferenceScreen();
+        if (mSecurityPreferenceController.getSecurityType() == WifiConfiguration.KeyMgmt.NONE) {
+            screen.setInitialExpandedChildrenCount(EXPANDED_CHILD_COUNT_WITH_SECURITY_NON);
+            return;
+        }
+        screen.setInitialExpandedChildrenCount(EXPANDED_CHILD_COUNT_DEFAULT);
+    }
+
+    @Override
+    public int getInitialExpandedChildCount() {
+        if (mSecurityPreferenceController == null) {
+            return EXPANDED_CHILD_COUNT_DEFAULT;
+        }
+
+        return (mSecurityPreferenceController.getSecurityType() == WifiConfiguration.KeyMgmt.NONE) ?
+            EXPANDED_CHILD_COUNT_WITH_SECURITY_NON : EXPANDED_CHILD_COUNT_DEFAULT;
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/CellularFallbackPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/CellularFallbackPreferenceControllerTest.java
index e5d5d8f..6f3230c 100644
--- a/tests/robotests/src/com/android/settings/wifi/CellularFallbackPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/CellularFallbackPreferenceControllerTest.java
@@ -26,12 +26,8 @@
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -39,32 +35,35 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowApplication;
 
 @RunWith(RobolectricTestRunner.class)
 public class CellularFallbackPreferenceControllerTest {
     private static final String KEY_CELLULAR_FALLBACK = "wifi_cellular_data_fallback";
 
-    @Mock
-    private SubscriptionManager mSubscriptionManager;
-
     private CellularFallbackPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        ShadowApplication shadowApplication = ShadowApplication.getInstance();
-        shadowApplication.setSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE,
-                mSubscriptionManager);
+
         mController = spy(new CellularFallbackPreferenceController(RuntimeEnvironment.application,
                 KEY_CELLULAR_FALLBACK));
     }
 
     @Test
+    public void isAvailable_invalidActiveSubscriptionId_shouldReturnFalse() {
+        doReturn(SubscriptionManager.INVALID_SUBSCRIPTION_ID)
+                .when(mController).getActiveDataSubscriptionId();
+
+        assertThat(mController.isAvailable()).isFalse();
+    }
+
+    @Test
     public void isAvailable_avoidBadWifiConfigIsFalse_shouldReturnTrue() {
-        setupMockIcc();
         final Resources resources = mock(Resources.class);
 
+        doReturn(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID)
+                .when(mController).getActiveDataSubscriptionId();
         doReturn(resources).when(mController).getResourcesForSubId(anyInt());
         when(resources.getInteger(
                 com.android.internal.R.integer.config_networkAvoidBadWifi))
@@ -75,9 +74,10 @@
 
     @Test
     public void isAvailable_avoidBadWifiConfigIsTrue_shouldReturnFalse() {
-        setupMockIcc();
         final Resources resources = mock(Resources.class);
 
+        doReturn(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID)
+                .when(mController).getActiveDataSubscriptionId();
         doReturn(resources).when(mController).getResourcesForSubId(anyInt());
         when(resources.getInteger(
                 com.android.internal.R.integer.config_networkAvoidBadWifi))
@@ -85,14 +85,4 @@
 
         assertThat(mController.isAvailable()).isFalse();
     }
-
-    private void setupMockIcc() {
-        final List<SubscriptionInfo> subscriptionInfoList = new ArrayList<>();
-        final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo info2 = mock(SubscriptionInfo.class);
-        subscriptionInfoList.add(info1);
-        subscriptionInfoList.add(info2);
-        when(mSubscriptionManager.getActiveSubscriptionInfoList())
-                .thenReturn(subscriptionInfoList);
-    }
-}
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
index 6bc2869..590d386 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
@@ -128,19 +128,19 @@
         mController.onPreferenceChange(mPreference, "-1");
         assertThat(mController.getBandIndex()).isEqualTo(1);
         assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
-        verify(mListener, times(1)).onTetherConfigUpdated();
+        verify(mListener, times(1)).onTetherConfigUpdated(mController);
 
         // set to 5 Ghz
         mController.onPreferenceChange(mPreference, "1");
         assertThat(mController.getBandIndex()).isEqualTo(1);
         assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
-        verify(mListener, times(2)).onTetherConfigUpdated();
+        verify(mListener, times(2)).onTetherConfigUpdated(mController);
 
         // set to 2 Ghz
         mController.onPreferenceChange(mPreference, "0");
         assertThat(mController.getBandIndex()).isEqualTo(0);
         assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
-        verify(mListener, times(3)).onTetherConfigUpdated();
+        verify(mListener, times(3)).onTetherConfigUpdated(mController);
     }
 
     @Test
@@ -155,19 +155,19 @@
         mController.onPreferenceChange(mPreference, "-1");
         assertThat(mController.getBandIndex()).isEqualTo(-1);
         assertThat(mPreference.getSummary()).isEqualTo(ALL_BANDS);
-        verify(mListener, times(1)).onTetherConfigUpdated();
+        verify(mListener, times(1)).onTetherConfigUpdated(mController);
 
         // should revert to the default for 5 Ghz only since this is not supported with this config
         mController.onPreferenceChange(mPreference, "1");
         assertThat(mController.getBandIndex()).isEqualTo(-1);
         assertThat(mPreference.getSummary()).isEqualTo(ALL_BANDS);
-        verify(mListener, times(2)).onTetherConfigUpdated();
+        verify(mListener, times(2)).onTetherConfigUpdated(mController);
 
         // set to 2 Ghz
         mController.onPreferenceChange(mPreference, "0");
         assertThat(mController.getBandIndex()).isEqualTo(0);
         assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
-        verify(mListener, times(3)).onTetherConfigUpdated();
+        verify(mListener, times(3)).onTetherConfigUpdated(mController);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
index 62fb277..07e7821 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
@@ -99,7 +99,7 @@
         assertThat(mController.getPasswordValidated(WifiConfiguration.KeyMgmt.WPA2_PSK))
                 .isEqualTo(VALID_PASS2);
 
-        verify(mListener, times(2)).onTetherConfigUpdated();
+        verify(mListener, times(2)).onTetherConfigUpdated(mController);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
index 3d15197..974dc2f 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
@@ -102,7 +102,7 @@
         mController.onPreferenceChange(mPreference, "0");
         assertThat(mController.getSSID()).isEqualTo("0");
 
-        verify(mListener, times(2)).onTetherConfigUpdated();
+        verify(mListener, times(2)).onTetherConfigUpdated(mController);
     }
 
     @Test