Merge "Import statsdprotolite library to use atoms.proto"
diff --git a/res/layout/homepage_slice_tile.xml b/res/layout/homepage_slice_tile.xml
index e95129e..b2badf5 100644
--- a/res/layout/homepage_slice_tile.xml
+++ b/res/layout/homepage_slice_tile.xml
@@ -32,6 +32,7 @@
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
             android:animateLayoutChanges="true"
+            android:importantForAccessibility="no"
             style="@style/SliceViewStyle"/>
 
         <!--dismissal view-->
diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml
index 9c1dd80..6368588 100644
--- a/res/layout/master_clear.xml
+++ b/res/layout/master_clear.xml
@@ -127,12 +127,9 @@
                         android:text="@string/erase_external_storage_description"/>
                 </LinearLayout>
             </LinearLayout>
-            <include
-                layout="@layout/reset_esim_checkbox"
-                android:layout_marginTop="40dp"
-                android:id="@+id/erase_esim_container"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
+
+            <include layout="@layout/reset_esim_checkbox"/>
+
         </LinearLayout>
     </ScrollView>
 </com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout/reset_esim_checkbox.xml b/res/layout/reset_esim_checkbox.xml
index 2195435..77b90a1 100644
--- a/res/layout/reset_esim_checkbox.xml
+++ b/res/layout/reset_esim_checkbox.xml
@@ -15,7 +15,9 @@
 -->
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/erase_esim_container"
     style="@style/SudDescription"
+    android:layout_marginTop="40dp"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
@@ -41,10 +43,10 @@
         android:orientation="vertical">
 
         <TextView
-            android:id="@+id/erase_esim_title"
             style="@style/TextAppearance.SudGlifItemTitle"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"/>
+            android:layout_height="wrap_content"
+            android:text="@string/reset_esim_title"/>
 
         <TextView
             style="@style/TextAppearance.SudGlifItemSummary"
diff --git a/res/layout/reset_network.xml b/res/layout/reset_network.xml
index 7eb5d2a..2c31d1a 100644
--- a/res/layout/reset_network.xml
+++ b/res/layout/reset_network.xml
@@ -40,10 +40,7 @@
                 android:textDirection="locale"
                 android:text="@string/reset_network_desc" />
 
-            <include layout="@layout/reset_esim_checkbox"
-                android:id="@+id/erase_esim_container"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+            <include layout="@layout/reset_esim_checkbox"/>
 
         </LinearLayout>
 
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 78a0278..9332463 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -25,6 +25,7 @@
         android:id="@+id/main_content_scrollable_container"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:importantForAccessibility="no"
         app:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
         <LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aa43f12..e4d0d11 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3581,10 +3581,10 @@
     <string name="reset_network_title">Reset Wi-Fi, mobile &amp; Bluetooth</string>
     <!-- SD card & phone storage settings screen, message on screen after user selects Reset network settings [CHAR LIMIT=NONE] -->
     <string name="reset_network_desc">This will reset all network settings, including:\n\n<li>Wi\u2011Fi</li>\n<li>Mobile data</li>\n<li>Bluetooth</li>"</string>
-    <!-- SD card & phone storage settings screen, title for the checkbox to let user decide whether erase eSIM data together [CHAR LIMIT=NONE] -->
-    <string name="reset_esim_title">Also reset eSIM</string>
+    <!-- SD card & phone storage settings screen, title for the checkbox to let user decide whether erase eSIM data together [CHAR LIMIT=30] -->
+    <string name="reset_esim_title">Erase eSIMs</string>
     <!-- SD card & phone storage settings screen, message for the checkbox to let user decide whether erase eSIM data together [CHAR LIMIT=NONE] -->
-    <string name="reset_esim_desc">Erase all eSIMs on the phone. You\u2019ll have to contact your carrier to redownload your eSIMs. This will not cancel your mobile service plan.</string>
+    <string name="reset_esim_desc">You\u2019ll have to contact your carrier to download replacement eSIMs. This won\u2019t cancel any mobile service plans.</string>
     <!-- SD card & phone storage settings screen, button on screen after user selects Reset network settings -->
     <string name="reset_network_button_text">Reset settings</string>
     <!-- SD card & phone storage settings screen, message on screen after user selects Reset settings button -->
@@ -3633,12 +3633,6 @@
     <string name="erase_external_storage_description" product="nosdcard">Erase all the data on the internal USB storage, such as music or photos</string>
     <!-- SD card & phone storage settings screen, description for check box to erase USB storage [CHAR LIMIT=NONE] -->
     <string name="erase_external_storage_description" product="default">Erase all the data on the SD card, such as music or photos</string>
