Merge "Added WifiSettings -> WifiSettings2 redirection behind feature flag"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cacb882..04dbdd7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2622,6 +2622,8 @@
     <string name="emergency_address_summary">Used as your location when you make an emergency call over Wi\u2011Fi</string>
     <!-- Message of private dns that provides a help link. [CHAR LIMIT=NONE] -->
     <string name="private_dns_help_message"><annotation id="url">Learn more</annotation> about Private DNS features</string>
+    <!-- Message to display when private dns is on. [CHAR LIMIT=10] -->
+    <string name="private_dns_mode_on">On</string>
 
     <!-- Message to display when setting wifi calling are not editable [CHAR LIMIT=NONE] -->
     <string name="wifi_calling_pref_managed_by_carrier">Setting managed by carrier</string>
@@ -4851,7 +4853,7 @@
     <!-- Summary for the accessibility preference screen to enable screen magnification gestures. [CHAR LIMIT=none] -->
     <string name="accessibility_screen_magnification_summary"><b>To zoom</b>, quickly tap the screen 3 times.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, quickly tap the screen 3 times and hold down your finger on the third tap.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can\'t zoom in on the keyboard and navigation bar.</string>
     <!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
-    <string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>•  Drag 2 or more fingers to scroll</li>\n<li>•  Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch &amp; hold anywhere on the screen.\n<ul><li>•  Drag to move around the screen</li>\n<li>•  Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
+    <string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch &amp; hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
     <!-- Title for the Accessibility tutorial dialog in Accessibility service with button. [CHAR LIMIT=50] -->
     <string name="accessibility_tutorial_dialog_title_button">Use accessibility button to open</string>
     <!-- Title for the Accessibility tutorial dialog in Accessibility service with gesture. [CHAR LIMIT=50] -->
@@ -11138,6 +11140,10 @@
     <string name="network_connection_connect_successful">Connection successful</string>
     <!-- Neutral button for Network connection request Dialog [CHAR LIMIT=30] -->
     <string name="network_connection_request_dialog_showall">Show all</string>
+    <!-- Message for Network connection searching progress Dialog. Searching for wifi ap. [CHAR LIMIT=40] -->
+    <string name="network_connection_searching_message">Searching for device\u2026</string>
+    <!-- Message for Network connection connecting progress Dialog. Try to connect to wifi ap.[CHAR LIMIT=40] -->
+    <string name="network_connection_connecting_message">Connecting to device\u2026</string>
 
     <!-- Summary for bluetooth devices count in Bluetooth devices slice. [CHAR LIMIT=NONE] -->
     <plurals name="show_bluetooth_devices">
diff --git a/src/com/android/settings/RegulatoryInfoDisplayActivity.java b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
index 8bc1cef..4c7515d 100644
--- a/src/com/android/settings/RegulatoryInfoDisplayActivity.java
+++ b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
@@ -119,7 +119,8 @@
         }
     }
 
-    private int getResourceId() {
+    @VisibleForTesting
+    int getResourceId() {
         // Use regulatory_info by default.
         int resId = getResources().getIdentifier(
                 REGULATORY_INFO_RESOURCE, "drawable", getPackageName());
@@ -134,6 +135,18 @@
                 resId = id;
             }
         }
+
+        // When hardware coo property exists, use regulatory_info_<sku>_<coo> resource if valid.
+        final String coo = getCoo();
+        if (!TextUtils.isEmpty(coo) && !TextUtils.isEmpty(sku)) {
+            final String regulatory_info_coo_res =
+                    REGULATORY_INFO_RESOURCE + "_" + sku.toLowerCase() + "_" + coo.toLowerCase();
+            final int id = getResources().getIdentifier(
+                    regulatory_info_coo_res, "drawable", getPackageName());
+            if (id != 0) {
+                resId = id;
+            }
+        }
         return resId;
     }
 
@@ -142,13 +155,15 @@
         finish();   // close the activity
     }
 
-    @VisibleForTesting
-    public static String getSku() {
+    private String getCoo() {
+        return SystemProperties.get("ro.boot.hardware.coo", "");
+    }
+
+    private String getSku() {
         return SystemProperties.get("ro.boot.hardware.sku", "");
     }
 
-    @VisibleForTesting
-    public static String getRegulatoryInfoImageFileName() {
+    private String getRegulatoryInfoImageFileName() {
         final String sku = getSku();
         if (TextUtils.isEmpty(sku)) {
             return DEFAULT_REGULATORY_INFO_FILEPATH;
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index b822a83..071cbcb 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -205,10 +205,14 @@
     }
 
     private String getMetricsTag() {
-        String tag = getClass().getName();
+        String tag = null;
         if (getIntent() != null && getIntent().hasExtra(EXTRA_SHOW_FRAGMENT)) {
             tag = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
         }
+        if (TextUtils.isEmpty(tag)) {
+            Log.w(LOG_TAG, "MetricsTag is invalid " + tag);
+            tag = getClass().getName();
+        }
         if (tag.startsWith("com.android.settings.")) {
             tag = tag.replace("com.android.settings.", "");
         }
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index fba5ddb..1feef01 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -138,7 +138,7 @@
         // Summary.
         if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY_RES)) {
             final int summary = arguments.getInt(AccessibilitySettings.EXTRA_SUMMARY_RES);
-            mFooterPreferenceMixin.createFooterPreference().setTitle(summary);
+            mFooterPreferenceMixin.createFooterPreference().setTitle(getText(summary));
         } else if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY)) {
             final CharSequence summary = arguments.getCharSequence(
                     AccessibilitySettings.EXTRA_SUMMARY);
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index 515008a..0dae10b 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -15,11 +15,17 @@
  */
 package com.android.settings.accounts;
 
+import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
 import static android.provider.Settings.EXTRA_AUTHORITIES;
 
+import android.app.ActivityManager;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.os.Bundle;
 import android.provider.SearchIndexableResource;
+import android.util.Log;
+
+import androidx.annotation.VisibleForTesting;
 
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
@@ -40,6 +46,14 @@
 
     private static final String TAG = "AccountDashboardFrag";
 
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        if (isLockTaskModePinned()) {
+            Log.w(TAG, "Devices lock task mode pinned.");
+            finish();
+        }
+    }
 
     @Override
     public int getMetricsCategory() {
@@ -83,6 +97,13 @@
         return controllers;
     }
 
+    @VisibleForTesting
+    boolean isLockTaskModePinned() {
+        final ActivityManager activityManager =
+                getContext().getSystemService(ActivityManager.class);
+        return activityManager.getLockTaskModeState() == LOCK_TASK_MODE_PINNED;
+    }
+
     public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
                 @Override
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 99d96dd..011cc12 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -134,7 +134,10 @@
         final AccessibilityManager accessibilityManager = getApplicationContext().getSystemService(
                 AccessibilityManager.class);
         if (accessibilityManager != null) {
-            accessibilityEnabled = accessibilityManager.isEnabled();
+            // Add additional check for touch exploration. This prevents other accessibility
+            // features such as Live Transcribe from defaulting to the accessibility setup.
+            accessibilityEnabled = accessibilityManager.isEnabled()
+                    && accessibilityManager.isTouchExplorationEnabled();
         }
         mFooterBarMixin.setPrimaryButton(footerButton);
         final Context context = getApplicationContext();
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index 74d3b6a..c56c50e 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -32,6 +32,7 @@
 import android.view.View;
 import android.widget.ImageView;
 
+import androidx.annotation.IntDef;
 import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.preference.Preference;
@@ -44,6 +45,9 @@
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 /**
  * BluetoothDevicePreference is the preference type used to display each remote
  * Bluetooth device in the Bluetooth Settings screen.
@@ -54,9 +58,19 @@
 
     private static int sDimAlpha = Integer.MIN_VALUE;
 
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef({SortType.TYPE_DEFAULT,
+            SortType.TYPE_FIFO})
+    public @interface SortType {
+        int TYPE_DEFAULT = 1;
+        int TYPE_FIFO = 2;
+    }
+
     private final CachedBluetoothDevice mCachedDevice;
     private final UserManager mUserManager;
     private final boolean mShowDevicesWithoutNames;
+    private final long mCurrentTime;
+    private final int mType;
 
     private AlertDialog mDisconnectDialog;
     private String contentDescription = null;
@@ -67,7 +81,7 @@
     Resources mResources;
 
     public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice,
-            boolean showDeviceWithoutNames) {
+            boolean showDeviceWithoutNames, @SortType int type) {
         super(context, null);
         mResources = getContext().getResources();
         mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
@@ -81,6 +95,8 @@
 
         mCachedDevice = cachedDevice;
         mCachedDevice.registerCallback(this);
+        mCurrentTime = System.currentTimeMillis();
+        mType = type;
 
         onDeviceAttributesChanged();
     }
@@ -200,8 +216,15 @@
             return super.compareTo(another);
         }
 
-        return mCachedDevice
-                .compareTo(((BluetoothDevicePreference) another).mCachedDevice);
+        switch (mType) {
+            case SortType.TYPE_DEFAULT:
+                return mCachedDevice
+                        .compareTo(((BluetoothDevicePreference) another).mCachedDevice);
+            case SortType.TYPE_FIFO:
+                return (int)(mCurrentTime - ((BluetoothDevicePreference) another).mCurrentTime);
+            default:
+                return super.compareTo(another);
+        }
     }
 
     void onClicked() {
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index 31055cc..7cf7fd5 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -226,7 +226,8 @@
         if (!mPreferenceMap.containsKey(device)) {
             BluetoothDevicePreference btPreference =
                     new BluetoothDevicePreference(mPrefContext, cachedDevice,
-                            true /* showDeviceWithoutNames */);
+                            true /* showDeviceWithoutNames */,
+                            BluetoothDevicePreference.SortType.TYPE_DEFAULT);
             btPreference.setOnGearClickListener(mDeviceProfilesListener);
             if (this instanceof Preference.OnPreferenceClickListener) {
                 btPreference.setOnPreferenceClickListener(
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index 4f27a39..8a286e4 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -191,7 +191,7 @@
 
         if (preference == null) {
             preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice,
-                    mShowDevicesWithoutNames);
+                    mShowDevicesWithoutNames, BluetoothDevicePreference.SortType.TYPE_FIFO);
             preference.setKey(key);
             //Set hideSecondTarget is true if it's bonded device.
             preference.hideSecondTarget(true);
diff --git a/src/com/android/settings/development/OWNERS b/src/com/android/settings/development/OWNERS
index 9ffcc47..ecdc4df 100644
--- a/src/com/android/settings/development/OWNERS
+++ b/src/com/android/settings/development/OWNERS
@@ -1,8 +1,9 @@
 # Default reviewers for this and subdirectories.
-asargent@google.com
-dling@google.com
-zhfan@google.com
+edgarwang@google.com
+emilychuang@google.com
+rafftsai@google.com
+tmfang@google.com
+
 
 # Emergency approvers in case the above are not available
-asapperstein@google.com
-miket@google.com
+zhfan@google.com
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
index ff9352a..fd54f19 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
@@ -21,6 +21,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.text.TextUtils;
+import android.text.format.DateFormat;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -28,9 +29,20 @@
 
 import com.android.settings.core.BasePreferenceController;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.TimeZone;
+
 public class MainlineModuleVersionPreferenceController extends BasePreferenceController {
 
     private static final String TAG = "MainlineModuleControl";
+    private static final List<String> VERSION_NAME_DATE_PATTERNS = Arrays.asList("yyyy-MM-dd",
+            "yyyy-MM");
 
     @VisibleForTesting
     static final Intent MODULE_UPDATE_INTENT =
@@ -81,6 +93,30 @@
 
     @Override
     public CharSequence getSummary() {
-        return mModuleVersion;
+        if (TextUtils.isEmpty(mModuleVersion)) {
+            return mModuleVersion;
+        }
+
+        final Optional<Date> parsedDate = parseDateFromVersionName(mModuleVersion);
+        if (!parsedDate.isPresent()) {
+            Log.w("Could not parse mainline versionName (%s) as date.", mModuleVersion);
+            return mModuleVersion;
+        }
+
+        return DateFormat.getLongDateFormat(mContext).format(parsedDate.get());
+    }
+
+    private Optional<Date> parseDateFromVersionName(String text) {
+        for (String pattern : VERSION_NAME_DATE_PATTERNS) {
+            try {
+                final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern,
+                        Locale.getDefault());
+                simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+                return Optional.of(simpleDateFormat.parse(text));
+            } catch (ParseException e) {
+                // ignore and try next pattern
+            }
+        }
+        return Optional.empty();
     }
 }
diff --git a/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java b/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java
deleted file mode 100644
index 6e8b414..0000000
--- a/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2019 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.gestures;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.os.Bundle;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-/**
- * Dialog to notify user that gesture navigation is not available because of unsupported launcher.
- */
-public class GestureNavigationNotAvailableDialog extends InstrumentedDialogFragment {
-    private static final String TAG = "GestureNavigationNotAvailableDialog";
-
-    public static void show(SystemNavigationGestureSettings parent) {
-        if (!parent.isAdded()) {
-            return;
-        }
-
-        final GestureNavigationNotAvailableDialog dialog =
-                new GestureNavigationNotAvailableDialog();
-        dialog.setTargetFragment(parent, 0);
-        dialog.show(parent.getFragmentManager(), TAG);
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.SETTINGS_GESTURE_NAV_NOT_AVAILABLE_DLG;
-    }
-
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        final Context context = getActivity();
-        final String defaultHomeAppName = SystemNavigationPreferenceController
-                .getDefaultHomeAppName(context);
-        final String message = getString(R.string.gesture_not_supported_dialog_message,
-                defaultHomeAppName);
-        return new AlertDialog.Builder(context)
-                .setMessage(message)
-                .setPositiveButton(R.string.okay, null)
-                .create();
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
index b3d090d..3def780 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -22,7 +22,6 @@
 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
 
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_GONE;
-import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_INFO;
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_SETTING;
 
 import android.accessibilityservice.AccessibilityServiceInfo;
@@ -160,17 +159,9 @@
 
         RadioButtonPreferenceWithExtraWidget p = (RadioButtonPreferenceWithExtraWidget) pref;
         if (info.getKey() == KEY_SYSTEM_NAV_GESTURAL) {
-            if (SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher(
-                    getContext())) {
-                p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING);
-                p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog
-                        .show(this, getBackSensitivity(getContext(), mOverlayManager)));
-            } else {
-                p.setEnabled(false);
-                p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_INFO);
-                p.setExtraWidgetOnClickListener((v) ->
-                        GestureNavigationNotAvailableDialog.show(this));
-            }
+            p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING);
+            p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog
+                    .show(this, getBackSensitivity(getContext(), mOverlayManager)));
         } else {
             p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
         }
