diff --git a/src/com/android/settings/utils/PreferenceGroupChildrenCache.java b/src/com/android/settings/utils/PreferenceGroupChildrenCache.java
new file mode 100644
index 0000000..dcbf4fd
--- /dev/null
+++ b/src/com/android/settings/utils/PreferenceGroupChildrenCache.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.utils;
+
+import android.text.TextUtils;
+import android.util.ArrayMap;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceGroup;
+
+/**
+ * Class that helps track which {@link Preference}s in a {@link PreferenceGroup} are still being
+ * used, and remove unused ones.
+ */
+public class PreferenceGroupChildrenCache {
+
+    private ArrayMap<String, Preference> mPreferenceCache;
+
+    public void cacheRemoveAllPrefs(PreferenceGroup group) {
+        mPreferenceCache = new ArrayMap<>();
+        final int N = group.getPreferenceCount();
+        for (int i = 0; i < N; i++) {
+            Preference p = group.getPreference(i);
+            if (TextUtils.isEmpty(p.getKey())) {
+                continue;
+            }
+            mPreferenceCache.put(p.getKey(), p);
+        }
+    }
+
+    public void removeCachedPrefs(PreferenceGroup group) {
+        for (Preference p : mPreferenceCache.values()) {
+            group.removePreference(p);
+        }
+        mPreferenceCache = null;
+    }
+
+    public Preference getCachedPreference(String key) {
+        return mPreferenceCache != null ? mPreferenceCache.remove(key) : null;
+    }
+
+    public int getCachedCount() {
+        return mPreferenceCache != null ? mPreferenceCache.size() : 0;
+    }
+}
diff --git a/src/com/android/settings/wifi/WifiDialog.java b/src/com/android/settings/wifi/WifiDialog.java
index 79500e0..8c2739f 100644
--- a/src/com/android/settings/wifi/WifiDialog.java
+++ b/src/com/android/settings/wifi/WifiDialog.java
@@ -27,11 +27,15 @@
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.wifi.AccessPoint;
 