-    <!-- SD card & phone storage settings screen, label for check box to erase all the carriers information on the embedded SIM card [CHAR LIMIT=30] -->
-    <string name="erase_esim_storage">Erase eSIM</string>
-    <!-- SD card & phone storage settings screen, description for check box to erase eSIMs for default devices [CHAR LIMIT=NONE] -->
-    <string name="erase_esim_storage_description" product="default">Erase all eSIMs on the phone. This will not cancel your mobile service plan.</string>
-    <!-- SD card & phone storage settings screen, description for check box to erase eSIMs for tablets [CHAR LIMIT=NONE] -->
-    <string name="erase_esim_storage_description" product="tablet">Erase all eSIMs on the tablet. This will not cancel your mobile service plan.</string>
     <!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset -->
     <string name="master_clear_button_text" product="tablet">Erase all data</string>
     <!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset -->
@@ -9892,8 +9886,6 @@
 
     <!-- Preference and settings suggestion title text for display wake-up gesture [CHAR LIMIT=60]-->
     <string name="ambient_display_wake_screen_title">Wake up display</string>
-    <!-- Summary text for ambient display wake-up gesture [CHAR LIMIT=NONE]-->
-    <string name="ambient_display_wake_screen_summary"></string>
 
     <!-- Summary text for ambient display (phone) [CHAR LIMIT=NONE]-->
     <string name="ambient_display_pickup_summary" product="default">To check time, notifications, and other info, pick up your phone.</string>
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index 6833922..611d33f 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -60,12 +60,6 @@
             settings:controller="com.android.settings.display.AmbientDisplayAlwaysOnPreferenceController" />
 
         <Preference
-            android:key="ambient_display_wake_screen"
-            android:title="@string/ambient_display_wake_screen_title"
-            android:fragment="com.android.settings.gestures.WakeScreenGestureSettings"
-            settings:controller="com.android.settings.gestures.WakeScreenGesturePreferenceController" />
-
-        <Preference
             android:key="ambient_display_tap"
             android:title="@string/ambient_display_tap_screen_title"
             android:fragment="com.android.settings.gestures.TapScreenGestureSettings"
diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml
index 05f4a81..9be01f9 100644
--- a/res/xml/special_access.xml
+++ b/res/xml/special_access.xml
@@ -53,7 +53,7 @@
         android:key="zen_access"
         android:title="@string/manage_zen_access_title"
         android:fragment="com.android.settings.notification.ZenAccessSettings"
-        settings:controller="com.android.settings.applications.specialaccess.ZenAccessController" />
+        settings:controller="com.android.settings.applications.specialaccess.zenaccess.ZenAccessController" />
 
     <Preference
         android:key="write_settings_apps"