@@ -219,12 +210,6 @@
     @Override
     protected boolean setDefaultKey(String key) {
         final Context c = getContext();
-        if (key == KEY_SYSTEM_NAV_GESTURAL &&
-                !SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher(c)) {
-            // This should not happen since the preference is disabled. Return to be safe.
-            return false;
-        }
-
         setCurrentSystemNavigationMode(c, mOverlayManager, key);
         setIllustrationVideo(mVideoPreference, key);
         if (TextUtils.equals(KEY_SYSTEM_NAV_GESTURAL, key) && (
diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
index a151dc1..d0d8155 100644
--- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
@@ -22,14 +22,11 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 
-import java.util.ArrayList;
-
 public class SystemNavigationPreferenceController extends BasePreferenceController {
 
     static final String PREF_KEY_SYSTEM_NAVIGATION = "gesture_system_navigation";
@@ -101,31 +98,4 @@
         return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger(
                 com.android.internal.R.integer.config_navBarInteractionMode);
     }
-
-    static boolean isGestureNavSupportedByDefaultLauncher(Context context) {
-        final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>());
-        if (cn == null) {
-            // There is no default home app set for the current user, don't make any changes yet.
-            return true;
-        }
-        ComponentName recentsComponentName = ComponentName.unflattenFromString(context.getString(
-                com.android.internal.R.string.config_recentsComponentName));
-        return recentsComponentName.getPackageName().equals(cn.getPackageName());
-    }
-
-    static String getDefaultHomeAppName(Context context) {
-        final PackageManager pm = context.getPackageManager();
-        final ComponentName cn = pm.getHomeActivities(new ArrayList<>());
-        if (cn != null) {
-            try {
-                ApplicationInfo ai = pm.getApplicationInfo(cn.getPackageName(), 0);
-                if (ai != null) {
-                    return pm.getApplicationLabel(ai).toString();
-                }
-            } catch (final PackageManager.NameNotFoundException e) {
-                // Do nothing
-            }
-        }
-        return "";
-    }
 }
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
index 47c3a95..84cae88 100644
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -126,11 +126,7 @@
             case PRIVATE_DNS_MODE_OFF:
                 return res.getString(R.string.private_dns_mode_off);
             case PRIVATE_DNS_MODE_OPPORTUNISTIC:
-                // TODO (b/79122154) : create a string specifically for this, instead of
-                // hijacking a string from notifications. This is necessary at this time
-                // because string freeze is in the past and this string has the right
-                // content at this moment.
-                return dnsesResolved ? res.getString(R.string.switch_on_text)
+                return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
                         : res.getString(R.string.private_dns_mode_opportunistic);
             case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
                 return dnsesResolved
diff --git a/src/com/android/settings/network/telephony/MobileNetworkActivity.java b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
index e20032f..8e8f6e6 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkActivity.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
@@ -22,6 +22,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
@@ -86,6 +87,10 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        final UserManager userManager = this.getSystemService(UserManager.class);
+        if (!userManager.isAdminUser()) {
+            this.finish();
+        }
 
         if (FeatureFlagPersistent.isEnabled(this, FeatureFlags.NETWORK_INTERNET_V2)) {
             setContentView(R.layout.mobile_network_settings_container_v2);
diff --git a/src/com/android/settings/notification/ZenModeBackend.java b/src/com/android/settings/notification/ZenModeBackend.java
index 4c9cebe..fe9df18 100644
--- a/src/com/android/settings/notification/ZenModeBackend.java
+++ b/src/com/android/settings/notification/ZenModeBackend.java
@@ -468,14 +468,14 @@
         }
     }
 
-    public String getStarredContactsSummary() {
+    public String getStarredContactsSummary(Context context) {
         List<String> starredContacts = getStarredContacts();
         int numStarredContacts = starredContacts.size();
 
         List<String> displayContacts = new ArrayList<>();
 
         if (numStarredContacts == 0) {
-            displayContacts.add(mContext.getString(R.string.zen_mode_from_none));
+            displayContacts.add(context.getString(R.string.zen_mode_from_none));
         } else {
             for (int i = 0; i < 2 && i < numStarredContacts; i++) {
                 displayContacts.add(starredContacts.get(i));
@@ -484,7 +484,7 @@
             if (numStarredContacts == 3) {
                 displayContacts.add(starredContacts.get(2));
             } else if (numStarredContacts > 2) {
-                displayContacts.add(mContext.getResources().getQuantityString(
+                displayContacts.add(context.getResources().getQuantityString(
                         R.plurals.zen_mode_starred_contacts_summary_additional_contacts,
                         numStarredContacts - 2, numStarredContacts - 2));
             }
diff --git a/src/com/android/settings/notification/ZenModeStarredContactsPreferenceController.java b/src/com/android/settings/notification/ZenModeStarredContactsPreferenceController.java
index e5982eb..05b1474 100644
--- a/src/com/android/settings/notification/ZenModeStarredContactsPreferenceController.java
+++ b/src/com/android/settings/notification/ZenModeStarredContactsPreferenceController.java
@@ -84,7 +84,7 @@
 
     @Override
     public CharSequence getSummary() {
-        return mBackend.getStarredContactsSummary();
+        return mBackend.getStarredContactsSummary(mContext);
     }
 
     @Override
diff --git a/src/com/android/settings/notification/ZenRuleStarredContactsPreferenceController.java b/src/com/android/settings/notification/ZenRuleStarredContactsPreferenceController.java
index 8a227a1..4a6c1c2 100644
--- a/src/com/android/settings/notification/ZenRuleStarredContactsPreferenceController.java
+++ b/src/com/android/settings/notification/ZenRuleStarredContactsPreferenceController.java
@@ -83,7 +83,7 @@
 
     @Override
     public CharSequence getSummary() {
-        return mBackend.getStarredContactsSummary();
+        return mBackend.getStarredContactsSummary(mContext);
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogActivity.java b/src/com/android/settings/wifi/NetworkRequestDialogActivity.java
index 5d89f77..d917b03 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogActivity.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogActivity.java
@@ -16,23 +16,242 @@
 
 package com.android.settings.wifi;
 
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiManager.NetworkRequestMatchCallback;
+import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
 import android.os.Bundle;
-
+import android.os.Handler;
+import android.os.Message;
+import android.widget.Toast;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.DialogFragment;
 import androidx.fragment.app.FragmentActivity;
+import com.android.settings.R;
+import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
+import java.util.List;
 
 /**
  * When other applications request to have a wifi connection, framework will bring up this activity
- * to let user select which wifi ap wanna to connect. This activity is just a door for framework
- * call, and main functional process is at {@code NetworkRequestDialogFragment}.
+ * to let user select which wifi ap wanna to connect. This activity contains
+ * {@code NetworkRequestDialogFragment}, {@code NetworkRequestSingleSsidDialogFragment} to show UI
+ * and handles framework callback.
  */
-public class NetworkRequestDialogActivity extends FragmentActivity {
+public class NetworkRequestDialogActivity extends FragmentActivity implements
+        NetworkRequestMatchCallback {
+    private static String TAG = "NetworkRequestDialogActivity";
+
+    /** Message sent to stop scanning wifi and pop up timeout dialog. */
+    private static final int MESSAGE_STOP_SCAN_WIFI_LIST = 0;
+
+    /** Delayed time to stop scanning wifi. */
+    private static final int DELAY_TIME_STOP_SCAN_MS = 30 * 1000;
+
+    final static String EXTRA_IS_SPECIFIED_SSID =
+        "com.android.settings.wifi.extra.REQUEST_IS_FOR_SINGLE_NETWORK";
+
+    private NetworkRequestDialogBaseFragment mDialogFragment;
+    private NetworkRequestUserSelectionCallback mUserSelectionCallback;
+    private boolean mIsSpecifiedSsid;
+    private boolean mShowingErrorDialog;
+    private WifiConfiguration mMatchedConfig;
+    private ProgressDialog mProgressDialog;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        final NetworkRequestDialogFragment fragment = NetworkRequestDialogFragment.newInstance();
-        fragment.show(getSupportFragmentManager(), "NetworkRequestDialogFragment");
+        final Intent intent = getIntent();
+        if (intent != null) {
+            mIsSpecifiedSsid = intent.getBooleanExtra(EXTRA_IS_SPECIFIED_SSID, false);
+        }
+
+        if (mIsSpecifiedSsid) {
+            showProgressDialog(getString(R.string.network_connection_searching_message));
+        } else {
+            mDialogFragment = NetworkRequestDialogFragment.newInstance();
+            mDialogFragment.show(getSupportFragmentManager(), TAG);
+        }
+    }
+
+    private void showProgressDialog(String message) {
+        dismissDialogs();
+
+        mProgressDialog = new ProgressDialog(this);
+        mProgressDialog.setIndeterminate(true);
+        mProgressDialog.setCancelable(false);
+        mProgressDialog.setMessage(message);
+        mProgressDialog.show();
+    }
+
+    private void showSingleSsidRequestDialog(String ssid, boolean isTryAgain) {
+        dismissDialogs();
+
+        mDialogFragment = new NetworkRequestSingleSsidDialogFragment();
+        final Bundle bundle = new Bundle();
+        bundle.putString(NetworkRequestSingleSsidDialogFragment.EXTRA_SSID, ssid);
+        bundle.putBoolean(NetworkRequestSingleSsidDialogFragment.EXTRA_TRYAGAIN, isTryAgain);
+        mDialogFragment.setArguments(bundle);
+        mDialogFragment.show(getSupportFragmentManager(), TAG);
+    }
+
+    private void dismissDialogs() {
+        if (mDialogFragment != null) {
+            mDialogFragment.dismiss();
+            mDialogFragment = null;
+        }
+        if (mProgressDialog != null) {
+            mProgressDialog.dismiss();
+            mProgressDialog = null;
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        final WifiManager wifiManager = getSystemService(WifiManager.class);
+        if (wifiManager != null) {
+            wifiManager.registerNetworkRequestMatchCallback(this, mHandler);
+        }
+        // Sets time-out to stop scanning.
+        mHandler.sendEmptyMessageDelayed(MESSAGE_STOP_SCAN_WIFI_LIST, DELAY_TIME_STOP_SCAN_MS);
+    }
+
+    @Override
+    protected void onPause() {
+        mHandler.removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
+        final WifiManager wifiManager = getSystemService(WifiManager.class);
+        if (wifiManager != null) {
+            wifiManager.unregisterNetworkRequestMatchCallback(this);
+        }
+
+        super.onPause();
+    }
+
+    private final Handler mHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MESSAGE_STOP_SCAN_WIFI_LIST:
+                    removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
+                    stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE.TIME_OUT);
+                    break;
+                default:
+                    // Do nothing.
+                    break;
+            }
+        }
+    };
+
+    protected void stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE type) {
+        dismissDialogs();
+
+        // Throws error dialog.
+        final DialogFragment dialogFragment = NetworkRequestErrorDialogFragment.newInstance();
+        final Bundle bundle = new Bundle();
+        bundle.putSerializable(NetworkRequestErrorDialogFragment.DIALOG_TYPE, type);
+        dialogFragment.setArguments(bundle);
+        dialogFragment.show(getSupportFragmentManager(), TAG);
+        mShowingErrorDialog = true;
+    }
+
+    @Override
+    public void onUserSelectionCallbackRegistration(
+        NetworkRequestUserSelectionCallback userSelectionCallback) {
+        if (mIsSpecifiedSsid) {
+            mUserSelectionCallback = userSelectionCallback;
+            return;
+        }
+
+        mDialogFragment.onUserSelectionCallbackRegistration(userSelectionCallback);
+    }
+
+    @Override
+    public void onAbort() {
+        stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE.ABORT);
+    }
+
+    @Override
+    public void onMatch(List<ScanResult> scanResults) {
+        if (mShowingErrorDialog) {
+            // Don't do anything since error dialog shows.
+            return;
+        }
+
+        mHandler.removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
+
+        if (mIsSpecifiedSsid) {
+            // Prevent from throwing same dialog, because onMatch() will be called many times.
+            if (mMatchedConfig == null) {
+                mMatchedConfig = WifiUtils.getWifiConfig(
+                    null /* accesspoint */, scanResults.get(0), null /* password */);
+                showSingleSsidRequestDialog(
+                    WifiInfo.removeDoubleQuotes(mMatchedConfig.SSID), false /* isTryAgain */);
+            }
+            return;
+        }
+
+        mDialogFragment.onMatch(scanResults);
+    }
+
+    @Override
+    public void onUserSelectionConnectSuccess(WifiConfiguration wificonfiguration) {
+        if (!isFinishing()) {
+            Toast.makeText(this, R.string.network_connection_connect_successful,
+                Toast.LENGTH_SHORT).show();
+            setResult(RESULT_OK);
+            finish();
+        }
+    }
+
+    @Override
+    public void onUserSelectionConnectFailure(WifiConfiguration wificonfiguration) {
+        if (mIsSpecifiedSsid) {
+            showSingleSsidRequestDialog(
+                WifiInfo.removeDoubleQuotes(mMatchedConfig.SSID), true /* isTryAgain */);
+            return;
+        }
+
+        mDialogFragment.onUserSelectionConnectFailure(wificonfiguration);
+    }
+
+    // Called when user click "Connect" button. Called by
+    // {@code NetworkRequestSingleSsidDialogFragment}.
+    public void onClickConnectButton() {
+        if (mUserSelectionCallback != null) {
+            mUserSelectionCallback.select(mMatchedConfig);
+            showProgressDialog(getString(R.string.network_connection_connecting_message));
+        }
+    }
+
+    // Called when user click retry button. Called by {@link NetworkRequestErrorDialogFragment}.
+    public void onClickRescanButton() {
+        // Sets time-out to stop scanning.
+        mHandler.sendEmptyMessageDelayed(MESSAGE_STOP_SCAN_WIFI_LIST, DELAY_TIME_STOP_SCAN_MS);
+
+        mShowingErrorDialog = false;
+
+        if (mIsSpecifiedSsid) {
+            mMatchedConfig = null;
+            showProgressDialog(getString(R.string.network_connection_searching_message));
+        } else {
+            mDialogFragment = NetworkRequestDialogFragment.newInstance();
+            mDialogFragment.show(getSupportFragmentManager(), TAG);
+        }
+    }
+
+    // Called when user click cancel button.
+    public void onCancel() {
+        dismissDialogs();
+
+        if (mUserSelectionCallback != null) {
+            mUserSelectionCallback.reject();
+        }
+        finish();
     }
 }
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogBaseFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogBaseFragment.java
new file mode 100644
index 0000000..eda3204
--- /dev/null
+++ b/src/com/android/settings/wifi/NetworkRequestDialogBaseFragment.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2019 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;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
+import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import java.util.List;
+
+/**
+ * This is base fragment of {@link NetworkRequestDialogFragment} and
+ * {@link NetworkRequestSingleSsidDialogFragment} to handle activity callback methods.
+ */
+abstract public class NetworkRequestDialogBaseFragment extends InstrumentedDialogFragment {
+
+    @VisibleForTesting
+    final static String EXTRA_APP_NAME = "com.android.settings.wifi.extra.APP_NAME";
+
+    NetworkRequestDialogActivity mActivity = null;
+
+    protected String getTitle() {
+        final Intent intent = getActivity().getIntent();
+        String appName = "";
+        if (intent != null) {
+            appName = intent.getStringExtra(EXTRA_APP_NAME);
+        }
+
+        return getString(R.string.network_connection_request_dialog_title, appName);
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.WIFI_SCANNING_NEEDED_DIALOG;
+    }
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        if (context instanceof NetworkRequestDialogActivity) {
+            mActivity = (NetworkRequestDialogActivity) context;
+        }
+    }
+
+    @Override
+    public void onDetach() {
+        super.onDetach();
+        mActivity = null;
+    }
+
+    @Override
+    public void onCancel(@NonNull DialogInterface dialog) {
+        super.onCancel(dialog);
+
+        if (mActivity != null) {
+            mActivity.onCancel();
+        }
+    }
+
+    protected void onUserSelectionCallbackRegistration(
+            NetworkRequestUserSelectionCallback userSelectionCallback) {
+    }
+
+    protected void onMatch(List<ScanResult> scanResults) {
+    }
+
+    protected void onUserSelectionConnectFailure(WifiConfiguration wificonfiguration) {
+    }
+}
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
index eb7d78f..a88b004 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
@@ -16,21 +16,15 @@
 
 package com.android.settings.wifi;
 
-import android.app.Activity;
 import android.app.Dialog;
-import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.NetworkRequestMatchCallback;
 import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
 import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -40,22 +34,16 @@
 import android.widget.Button;
 import android.widget.ProgressBar;
 import android.widget.TextView;
-import android.widget.Toast;
-
 import androidx.annotation.NonNull;
 import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.preference.internal.PreferenceImageView;
-
 import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
 import com.android.settingslib.Utils;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.wifi.AccessPoint;
 import com.android.settingslib.wifi.WifiTracker;
 import com.android.settingslib.wifi.WifiTrackerFactory;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -64,11 +52,8 @@
  * behaviors of the callback when requesting wifi network, except for error message. When error
  * happens, {@link NetworkRequestErrorDialogFragment} will be called to display error message.
  */
-public class NetworkRequestDialogFragment extends InstrumentedDialogFragment implements
-        DialogInterface.OnClickListener, NetworkRequestMatchCallback {
-
-    /** Message sent to us to stop scanning wifi and pop up timeout dialog. */
-    private static final int MESSAGE_STOP_SCAN_WIFI_LIST = 0;
+public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragment implements
+        DialogInterface.OnClickListener{
 
     /**
      * Spec defines there should be 5 wifi ap on the list at most or just show all if {@code
@@ -77,20 +62,10 @@
     private static final int MAX_NUMBER_LIST_ITEM = 5;
     private boolean mShowLimitedItem = true;
 
-    /** Delayed time to stop scanning wifi. */
-    private static final int DELAY_TIME_STOP_SCAN_MS = 30 * 1000;
-
-    @VisibleForTesting
-    final static String EXTRA_APP_NAME = "com.android.settings.wifi.extra.APP_NAME";
-    final static String EXTRA_IS_SPECIFIED_SSID =
-            "com.android.settings.wifi.extra.REQUEST_IS_FOR_SINGLE_NETWORK";
-
     private List<AccessPoint> mAccessPointList;
     private FilterWifiTracker mFilterWifiTracker;
     private AccessPointAdapter mDialogAdapter;
     private NetworkRequestUserSelectionCallback mUserSelectionCallback;
-    private boolean mIsSpecifiedSsid;
-    private boolean mWaitingConnectCallback;
 
     public static NetworkRequestDialogFragment newInstance() {
         NetworkRequestDialogFragment dialogFragment = new NetworkRequestDialogFragment();
@@ -108,11 +83,6 @@
         final TextView title = customTitle.findViewById(R.id.network_request_title_text);
         title.setText(getTitle());
 
-        final Intent intent = getActivity().getIntent();
-        if (intent != null) {
-            mIsSpecifiedSsid = intent.getBooleanExtra(EXTRA_IS_SPECIFIED_SSID, false);
-        }
-
         final ProgressBar progressBar = customTitle.findViewById(
                 R.id.network_request_title_progress);
         progressBar.setVisibility(View.VISIBLE);
@@ -128,9 +98,6 @@
                 // Do nothings, will replace the onClickListener to avoid auto closing dialog.
                 .setNeutralButton(R.string.network_connection_request_dialog_showall,
                         null /* OnClickListener */);
-        if (mIsSpecifiedSsid) {
-            builder.setPositiveButton(R.string.wifi_connect, null /* OnClickListener */);
-        }
 
         // Clicking list item is to connect wifi ap.
         final AlertDialog dialog = builder.create();
@@ -152,32 +119,10 @@
                 notifyAdapterRefresh();
                 neutralBtn.setVisibility(View.GONE);
             });
-
-            // Replace Positive onClickListener to avoid closing dialog
-            if (mIsSpecifiedSsid) {
-                final Button positiveBtn = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
-                positiveBtn.setOnClickListener(v -> {
-                    // When clicking connect button, should connect to the first and the only one
-                    // list item.
-                    this.onClick(dialog, 0 /* position */);
-                });
-                // Disable button in first, and enable it after there are some accesspoints in list.
-                positiveBtn.setEnabled(false);
-            }
         });
         return dialog;
     }
 