-public class WifiDialog extends AlertDialog implements WifiConfigUiBase, DialogInterface.OnClickListener {
+public class WifiDialog extends AlertDialog implements WifiConfigUiBase,
+        DialogInterface.OnClickListener {
 
     public interface WifiDialogListener {
-        void onForget(WifiDialog dialog);
-        void onSubmit(WifiDialog dialog);
+        default void onForget(WifiDialog dialog) {
+        }
+
+        default void onSubmit(WifiDialog dialog) {
+        }
     }
 
     private static final int BUTTON_SUBMIT = DialogInterface.BUTTON_POSITIVE;
@@ -64,7 +68,7 @@
     }
 
     /* package */ WifiDialog(Context context, WifiDialogListener listener, AccessPoint accessPoint,
-        int mode, int style, boolean hideSubmitButton) {
+            int mode, int style, boolean hideSubmitButton) {
         super(context, style);
         mMode = mode;
         mListener = listener;
@@ -99,8 +103,8 @@
     }
 
     public void onRestoreInstanceState(Bundle savedInstanceState) {
-            super.onRestoreInstanceState(savedInstanceState);
-            mController.updatePassword();
+        super.onRestoreInstanceState(savedInstanceState);
+        mController.updatePassword();
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index d291f9c..bda3b76 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -542,11 +542,6 @@
     }
 
     @Override
-    public void onForget(WifiDialog dialog) {
-        // can't forget network from a 'modify' dialog
-    }
-
-    @Override
     public void onSubmit(WifiDialog dialog) {
         if (dialog.getController() != null) {
             mWifiManager.save(dialog.getController().getConfig(), new WifiManager.ActionListener() {
diff --git a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceController.java b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceController.java
index a7c4038..dea4443 100644
--- a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceController.java
+++ b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceController.java
@@ -18,21 +18,127 @@
 
 
 import android.content.Context;
+import android.net.wifi.WifiManager;
+import android.util.Log;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.BasePreferenceController;
+import com.android.settings.utils.PreferenceGroupChildrenCache;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.utils.ThreadUtils;
+import com.android.settingslib.wifi.AccessPoint;
+import com.android.settingslib.wifi.AccessPointPreference;
+import com.android.settingslib.wifi.AccessPointPreference.UserBadgeCache;
+import com.android.settingslib.wifi.WifiSavedConfigUtils;
+
+import java.util.Collections;
+import java.util.List;
 
 /**
- * Controller that manages a PrferenceGroup, which contains a list of saved access points.
+ * Controller that manages a PreferenceGroup, which contains a list of saved access points.
  */
-public class SavedAccessPointsPreferenceController extends BasePreferenceController {
+public class SavedAccessPointsPreferenceController extends BasePreferenceController implements
+        LifecycleObserver, OnStart, Preference.OnPreferenceClickListener,
+        WifiManager.ActionListener {
+
+    private static final String TAG = "SavedAPPrefCtrl";
+
+    private final WifiManager mWifiManager;
+    private final PreferenceGroupChildrenCache mChildrenCache;
+
+    private final UserBadgeCache mUserBadgeCache;
+    private PreferenceGroup mPreferenceGroup;
+    private SavedAccessPointsWifiSettings mHost;
 
     public SavedAccessPointsPreferenceController(Context context,
             String preferenceKey) {
         super(context, preferenceKey);
+        mUserBadgeCache = new AccessPointPreference.UserBadgeCache(context.getPackageManager());
+        mWifiManager = context.getSystemService(WifiManager.class);
+        mChildrenCache = new PreferenceGroupChildrenCache();
+    }
+
+    public SavedAccessPointsPreferenceController setHost(SavedAccessPointsWifiSettings host) {
+        mHost = host;
+        return this;
     }
 
     @Override
     public int getAvailabilityStatus() {
         return AVAILABLE;
     }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreferenceGroup = (PreferenceGroup) screen.findPreference(getPreferenceKey());
+    }
+
+    @Override
+    public void onStart() {
+        refreshSavedAccessPoints();
+    }
+
+    public void postRefreshSavedAccessPoints() {
+        ThreadUtils.postOnMainThread(() -> refreshSavedAccessPoints());
+    }
+
+    @Override
+    public boolean onPreferenceClick(Preference preference) {
+        if (mHost != null) {
+            mHost.showWifiDialog((AccessPointPreference) preference);
+        }
+        return false;
+    }
+
+    @Override
+    public void onSuccess() {
+        postRefreshSavedAccessPoints();
+    }
+
+    @Override
+    public void onFailure(int reason) {
+        postRefreshSavedAccessPoints();
+    }
+
+    @VisibleForTesting
+    void refreshSavedAccessPoints() {
+        if (mPreferenceGroup == null) {
+            Log.w(TAG, "PreferenceGroup is null, skipping.");
+            return;
+        }
+        final Context prefContext = mPreferenceGroup.getContext();
+
+        final List<AccessPoint> accessPoints =
+                WifiSavedConfigUtils.getAllConfigs(mContext, mWifiManager);
+        Collections.sort(accessPoints, SavedNetworkComparator.INSTANCE);
+        mChildrenCache.cacheRemoveAllPrefs(mPreferenceGroup);
+
+        final int accessPointsSize = accessPoints.size();
+        for (int i = 0; i < accessPointsSize; ++i) {
+            AccessPoint ap = accessPoints.get(i);
+            String key = ap.getKey();
+            AccessPointPreference preference =
+                    (AccessPointPreference) mChildrenCache.getCachedPreference(key);
+            if (preference == null) {
+                preference = new AccessPointPreference(ap, prefContext, mUserBadgeCache, true);
+                preference.setKey(key);
+                preference.setIcon(null);
+                preference.setOnPreferenceClickListener(this);
+                mPreferenceGroup.addPreference(preference);
+            }
+            preference.setOrder(i);
+        }
+
+        mChildrenCache.removeCachedPrefs(mPreferenceGroup);
+
+        if (mPreferenceGroup.getPreferenceCount() < 1) {
+            Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java
index 930cd85..8f14ec2 100644
--- a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java
@@ -17,18 +17,12 @@
 package com.android.settings.wifi.savedaccesspoints;
 
 import android.annotation.Nullable;
-import android.app.Activity;
 import android.app.Dialog;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
-import android.os.Handler;
 import android.util.Log;
-import android.widget.Toast;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
 
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -39,68 +33,19 @@
 import com.android.settings.wifi.WifiSettings;
 import com.android.settingslib.wifi.AccessPoint;
 import com.android.settingslib.wifi.AccessPointPreference;
-import com.android.settingslib.wifi.WifiSavedConfigUtils;
-
-import java.util.Collections;
-import java.util.List;
 
 /**
  * UI to manage saved networks/access points.
  */
 public class SavedAccessPointsWifiSettings extends DashboardFragment
-        implements WifiDialog.WifiDialogListener {
+        implements WifiDialog.WifiDialogListener, DialogInterface.OnCancelListener {
+
     private static final String TAG = "SavedAccessPoints";
-    @VisibleForTesting
-    static final int MSG_UPDATE_PREFERENCES = 1;
 
-    @VisibleForTesting
-    final WifiManager.ActionListener mForgetListener = new WifiManager.ActionListener() {
-        @Override
-        public void onSuccess() {
-            postUpdatePreference();
-        }
-
-        @Override
-        public void onFailure(int reason) {
-            postUpdatePreference();
-        }
-    };
-
-    @VisibleForTesting
-    final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(android.os.Message msg) {
-            if (msg.what == MSG_UPDATE_PREFERENCES) {
-                initPreferences();
-            }
-        }
-    };
-
-    private final WifiManager.ActionListener mSaveListener = new WifiManager.ActionListener() {
-        @Override
-        public void onSuccess() {
-            postUpdatePreference();
-        }
-
-        @Override
-        public void onFailure(int reason) {
-            Activity activity = getActivity();
-            if (activity != null) {
-                Toast.makeText(activity,
-                        R.string.wifi_failed_save_message,
-                        Toast.LENGTH_SHORT).show();
-            }
-        }
-    };
-
-    private WifiDialog mDialog;
     private WifiManager mWifiManager;
-    private AccessPoint mDlgAccessPoint;
     private Bundle mAccessPointSavedState;
     private AccessPoint mSelectedAccessPoint;
 
-    private AccessPointPreference.UserBadgeCache mUserBadgeCache;
-
     // Instance state key
     private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
 
@@ -122,21 +67,15 @@
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
-        mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        initPreferences();
-    }
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
         mWifiManager = (WifiManager) getContext()
                 .getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+        use(SavedAccessPointsPreferenceController.class)
+                .setHost(this);
+    }
 
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
         if (savedInstanceState != null) {
             if (savedInstanceState.containsKey(SAVE_DIALOG_ACCESS_POINT_STATE)) {
                 mAccessPointSavedState =
@@ -145,55 +84,15 @@
         }
     }
 
-    private void initPreferences() {
-        PreferenceScreen preferenceScreen = getPreferenceScreen();
-        final Context context = getPrefContext();
-
-        final List<AccessPoint> accessPoints =
-                WifiSavedConfigUtils.getAllConfigs(context, mWifiManager);
-        Collections.sort(accessPoints, SavedNetworkComparator.INSTANCE);
-        cacheRemoveAllPrefs(preferenceScreen);
-
-        final int accessPointsSize = accessPoints.size();
-        for (int i = 0; i < accessPointsSize; ++i) {
-            AccessPoint ap = accessPoints.get(i);
-            String key = ap.getKey();
-            AccessPointPreference preference =
-                    (AccessPointPreference) getCachedPreference(key);
-            if (preference == null) {
-                preference = new AccessPointPreference(ap, context, mUserBadgeCache, true);
-                preference.setKey(key);
-                preference.setIcon(null);
-                preferenceScreen.addPreference(preference);
-            }
-            preference.setOrder(i);
-        }
-
-        removeCachedPrefs(preferenceScreen);
-
-        if (getPreferenceScreen().getPreferenceCount() < 1) {
-            Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
-        }
-    }
-
-    private void postUpdatePreference() {
-        if (!mHandler.hasMessages(MSG_UPDATE_PREFERENCES)) {
-            mHandler.sendEmptyMessage(MSG_UPDATE_PREFERENCES);
-        }
-    }
-
-    private void showWifiDialog(@Nullable AccessPointPreference accessPoint) {
-        if (mDialog != null) {
-            removeDialog(WifiSettings.WIFI_DIALOG_ID);
-            mDialog = null;
-        }
+    public void showWifiDialog(@Nullable AccessPointPreference accessPoint) {
+        removeDialog(WifiSettings.WIFI_DIALOG_ID);
 
         if (accessPoint != null) {
             // Save the access point and edit mode
-            mDlgAccessPoint = accessPoint.getAccessPoint();
+            mSelectedAccessPoint = accessPoint.getAccessPoint();
         } else {
             // No access point is selected. Clear saved state.
-            mDlgAccessPoint = null;
+            mSelectedAccessPoint = null;
             mAccessPointSavedState = null;
         }
 
@@ -204,24 +103,18 @@
     public Dialog onCreateDialog(int dialogId) {
         switch (dialogId) {
             case WifiSettings.WIFI_DIALOG_ID:
-                if (mDlgAccessPoint == null && mAccessPointSavedState == null) {
-                    // Add new network
-                    mDialog = WifiDialog.createFullscreen(getActivity(), this, null,
-                            WifiConfigUiBase.MODE_CONNECT);
-                } else {
-                    // Modify network
-                    if (mDlgAccessPoint == null) {
-                        // Restore AP from save state
-                        mDlgAccessPoint = new AccessPoint(getActivity(), mAccessPointSavedState);
-                        // Reset the saved access point data
-                        mAccessPointSavedState = null;
-                    }
-                    mDialog = WifiDialog.createModal(getActivity(), this, mDlgAccessPoint,
-                            WifiConfigUiBase.MODE_VIEW);
+                // Modify network
+                if (mSelectedAccessPoint == null) {
+                    // Restore AP from save state
+                    mSelectedAccessPoint = new AccessPoint(getActivity(), mAccessPointSavedState);
+                    // Reset the saved access point data
+                    mAccessPointSavedState = null;
                 }
-                mSelectedAccessPoint = mDlgAccessPoint;
+                final WifiDialog dialog = WifiDialog.createModal(
+                        getActivity(), this, mSelectedAccessPoint, WifiConfigUiBase.MODE_VIEW);
+                dialog.setOnCancelListener(this);
 
-                return mDialog;
+                return dialog;
         }
         return super.onCreateDialog(dialogId);
     }
@@ -239,14 +132,12 @@
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
-
-        // If the dialog is showing, save its state.
-        if (mDialog != null && mDialog.isShowing()) {
-            if (mDlgAccessPoint != null) {
-                mAccessPointSavedState = new Bundle();
-                mDlgAccessPoint.saveWifiState(mAccessPointSavedState);
-                outState.putBundle(SAVE_DIALOG_ACCESS_POINT_STATE, mAccessPointSavedState);
-            }
+        // If the dialog is showing (indicated by the existence of mSelectedAccessPoint), then we
+        // save its state.
+        if (mSelectedAccessPoint != null) {
+            mAccessPointSavedState = new Bundle();
+            mSelectedAccessPoint.saveWifiState(mAccessPointSavedState);
+            outState.putBundle(SAVE_DIALOG_ACCESS_POINT_STATE, mAccessPointSavedState);
         }
     }
 
@@ -261,27 +152,19 @@
                     Log.e(TAG, "Failed to remove Passpoint configuration for "
                             + mSelectedAccessPoint.getConfigName());
                 }
-                postUpdatePreference();
+                use(SavedAccessPointsPreferenceController.class)
+                        .postRefreshSavedAccessPoints();
             } else {
                 // mForgetListener will call initPreferences upon completion
-                mWifiManager.forget(mSelectedAccessPoint.getConfig().networkId, mForgetListener);
+                mWifiManager.forget(mSelectedAccessPoint.getConfig().networkId,
+                        use(SavedAccessPointsPreferenceController.class));
             }
             mSelectedAccessPoint = null;
         }
     }
 
     @Override
-    public void onSubmit(WifiDialog dialog) {
-        mWifiManager.save(dialog.getController().getConfig(), mSaveListener);
-    }
-
-    @Override
-    public boolean onPreferenceTreeClick(Preference preference) {
-        if (preference instanceof AccessPointPreference) {
-            showWifiDialog((AccessPointPreference) preference);
-            return true;
-        } else {
-            return super.onPreferenceTreeClick(preference);
-        }
+    public void onCancel(DialogInterface dialog) {
+        mSelectedAccessPoint = null;
     }
 }
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java
new file mode 100644
index 0000000..2cb6964
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.testutils.shadow;
+
+import com.android.settingslib.wifi.AccessPoint;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+@Implements(AccessPoint.class)
+public class ShadowAccessPoint {
+
+    @Implementation
+    public String getSavedNetworkSummary() {
+        return "saved";
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java
index e5304da..65f92a3 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java
@@ -20,13 +20,17 @@
 
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
+import android.net.wifi.hotspot2.PasspointConfiguration;
 
 import org.robolectric.annotation.HiddenApi;
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
 import org.robolectric.shadow.api.Shadow;
 
-@Implements(WifiManager.class)
+import java.util.Collections;
+import java.util.List;
+
+@Implements(value = WifiManager.class, inheritImplementationMethods = true)
 public class ShadowWifiManager extends org.robolectric.shadows.ShadowWifiManager {
 
     public WifiConfiguration savedWifiConfig;
@@ -43,6 +47,11 @@
         savedWifiConfig = config;
     }
 
+    @Implementation
+    public List<PasspointConfiguration> getPasspointConfigurations() {
+        return Collections.emptyList();
+    }
+
     public static ShadowWifiManager get() {
         return Shadow.extract(application.getSystemService(WifiManager.class));
     }
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiDialogTest.java b/tests/robotests/src/com/android/settings/wifi/WifiDialogTest.java
index 7025100..7a88131 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiDialogTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiDialogTest.java
@@ -25,15 +25,7 @@
 
     private Context mContext = RuntimeEnvironment.application;
 
-    private WifiDialogListener mListener = new WifiDialogListener() {
-        @Override
-        public void onForget(WifiDialog dialog) {
-        }
-
-        @Override
-        public void onSubmit(WifiDialog dialog) {
-        }
-    };
+    private WifiDialogListener mListener = new WifiDialogListener() {};
 
     @Before
     public void setUp() {
diff --git a/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceControllerTest.java
new file mode 100644
index 0000000..790739a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsPreferenceControllerTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.wifi.savedaccesspoints;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.net.wifi.WifiConfiguration;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.ShadowAccessPoint;
+import com.android.settings.testutils.shadow.ShadowThreadUtils;
+import com.android.settings.testutils.shadow.ShadowWifiManager;
+import com.android.settingslib.wifi.AccessPointPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(shadows = {ShadowThreadUtils.class, ShadowWifiManager.class})
+public class SavedAccessPointsPreferenceControllerTest {
+
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
+    @Mock
+    private PreferenceCategory mPreferenceCategory;
+
+    private Context mContext;
+    private ShadowWifiManager mWifiManager;
+    private SavedAccessPointsPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mWifiManager = ShadowWifiManager.get();
+        mController = spy(new SavedAccessPointsPreferenceController(mContext, "test_key"));
+
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+                .thenReturn(mPreferenceCategory);
+        when(mPreferenceCategory.getContext()).thenReturn(mContext);
+    }
+
+    @Test
+    public void getAvailability_alwaysAvailable() {
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
+    public void onStart_shouldRefreshApList() {
+        doNothing().when(mController).refreshSavedAccessPoints();
+
+        mController.onStart();
+
+        verify(mController).refreshSavedAccessPoints();
+    }
+
+
+    @Test
+    public void postRefresh_shouldRefreshApList() {
+        doNothing().when(mController).refreshSavedAccessPoints();
+
+        mController.postRefreshSavedAccessPoints();
+
+        verify(mController).refreshSavedAccessPoints();
+    }
+
+    @Test
+    public void forget_onSuccess_shouldRefreshApList() {
+        doNothing().when(mController).refreshSavedAccessPoints();
+
+        mController.onSuccess();
+
+        verify(mController).refreshSavedAccessPoints();
+    }
+
+    @Test
+    public void forget_onFailure_shouldRefreshApList() {
+        doNothing().when(mController).refreshSavedAccessPoints();
+
+        mController.onFailure(0 /* reason */);
+
+        verify(mController).refreshSavedAccessPoints();
+    }
+
+    @Test
+    @Config(shadows = ShadowAccessPoint.class)
+    public void refreshSavedAccessPoints_shouldListAllAPs() {
+        final WifiConfiguration config = new WifiConfiguration();
+        config.SSID = "SSID";
+        config.BSSID = "BSSID";
+        config.networkId = 2;
+        mWifiManager.addNetwork(config);
+
+        final ArgumentCaptor<AccessPointPreference> captor =
+                ArgumentCaptor.forClass(AccessPointPreference.class);
+        mController.displayPreference(mPreferenceScreen);
+        mController.refreshSavedAccessPoints();
+
+        verify(mPreferenceCategory).addPreference(captor.capture());
+
+        final AccessPointPreference pref = captor.getValue();
+        assertThat(pref.getTitle()).isEqualTo(config.SSID);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettingsTest.java
index a988390..97ad7d9 100644
--- a/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettingsTest.java
@@ -18,22 +18,20 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
-import android.net.wifi.WifiManager.ActionListener;
-import android.os.Handler;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.wifi.WifiConfigController;
 import com.android.settings.wifi.WifiDialog;
+import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.wifi.AccessPoint;
 
 import org.junit.Before;
@@ -47,69 +45,53 @@
 public class SavedAccessPointsWifiSettingsTest {
 
     @Mock
-    private WifiManager mockWifiManager;
+    private WifiManager mWifiManager;
     @Mock
-    private WifiDialog mockWifiDialog;
+    private WifiDialog mWifiDialog;
     @Mock
-    private WifiConfigController mockConfigController;
+    private WifiConfigController mConfigController;
     @Mock
-    private WifiConfiguration mockWifiConfiguration;
+    private WifiConfiguration mWifiConfiguration;
     @Mock
-    private AccessPoint mockAccessPoint;
+    private AccessPoint mAccessPoint;
     @Mock
-    private Handler mHandler;
+    private SavedAccessPointsPreferenceController mSavedApController;
 
-    private SavedAccessPointsWifiSettings mSettings;
+    private TestFragment mSettings;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mSettings = new SavedAccessPointsWifiSettings();
-        ReflectionHelpers.setField(mSettings, "mHandler", mHandler);
-        ReflectionHelpers.setField(mSettings, "mWifiManager", mockWifiManager);
+        mSettings = spy(new TestFragment());
 
-        when(mockWifiDialog.getController()).thenReturn(mockConfigController);
-        when(mockConfigController.getConfig()).thenReturn(mockWifiConfiguration);
+        doReturn(mSavedApController).when(mSettings)
+                .use(SavedAccessPointsPreferenceController.class);
+
+        ReflectionHelpers.setField(mSettings, "mWifiManager", mWifiManager);
+
+        when(mWifiDialog.getController()).thenReturn(mConfigController);
+        when(mConfigController.getConfig()).thenReturn(mWifiConfiguration);
     }
 
     @Test
-    public void onForget_isPasspointConfig_shouldSendMessageToHandler() {
-        final AccessPoint accessPoint = mock(AccessPoint.class);
-        when(accessPoint.isPasspointConfig()).thenReturn(true);
-        ReflectionHelpers.setField(mSettings, "mSelectedAccessPoint", accessPoint);
+    public void onForget_isPasspointConfig_shouldRefreshAPList() {
+        when(mAccessPoint.isPasspointConfig()).thenReturn(true);
+        ReflectionHelpers.setField(mSettings, "mSelectedAccessPoint", mAccessPoint);
 
         mSettings.onForget(null);
 
-        verify(mHandler).sendEmptyMessage(SavedAccessPointsWifiSettings.MSG_UPDATE_PREFERENCES);
-    }
-
-    @Test
-    public void onForget_onSuccess_shouldSendMessageToHandler() {
-        mSettings.mForgetListener.onSuccess();
-
-        verify(mHandler).sendEmptyMessage(SavedAccessPointsWifiSettings.MSG_UPDATE_PREFERENCES);
-    }
-
-    @Test
-    public void onForget_onFailure_shouldSendMessageToHandler() {
-        mSettings.mForgetListener.onFailure(0);
-
-        verify(mHandler).sendEmptyMessage(SavedAccessPointsWifiSettings.MSG_UPDATE_PREFERENCES);
-    }
-
-    @Test
-    public void onSubmit_shouldInvokeSaveApi() {
-        mSettings.onSubmit(mockWifiDialog);
-        verify(mockWifiManager).save(eq(mockWifiConfiguration), any(ActionListener.class));
+        verify(mSavedApController).postRefreshSavedAccessPoints();
     }
 
     @Test
     public void onForget_shouldInvokeForgetApi() {
-        ReflectionHelpers.setField(mSettings, "mSelectedAccessPoint", mockAccessPoint);
-        when(mockAccessPoint.getConfig()).thenReturn(mockWifiConfiguration);
-        mSettings.onForget(mockWifiDialog);
-        verify(mockWifiManager)
-                .forget(eq(mockWifiConfiguration.networkId), any(ActionListener.class));
+        ReflectionHelpers.setField(mSettings, "mSelectedAccessPoint", mAccessPoint);
+        when(mAccessPoint.getConfig()).thenReturn(mWifiConfiguration);
+
+        mSettings.onForget(mWifiDialog);
+
+        verify(mWifiManager)
+                .forget(mWifiConfiguration.networkId, mSavedApController);
     }
 
     @Test
@@ -118,4 +100,11 @@
         assertThat(mSettings.getPreferenceScreenResId())
                 .isEqualTo(R.xml.wifi_display_saved_access_points);
     }
+
+    public static class TestFragment extends SavedAccessPointsWifiSettings {
+
+        public <T extends AbstractPreferenceController> T use(Class<T> clazz) {
+            return super.use(clazz);
+        }
+    }
 }