diff --git a/res/xml/wake_screen_gesture_settings.xml b/res/xml/wake_screen_gesture_settings.xml
deleted file mode 100644
index 7bcb2e9..0000000
--- a/res/xml/wake_screen_gesture_settings.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2018 The Android Open Source Project
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<PreferenceScreen
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:key="gesture_wake_screen_screen"
-    android:title="@string/ambient_display_wake_screen_title">
-
-    <com.android.settings.widget.VideoPreference
-        android:key="gesture_wake_screen_video"
-        app:animation="@raw/gesture_ambient_wake_screen"
-        app:preview="@drawable/gesture_ambient_wake_screen" />
-
-    <SwitchPreference
-        android:key="gesture_wake_screen"
-        android:title="@string/ambient_display_wake_screen_title"
-        android:summary="@string/ambient_display_wake_screen_summary"
-        app:keywords="@string/keywords_gesture"
-        app:controller="com.android.settings.gestures.WakeScreenGesturePreferenceController"
-        app:allowDividerAbove="true" />
-
-</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 58bc58c..c78115d 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -326,8 +326,6 @@
 
         if (showWipeEuicc()) {
             if (showWipeEuiccCheckbox()) {
-                TextView title = mContentView.findViewById(R.id.erase_esim_title);
-                title.setText(R.string.erase_esim_storage);
                 mEsimStorageContainer.setVisibility(View.VISIBLE);
                 mEsimStorageContainer.setOnClickListener(new View.OnClickListener() {
                     @Override
diff --git a/src/com/android/settings/ResetNetwork.java b/src/com/android/settings/ResetNetwork.java
index bd45f9b..5d7dd99 100644
--- a/src/com/android/settings/ResetNetwork.java
+++ b/src/com/android/settings/ResetNetwork.java
@@ -213,8 +213,6 @@
         mInitiateButton.setOnClickListener(mInitiateListener);
         if (showEuiccSettings(getContext())) {
             mEsimContainer.setVisibility(View.VISIBLE);
-            TextView title = mContentView.findViewById(R.id.erase_esim_title);
-            title.setText(R.string.reset_esim_title);
             mEsimContainer.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
diff --git a/src/com/android/settings/UserCredentialsSettings.java b/src/com/android/settings/UserCredentialsSettings.java
index c30e51d..d322819 100644
--- a/src/com/android/settings/UserCredentialsSettings.java
+++ b/src/com/android/settings/UserCredentialsSettings.java
@@ -154,11 +154,15 @@
                         dialog.dismiss();
                     }
                 };
-                if (item.isSystem()) {
-                    // TODO: a safe means of clearing wifi certificates. Configs refer to aliases
-                    //       directly so deleting certs will break dependent access points.
-                    builder.setNegativeButton(R.string.trusted_credentials_remove_label, listener);
-                }
+                // TODO: b/127865361
+                //       a safe means of clearing wifi certificates. Configs refer to aliases
+                //       directly so deleting certs will break dependent access points.
+                //       However, Wi-Fi used to remove this certificate from storage if the network
+                //       was removed, regardless if it is used in more than one network.
+                //       It has been decided to allow removing certificates from this menu, as we
+                //       assume that the user who manually adds certificates must have a way to
+                //       manually remove them.
+                builder.setNegativeButton(R.string.trusted_credentials_remove_label, listener);
             }
             return builder.create();
         }
@@ -172,7 +176,8 @@
          * Deletes all certificates and keys under a given alias.
          *
          * If the {@link Credential} is for a system alias, all active grants to the alias will be
-         * removed using {@link KeyChain}.
+         * removed using {@link KeyChain}. If the {@link Credential} is for Wi-Fi alias, all
+         * credentials and keys will be removed using {@link KeyStore}.
          */
         private class RemoveCredentialsTask extends AsyncTask<Credential, Void, Credential[]> {
             private Context context;
@@ -188,14 +193,32 @@
                 for (final Credential credential : credentials) {
                     if (credential.isSystem()) {
                         removeGrantsAndDelete(credential);
-                        continue;
+                    } else {
+                        deleteWifiCredential(credential);
                     }
-                    throw new UnsupportedOperationException(
-                            "Not implemented for wifi certificates. This should not be reachable.");
                 }
                 return credentials;
             }
 
+            private void deleteWifiCredential(final Credential credential) {
+                final KeyStore keyStore = KeyStore.getInstance();
+                final EnumSet<Credential.Type> storedTypes = credential.getStoredTypes();
+
+                // Remove all Wi-Fi credentials
+                if (storedTypes.contains(Credential.Type.USER_KEY)) {
+                    keyStore.delete(Credentials.USER_PRIVATE_KEY + credential.getAlias(),
+                            Process.WIFI_UID);
+                }
+                if (storedTypes.contains(Credential.Type.USER_CERTIFICATE)) {
+                    keyStore.delete(Credentials.USER_CERTIFICATE + credential.getAlias(),
+                            Process.WIFI_UID);
+                }
+                if (storedTypes.contains(Credential.Type.CA_CERTIFICATE)) {
+                    keyStore.delete(Credentials.CA_CERTIFICATE + credential.getAlias(),
+                            Process.WIFI_UID);
+                }
+            }
+
             private void removeGrantsAndDelete(final Credential credential) {
                 final KeyChainConnection conn;
                 try {
@@ -488,5 +511,11 @@
         public boolean isSystem() {
             return UserHandle.getAppId(uid) == Process.SYSTEM_UID;
         }
+
+        public String getAlias() { return alias; }
+
+        public EnumSet<Type> getStoredTypes() {
+            return storedTypes;
+        }
     }
 }
diff --git a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
index d0b26a5..0f90c69 100644
--- a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
+++ b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
@@ -15,22 +15,13 @@
  */
 package com.android.settings.applications.appinfo;
 
-import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-
-import android.app.ActivityManager;
 import android.app.AppOpsManager;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
 import android.os.Bundle;
-import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
@@ -55,16 +46,11 @@
     private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
     private static final String LOG_TAG = "DrawOverlayDetails";
 
-    private static final int[] APP_OPS_OP_CODE = {
-            AppOpsManager.OP_SYSTEM_ALERT_WINDOW
-    };
-
     // Use a bridge to get the overlay details but don't initialize it to connect with all state.
     // TODO: Break out this functionality into its own class.
     private AppStateOverlayBridge mOverlayBridge;
     private AppOpsManager mAppOpsManager;
     private SwitchPreference mSwitchPref;
-    private Intent mSettingsIntent;
     private OverlayState mOverlayState;
 
     @Override
@@ -82,18 +68,15 @@
 
         // find preferences
         addPreferencesFromResource(R.xml.draw_overlay_permissions_details);
-        mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
+        mSwitchPref = findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
 
         // install event listeners
         mSwitchPref.setOnPreferenceChangeListener(this);
-
-        mSettingsIntent = new Intent(Intent.ACTION_MAIN)
-                .setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
     }
 
     // Override here so we don't have an empty screen
     @Override