-    private String getTitle() {
-        final Intent intent = getActivity().getIntent();
-        String appName = "";
-        if (intent != null) {
-            appName = intent.getStringExtra(EXTRA_APP_NAME);
-        }
-
-        return getString(R.string.network_connection_request_dialog_title, appName);
-    }
-
     @NonNull
     List<AccessPoint> getAccessPointList() {
         // Initials list for adapter, in case of display crashing.
@@ -211,9 +156,6 @@
 
             if (wifiConfig != null) {
                 mUserSelectionCallback.select(wifiConfig);
-
-                mWaitingConnectCallback = true;
-                updateConnectButton(false);
             }
         }
     }
@@ -221,10 +163,6 @@
     @Override
     public void onCancel(@NonNull DialogInterface dialog) {
         super.onCancel(dialog);
-        // Finishes the activity when user clicks back key or outside of the dialog.
-        if (getActivity() != null) {
-            getActivity().finish();
-        }
         if (mUserSelectionCallback != null) {
             mUserSelectionCallback.reject();
         }
@@ -234,13 +172,6 @@
     public void onPause() {
         super.onPause();
 
-        mHandler.removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
-        final WifiManager wifiManager = getContext().getApplicationContext()
-                .getSystemService(WifiManager.class);
-        if (wifiManager != null) {
-            wifiManager.unregisterNetworkRequestMatchCallback(this);
-        }
-
         if (mFilterWifiTracker != null) {
             mFilterWifiTracker.onPause();
         }
@@ -268,23 +199,6 @@
         }
     }
 
-    private void updateConnectButton(boolean enabled) {
-        // The button is only showed in single SSID mode.
-        if (!mIsSpecifiedSsid) {
-            return;
-        }
-
-        final AlertDialog alertDialog = (AlertDialog) getDialog();
-        if (alertDialog == null) {
-            return;
-        }
-
-        final Button positiveBtn = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-        if (positiveBtn != null) {
-            positiveBtn.setEnabled(enabled);
-        }
-    }
-
     private void hideProgressIcon() {
         final AlertDialog alertDialog = (AlertDialog) getDialog();
         if (alertDialog == null) {
@@ -301,57 +215,12 @@
     public void onResume() {
         super.onResume();
 
-        final WifiManager wifiManager = getContext().getApplicationContext()
-                .getSystemService(WifiManager.class);
-        if (wifiManager != null) {
-            wifiManager.registerNetworkRequestMatchCallback(this, mHandler);
-        }
-        // Sets time-out to stop scanning.
-        mHandler.sendEmptyMessageDelayed(MESSAGE_STOP_SCAN_WIFI_LIST, DELAY_TIME_STOP_SCAN_MS);
-
         if (mFilterWifiTracker == null) {
             mFilterWifiTracker = new FilterWifiTracker(getActivity(), getSettingsLifecycle());
         }
         mFilterWifiTracker.onResume();
     }
 
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MESSAGE_STOP_SCAN_WIFI_LIST:
-                    removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
-                    stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE.TIME_OUT);
-                    break;
-                default:
-                    // Do nothing.
-                    break;
-            }
-        }
-    };
-
-    protected void stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE type) {
-        // Dismisses current dialog.
-        final Dialog dialog =  getDialog();
-        if (dialog != null && dialog.isShowing()) {
-            dismiss();
-        }
-
-        // Throws error dialog.
-        final NetworkRequestErrorDialogFragment fragment = NetworkRequestErrorDialogFragment
-                .newInstance();
-        final Bundle bundle = new Bundle();
-        bundle.putSerializable(NetworkRequestErrorDialogFragment.DIALOG_TYPE, type);
-        fragment.setArguments(bundle);
-        fragment.show(getActivity().getSupportFragmentManager(),
-                NetworkRequestDialogFragment.class.getSimpleName());
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.WIFI_SCANNING_NEEDED_DIALOG;
-    }
-
     private class AccessPointAdapter extends ArrayAdapter<AccessPoint> {
 
         private final int mResourceId;
@@ -408,11 +277,6 @@
     }
 
     @Override