-    public View onCreateView (LayoutInflater inflater,
+    public View onCreateView(LayoutInflater inflater,
             ViewGroup container,
             Bundle savedInstanceState) {
         // if we don't have a package info, show a page saying this is unsupported
@@ -104,21 +87,6 @@
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
-        getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        Window window = getActivity().getWindow();
-        WindowManager.LayoutParams attrs = window.getAttributes();
-        attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-        window.setAttributes(attrs);
-    }
-
-    @Override
     public void onDestroy() {
         super.onDestroy();
         mOverlayBridge.release();
@@ -164,7 +132,9 @@
 
     @Override
     protected boolean refreshUi() {
-        if (mPackageInfo == null) return true;
+        if (mPackageInfo == null) {
+            return true;
+        }
 
         mOverlayState = mOverlayBridge.getOverlayInfo(mPackageName,
                 mPackageInfo.applicationInfo.uid);
@@ -174,9 +144,6 @@
         // you cannot ask a user to grant you a permission you did not have!
         mSwitchPref.setEnabled(mOverlayState.permissionDeclared && mOverlayState.controlEnabled);
 
-        ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
-                PackageManager.GET_META_DATA, mUserId);
-
         return true;
     }
 
diff --git a/src/com/android/settings/applications/specialaccess/zenaccess/OWNERS b/src/com/android/settings/applications/specialaccess/zenaccess/OWNERS
new file mode 100644
index 0000000..9b5f41e
--- /dev/null
+++ b/src/com/android/settings/applications/specialaccess/zenaccess/OWNERS
@@ -0,0 +1,2 @@
+beverlyt@google.com
+juliacr@google.com
\ No newline at end of file
diff --git a/src/com/android/settings/applications/specialaccess/ZenAccessController.java b/src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessController.java
similarity index 94%
rename from src/com/android/settings/applications/specialaccess/ZenAccessController.java
rename to src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessController.java
index 5ae2bd3..88d444d 100644
--- a/src/com/android/settings/applications/specialaccess/ZenAccessController.java
+++ b/src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessController.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.settings.applications.specialaccess;
+package com.android.settings.applications.specialaccess.zenaccess;
 
 import android.app.ActivityManager;
 import android.content.Context;
diff --git a/src/com/android/settings/core/HideNonSystemOverlayMixin.java b/src/com/android/settings/core/HideNonSystemOverlayMixin.java
new file mode 100644
index 0000000..59cef3b
--- /dev/null
+++ b/src/com/android/settings/core/HideNonSystemOverlayMixin.java
@@ -0,0 +1,64 @@
+/*
+ * 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.core;
+
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
+import static androidx.lifecycle.Lifecycle.Event.ON_START;
+import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
+
+import android.app.Activity;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.lifecycle.LifecycleObserver;
+import androidx.lifecycle.OnLifecycleEvent;
+
+
+/**
+ * A mixin that adds window flag to prevent non-system overlays showing on top of Settings
+ * activities.
+ */
+public class HideNonSystemOverlayMixin implements LifecycleObserver {
+
+    private final Activity mActivity;
+
+    public HideNonSystemOverlayMixin(Activity activity) {
+        mActivity = activity;
+    }
+
+    @OnLifecycleEvent(ON_START)
+    public void onStart() {
+        if (mActivity == null) {
+            return;
+        }
+        mActivity.getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+        android.util.EventLog.writeEvent(0x534e4554, "120484087", -1, "");
+    }
+
+
+    @OnLifecycleEvent(ON_STOP)
+    public void onStop() {
+        if (mActivity == null) {
+            return;
+        }
+        final Window window = mActivity.getWindow();
+        final WindowManager.LayoutParams attrs = window.getAttributes();
+        attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+        window.setAttributes(attrs);
+    }
+}
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index 294e754..cd13654 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -32,7 +32,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
-import android.view.WindowManager.LayoutParams;
 import android.widget.Toolbar;
 
 import androidx.fragment.app.FragmentActivity;
@@ -59,8 +58,8 @@
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-
         final long startTime = System.currentTimeMillis();
+        getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
 
         final TypedArray theme = getTheme().obtainStyledAttributes(android.R.styleable.Theme);
         if (!theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) {
diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
index a11754e..e1be9d4 100644
--- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
@@ -51,13 +51,15 @@
     private static final String ENABLE_ASSISTANT_GESTURE = "ENABLE_ASSISTANT_GESTURE";
     private static final String PROTOTYPE_ENABLED = "prototype_enabled";
 
-    private static final int EDGE_SENSITIVITY_WIDTH = 32;
+    private static final int EDGE_SENSITIVITY_WIDTH = 48;
     private static final String EDGE_SENSITIVITY_KEY = "quickstepcontroller_edge_width_sensitivity";
 
     private static final String GESTURES_MATCH_MAP_OFF = "000000";
     private static final String GESTURES_MATCH_MAP_ON = "071133";
     private static final String GESTURES_MATCH_MAP_KEY = "quickstepcontroller_gesture_match_map";
 
+    private static final String OVERLAY_NAVBAR_KEY =
+            "com.android.internal.experiment.navbar.default";
     private static final String OVERLAY_NAVBAR_TYPE_INSET =
             "com.android.internal.experiment.navbar.type.inset";
     private static final String OVERLAY_NAVBAR_TYPE_FLOATING =
@@ -174,6 +176,7 @@
                 .asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
         if (overlayManager != null) {
             try {
+                overlayManager.setEnabled(OVERLAY_NAVBAR_KEY, true, USER_SYSTEM);
                 overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_FLOATING, false, USER_SYSTEM);
                 overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_INSET, enable, USER_SYSTEM);
             } catch (RemoteException e) {
diff --git a/src/com/android/settings/gestures/WakeScreenGestureSettings.java b/src/com/android/settings/gestures/WakeScreenGestureSettings.java
deleted file mode 100644
index b8a782a..0000000
--- a/src/com/android/settings/gestures/WakeScreenGestureSettings.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.gestures;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.provider.SearchIndexableResource;
-
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-import java.util.Arrays;
-import java.util.List;
-
-@SearchIndexable
-public class WakeScreenGestureSettings extends DashboardFragment {
-
-    private static final String TAG = "WakeScreenGestureSettings";
-
-    public static final String PREF_KEY_SUGGESTION_COMPLETE =
-            "pref_wake_screen_gesture_suggestion_complete";
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.SETTINGS_GESTURE_WAKE_SCREEN;
-    }
-
-    @Override
-    protected String getLogTag() {
-        return TAG;
-    }
-
-    @Override
-    protected int getPreferenceScreenResId() {
-        return R.xml.wake_screen_gesture_settings;
-    }
-
-    public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider() {
-                @Override
-                public List<SearchIndexableResource> getXmlResourcesToIndex(
-                        Context context, boolean enabled) {
-                    final SearchIndexableResource sir = new SearchIndexableResource(context);
-                    sir.xmlResId = R.xml.wake_screen_gesture_settings;
-                    return Arrays.asList(sir);
-                }
-            };
-
-}
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 232986c..e76bc88 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -76,6 +76,11 @@
             return null;
         }
 
+        if (getWorker() == null) {
+            Log.d(TAG, "getSlice() Can not get worker through uri!");
+            return null;
+        }
+
         final List<MediaDevice> devices = getMediaDevices();
         @ColorInt final int color = Utils.getColorAccentDefaultColor(mContext);
 
@@ -115,13 +120,15 @@
     private MediaDeviceUpdateWorker getWorker() {
         if (mWorker == null) {
             mWorker = (MediaDeviceUpdateWorker) SliceBackgroundWorker.getInstance(getUri());
-            mWorker.setPackageName(mPackageName);
+            if (mWorker != null) {
+                mWorker.setPackageName(mPackageName);
+            }
         }
         return mWorker;
     }
 
     private List<MediaDevice> getMediaDevices() {
-        List<MediaDevice> devices = getWorker().getMediaDevices();
+        final List<MediaDevice> devices = getWorker().getMediaDevices();
         return devices;
     }
 
diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
index d70bd62..47db875 100644
--- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java
+++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
@@ -27,7 +27,7 @@
 import android.telephony.CarrierConfigManager;
 import android.telephony.CellIdentity;
 import android.telephony.CellInfo;
-import android.telephony.NetworkRegistrationState;
+import android.telephony.NetworkRegistrationInfo;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -304,7 +304,7 @@
      * Config the connected network operator preference when the page was created. When user get
      * into this page, the device might or might not have data connection.
      * - If the device has data:
-     * 1. use {@code ServiceState#getNetworkRegistrationStates()} to get the currently
+     * 1. use {@code ServiceState#getNetworkRegistrationInfoList()} to get the currently
      * registered cellIdentity, wrap it into a CellInfo;
      * 2. set the signal strength level as strong;
      * 3. use {@link TelephonyManager#getNetworkOperatorName()} to get the title of the
@@ -317,8 +317,8 @@
         if (mTelephonyManager.getDataState() == mTelephonyManager.DATA_CONNECTED) {
             // Try to get the network registration states
             ServiceState ss = mTelephonyManager.getServiceState();
-            List<NetworkRegistrationState> networkList =
-                    ss.getNetworkRegistrationStatesForTransportType(
+            List<NetworkRegistrationInfo> networkList =
+                    ss.getNetworkRegistrationInfoListForTransportType(
                             AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
             if (networkList == null || networkList.size() == 0) {
                 // Remove the connected network operators category
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 5fd26a6..3ccca00 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.notification;
 
-import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-
 import android.app.NotificationChannel;
 import android.app.NotificationChannelGroup;
 import android.app.settings.SettingsEnums;
@@ -26,8 +24,6 @@
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
-import android.view.Window;
-import android.view.WindowManager;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
@@ -88,8 +84,6 @@
     public void onResume() {
         super.onResume();
 
-        getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
-
         if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null) {
             Log.w(TAG, "Missing package or uid or packageinfo");
             finish();
@@ -124,15 +118,6 @@
     }
 
     @Override
-    public void onPause() {
-        super.onPause();
-        final Window window = getActivity().getWindow();
-        final WindowManager.LayoutParams attrs = window.getAttributes();
-        attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-        window.setAttributes(attrs);
-    }
-
-    @Override
     protected String getLogTag() {
         return TAG;
     }
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index ec1e835..d3d5c49 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -198,7 +198,7 @@
         } else if (isManagedProfile && isInternalActivity()
                 && !lockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
             mCredentialMode = CREDENTIAL_MANAGED;
-            if (isBiometricAllowed(effectiveUserId)) {
+            if (isBiometricAllowed(effectiveUserId, mUserId)) {
                 showBiometricPrompt(bpBundle);
                 launchedBiometric = true;
             } else {
@@ -207,7 +207,7 @@
             }
         } else {
             mCredentialMode = CREDENTIAL_NORMAL;
-            if (isBiometricAllowed(effectiveUserId)) {
+            if (isBiometricAllowed(effectiveUserId, mUserId)) {
                 // Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
                 // onAuthenticationError and do the right thing automatically.
                 showBiometricPrompt(bpBundle);
@@ -273,9 +273,10 @@
         return (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_BIOMETRICS) != 0;
     }
 
-    private boolean isBiometricAllowed(int effectiveUserId) {
+    private boolean isBiometricAllowed(int effectiveUserId, int realUserId) {
         return !isStrongAuthRequired(effectiveUserId)
-                && !isBiometricDisabledByAdmin(effectiveUserId);
+                && !isBiometricDisabledByAdmin(effectiveUserId)
+                && !mLockPatternUtils.hasPendingEscrowToken(realUserId);
     }
 
     private void showBiometricPrompt(Bundle bundle) {
@@ -304,9 +305,18 @@
     private void showConfirmCredentials() {
         mCCLaunched = true;
         boolean launched = false;
+        // The only difference between CREDENTIAL_MANAGED and CREDENTIAL_NORMAL is that for
+        // CREDENTIAL_MANAGED, we launch the real confirm credential activity with an explicit
+        // but dummy challenge value (0L). This will result in ConfirmLockPassword calling
+        // verifyTiedProfileChallenge() (if it's a profile with unified challenge), due to the
+        // difference between ConfirmLockPassword.startVerifyPassword() and
+        // ConfirmLockPassword.startCheckPassword(). Calling verifyTiedProfileChallenge() here is
+        // necessary when this is part of the turning on work profile flow, because it forces
+        // unlocking the work profile even before the profile is running.
+        // TODO: Remove the duplication of checkPassword and verifyPassword in ConfirmLockPassword,
+        // LockPatternChecker and LockPatternUtils. verifyPassword should be the only API to use,
+        // which optionally accepts a challenge.
         if (mCredentialMode == CREDENTIAL_MANAGED) {
-            // We set the challenge as 0L, so it will force to unlock managed profile when it
-            // unlocks primary profile screen lock, by calling verifyTiedProfileChallenge()
             launched = mChooseLockSettingsHelper
                     .launchConfirmationActivityWithExternalAndChallenge(
                             0 /* request code */, null /* title */, mTitle, mDetails,
diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java
index dcb4acc..896f6e5 100644
--- a/src/com/android/settings/search/SearchFeatureProvider.java
+++ b/src/com/android/settings/search/SearchFeatureProvider.java
@@ -39,7 +39,7 @@
  */
 public interface SearchFeatureProvider {
 
-    int REQUEST_CODE = 0;
+    int REQUEST_CODE = 501;
 
     /**
      * Ensures the caller has necessary privilege to launch search result page.
diff --git a/src/com/android/settings/search/actionbar/SearchMenuController.java b/src/com/android/settings/search/actionbar/SearchMenuController.java
index af7141e..25d0d30 100644
--- a/src/com/android/settings/search/actionbar/SearchMenuController.java
+++ b/src/com/android/settings/search/actionbar/SearchMenuController.java
@@ -33,6 +33,7 @@
 import com.android.settings.core.InstrumentedFragment;
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.search.SearchFeatureProvider;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnCreateOptionsMenu;
 
@@ -93,7 +94,7 @@
 
             FeatureFactory.getFactory(context).getMetricsFeatureProvider()
                     .action(context, SettingsEnums.ACTION_SEARCH_RESULTS);
-            mHost.startActivityForResult(intent, 0 /* requestCode */);
+            mHost.startActivityForResult(intent, SearchFeatureProvider.REQUEST_CODE);
             return true;
         });
     }
diff --git a/src/com/android/settings/slices/SliceBackgroundWorker.java b/src/com/android/settings/slices/SliceBackgroundWorker.java
index 559aa71..f19b1df 100644
--- a/src/com/android/settings/slices/SliceBackgroundWorker.java
+++ b/src/com/android/settings/slices/SliceBackgroundWorker.java
@@ -146,7 +146,7 @@
                 needNotify = true;
             }
         } else {
-            needNotify = !results.equals(mCachedResults);
+            needNotify = !areListsTheSame(results, mCachedResults);
         }
 
         if (needNotify) {
@@ -155,6 +155,10 @@
         }
     }
 
+    protected boolean areListsTheSame(List<E> a, List<E> b) {
+        return a.equals(b);
+    }
+
     /**
      * Notify that data was updated and attempt to sync changes to the Slice.
      */
diff --git a/src/com/android/settings/slices/SlicesIndexer.java b/src/com/android/settings/slices/SlicesIndexer.java
index 1b3a25e..5f80047 100644
--- a/src/com/android/settings/slices/SlicesIndexer.java
+++ b/src/com/android/settings/slices/SlicesIndexer.java
@@ -84,7 +84,6 @@
         } finally {
             database.endTransaction();
         }
-        database.close();
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index a2debb8..1c44204 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -32,6 +32,7 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.NetworkInfo;
+import android.net.NetworkInfo.State;
 import android.net.Uri;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
@@ -355,7 +356,6 @@
 
         @Override
         public void onConnectedChanged() {
-            notifySliceChange();
         }
 
         @Override
@@ -370,10 +370,43 @@
             final List<AccessPoint> resultList = new ArrayList<>();
             for (AccessPoint ap : accessPoints) {
                 if (ap.isReachable()) {
-                    resultList.add(ap);
+                    resultList.add(clone(ap));
+                    if (resultList.size() >= DEFAULT_EXPANDED_ROW_COUNT) {
+                        break;
+                    }
                 }
             }
             updateResults(resultList);
         }
+
+        private AccessPoint clone(AccessPoint accessPoint) {
+            final Bundle savedState = new Bundle();
+            accessPoint.saveWifiState(savedState);
+            return new AccessPoint(mContext, savedState);
+        }
+
+        @Override
+        protected boolean areListsTheSame(List<AccessPoint> a, List<AccessPoint> b) {
+            if (!a.equals(b)) {
+                return false;
+            }
+
+            // compare access point states one by one
+            final int listSize = a.size();
+            for (int i = 0; i < listSize; i++) {
+                if (getState(a.get(i)) != getState(b.get(i))) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        private State getState(AccessPoint accessPoint) {
+            final NetworkInfo networkInfo = accessPoint.getNetworkInfo();
+            if (networkInfo != null) {
+                return networkInfo.getState();
+            }
+            return null;
+        }
     }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/specialaccess/ZenAccessControllerTest.java b/tests/robotests/src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessControllerTest.java
similarity index 96%
rename from tests/robotests/src/com/android/settings/applications/specialaccess/ZenAccessControllerTest.java
rename to tests/robotests/src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessControllerTest.java
index 5bce86c..bcb4bb3 100644
--- a/tests/robotests/src/com/android/settings/applications/specialaccess/ZenAccessControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/specialaccess/zenaccess/ZenAccessControllerTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.settings.applications.specialaccess;
+package com.android.settings.applications.specialaccess.zenaccess;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
new file mode 100644
index 0000000..579cba0
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.core;
+
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.os.Bundle;
+import android.view.WindowManager;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.android.settings.R;
+
+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.android.controller.ActivityController;
+
+@RunWith(RobolectricTestRunner.class)
+public class HideNonSystemOverlayMixinTest {
+
+    private ActivityController<TestActivity> mActivityController;
+
+    @Before
+    public void setUp() {
+        RuntimeEnvironment.application.setTheme(R.style.Theme_AppCompat);
+        mActivityController = Robolectric.buildActivity(TestActivity.class);
+    }
+
+    @Test
+    public void startActivity_shouldHideNonSystemOverlay() {
+        mActivityController.setup();
+        TestActivity activity = mActivityController.get();
+
+        // Activity start: HIDE_NON_SYSTEM_OVERLAY should be set.
+        final WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
+        assertThat(attrs.privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
+                .isNotEqualTo(0);
+    }
+
+    @Test
+    public void stopActivity_shouldUnhideNonSystemOverlay() {
+        mActivityController.setup().stop();
+        TestActivity activity = mActivityController.get();
+
+        final WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
+        assertThat(attrs.privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
+                .isEqualTo(0);
+    }
+
+    public static class TestActivity extends AppCompatActivity {
+        @Override
+        protected void onCreate(@Nullable Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+            getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java
deleted file mode 100644
index f1d2fcc..0000000
--- a/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.gestures;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.provider.SearchIndexableResource;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class WakeScreenGestureSettingsTest {
-
-    private WakeScreenGestureSettings mSettings;
-
-    @Before
-    public void setUp() {
-        mSettings = new WakeScreenGestureSettings();
-    }
-
-    @Test
-    public void testSearchIndexProvider_shouldIndexResource() {
-        final List<SearchIndexableResource> indexRes =
-                WakeScreenGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
-                        RuntimeEnvironment.application, true /* enabled */);
-
-        assertThat(indexRes).isNotNull();
-        assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
index da0d85b..d26a458 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
@@ -94,6 +94,13 @@
     }
 
     @Test
+    public void getSlice_workerIsNull_shouldNotCrash() {
+        mMediaOutputSlice.init(TEST_PACKAGE_NAME, null);
+
+        mMediaOutputSlice.getSlice();
+    }
+
+    @Test
     public void getSlice_shouldHaveActiveDeviceName() {
         mDevices.clear();
         final MediaDevice device = mock(MediaDevice.class);
diff --git a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
index 1bf2fd8..1e68de5 100644
--- a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
@@ -23,7 +23,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.media.session.ControllerLink;
+import android.media.session.ISessionController;
 import android.media.session.MediaController;
 import android.media.session.MediaSession;
 import android.media.session.MediaSessionManager;
@@ -51,9 +51,9 @@
     @Mock
     private MediaController mMediaController;
     @Mock
-    private ControllerLink.ControllerStub mStub;
+    private ISessionController mStub;
     @Mock
-    private ControllerLink.ControllerStub mStub2;
+    private ISessionController mStub2;
     private MediaSession.Token mToken;
     private MediaSession.Token mToken2;
     private RemoteVolumePreferenceController mController;
@@ -71,8 +71,8 @@
         mActiveSessions.add(mMediaController);
         when(mMediaSessionManager.getActiveSessions(null)).thenReturn(
                 mActiveSessions);
-        mToken = new MediaSession.Token(new ControllerLink(mStub));
-        mToken2 = new MediaSession.Token(new ControllerLink(mStub2));
+        mToken = new MediaSession.Token(mStub);
+        mToken2 = new MediaSession.Token(mStub2);
 
         mController = new RemoteVolumePreferenceController(mContext);
         mPlaybackInfo = new MediaController.PlaybackInfo(
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
index 01feb8e..75a9e11 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
@@ -34,8 +34,10 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.NetworkInfo;
+import android.net.NetworkInfo.State;
 import android.net.Uri;
 import android.net.wifi.WifiManager;
+import android.os.Bundle;
 
 import androidx.core.graphics.drawable.IconCompat;
 import androidx.slice.Slice;
@@ -61,6 +63,7 @@
 import org.robolectric.annotation.Implements;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
@@ -253,11 +256,42 @@
         verify(mResolver).notifyChange(WIFI_SLICE_URI, null);
     }
 
-    @Test
-    public void onConnectedChanged_shouldNotifyChange() {
-        mWifiScanWorker.onConnectedChanged();
+    private AccessPoint createAccessPoint(String name, State state) {
+        final NetworkInfo info = mock(NetworkInfo.class);
+        doReturn(state).when(info).getState();
 
-        verify(mResolver).notifyChange(WIFI_SLICE_URI, null);
+        final Bundle savedState = new Bundle();
+        savedState.putString("key_ssid", name);
+        savedState.putParcelable("key_networkinfo", info);
+        return new AccessPoint(mContext, savedState);
+    }
+
+    @Test
+    public void SliceAccessPoint_sameState_shouldBeTheSame() {
+        final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTED);
+        final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED);
+
+        assertThat(mWifiScanWorker.areListsTheSame(Arrays.asList(ap1), Arrays.asList(ap2)))
+                .isTrue();
+    }
+
+    @Test
+    public void SliceAccessPoint_differentState_shouldBeDifferent() {
+        final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTING);
+        final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED);
+
+        assertThat(mWifiScanWorker.areListsTheSame(Arrays.asList(ap1), Arrays.asList(ap2)))
+                .isFalse();
+    }
+    @Test
+    public void SliceAccessPoint_differentLength_shouldBeDifferent() {
+        final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTED);
+        final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED);
+        final List<AccessPoint> list = new ArrayList<>();
+        list.add(ap1);
+        list.add(ap2);
+
+        assertThat(mWifiScanWorker.areListsTheSame(list, Arrays.asList(ap1))).isFalse();
     }
 
     @Implements(SliceBackgroundWorker.class)