-    public void onAbort() {
-        stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE.ABORT);
-    }
-
-    @Override
     public void onUserSelectionCallbackRegistration(
             NetworkRequestUserSelectionCallback userSelectionCallback) {
         mUserSelectionCallback = userSelectionCallback;
@@ -422,7 +286,6 @@
     public void onMatch(List<ScanResult> scanResults) {
         // Shouldn't need to renew cached list, since input result is empty.
         if (scanResults != null && scanResults.size() > 0) {
-            mHandler.removeMessages(MESSAGE_STOP_SCAN_WIFI_LIST);
             renewAccessPointList(scanResults);
 
             notifyAdapterRefresh();
@@ -456,20 +319,8 @@
     }
 
     @Override
-    public void onUserSelectionConnectSuccess(WifiConfiguration wificonfiguration) {
-        final Activity activity = getActivity();
-        if (activity != null) {
-            Toast.makeText(activity, R.string.network_connection_connect_successful,
-                    Toast.LENGTH_SHORT).show();
-            activity.finish();
-        }
-    }
-
-    @Override
     public void onUserSelectionConnectFailure(WifiConfiguration wificonfiguration) {
         // Do nothing when selection is failed, let user could try again easily.
-        mWaitingConnectCallback = false;
-        updateConnectButton(true);
     }
 
     private final class FilterWifiTracker {
@@ -526,13 +377,6 @@
             if (count > 0) {
                 hideProgressIcon();
             }
-            // Enable connect button if there is Accesspoint item, except for the situation that
-            // user click but connected status doesn't come back yet.
-            if (count < 0) {
-                updateConnectButton(false);
-            } else if (!mWaitingConnectCallback) {
-                updateConnectButton(true);
-            }
 
             return result;
         }
diff --git a/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java
index 261d313..731456a 100644
--- a/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java
@@ -20,10 +20,8 @@
 import android.app.settings.SettingsEnums;
 import android.content.DialogInterface;
 import android.os.Bundle;
-
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
-
 import com.android.settings.R;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
 
@@ -64,7 +62,7 @@
         if (msgType == ERROR_DIALOG_TYPE.TIME_OUT) {
             builder.setMessage(R.string.network_connection_timeout_dialog_message)
                     .setPositiveButton(R.string.network_connection_timeout_dialog_ok,
-                            (dialog, which) -> startScanningDialog())
+                            (dialog, which) -> onRescanClick())
                     .setNegativeButton(R.string.cancel, (dialog, which) -> getActivity().finish());
         } else {
             builder.setMessage(R.string.network_connection_errorstate_dialog_message)
@@ -78,9 +76,10 @@
         return SettingsEnums.WIFI_SCANNING_NEEDED_DIALOG;
     }
 
-    protected void startScanningDialog() {
-        final NetworkRequestDialogFragment fragment = NetworkRequestDialogFragment.newInstance();
-        fragment.show(getActivity().getSupportFragmentManager(),
-                NetworkRequestErrorDialogFragment.class.getSimpleName());
+    protected void onRescanClick() {
+        if (getActivity() != null) {
+            dismiss();
+            ((NetworkRequestDialogActivity)getActivity()).onClickRescanButton();
+        }
     }
 }
diff --git a/src/com/android/settings/wifi/NetworkRequestSingleSsidDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestSingleSsidDialogFragment.java
new file mode 100644
index 0000000..7a0ccbe
--- /dev/null
+++ b/src/com/android/settings/wifi/NetworkRequestSingleSsidDialogFragment.java
@@ -0,0 +1,59 @@
+package com.android.settings.wifi;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import androidx.appcompat.app.AlertDialog;
+import com.android.settings.R;
+
+/**
+ * This is similar fragment with {@link NetworkRequestDialogFragment} but only for single SSID mode.
+ */
+public class NetworkRequestSingleSsidDialogFragment extends
+        NetworkRequestDialogBaseFragment {
+    public static final String EXTRA_SSID = "DIALOG_REQUEST_SSID";
+    public static final String EXTRA_TRYAGAIN = "DIALOG_IS_TRYAGAIN";
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        boolean isTryAgain = false;
+        String requestSsid = "";
+        if (getArguments() != null) {
+            isTryAgain = getArguments().getBoolean(EXTRA_TRYAGAIN, true);
+            requestSsid = getArguments().getString(EXTRA_SSID, "");
+        }
+
+        final Context context = getContext();
+        final LayoutInflater inflater = LayoutInflater.from(context);
+
+        final View customTitle = inflater.inflate(R.layout.network_request_dialog_title, null);
+        final TextView title = customTitle.findViewById(R.id.network_request_title_text);
+        title.setText(getTitle());
+        final ProgressBar progressBar = customTitle
+                .findViewById(R.id.network_request_title_progress);
+        progressBar.setVisibility(View.GONE);
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(context)
+                .setCustomTitle(customTitle)
+                .setMessage(requestSsid)
+                .setPositiveButton(isTryAgain ? R.string.network_connection_timeout_dialog_ok
+                        : R.string.wifi_connect, (dialog, which) -> onUserClickConnectButton())
+                .setNeutralButton(R.string.cancel, (dialog, which) -> onCancel(dialog));
+
+        // Don't dismiss dialog when touching outside. User reports it is easy to touch outside.
+        // This causes dialog to close.
+        setCancelable(false);
+
+        return builder.create();
+    }
+
+    private void onUserClickConnectButton() {
+        if (mActivity != null) {
+            mActivity.onClickConnectButton();
+        }
+    }
+}
diff --git a/src/com/android/settings/wifi/OWNERS b/src/com/android/settings/wifi/OWNERS
index 3090f13..ab0af7c 100644
--- a/src/com/android/settings/wifi/OWNERS
+++ b/src/com/android/settings/wifi/OWNERS
@@ -1,9 +1,4 @@
 # Default reviewers for this and subdirectories.
-asargent@google.com
-easchwar@google.com
-dling@google.com
-jlapenna@google.com
-sghuman@google.com
-zhfan@google.com
-
-# Emergency approvers in case the above are not available
\ No newline at end of file
+govenliu@google.com
+arcwang@google.com
+tmfang@google.com
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index dc84201..bb60f47 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -678,6 +678,12 @@
                 config.enterpriseConfig = new WifiEnterpriseConfig();
                 int eapMethod = mEapMethodSpinner.getSelectedItemPosition();
                 int phase2Method = mPhase2Spinner.getSelectedItemPosition();
+                if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B) {
+                    if (eapMethod != WIFI_EAP_METHOD_TLS) {
+                        Log.e(TAG, "WPA3-Enterprise 192-bit EAP method must be EAP-TLS");
+                        return null;
+                    }
+                }
                 config.enterpriseConfig.setEapMethod(eapMethod);
                 switch (eapMethod) {
                     case Eap.PEAP:
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 4e6337a..f7e8936 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -19,7 +19,6 @@
 import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.pm.ActivityInfo;
 import android.net.wifi.EasyConnectStatusCallback;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
@@ -28,7 +27,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
 import android.widget.Button;
 import android.widget.ImageView;
 
@@ -36,8 +34,6 @@
 
 import com.android.settings.R;
 
-import java.util.concurrent.Executor;
-
 /**
  * After getting Wi-Fi network information and(or) QR code, this fragment config a device to connect
  * to the Wi-Fi network.
@@ -51,7 +47,7 @@
     private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
 
     // Key for Bundle usage
-    private static final String KEY_LATEST_ERROR_CODE = "key_latest_error_code";
+    private static final String KEY_LATEST_STATUS_CODE = "key_latest_status_code";
 
     private class EasyConnectConfiguratorStatusCallback extends EasyConnectStatusCallback {
         @Override
@@ -80,7 +76,7 @@
     private void showSuccessUi(boolean isConfigurationChange) {
         setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green_32dp);
         setHeaderTitle(R.string.wifi_dpp_wifi_shared_with_device);
-        setProgressBarShown(isGoingInitiator());
+        setProgressBarShown(isEasyConnectHandshaking());
         mSummary.setVisibility(View.INVISIBLE);
         mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
         mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
@@ -170,12 +166,12 @@
             mLeftButton.setVisibility(View.INVISIBLE);
         }
 
-        if (isGoingInitiator()) {
+        if (isEasyConnectHandshaking()) {
             mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
         }
 
-        setProgressBarShown(isGoingInitiator());
-        mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
+        setProgressBarShown(isEasyConnectHandshaking());
+        mRightButton.setVisibility(isEasyConnectHandshaking() ? View.INVISIBLE : View.VISIBLE);
 
         if (!isConfigurationChange) {
             mLatestStatusCode = code;
@@ -205,7 +201,7 @@
         super.onCreate(savedInstanceState);
 
         if (savedInstanceState != null) {
-            mLatestStatusCode = savedInstanceState.getInt(KEY_LATEST_ERROR_CODE);
+            mLatestStatusCode = savedInstanceState.getInt(KEY_LATEST_STATUS_CODE);
         }
 
         final WifiDppInitiatorViewModel model =
@@ -214,7 +210,7 @@
         model.getStatusCode().observe(this, statusCode -> {
             // After configuration change, observe callback will be triggered,
             // do nothing for this case if a handshake does not end
-            if (model.isGoingInitiator()) {
+            if (model.isWifiDppHandshaking()) {
                 return;
             }
 
@@ -272,8 +268,9 @@
             if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
                 showSuccessUi(/* isConfigurationChange */ true);
             } else if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE) {
-                setProgressBarShown(isGoingInitiator());
-                mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
+                setProgressBarShown(isEasyConnectHandshaking());
+                mRightButton.setVisibility(isEasyConnectHandshaking() ?
+                        View.INVISIBLE : View.VISIBLE);
             } else {
                 showErrorUi(mLatestStatusCode, /* isConfigurationChange */ true);
             }
@@ -282,7 +279,7 @@
 
     @Override
     public void onSaveInstanceState(Bundle outState) {
-        outState.putInt(KEY_LATEST_ERROR_CODE, mLatestStatusCode);
+        outState.putInt(KEY_LATEST_STATUS_CODE, mLatestStatusCode);
 
         super.onSaveInstanceState(outState);
     }
@@ -310,9 +307,9 @@
 
     // Container Activity must implement this interface
     public interface OnClickChooseDifferentNetworkListener {
-        public void onClickChooseDifferentNetwork();
+        void onClickChooseDifferentNetwork();
     }
-    OnClickChooseDifferentNetworkListener mClickChooseDifferentNetworkListener;
+    private OnClickChooseDifferentNetworkListener mClickChooseDifferentNetworkListener;
 
     @Override
     public void onAttach(Context context) {
@@ -329,34 +326,21 @@
     }
 
     // Check is Easy Connect handshaking or not
-    private boolean isGoingInitiator() {
+    private boolean isEasyConnectHandshaking() {
         final WifiDppInitiatorViewModel model =
                 ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
 
-        return model.isGoingInitiator();
+        return model.isWifiDppHandshaking();
     }
 
     private void updateSummary() {
-        if (isGoingInitiator()) {
+        if (isEasyConnectHandshaking()) {
             mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
         } else {
             mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
         }
     }
 
-    /**
-     * This fragment will change UI display and text messages for events. To improve Talkback user
-     * experienience, using this method to focus on a right component and announce a changed text
-     * after an UI changing event.
-     *
-     * @param focusView The UI component which will be focused
-     * @param announceView The UI component's text will be talked
-     */
-    private void changeFocusAndAnnounceChange(View focusView, View announceView) {
-        focusView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
-        announceView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
-    }
-
     @Override
     protected boolean isFooterAvailable() {
         return true;
diff --git a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
index add80c1..a257c2a 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
@@ -22,8 +22,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.ListView;
 
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
@@ -37,8 +35,6 @@
 public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFragment {
     private static final String TAG_FRAGMENT_WIFI_NETWORK_LIST = "wifi_network_list_fragment";
 
-    private ListView mSavedWifiNetworkList;
-
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR;
@@ -48,8 +44,8 @@
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        /** Embeded WifiNetworkListFragment as child fragment within
-         * WifiDppChooseSavedWifiNetworkFragment. */
+        // Embedded WifiNetworkListFragment as child fragment within
+        // WifiDppChooseSavedWifiNetworkFragment.
         final FragmentManager fragmentManager = getChildFragmentManager();
         final WifiNetworkListFragment fragment = new WifiNetworkListFragment();
         final Bundle args = getArguments();
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index e7ea704..415ae93 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -27,7 +27,6 @@
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentTransaction;
 
 import com.android.settings.R;
@@ -59,9 +58,9 @@
 
     private static final String TAG = "WifiDppConfiguratorActivity";
 
-    public static final String ACTION_CONFIGURATOR_QR_CODE_SCANNER =
+    static final String ACTION_CONFIGURATOR_QR_CODE_SCANNER =
             "android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER";
-    public static final String ACTION_CONFIGURATOR_QR_CODE_GENERATOR =
+    static final String ACTION_CONFIGURATOR_QR_CODE_GENERATOR =
             "android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR";
 
     // Key for Bundle usage
@@ -274,7 +273,7 @@
         return mWifiNetworkConfig;
     }
 
-    public WifiQrCode getWifiDppQrCode() {
+    WifiQrCode getWifiDppQrCode() {
         return mWifiDppQrCode;
     }
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 55af79d..a5fa7c0 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -20,7 +20,6 @@
 import android.content.Intent;
 import android.util.Log;
 
-import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentTransaction;
 
 import com.android.settings.R;
@@ -35,7 +34,7 @@
         WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener {
     private static final String TAG = "WifiDppEnrolleeActivity";
 
-    public static final String ACTION_ENROLLEE_QR_CODE_SCANNER =
+    static final String ACTION_ENROLLEE_QR_CODE_SCANNER =
             "android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER";
 
     @Override
@@ -48,7 +47,7 @@
         switch (intent.getAction()) {
             case ACTION_ENROLLEE_QR_CODE_SCANNER:
                 String ssid = intent.getStringExtra(WifiDppUtils.EXTRA_WIFI_SSID);
-                showQrCodeScannerFragment(/* addToBackStack */ false, ssid);
+                showQrCodeScannerFragment(ssid);
                 break;
             default:
                 Log.e(TAG, "Launch with an invalid action");
@@ -56,7 +55,7 @@
         }
     }
 
-    private void showQrCodeScannerFragment(boolean addToBackStack, String ssid) {
+    private void showQrCodeScannerFragment(String ssid) {
         WifiDppQrCodeScannerFragment fragment =
                 (WifiDppQrCodeScannerFragment) mFragmentManager.findFragmentByTag(
                         WifiDppUtils.TAG_FRAGMENT_QR_CODE_SCANNER);
@@ -77,9 +76,6 @@
 
         fragmentTransaction.replace(R.id.fragment_container, fragment,
                 WifiDppUtils.TAG_FRAGMENT_QR_CODE_SCANNER);
-        if (addToBackStack) {
-            fragmentTransaction.addToBackStack(/* name */ null);
-        }
         fragmentTransaction.commit();
     }
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java b/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java
index 24e5ebe..f48ec7c 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java
@@ -26,13 +26,13 @@
 public class WifiDppInitiatorViewModel extends AndroidViewModel {
     private MutableLiveData<Integer> mEnrolleeSuccessNetworkId;
     private MutableLiveData<Integer> mStatusCode;
-    private boolean mIsGoingInitiator;
+    private boolean mIsWifiDppHandshaking;
 
     public WifiDppInitiatorViewModel(Application application) {
         super(application);
     }
 
-    public MutableLiveData<Integer> getEnrolleeSuccessNetworkId() {
+    MutableLiveData<Integer> getEnrolleeSuccessNetworkId() {
         if (mEnrolleeSuccessNetworkId == null) {
             mEnrolleeSuccessNetworkId = new MutableLiveData<>();
         }
@@ -40,7 +40,7 @@
         return mEnrolleeSuccessNetworkId;
     }
 
-    public MutableLiveData<Integer> getStatusCode() {
+    MutableLiveData<Integer> getStatusCode() {
         if (mStatusCode == null) {
             mStatusCode = new MutableLiveData<>();
         }
@@ -48,12 +48,12 @@
         return mStatusCode;
     }
 
-    public boolean isGoingInitiator() {
-        return mIsGoingInitiator;
+    boolean isWifiDppHandshaking() {
+        return mIsWifiDppHandshaking;
     }
 
-    public void startEasyConnectAsConfiguratorInitiator(String qrCode, int networkId) {
-        mIsGoingInitiator = true;
+    void startEasyConnectAsConfiguratorInitiator(String qrCode, int networkId) {
+        mIsWifiDppHandshaking = true;
         final WifiManager wifiManager = getApplication().getSystemService(WifiManager.class);
 
         wifiManager.startEasyConnectAsConfiguratorInitiator(qrCode, networkId,
@@ -61,8 +61,8 @@
                 new EasyConnectDelegateCallback());
     }
 
-    public void startEasyConnectAsEnrolleeInitiator(String qrCode) {
-        mIsGoingInitiator = true;
+    void startEasyConnectAsEnrolleeInitiator(String qrCode) {
+        mIsWifiDppHandshaking = true;
         final WifiManager wifiManager = getApplication().getSystemService(WifiManager.class);
 
         wifiManager.startEasyConnectAsEnrolleeInitiator(qrCode, getApplication().getMainExecutor(),
@@ -72,19 +72,19 @@
     private class EasyConnectDelegateCallback extends EasyConnectStatusCallback {
         @Override
         public void onEnrolleeSuccess(int newNetworkId) {
-            mIsGoingInitiator = false;
+            mIsWifiDppHandshaking = false;
             mEnrolleeSuccessNetworkId.setValue(newNetworkId);
         }
 
         @Override
         public void onConfiguratorSuccess(int code) {
-            mIsGoingInitiator = false;
+            mIsWifiDppHandshaking = false;
             mStatusCode.setValue(WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS);
         }
 
         @Override
         public void onFailure(int code) {
-            mIsGoingInitiator = false;
+            mIsWifiDppHandshaking = false;
             mStatusCode.setValue(code);
         }
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
index c5b2e8b..e0a1e39 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
@@ -19,8 +19,8 @@
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.View;
-import android.widget.ImageView;
 import android.widget.TextView;
 
 import androidx.annotation.DrawableRes;
@@ -42,8 +42,9 @@
  * {@code WifiDppAddDeviceFragment}
  */
 public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
+    private static final String TAG = "WifiDppQrCodeBaseFragment";
+
     private GlifLayout mGlifLayout;
-    private ImageView mHeaderIcon;
     protected TextView mSummary;
     protected FooterButton mLeftButton;
     protected FooterButton mRightButton;
@@ -53,13 +54,9 @@
         super.onViewCreated(view, savedInstanceState);
 
         mGlifLayout = (GlifLayout) view;
-
-        mHeaderIcon = view.findViewById(android.R.id.icon);
         mSummary = view.findViewById(android.R.id.summary);
 
         if (isFooterAvailable()) {
-            FooterBarMixin FooterBarMixin = ((GlifLayout) view).getMixin(FooterBarMixin.class);
-
             mLeftButton = new FooterButton.Builder(getContext())
                     .setButtonType(FooterButton.ButtonType.CANCEL)
                     .setTheme(R.style.SudGlifButton_Secondary)
@@ -87,6 +84,7 @@
         try {
             buttonIcon = getContext().getDrawable(iconResId);
         } catch (Resources.NotFoundException exception) {
+            Log.e(TAG, "Resource does not exist: " + iconResId);
         }
         return buttonIcon;
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index 2105408..603ea10 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.settings.SettingsEnums;
-import android.content.Context;
 import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.text.TextUtils;
@@ -44,7 +43,6 @@
     private static final String TAG = "WifiDppQrCodeGeneratorFragment";
 
     private ImageView mQrCodeView;
-    private TextView mPasswordView;
     private String mQrCode;
 
     @Override
@@ -56,7 +54,7 @@
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        // setTitle for Talkback
+        // setTitle for TalkBack
         final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
         if (wifiNetworkConfig.isHotspot()) {
             getActivity().setTitle(R.string.wifi_dpp_share_hotspot);
@@ -96,21 +94,21 @@
         }
 
         final String password = wifiNetworkConfig.getPreSharedKey();
-        mPasswordView = view.findViewById(R.id.password);
+        TextView passwordView = view.findViewById(R.id.password);
         if (TextUtils.isEmpty(password)) {
             mSummary.setText(getString(
                     R.string.wifi_dpp_scan_open_network_qr_code_with_another_device,
                     wifiNetworkConfig.getSsid()));
 
-            mPasswordView.setVisibility(View.GONE);
+            passwordView.setVisibility(View.GONE);
         } else {
             mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
                     wifiNetworkConfig.getSsid()));
 
             if (wifiNetworkConfig.isHotspot()) {
-               mPasswordView.setText(getString(R.string.wifi_dpp_hotspot_password, password));
+                passwordView.setText(getString(R.string.wifi_dpp_hotspot_password, password));
             } else {
-                mPasswordView.setText(getString(R.string.wifi_dpp_wifi_password, password));
+                passwordView.setText(getString(R.string.wifi_dpp_wifi_password, password));
             }
         }
 
@@ -125,11 +123,11 @@
             final Bitmap bmp = QrCodeGenerator.encodeQrCode(mQrCode, qrcodeSize);
             mQrCodeView.setImageBitmap(bmp);
         } catch (WriterException e) {
-            Log.e(TAG, "Error generatting QR code bitmap " + e);
+            Log.e(TAG, "Error generating QR code bitmap " + e);
         }
     }
 
-    WifiNetworkConfig getWifiNetworkConfigFromHostActivity() {
+    private WifiNetworkConfig getWifiNetworkConfigFromHostActivity() {
         final WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
                 .getWifiNetworkConfig();
         if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index b444dca..ce02c64 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -19,7 +19,6 @@
 import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.pm.ActivityInfo;
 import android.content.Intent;
 import android.graphics.Matrix;
 import android.graphics.Rect;
@@ -57,7 +56,6 @@
 import com.android.settingslib.wifi.WifiTracker;
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
-import java.util.ArrayList;
 import java.util.List;
 
 public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment implements
@@ -201,7 +199,6 @@
                     break;
 
                 default:
-                    return;
             }
         }
     };
@@ -246,7 +243,7 @@
         model.getEnrolleeSuccessNetworkId().observe(this, networkId -> {
             // After configuration change, observe callback will be triggered,
             // do nothing for this case if a handshake does not end
-            if (model.isGoingInitiator()) {
+            if (model.isWifiDppHandshaking()) {
                 return;
             }
 
@@ -256,7 +253,7 @@
         model.getStatusCode().observe(this, statusCode -> {
             // After configuration change, observe callback will be triggered,
             // do nothing for this case if a handshake does not end
-            if (model.isGoingInitiator()) {
+            if (model.isWifiDppHandshaking()) {
                 return;
             }
 
@@ -279,7 +276,7 @@
     public void onResume() {
         super.onResume();
 
-        if (!isGoingInitiator()) {
+        if (!isWifiDppHandshaking()) {
             restartCamera();
         }
     }
@@ -295,9 +292,9 @@
 
     // Container Activity must implement this interface
     public interface OnScanWifiDppSuccessListener {
-        public void onScanWifiDppSuccess(WifiQrCode wifiQrCode);
+        void onScanWifiDppSuccess(WifiQrCode wifiQrCode);
     }
-    OnScanWifiDppSuccessListener mScanWifiDppSuccessListener;
+    private OnScanWifiDppSuccessListener mScanWifiDppSuccessListener;
 
     /**
      * Configurator container activity of the fragment should create instance with this constructor.
@@ -312,7 +309,7 @@
      * Enrollee container activity of the fragment should create instance with this constructor and
      * specify the SSID string of the WI-Fi network to be provisioned.
      */
-    public WifiDppQrCodeScannerFragment(String ssid) {
+    WifiDppQrCodeScannerFragment(String ssid) {
         super();
 
         mIsConfiguratorMode = false;
@@ -326,7 +323,7 @@
         mWifiTracker = WifiTrackerFactory.create(getActivity(), /* wifiListener */ this,
                 getSettingsLifecycle(), /* includeSaved */ false, /* includeScans */ true);
 
-        // setTitle for Talkback
+        // setTitle for TalkBack
         if (mIsConfiguratorMode) {
             getActivity().setTitle(R.string.wifi_dpp_add_device_to_network);
         } else {
@@ -359,12 +356,12 @@
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
-        mTextureView = (TextureView) view.findViewById(R.id.preview_view);
+        mTextureView = view.findViewById(R.id.preview_view);
         mTextureView.setSurfaceTextureListener(this);
 
-        mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
+        mDecorateView = view.findViewById(R.id.decorate_view);
 
-        setProgressBarShown(isGoingInitiator());
+        setProgressBarShown(isWifiDppHandshaking());
 
         if (mIsConfiguratorMode) {
             setHeaderTitle(R.string.wifi_dpp_add_device_to_network);
@@ -490,7 +487,7 @@
         if (mCamera == null) {
             mCamera = new QrCamera(getContext(), this);
 
-            if (isGoingInitiator()) {
+            if (isWifiDppHandshaking()) {
                 if (mDecorateView != null) {
                     mDecorateView.setFocused(true);
                 }
@@ -561,7 +558,7 @@
         public void onFailure(int code) {
             Log.d(TAG, "EasyConnectEnrolleeStatusCallback.onFailure " + code);
 
-            int errorMessageResId = 0;
+            int errorMessageResId;
             switch (code) {
                 case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI:
                     errorMessageResId = R.string.wifi_dpp_qr_code_is_not_valid_format;
@@ -648,11 +645,11 @@
     }
 
     // Check is Easy Connect handshaking or not
-    private boolean isGoingInitiator() {
+    private boolean isWifiDppHandshaking() {
         final WifiDppInitiatorViewModel model =
                 ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
 
-        return model.isGoingInitiator();
+        return model.isWifiDppHandshaking();
     }
 
     /**
@@ -677,7 +674,7 @@
     }
 
     private void updateEnrolleeSummary() {
-        if (isGoingInitiator()) {
+        if (isWifiDppHandshaking()) {
             mSummary.setText(R.string.wifi_dpp_connecting);
         } else {
             String description;
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 7e15064..95e5098 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -29,7 +29,6 @@
 import android.os.VibrationEffect;
 import android.os.Vibrator;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 
 import com.android.settings.R;
 
@@ -48,62 +47,62 @@
     /**
      * The fragment tag specified to FragmentManager for container activities to manage fragments.
      */
-    public static final String TAG_FRAGMENT_QR_CODE_SCANNER = "qr_code_scanner_fragment";
+    static final String TAG_FRAGMENT_QR_CODE_SCANNER = "qr_code_scanner_fragment";
 
     /**
      * @see #TAG_FRAGMENT_QR_CODE_SCANNER
      */
-    public static final String TAG_FRAGMENT_QR_CODE_GENERATOR = "qr_code_generator_fragment";
+    static final String TAG_FRAGMENT_QR_CODE_GENERATOR = "qr_code_generator_fragment";
 
     /**
      * @see #TAG_FRAGMENT_QR_CODE_SCANNER
      */
-    public static final String TAG_FRAGMENT_CHOOSE_SAVED_WIFI_NETWORK =
+    static final String TAG_FRAGMENT_CHOOSE_SAVED_WIFI_NETWORK =
             "choose_saved_wifi_network_fragment";
 
     /**
      * @see #TAG_FRAGMENT_QR_CODE_SCANNER
      */
-    public static final String TAG_FRAGMENT_ADD_DEVICE = "add_device_fragment";
+    static final String TAG_FRAGMENT_ADD_DEVICE = "add_device_fragment";
 
     /** The data is from {@code com.android.settingslib.wifi.AccessPoint.securityToString} */
-    public static final String EXTRA_WIFI_SECURITY = "security";
+    static final String EXTRA_WIFI_SECURITY = "security";
 
     /** The data corresponding to {@code WifiConfiguration} SSID */
-    public static final String EXTRA_WIFI_SSID = "ssid";
+    static final String EXTRA_WIFI_SSID = "ssid";
 
     /** The data corresponding to {@code WifiConfiguration} preSharedKey */
-    public static final String EXTRA_WIFI_PRE_SHARED_KEY = "preSharedKey";
+    static final String EXTRA_WIFI_PRE_SHARED_KEY = "preSharedKey";
 
     /** The data corresponding to {@code WifiConfiguration} hiddenSSID */
-    public static final String EXTRA_WIFI_HIDDEN_SSID = "hiddenSsid";
+    static final String EXTRA_WIFI_HIDDEN_SSID = "hiddenSsid";
 
     /** The data corresponding to {@code WifiConfiguration} networkId */
-    public static final String EXTRA_WIFI_NETWORK_ID = "networkId";
+    static final String EXTRA_WIFI_NETWORK_ID = "networkId";
 
     /** The data to recognize if it's a Wi-Fi hotspot for configuration */
-    public static final String EXTRA_IS_HOTSPOT = "isHotspot";
+    static final String EXTRA_IS_HOTSPOT = "isHotspot";
 
     /** Used by {@link android.provider.Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_URI} to
      * indicate test mode UI should be shown. Test UI does not make API calls. Value is a boolean.*/
-    public static final String EXTRA_TEST = "test";
+    static final String EXTRA_TEST = "test";
 
     /**
      * Default status code for Easy Connect
      */
-    public static final int EASY_CONNECT_EVENT_FAILURE_NONE = 0;
+    static final int EASY_CONNECT_EVENT_FAILURE_NONE = 0;
 
     /**
      * Success status code for Easy Connect.
      */
-    public static final int EASY_CONNECT_EVENT_SUCCESS = 1;
+    static final int EASY_CONNECT_EVENT_SUCCESS = 1;
 
     private static final Duration VIBRATE_DURATION_QR_CODE_RECOGNITION = Duration.ofMillis(3);
 
     /**
      * Returns whether the device support WiFi DPP.
      */
-    public static boolean isWifiDppEnabled(Context context) {
+    static boolean isWifiDppEnabled(Context context) {
         final WifiManager manager = context.getSystemService(WifiManager.class);
         return manager.isEasyConnectSupported();
     }
@@ -130,10 +129,10 @@
 
     private static String getPresharedKey(WifiManager wifiManager,
             WifiConfiguration wifiConfiguration) {
-        final List<WifiConfiguration> privilegedWifiConfiguratios =
+        final List<WifiConfiguration> privilegedWifiConfigurations =
                 wifiManager.getPrivilegedConfiguredNetworks();
 
-        for (WifiConfiguration privilegedWifiConfiguration : privilegedWifiConfiguratios) {
+        for (WifiConfiguration privilegedWifiConfiguration : privilegedWifiConfigurations) {
             if (privilegedWifiConfiguration.networkId == wifiConfiguration.networkId) {
                 // WEP uses a shared key hence the AuthAlgorithm.SHARED is used
                 // to identify it.
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index 7423561..3c3aa7d 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -81,7 +81,7 @@
      * WifiNetworkConfig for configuration
      */
     public interface Retriever {
-        public WifiNetworkConfig getWifiNetworkConfig();
+        WifiNetworkConfig getWifiNetworkConfig();
     }
 
     /**
@@ -90,7 +90,7 @@
      * android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR
      * android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER
      */
-    public static WifiNetworkConfig getValidConfigOrNull(Intent intent) {
+    static WifiNetworkConfig getValidConfigOrNull(Intent intent) {
         final String security = intent.getStringExtra(WifiDppUtils.EXTRA_WIFI_SECURITY);
         final String ssid = intent.getStringExtra(WifiDppUtils.EXTRA_WIFI_SSID);
         final String preSharedKey = intent.getStringExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY);
@@ -103,7 +103,7 @@
         return getValidConfigOrNull(security, ssid, preSharedKey, hiddenSsid, networkId, isHotspot);
     }
 
-    public static WifiNetworkConfig getValidConfigOrNull(String security, String ssid,
+    static WifiNetworkConfig getValidConfigOrNull(String security, String ssid,
             String preSharedKey, boolean hiddenSsid, int networkId, boolean isHotspot) {
         if (!isValidConfig(security, ssid, preSharedKey, hiddenSsid)) {
             return null;
@@ -113,7 +113,7 @@
                 isHotspot);
     }
 
-    public static boolean isValidConfig(WifiNetworkConfig config) {
+    static boolean isValidConfig(WifiNetworkConfig config) {
         if (config == null) {
             return false;
         } else {
@@ -122,7 +122,7 @@
         }
     }
 
-    public static boolean isValidConfig(String security, String ssid, String preSharedKey,
+    static boolean isValidConfig(String security, String ssid, String preSharedKey,
             boolean hiddenSsid) {
         if (!TextUtils.isEmpty(security) && !SECURITY_NO_PASSWORD.equals(security)) {
             if (TextUtils.isEmpty(preSharedKey)) {
@@ -162,9 +162,9 @@
      * Construct a barcode string for WiFi network login.
      * See https://en.wikipedia.org/wiki/QR_code#WiFi_network_login
      */
-    public String getQrCode() {
+    String getQrCode() {
         final String empty = "";
-        String barcode = new StringBuilder("WIFI:")
+        return new StringBuilder("WIFI:")
                 .append("S:")
                 .append(escapeSpecialCharacters(mSsid))
                 .append(";")
@@ -179,7 +179,6 @@
                 .append(mHiddenSsid)
                 .append(";;")
                 .toString();
-        return barcode;
     }
 
     public String getSecurity() {
@@ -233,9 +232,6 @@
     /**
      * This is a simplified method from {@code WifiConfigController.getConfig()}
      *
-     * TODO (b/129021867): WifiConfiguration is a deprecated class, should replace it with
-     *       {@code android.net.wifi.WifiNetworkSuggestion}
-     *
      * @return When it's a open network, returns 2 WifiConfiguration in the List, the 1st is
      *         open network and the 2nd is enhanced open network. Returns 1 WifiConfiguration in the
      *         List for all other supported Wi-Fi securities.
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
index fa2dc99..e3a9db8 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
@@ -40,7 +40,6 @@
 import com.android.settingslib.wifi.WifiTracker;
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
-import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -51,7 +50,7 @@
     private static final String WIFI_CONFIG_KEY = "wifi_config_key";
     private static final String PREF_KEY_ACCESS_POINTS = "access_points";
 
-    static final int ADD_NETWORK_REQUEST = 1;
+    private static final int ADD_NETWORK_REQUEST = 1;
 
     private PreferenceCategory mAccessPointsPreferenceCategory;
     private AccessPointPreference.UserBadgeCache mUserBadgeCache;
@@ -67,10 +66,9 @@
 
     // Container Activity must implement this interface
     public interface OnChooseNetworkListener {
-        public void onChooseNetwork(WifiNetworkConfig wifiNetworkConfig);
+        void onChooseNetwork(WifiNetworkConfig wifiNetworkConfig);
     }
-
-    OnChooseNetworkListener mOnChooseNetworkListener;
+    private OnChooseNetworkListener mOnChooseNetworkListener;
 
     @Override
     public int getMetricsCategory() {
@@ -139,8 +137,7 @@
     public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
         addPreferencesFromResource(R.xml.wifi_dpp_network_list);
 
-        mAccessPointsPreferenceCategory = (PreferenceCategory) findPreference(
-                PREF_KEY_ACCESS_POINTS);
+        mAccessPointsPreferenceCategory = findPreference(PREF_KEY_ACCESS_POINTS);
 
         mFakeNetworkPreference = new Preference(getPrefContext());
         mFakeNetworkPreference.setIcon(R.drawable.ic_wifi_signal_0);
@@ -254,12 +251,8 @@
     private boolean isValidForDppConfiguration(AccessPoint accessPoint) {
         final int security = accessPoint.getSecurity();
 
-        // DPP 1.0 only support SAE and PSK.
-        if (!(security == AccessPoint.SECURITY_PSK || security == AccessPoint.SECURITY_SAE)) {
-            return false;
-        }
-
-        return true;
+        // DPP 1.0 only support PSK and SAE.
+        return security == AccessPoint.SECURITY_PSK || security == AccessPoint.SECURITY_SAE;
     }
 
     private void launchAddNetworkFragment() {
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index 40ae111..2b4c3ed 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -48,26 +48,26 @@
  *
  */
 public class WifiQrCode {
-    public static final String SCHEME_DPP = "DPP";
-    public static final String SCHEME_ZXING_WIFI_NETWORK_CONFIG = "WIFI";
-    public static final String PREFIX_DPP = "DPP:";
-    public static final String PREFIX_ZXING_WIFI_NETWORK_CONFIG = "WIFI:";
+    static final String SCHEME_DPP = "DPP";
+    static final String SCHEME_ZXING_WIFI_NETWORK_CONFIG = "WIFI";
+    static final String PREFIX_DPP = "DPP:";
+    static final String PREFIX_ZXING_WIFI_NETWORK_CONFIG = "WIFI:";
 
-    public static final String PREFIX_DPP_PUBLIC_KEY = "K:";
-    public static final String PREFIX_DPP_INFORMATION = "I:";
+    static final String PREFIX_DPP_PUBLIC_KEY = "K:";
+    static final String PREFIX_DPP_INFORMATION = "I:";
 
-    public static final String PREFIX_ZXING_SECURITY = "T:";
-    public static final String PREFIX_ZXING_SSID = "S:";
-    public static final String PREFIX_ZXING_PASSWORD = "P:";
-    public static final String PREFIX_ZXING_HIDDEN_SSID = "H:";
+    static final String PREFIX_ZXING_SECURITY = "T:";
+    static final String PREFIX_ZXING_SSID = "S:";
+    static final String PREFIX_ZXING_PASSWORD = "P:";
+    static final String PREFIX_ZXING_HIDDEN_SSID = "H:";
 
-    public static final String DELIMITER_QR_CODE = ";";
+    static final String DELIMITER_QR_CODE = ";";
 
     // Ignores password if security is SECURITY_NO_PASSWORD or absent
-    public static final String SECURITY_NO_PASSWORD = "nopass"; //open network or OWE
-    public static final String SECURITY_WEP = "WEP";
-    public static final String SECURITY_WPA_PSK = "WPA";
-    public static final String SECURITY_SAE = "SAE";
+    static final String SECURITY_NO_PASSWORD = "nopass"; //open network or OWE
+    static final String SECURITY_WEP = "WEP";
+    static final String SECURITY_WPA_PSK = "WPA";
+    static final String SECURITY_SAE = "SAE";
 
     private String mQrCode;
 
@@ -104,7 +104,7 @@
 
     /** Parses Wi-Fi DPP QR code string */
     private void parseWifiDppQrCode(String qrCode) throws IllegalArgumentException {
-        List keyValueList = getKeyValueList(qrCode, PREFIX_DPP, DELIMITER_QR_CODE);
+        List<String> keyValueList = getKeyValueList(qrCode, PREFIX_DPP, DELIMITER_QR_CODE);
 
         String publicKey = getValueOrNull(keyValueList, PREFIX_DPP_PUBLIC_KEY);
         if (TextUtils.isEmpty(publicKey)) {
@@ -117,7 +117,7 @@
 
     /** Parses ZXing reader library's Wi-Fi Network config format */
     private void parseZxingWifiQrCode(String qrCode) throws IllegalArgumentException {
-        List keyValueList = getKeyValueList(qrCode, PREFIX_ZXING_WIFI_NETWORK_CONFIG,
+        List<String> keyValueList = getKeyValueList(qrCode, PREFIX_ZXING_WIFI_NETWORK_CONFIG,
                 DELIMITER_QR_CODE);
 
         String security = getValueOrNull(keyValueList, PREFIX_ZXING_SECURITY);
@@ -155,8 +155,7 @@
         // Should not treat \delimiter as a delimiter
         String regex = "(?<!\\\\)" + Pattern.quote(delimiter);
 
-        List<String> result = Arrays.asList(keyValueString.split(regex));
-        return result;
+        return Arrays.asList(keyValueString.split(regex));
     }
 
     private String getValueOrNull(List<String> keyValueList, String prefix) {
@@ -195,7 +194,7 @@
         return sb.toString();
     }
 
-    public String getQrCode() {
+    String getQrCode() {
         return mQrCode;
     }
 
@@ -221,7 +220,7 @@
     }
 
     /** Available when {@code getScheme()} returns SCHEME_ZXING_WIFI_NETWORK_CONFIG */
-    public WifiNetworkConfig getWifiNetworkConfig() {
+    WifiNetworkConfig getWifiNetworkConfig() {
         if (mWifiNetworkConfig == null) {
             return null;
         }
@@ -229,7 +228,7 @@
         return new WifiNetworkConfig(mWifiNetworkConfig);
     }
 
-    public static WifiQrCode getValidWifiDppQrCodeOrNull(String qrCode) {
+    static WifiQrCode getValidWifiDppQrCodeOrNull(String qrCode) {
         WifiQrCode wifiQrCode;
         try {
             wifiQrCode = new WifiQrCode(qrCode);
diff --git a/src/com/android/settings/wifi/qrcode/QrCamera.java b/src/com/android/settings/wifi/qrcode/QrCamera.java
index c682587..f0afd60 100644
--- a/src/com/android/settings/wifi/qrcode/QrCamera.java
+++ b/src/com/android/settings/wifi/qrcode/QrCamera.java
@@ -68,9 +68,9 @@
      * size is 1920x1440, MAX_RATIO_DIFF 0.1 could allow picture size of 720x480 or 352x288 or
      * 176x44 but not 1920x1080.
      */
-    private static double MAX_RATIO_DIFF = 0.1;
+    private static final double MAX_RATIO_DIFF = 0.1;
 
-    private static long AUTOFOCUS_INTERVAL_MS = 1500L;
+    private static final long AUTOFOCUS_INTERVAL_MS = 1500L;
 
     private static Map<DecodeHintType, List<BarcodeFormat>> HINTS = new ArrayMap<>();
     private static List<BarcodeFormat> FORMATS = new ArrayList<>();
@@ -217,7 +217,7 @@
         final int rotateDegrees = (mCameraOrientation - degrees + 360) % 360;
         mCamera.setDisplayOrientation(rotateDegrees);
         mCamera.startPreview();
-        if (mParameters.getFocusMode() == Parameters.FOCUS_MODE_AUTO) {
+        if (Parameters.FOCUS_MODE_AUTO.equals(mParameters.getFocusMode())) {
             mCamera.autoFocus(/* Camera.AutoFocusCallback */ null);
             sendMessageDelayed(obtainMessage(MSG_AUTO_FOCUS), AUTOFOCUS_INTERVAL_MS);
         }
@@ -241,7 +241,7 @@
             final Semaphore imageGot = new Semaphore(0);
             while (true) {
                 // This loop will try to capture preview image continuously until a valid QR Code
-                // decoded. The caller can also call {@link #stop()} to inturrupts scanning loop.
+                // decoded. The caller can also call {@link #stop()} to interrupts scanning loop.
                 mCamera.setOneShotPreviewCallback(
                         (imageData, camera) -> {
                             mImage = getFrameImage(imageData);
@@ -300,7 +300,7 @@
                     return false;
                 }
                 setCameraParameter();
-                setTransformationMatrix(mScannerCallback.getViewSize());
+                setTransformationMatrix();
                 if (!startPreview()) {
                     Log.e(TAG, "Error to init Camera");
                     mCamera = null;
@@ -317,13 +317,10 @@
         }
     }
 
-    /** Set transfom matrix to crop and center the preview picture */
-    private void setTransformationMatrix(Size viewSize) {
-        // Check aspect ratio, can only handle square view.
-        final int viewRatio = (int)getRatio(viewSize.getWidth(), viewSize.getHeight());
-
+    /** Set transform matrix to crop and center the preview picture */
+    private void setTransformationMatrix() {
         final boolean isPortrait = mContext.get().getResources().getConfiguration().orientation
-                == Configuration.ORIENTATION_PORTRAIT ? true : false;
+                == Configuration.ORIENTATION_PORTRAIT;
 
         final int previewWidth = isPortrait ? mPreviewSize.getWidth() : mPreviewSize.getHeight();
         final int previewHeight = isPortrait ? mPreviewSize.getHeight() : mPreviewSize.getWidth();
@@ -357,7 +354,7 @@
         switch (msg.what) {
             case MSG_AUTO_FOCUS:
                 // Calling autoFocus(null) will only trigger the camera to focus once. In order
-                // to make the camera continuously auto focus during scanning, need to periodly
+                // to make the camera continuously auto focus during scanning, need to periodically
                 // trigger it.
                 mCamera.autoFocus(/* Camera.AutoFocusCallback */ null);
                 sendMessageDelayed(obtainMessage(MSG_AUTO_FOCUS), AUTOFOCUS_INTERVAL_MS);
diff --git a/tests/robotests/res/drawable/regulatory_info.png b/tests/robotests/res/drawable/regulatory_info.png
new file mode 100644
index 0000000..65de26c
--- /dev/null
+++ b/tests/robotests/res/drawable/regulatory_info.png
Binary files differ
diff --git a/tests/robotests/res/drawable/regulatory_info_sku.png b/tests/robotests/res/drawable/regulatory_info_sku.png
new file mode 100644
index 0000000..65de26c
--- /dev/null
+++ b/tests/robotests/res/drawable/regulatory_info_sku.png
Binary files differ
diff --git a/tests/robotests/res/drawable/regulatory_info_sku1_coo.png b/tests/robotests/res/drawable/regulatory_info_sku1_coo.png
new file mode 100644
index 0000000..65de26c
--- /dev/null
+++ b/tests/robotests/res/drawable/regulatory_info_sku1_coo.png
Binary files differ
diff --git a/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java b/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java
new file mode 100644
index 0000000..d05d5d7
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2019 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;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.os.SystemProperties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+
+
+@RunWith(RobolectricTestRunner.class)
+public class RegulatoryInfoDisplayActivityTest {
+
+    private static final String SKU_PROP_KEY = "ro.boot.hardware.sku";
+    private static final String COO_PROP_KEY = "ro.boot.hardware.coo";
+
+    private RegulatoryInfoDisplayActivity mRegulatoryInfoDisplayActivity;
+
+    @Before
+    public void setUp() {
+        mRegulatoryInfoDisplayActivity = Robolectric.buildActivity(
+                RegulatoryInfoDisplayActivity.class).create().get();
+    }
+
+    @Test
+    public void getResourceId_noSkuProperty_shouldReturnDefaultLabel() {
+        SystemProperties.set(SKU_PROP_KEY, "");
+
+        final int expectedResId = getResourceId("regulatory_info");
+        assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId);
+    }
+
+    @Test
+    public void getResourceId_noCooProperty_shouldReturnSkuLabel() {
+        SystemProperties.set(SKU_PROP_KEY, "sku");
+        SystemProperties.set(COO_PROP_KEY, "");
+
+        final int expectedResId = getResourceId("regulatory_info_sku");
+        assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId);
+    }
+
+    @Test
+    public void getResourceId_hasSkuAndCooProperties_shouldReturnCooLabel() {
+        SystemProperties.set(SKU_PROP_KEY, "sku1");
+        SystemProperties.set(COO_PROP_KEY, "coo");
+
+        final int expectedResId = getResourceId("regulatory_info_sku1_coo");
+        assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId);
+    }
+
+    @Test
+    public void getResourceId_noCorrespondingCooLabel_shouldReturnSkuLabel() {
+        SystemProperties.set(SKU_PROP_KEY, "sku");
+        SystemProperties.set(COO_PROP_KEY, "unknown");
+
+        final int expectedResId = getResourceId("regulatory_info_sku");
+        assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId);
+    }
+
+    private int getResourceId(String resourceName) {
+        return mRegulatoryInfoDisplayActivity.getResources().getIdentifier(resourceName, "drawable",
+                mRegulatoryInfoDisplayActivity.getPackageName());
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/SettingsActivityTest.java b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
index dd39f12..7906803 100644
--- a/tests/robotests/src/com/android/settings/SettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
@@ -16,6 +16,8 @@
 
 package com.android.settings;
 
+import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyInt;
@@ -34,6 +36,7 @@
 import androidx.fragment.app.FragmentTransaction;
 
 import com.android.settings.core.OnActivityResultListener;
+import com.android.settings.testutils.FakeFeatureFactory;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -83,6 +86,17 @@
     }
 
     @Test
+    public void getSharedPreferences_intentExtraIsNull_shouldNotCrash() {
+        final Intent intent = new Intent();
+        intent.putExtra(EXTRA_SHOW_FRAGMENT, (String)null);
+        doReturn(intent).when(mActivity).getIntent();
+        doReturn(mContext.getPackageName()).when(mActivity).getPackageName();
+        FakeFeatureFactory.setupForTest();
+
+        mActivity.getSharedPreferences(mContext.getPackageName() + "_preferences", 0);
+    }
+
+    @Test
     public void onActivityResult_shouldDelegateToListener() {
         final List<Fragment> fragments = new ArrayList<>();
         fragments.add(new Fragment());
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
index 0060875..c07f915 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
@@ -15,8 +15,16 @@
  */
 package com.android.settings.accounts;
 
+import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
+import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
+
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
+import android.app.ActivityManager;
+import android.content.Context;
 import android.provider.SearchIndexableResource;
 
 import com.android.settingslib.drawer.CategoryKey;
@@ -26,6 +34,8 @@
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowActivityManager;
 
 import java.util.List;
 
@@ -33,10 +43,12 @@
 public class AccountDashboardFragmentTest {
 
     private AccountDashboardFragment mFragment;
+    private Context mContext;
 
     @Before
     public void setUp() {
         mFragment = new AccountDashboardFragment();
+        mContext = RuntimeEnvironment.application;
     }
 
     @Test
@@ -53,4 +65,26 @@
         assertThat(indexRes).isNotNull();
         assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
     }
+
+    @Test
+    public void isLockTaskModePinned_disableLockTaskMode_shouldReturnFalse() {
+        final AccountDashboardFragment fragment = spy(mFragment);
+        doReturn(mContext).when(fragment).getContext();
+        final ShadowActivityManager activityManager =
+                Shadow.extract(mContext.getSystemService(ActivityManager.class));
+        activityManager.setLockTaskModeState(LOCK_TASK_MODE_NONE);
+
+        assertThat(fragment.isLockTaskModePinned()).isFalse();
+    }
+
+    @Test
+    public void isLockTaskModePinned_hasTaskPinned_shouldReturnTrue() {
+        final AccountDashboardFragment fragment = spy(mFragment);
+        doReturn(mContext).when(fragment).getContext();
+        final ShadowActivityManager activityManager =
+                Shadow.extract(mContext.getSystemService(ActivityManager.class));
+        activityManager.setLockTaskModeState(LOCK_TASK_MODE_PINNED);
+
+        assertThat(fragment.isLockTaskModePinned()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
index 29640d6..4348e1b 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
@@ -91,7 +91,8 @@
         mBluetoothDeviceUpdater = spy(new AvailableMediaBluetoothDeviceUpdater(mContext,
                 mDashboardFragment, mDevicePreferenceCallback));
         mBluetoothDeviceUpdater.setPrefContext(mContext);
-        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
+        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false,
+                BluetoothDevicePreference.SortType.TYPE_DEFAULT);
         doNothing().when(mBluetoothDeviceUpdater).addPreference(any());
         doNothing().when(mBluetoothDeviceUpdater).removePreference(any());
     }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
index 92f2354..a02ab4a 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
@@ -24,7 +24,6 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.bluetooth.BluetoothClass;
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.os.UserManager;
@@ -48,19 +47,36 @@
 import org.robolectric.annotation.Config;
 import org.robolectric.util.ReflectionHelpers;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {ShadowAlertDialogCompat.class})
 public class BluetoothDevicePreferenceTest {
     private static final boolean SHOW_DEVICES_WITHOUT_NAMES = true;
     private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+    private static final String MAC_ADDRESS_2 = "05:52:C7:0B:D8:3C";
+    private static final String MAC_ADDRESS_3 = "06:52:C7:0B:D8:3C";
+    private static final String MAC_ADDRESS_4 = "07:52:C7:0B:D8:3C";
+    private static final Comparator<BluetoothDevicePreference> COMPARATOR =
+            Comparator.naturalOrder();
 
     private Context mContext;
     @Mock
     private CachedBluetoothDevice mCachedBluetoothDevice;
+    @Mock
+    private CachedBluetoothDevice mCachedDevice1;
+    @Mock
+    private CachedBluetoothDevice mCachedDevice2;
+    @Mock
+    private CachedBluetoothDevice mCachedDevice3;
 
     private FakeFeatureFactory mFakeFeatureFactory;
     private MetricsFeatureProvider mMetricsFeatureProvider;
     private BluetoothDevicePreference mPreference;
+    private List<BluetoothDevicePreference> mPreferenceList = new ArrayList<>();
 
     @Before
     public void setUp() {
@@ -70,8 +86,11 @@
         mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
         mMetricsFeatureProvider = mFakeFeatureFactory.getMetricsFeatureProvider();
         when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
+        when(mCachedDevice1.getAddress()).thenReturn(MAC_ADDRESS_2);
+        when(mCachedDevice2.getAddress()).thenReturn(MAC_ADDRESS_3);
+        when(mCachedDevice3.getAddress()).thenReturn(MAC_ADDRESS_4);
         mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
-                SHOW_DEVICES_WITHOUT_NAMES);
+                SHOW_DEVICES_WITHOUT_NAMES, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
     }
 
     @Test
@@ -170,7 +189,8 @@
         doReturn(false).when(mCachedBluetoothDevice).hasHumanReadableName();
         BluetoothDevicePreference preference =
                 new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
-                        SHOW_DEVICES_WITHOUT_NAMES);
+                        SHOW_DEVICES_WITHOUT_NAMES,
+                        BluetoothDevicePreference.SortType.TYPE_DEFAULT);
 
         assertThat(preference.isVisible()).isTrue();
     }
@@ -179,7 +199,8 @@
     public void isVisible_hideDeviceWithoutNames_invisible() {
         doReturn(false).when(mCachedBluetoothDevice).hasHumanReadableName();
         BluetoothDevicePreference preference =
-                new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
+                new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
+                        false, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
 
         assertThat(preference.isVisible()).isFalse();
     }
@@ -190,4 +211,48 @@
 
         assertThat(mPreference.mNeedNotifyHierarchyChanged).isTrue();
     }
+
+    @Test
+    public void compareTo_sortTypeFIFO() {
+        final BluetoothDevicePreference preference3 = new BluetoothDevicePreference(mContext,
+                mCachedDevice3, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_FIFO);
+        final BluetoothDevicePreference preference2 = new BluetoothDevicePreference(mContext,
+                mCachedDevice2, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_FIFO);
+        final BluetoothDevicePreference preference1 = new BluetoothDevicePreference(mContext,
+                mCachedDevice1, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_FIFO);
+
+        mPreferenceList.add(preference1);
+        mPreferenceList.add(preference2);
+        mPreferenceList.add(preference3);
+        Collections.sort(mPreferenceList, COMPARATOR);
+
+        assertThat(mPreferenceList.get(0)).isEqualTo(preference3);
+        assertThat(mPreferenceList.get(1)).isEqualTo(preference2);
+        assertThat(mPreferenceList.get(2)).isEqualTo(preference1);
+    }
+
+    @Test
+    public void compareTo_sortTypeDefault() {
+        final BluetoothDevicePreference preference3 = new BluetoothDevicePreference(mContext,
+                mCachedDevice3, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_DEFAULT);
+        final BluetoothDevicePreference preference2 = new BluetoothDevicePreference(mContext,
+                mCachedDevice2, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_DEFAULT);
+        final BluetoothDevicePreference preference1 = new BluetoothDevicePreference(mContext,
+                mCachedDevice1, SHOW_DEVICES_WITHOUT_NAMES,
+                BluetoothDevicePreference.SortType.TYPE_DEFAULT);
+
+        mPreferenceList.add(preference1);
+        mPreferenceList.add(preference2);
+        mPreferenceList.add(preference3);
+        Collections.sort(mPreferenceList, COMPARATOR);
+
+        assertThat(mPreferenceList.get(0)).isEqualTo(preference1);
+        assertThat(mPreferenceList.get(1)).isEqualTo(preference2);
+        assertThat(mPreferenceList.get(2)).isEqualTo(preference3);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
index 1066552..66bf959 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
@@ -99,7 +99,8 @@
         when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
         when(mSubBluetoothDevice.getAddress()).thenReturn(SUB_MAC_ADDRESS);
 
-        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
+        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
+                false, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
         mBluetoothDeviceUpdater =
             new BluetoothDeviceUpdater(mDashboardFragment, mDevicePreferenceCallback,
                     mLocalManager) {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
index 615f67a..13e138c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
@@ -239,7 +239,8 @@
     @Test
     public void addPreference_addPreference_shouldHideSecondTarget() {
         BluetoothDevicePreference btPreference =
-                new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, true);
+                new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
+                        true, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
         mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, btPreference);
 
         mBluetoothDeviceUpdater.addPreference(mCachedBluetoothDevice);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
index ac7692d..4cc9b87 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
@@ -72,7 +72,8 @@
         mBluetoothDeviceUpdater = spy(new SavedBluetoothDeviceUpdater(mContext, mDashboardFragment,
                 mDevicePreferenceCallback));
         mBluetoothDeviceUpdater.setPrefContext(mContext);
-        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
+        mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
+                false, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
         doNothing().when(mBluetoothDeviceUpdater).addPreference(any());
         doNothing().when(mBluetoothDeviceUpdater).removePreference(any());
     }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
index adddc96..950d962 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
@@ -31,12 +31,9 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
-import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 
-import com.android.settings.core.FeatureFlags;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -91,7 +88,7 @@
 
     @Test
     public void getAvailabilityStatus_hasMainlineModulePackageInfo_available() throws Exception {
-        setupModulePackage();
+        setupModulePackage("test version 123");
 
         final MainlineModuleVersionPreferenceController controller =
                 new MainlineModuleVersionPreferenceController(mContext, "key");
@@ -101,7 +98,7 @@
 
     @Test
     public void updateStates_canHandleIntent_setIntentToPreference() throws Exception {
-        setupModulePackage();
+        setupModulePackage("test version 123");
         when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0))
                 .thenReturn(new ResolveInfo());
 
@@ -115,7 +112,7 @@
 
     @Test
     public void updateStates_cannotHandleIntent_setNullToPreference() throws Exception {
-        setupModulePackage();
+        setupModulePackage("test version 123");
         when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0))
                 .thenReturn(null);
 
@@ -127,9 +124,38 @@
         assertThat(mPreference.getIntent()).isNull();
     }
 
-    private void setupModulePackage() throws Exception {
+    @Test
+    public void getSummary_versionIsNull_returnNull() throws Exception {
+        setupModulePackage(null);
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getSummary()).isNull();
+    }
+
+    @Test
+    public void getSummary_versionIsMonth_returnMonth() throws Exception {
+        setupModulePackage("2019-05");
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getSummary()).isEqualTo("May 01, 2019");
+    }
+
+    @Test
+    public void getSummary_versionIsDate_returnDate() throws Exception {
+        setupModulePackage("2019-05-13");
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getSummary()).isEqualTo("May 13, 2019");
+    }
+
+    private void setupModulePackage(String version) throws Exception {
         final String provider = "test.provider";
-        final String version = "test version 123";
         final PackageInfo info = new PackageInfo();
         info.versionName = version;
         when(mContext.getString(
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java
index 79f1850..3163f9a 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java
@@ -24,7 +24,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.when;
 
 import android.content.ComponentName;
@@ -181,46 +180,4 @@
         assertThat(TextUtils.equals(mController.getSummary(), mContext.getText(
                 com.android.settings.R.string.swipe_up_to_switch_apps_title))).isTrue();
     }
-
-    @Test
-    public void testIsGestureNavSupportedByDefaultLauncher_noDefaultLauncher() {
-        when(mMockPackageManager.getHomeActivities(any())).thenReturn(null);
-        assertThat(SystemNavigationPreferenceController
-                .isGestureNavSupportedByDefaultLauncher(mMockContext)).isTrue();
-    }
-
-    @Test
-    public void testIsGestureNavSupportedByDefaultLauncher_supported() {
-        when(mMockPackageManager.getHomeActivities(any())).thenReturn(
-                ComponentName.unflattenFromString(TEST_RECENTS_COMPONENT_NAME));
-        assertThat(SystemNavigationPreferenceController
-                .isGestureNavSupportedByDefaultLauncher(mMockContext)).isTrue();
-    }
-
-    @Test
-    public void testIsGestureNavSupportedByDefaultLauncher_notSupported() {
-        when(mMockPackageManager.getHomeActivities(any())).thenReturn(
-                new ComponentName("unsupported", "launcher"));
-        assertThat(SystemNavigationPreferenceController
-                .isGestureNavSupportedByDefaultLauncher(mMockContext)).isFalse();
-    }
-
-    @Test
-    public void testGetDefaultHomeAppName_noDefaultLauncher() {
-        when(mMockPackageManager.getHomeActivities(any())).thenReturn(null);
-        assertThat(SystemNavigationPreferenceController
-                .getDefaultHomeAppName(mMockContext)).isEqualTo("");
-    }
-
-    @Test
-    public void testGetDefaultHomeAppName_defaultLauncherExists() throws Exception {
-        when(mMockPackageManager.getHomeActivities(any())).thenReturn(
-                new ComponentName("supported", "launcher"));
-        ApplicationInfo info = new ApplicationInfo();
-        when(mMockPackageManager.getApplicationInfo("supported", 0)).thenReturn(info);
-        when(mMockPackageManager.getApplicationLabel(info)).thenReturn("Test Home App");
-
-        assertThat(SystemNavigationPreferenceController
-                .getDefaultHomeAppName(mMockContext)).isEqualTo("Test Home App");
-    }
 }
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
index 15fa5de..efb77eb 100644
--- a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
@@ -213,7 +213,7 @@
         when(lp.getValidatedPrivateDnsServers()).thenReturn(NON_EMPTY_ADDRESS_LIST);
         updateLinkProperties(lp);
         mController.updateState(mPreference);
-        verify(mPreference).setSummary(getResourceString(R.string.switch_on_text));
+        verify(mPreference).setSummary(getResourceString(R.string.private_dns_mode_on));
 
         reset(mPreference);
         lp = mock(LinkProperties.class);
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
index 107da79..5cfc3e8 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
@@ -17,35 +17,109 @@
 package com.android.settings.wifi;
 
 import static com.google.common.truth.Truth.assertThat;
-
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
+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 android.net.wifi.WifiManager;
+import android.os.Bundle;
+import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
-
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
 import com.android.settingslib.wifi.WifiTracker;
 import com.android.settingslib.wifi.WifiTrackerFactory;
-
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowLooper;
 
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestDialogActivityTest {
 
-    @Test
-    public void LaunchActivity_shouldShowNetworkRequestDialog() {
-        // Mocks fake WifiTracker, in case of exception in NetworkRequestDialogFragment.onResume().
+    NetworkRequestDialogActivity mActivity;
+    WifiManager mWifiManager;
+    Context mContext;
+
+    @Before
+    public void setUp() {
+        mContext = spy(RuntimeEnvironment.application);
+
         WifiTracker wifiTracker = mock(WifiTracker.class);
         WifiTrackerFactory.setTestingWifiTracker(wifiTracker);
 
-        Robolectric.setupActivity(NetworkRequestDialogActivity.class);
+        NetworkRequestDialogActivity activity =
+            Robolectric.setupActivity(NetworkRequestDialogActivity.class);
+        mActivity = spy(activity);
 
+        mWifiManager = mock(WifiManager.class);
+        when(mActivity.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
+    }
+
+    @Test
+    public void LaunchActivity_shouldShowNetworkRequestDialog() {
         AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
 
         assertThat(alertDialog.isShowing()).isTrue();
     }
+
+    @Test
+    public void onResume_shouldRegisterCallback() {
+        mActivity.onResume();
+
+        verify(mWifiManager).registerNetworkRequestMatchCallback(any(), any());
+    }
+
+    @Test
+    public void onPause_shouldUnRegisterCallback() {
+        mActivity.onPause();
+
+        verify(mWifiManager).unregisterNetworkRequestMatchCallback(mActivity);
+    }
+
+    @Test
+    public void onResumeAndWaitTimeout_shouldCallTimeoutDialog() {
+        FakeNetworkRequestDialogActivity fakeActivity =
+            Robolectric.setupActivity(FakeNetworkRequestDialogActivity.class);
+
+        fakeActivity.onResume();
+        ShadowLooper.getShadowMainLooper().runToEndOfTasks();
+
+        assertThat(fakeActivity.bCalledStopAndPop).isTrue();
+        assertThat(fakeActivity.errorType).isEqualTo(ERROR_DIALOG_TYPE.TIME_OUT);
+    }
+
+    public static class FakeNetworkRequestDialogActivity extends NetworkRequestDialogActivity {
+        boolean bCalledStopAndPop = false;
+        ERROR_DIALOG_TYPE errorType = null;
+
+        @Override
+        protected void onCreate(@Nullable Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+        }
+
+        @Override
+        public void stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE type) {
+            bCalledStopAndPop = true;
+            errorType = type;
+        }
+    }
+
+    @Test
+    public void updateAccessPointList_onUserSelectionConnectSuccess_shouldFinishActivity() {
+        final WifiConfiguration config = new WifiConfiguration();
+        config.SSID = "Test AP 3";
+        mActivity.onUserSelectionConnectSuccess(config);
+
+        verify(mActivity).finish();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
index 4202143..4f75794 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
@@ -17,8 +17,6 @@
 package com.android.settings.wifi;
 
 import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -29,25 +27,20 @@
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.wifi.ScanResult;
-import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
-
 import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.FragmentActivity;
-
 import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
-import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
 import com.android.settingslib.wifi.AccessPoint;
-
+import com.android.settingslib.wifi.WifiTracker;
+import com.android.settingslib.wifi.WifiTrackerFactory;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -56,11 +49,6 @@
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
 
-import com.android.settingslib.wifi.WifiTracker;
-import com.android.settingslib.wifi.WifiTrackerFactory;
-
-import org.robolectric.shadows.ShadowLooper;
-
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestDialogFragmentTest {
@@ -69,14 +57,14 @@
     private static final String KEY_SECURITY = "key_security";
     private static final String TEST_APP_NAME = "TestAppName";
 
-    private FragmentActivity mActivity;
+    private NetworkRequestDialogActivity mActivity;
     private NetworkRequestDialogFragment networkRequestDialogFragment;
     private Context mContext;
     private WifiTracker mWifiTracker;
 
     @Before
     public void setUp() {
-        mActivity = Robolectric.buildActivity(FragmentActivity.class,
+        mActivity = Robolectric.buildActivity(NetworkRequestDialogActivity.class,
                 new Intent().putExtra(NetworkRequestDialogFragment.EXTRA_APP_NAME,
                         TEST_APP_NAME)).setup().get();
         networkRequestDialogFragment = spy(NetworkRequestDialogFragment.newInstance());
@@ -119,73 +107,6 @@
     }
 
     @Test
-    public void onResumeAndWaitTimeout_shouldCallTimeoutDialog() {
-        FakeNetworkRequestDialogFragment fakeFragment = new FakeNetworkRequestDialogFragment();
-        FakeNetworkRequestDialogFragment spyFakeFragment = spy(fakeFragment);
-        spyFakeFragment.show(mActivity.getSupportFragmentManager(), null);
-
-        assertThat(fakeFragment.bCalledStopAndPop).isFalse();
-
-        ShadowLooper.getShadowMainLooper().runToEndOfTasks();
-
-        assertThat(fakeFragment.bCalledStopAndPop).isTrue();
-        assertThat(fakeFragment.errorType).isEqualTo(ERROR_DIALOG_TYPE.TIME_OUT);
-    }
-
-    class FakeNetworkRequestDialogFragment extends NetworkRequestDialogFragment {
-        boolean bCalledStopAndPop = false;
-        ERROR_DIALOG_TYPE errorType = null;
-
-        @Override
-        public void stopScanningAndPopErrorDialog(ERROR_DIALOG_TYPE type) {
-            bCalledStopAndPop = true;
-            errorType = type;
-        }
-    }
-
-    @Test
-    public void onResume_shouldRegisterCallback() {
-        when(networkRequestDialogFragment.getContext()).thenReturn(mContext);
-        Context applicationContext = spy(RuntimeEnvironment.application.getApplicationContext());
-        when(mContext.getApplicationContext()).thenReturn(applicationContext);
-        WifiManager wifiManager = mock(WifiManager.class);
-        when(applicationContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager);
-
-        networkRequestDialogFragment.onResume();
-
-        verify(wifiManager).registerNetworkRequestMatchCallback(any(), any());
-    }
-
-    @Test
-    public void onPause_shouldUnRegisterCallback() {
-        when(networkRequestDialogFragment.getContext()).thenReturn(mContext);
-        Context applicationContext = spy(RuntimeEnvironment.application.getApplicationContext());
-        when(mContext.getApplicationContext()).thenReturn(applicationContext);
-        WifiManager wifiManager = mock(WifiManager.class);
-        when(applicationContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager);
-
-        networkRequestDialogFragment.onPause();
-
-        verify(wifiManager).unregisterNetworkRequestMatchCallback(networkRequestDialogFragment);
-    }
-
-    @Test
-    public void updateAccessPointList_onUserSelectionConnectSuccess_shouldFinishActivity() {
-        // Assert
-        final FragmentActivity spyActivity = spy(mActivity);
-        when(networkRequestDialogFragment.getActivity()).thenReturn(spyActivity);
-        networkRequestDialogFragment.show(spyActivity.getSupportFragmentManager(), "onUserSelectionConnectSuccess");
-
-        // Action
-        final WifiConfiguration config = new WifiConfiguration();
-        config.SSID = "Test AP 3";
-        networkRequestDialogFragment.onUserSelectionConnectSuccess(config);
-
-        // Check
-        verify(spyActivity).finish();
-    }
-
-    @Test
     public void onUserSelectionCallbackRegistration_onClick_shouldCallSelect() {
         // Assert.
         final int indexClickItem = 3;
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
index 303f6af..fb15371 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
@@ -17,7 +17,7 @@
 package com.android.settings.wifi;
 
 import static com.google.common.truth.Truth.assertThat;
-
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.internal.verification.VerificationModeFactory.times;
@@ -25,14 +25,12 @@
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.widget.Button;
-
 import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.FragmentActivity;
-
 import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
 import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
-
+import com.android.settingslib.wifi.WifiTracker;
+import com.android.settingslib.wifi.WifiTrackerFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,12 +43,15 @@
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestErrorDialogFragmentTest {
 
-    private FragmentActivity mActivity;
+    private NetworkRequestDialogActivity mActivity;
     private NetworkRequestErrorDialogFragment mFragment;
 
     @Before
     public void setUp() {
-        mActivity = Robolectric.setupActivity(FragmentActivity.class);
+        WifiTracker wifiTracker = mock(WifiTracker.class);
+        WifiTrackerFactory.setTestingWifiTracker(wifiTracker);
+
+        mActivity = Robolectric.setupActivity(NetworkRequestDialogActivity.class);
         mFragment = spy(NetworkRequestErrorDialogFragment.newInstance());
         mFragment.show(mActivity.getSupportFragmentManager(), null);
     }
@@ -97,7 +98,7 @@
         assertThat(positiveButton).isNotNull();
 
         positiveButton.performClick();
-        verify(mFragment, times(1)).startScanningDialog();
+        verify(mFragment, times(1)).onRescanClick();
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiNetworkListFragmentTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiNetworkListFragmentTest.java
index 832f153..fe21596 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiNetworkListFragmentTest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiNetworkListFragmentTest.java
@@ -107,8 +107,6 @@
         intent.setData(Uri.parse(uriString));
         mActivityRule.launchActivity(intent);
 
-        verify(mWifiTracker).getManager();
-
         List<Fragment> fragments =
                 mActivityRule.getActivity().getSupportFragmentManager().getFragments();
         assertThat(fragments.size()).isEqualTo(1);