Merge "Add silent status bar icon setting"
diff --git a/res/drawable/ic_devices_check_circle_green.xml b/res/drawable/ic_devices_check_circle_green.xml
new file mode 100644
index 0000000..71c683b
--- /dev/null
+++ b/res/drawable/ic_devices_check_circle_green.xml
@@ -0,0 +1,30 @@
+<!--
+    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.
+-->
+<layer-list
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:drawable="@drawable/ic_devices_other_opaque_black"
+        android:width="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:height="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:gravity="center"/>
+
+    <item
+        android:drawable="@drawable/ic_check_circle_green"
+        android:top="28dp"
+        android:left="44dp"
+        android:gravity="center"/>
+
+</layer-list>
diff --git a/res/layout/homepage_condition_footer.xml b/res/layout/homepage_condition_footer.xml
index 0ff7ac6..56687fe 100644
--- a/res/layout/homepage_condition_footer.xml
+++ b/res/layout/homepage_condition_footer.xml
@@ -15,26 +15,20 @@
   limitations under the License.
   -->
 
-<androidx.cardview.widget.CardView
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    style="@style/ContextualCardStyle">
+    android:layout_height="@dimen/homepage_condition_footer_height"
+    android:contentDescription="@string/homepage_condition_footer_content_description"
+    android:gravity="end"
+    android:orientation="horizontal"
+    android:paddingTop="@dimen/homepage_condition_footer_padding_top"
+    android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/homepage_condition_footer_height"
-        android:contentDescription="@string/homepage_condition_footer_content_description"
-        android:gravity="end"
-        android:orientation="horizontal"
-        android:paddingTop="@dimen/homepage_condition_footer_padding_top"
-        android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
+    <ImageView
+        android:id="@+id/collapse_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_expand_less"/>
 
-        <ImageView
-            android:id="@+id/collapse_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:src="@drawable/ic_expand_less" />
-
-    </LinearLayout>
-</androidx.cardview.widget.CardView>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index c2f58c3..021a61e 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -28,9 +28,9 @@
         settings:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
         <FrameLayout
+            android:id="@+id/content_container"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:paddingTop="@dimen/app_bar_height">
+            android:layout_height="match_parent">
 
             <LinearLayout
                 android:id="@+id/list_container"
diff --git a/res/layout/preference_widget_add.xml b/res/layout/preference_widget_add.xml
new file mode 100644
index 0000000..6e33a4d
--- /dev/null
+++ b/res/layout/preference_widget_add.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+  -->
+
+<ImageView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/add_preference_widget"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="center"
+    android:paddingStart="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:background="?android:attr/selectableItemBackground"
+    android:scaleType="center"
+    android:src="@drawable/ic_add_24dp"
+    android:contentDescription="@string/add" />
+
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 1e5bdce..45d0861 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -28,12 +28,11 @@
         app:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
         <LinearLayout
+            android:id="@+id/homepage_container"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
-            android:descendantFocusability="blocksDescendants"
-            android:paddingTop="104dp">
-            <!-- height of status bar(24dp) + height of action bar(48dp) + top/bottom margins(16dp) -->
+            android:descendantFocusability="blocksDescendants">
 
             <FrameLayout
                 android:id="@+id/contextual_cards_content"
diff --git a/res/layout/wifi_dpp_fragment_header.xml b/res/layout/wifi_dpp_fragment_header.xml
index 20bcd7d..e8e71d1 100644
--- a/res/layout/wifi_dpp_fragment_header.xml
+++ b/res/layout/wifi_dpp_fragment_header.xml
@@ -28,8 +28,16 @@
 
     <ImageView
         android:id="@android:id/icon"
-        android:layout_width="48dp"
-        android:layout_height="48dp"
+        android:layout_width="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:layout_height="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:scaleType="fitCenter"/>
+
+    <!-- Special header icon only for ic_devices_check_circle_green -->
+    <ImageView
+        android:id="@+id/devices_check_circle_green_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_devices_check_circle_green"
         android:scaleType="fitCenter"/>
 
     <TextView
diff --git a/res/values/config.xml b/res/values/config.xml
index e6856ac..0e46200 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -41,10 +41,6 @@
     <!-- Whether to show Camera laser sensor switch in Developer Options -->
     <bool name="config_show_camera_laser_sensor">false</bool>
 
-    <!-- Whether to show Connected MAC Randomization in Developer Options
-         as not all devices can support dynamic MAC address change.  -->
-    <bool name="config_wifi_support_connected_mac_randomization">false</bool>
-
     <!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. -->
     <string name="config_featureFactory" translatable="false">com.android.settings.overlay.FeatureFactoryImpl</string>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index dd06c37..0a35188 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -385,6 +385,9 @@
     <dimen name="qrcode_size">264dp</dimen>
     <dimen name="qrcode_preview_size">360dp</dimen>
 
+    <!-- Wi-Fi DPP fragment icon size -->
+    <dimen name="wifi_dpp_fragment_icon_width_height">48dp</dimen>
+
     <!-- Height for slice preference, which contains 6 items at most -->
     <dimen name="slice_preference_group_height">360dp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ecb74bb..cb8a318 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -658,6 +658,8 @@
     <string name="apply">Apply</string>
     <!-- Button label for generic share action [CHAR LIMIT=20] -->
     <string name="share">Share</string>
+    <!-- Button label for generic add action [CHAR LIMIT=20] -->
+    <string name="add">Add</string>
 
     <!-- Title of the Settings activity shown within the application itself. -->
     <string name="settings_label">Settings</string>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 9b43723..d7fcaec 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -222,11 +222,6 @@
             android:summary="@string/wifi_verbose_logging_summary" />
 
         <SwitchPreference
-            android:key="wifi_connected_mac_randomization"
-            android:title="@string/wifi_connected_mac_randomization"
-            android:summary="@string/wifi_connected_mac_randomization_summary" />
-
-        <SwitchPreference
             android:key="mobile_data_always_on"
             android:title="@string/mobile_data_always_on"
             android:summary="@string/mobile_data_always_on_summary" />
diff --git a/res/xml/mobile_network_list.xml b/res/xml/mobile_network_list.xml
index 81704e5..5bffa2f 100644
--- a/res/xml/mobile_network_list.xml
+++ b/res/xml/mobile_network_list.xml
@@ -23,6 +23,8 @@
         android:key="add_more"
         android:title="@string/mobile_network_list_add_more"
         android:icon="@drawable/ic_menu_add"
-        android:order="100" />
+        android:order="100" >
+        <intent android:action="android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION" />
+    </Preference>
 
 </PreferenceScreen>
diff --git a/res/xml/network_and_internet_v2.xml b/res/xml/network_and_internet_v2.xml
index 83499d7..fd29c41 100644
--- a/res/xml/network_and_internet_v2.xml
+++ b/res/xml/network_and_internet_v2.xml
@@ -39,7 +39,7 @@
             android:targetClass="Settings$WifiSettingsActivity" />
     </com.android.settings.widget.MasterSwitchPreference>
 
-    <com.android.settingslib.RestrictedPreference
+    <com.android.settings.widget.AddPreference
         android:key="mobile_network_list"
         android:title="@string/network_settings_title"
         android:summary="@string/summary_placeholder"
diff --git a/src/com/android/settings/SettingsInitialize.java b/src/com/android/settings/SettingsInitialize.java
index 784617a..5157033 100644
--- a/src/com/android/settings/SettingsInitialize.java
+++ b/src/com/android/settings/SettingsInitialize.java
@@ -21,6 +21,8 @@
 import static android.content.pm.PackageManager.GET_RESOLVED_FILTER;
 import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -51,14 +53,13 @@
     private static final String TAG = "Settings";
     private static final String PRIMARY_PROFILE_SETTING =
             "com.android.settings.PRIMARY_PROFILE_CONTROLLED";
-    private static final String SETTINGS_PACKAGE = "com.android.settings";
     private static final String WEBVIEW_IMPLEMENTATION_ACTIVITY = ".WebViewImplementation";
 
     @Override
     public void onReceive(Context context, Intent broadcast) {
         final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
         UserInfo userInfo = um.getUserInfo(UserHandle.myUserId());
-        final PackageManager pm  = context.getPackageManager();
+        final PackageManager pm = context.getPackageManager();
         managedProfileSetup(context, pm, broadcast, userInfo);
         webviewSettingSetup(context, pm, userInfo);
         refreshExistingShortcuts(context);
@@ -91,7 +92,7 @@
                         PRIMARY_PROFILE_SETTING);
                 if (shouldForward) {
                     pm.addCrossProfileIntentFilter(info.filter, userInfo.id,
-                        userInfo.profileGroupId, PackageManager.SKIP_CURRENT_PROFILE);
+                            userInfo.profileGroupId, PackageManager.SKIP_CURRENT_PROFILE);
                 }
             }
         }
@@ -113,7 +114,8 @@
             return;
         }
         ComponentName settingsComponentName =
-            new ComponentName(SETTINGS_PACKAGE, SETTINGS_PACKAGE + WEBVIEW_IMPLEMENTATION_ACTIVITY);
+                new ComponentName(SETTINGS_PACKAGE_NAME,
+                        SETTINGS_PACKAGE_NAME + WEBVIEW_IMPLEMENTATION_ACTIVITY);
         pm.setComponentEnabledSetting(settingsComponentName,
                 userInfo.isAdmin() ?
                         PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 79caefe..93a785f 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -111,16 +111,7 @@
      */
     public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
 
-    /**
-     * Color spectrum to use to indicate badness.  0 is completely transparent (no data),
-     * 1 is most bad (red), the last value is least bad (green).
-     */
-    public static final int[] BADNESS_COLORS = new int[] {
-            0x00000000, 0xffc43828, 0xffe54918, 0xfff47b00,
-            0xfffabf2c, 0xff679e37, 0xff0a7f42
-    };
-
-    private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
+    public static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
 
     public static final String OS_PKG = "os";
 
diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java
index c7d310e..364aeff 100644
--- a/src/com/android/settings/applications/RecentAppsPreferenceController.java
+++ b/src/com/android/settings/applications/RecentAppsPreferenceController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.applications;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Application;
 import android.app.settings.SettingsEnums;
 import android.app.usage.UsageStats;
@@ -91,7 +93,7 @@
         SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
                 "android",
                 "com.android.phone",
-                "com.android.settings",
+                SETTINGS_PACKAGE_NAME,
                 "com.android.systemui",
                 "com.android.providers.calendar",
                 "com.android.providers.media"
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 126cf6d..816b44a 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -185,7 +185,6 @@
     private ApplicationsAdapter mApplications;
 
     private View mLoadingContainer;
-
     private View mListContainer;
     private RecyclerView mRecyclerView;
     private SearchView mSearchView;
@@ -216,10 +215,15 @@
             LIST_TYPE_MAIN,
             LIST_TYPE_STORAGE));
 
+    @VisibleForTesting
+    View mSpinnerHeader;
+    @VisibleForTesting
+    FilterSpinnerAdapter mFilterAdapter;
+    @VisibleForTesting
+    View mContentContainer;
+
     private View mRootView;
-    private View mSpinnerHeader;
     private Spinner mFilterSpinner;
-    private FilterSpinnerAdapter mFilterAdapter;
     private IUsageStatsManager mUsageStatsManager;
     private UserManager mUserManager;
     private NotificationBackend mNotificationBackend;
@@ -326,6 +330,7 @@
             Bundle savedInstanceState) {
         mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
         mLoadingContainer = mRootView.findViewById(R.id.loading_container);
+        mContentContainer = mRootView.findViewById(R.id.content_container);
         mListContainer = mRootView.findViewById(R.id.list_container);
         if (mListContainer != null) {
             // Create adapter and list view here
@@ -794,8 +799,7 @@
             }
             mFilterOptions.add(filter);
             Collections.sort(mFilterOptions);
-            mManageApplications.mSpinnerHeader.setVisibility(
-                    mFilterOptions.size() > 1 ? View.VISIBLE : View.GONE);
+            updateFilterView(mFilterOptions.size() > 1);
             notifyDataSetChanged();
             if (mFilterOptions.size() == 1) {
                 if (DEBUG) {
@@ -826,14 +830,13 @@
                         filter.getTitle()));
             }
             Collections.sort(mFilterOptions);
-            mManageApplications.mSpinnerHeader.setVisibility(
-                    mFilterOptions.size() > 1 ? View.VISIBLE : View.GONE);
+            updateFilterView(mFilterOptions.size() > 1);
             notifyDataSetChanged();
             if (mManageApplications.mFilter == filter) {
                 if (mFilterOptions.size() > 0) {
                     if (DEBUG) {
                         Log.d(TAG, "Auto selecting filter " + mFilterOptions.get(0)
-                            + mContext.getText(mFilterOptions.get(0).getTitle()));
+                                + mContext.getText(mFilterOptions.get(0).getTitle()));
                     }
                     mManageApplications.mFilterSpinner.setSelection(0);
                     mManageApplications.onItemSelected(null, null, 0, 0);
@@ -850,6 +853,26 @@
         public CharSequence getItem(int position) {
             return mContext.getText(mFilterOptions.get(position).getTitle());
         }
+
+        @VisibleForTesting
+        void updateFilterView(boolean hasFilter) {
+            // If we need to add a floating filter in this screen, we should have an extra top
+            // padding for putting floating filter view. Otherwise, the content of list will be
+            // overlapped by floating filter.
+            if (hasFilter) {
+                mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
+                mManageApplications.mContentContainer.setPadding(0 /* left */,
+                        mContext.getResources().getDimensionPixelSize(
+                                R.dimen.app_bar_height) /* top */,
+                        0 /* right */,
+                        0 /* bottom */);
+            } else {
+                mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
+                mManageApplications.mContentContainer.setPadding(0 /* left */, 0 /* top */,
+                        0 /* right */,
+                        0 /* bottom */);
+            }
+        }
     }
 
     static class ApplicationsAdapter extends RecyclerView.Adapter<ApplicationViewHolder>
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index ee35945..b650c6c 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -33,8 +35,6 @@
  */
 public class BiometricEnrollActivity extends InstrumentedActivity {
 
-    private static final String SETTINGS_PACKAGE = "com.android.settings";
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -44,9 +44,10 @@
 
         // This logic may have to be modified on devices with multiple biometrics.
         if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
-            intent.setClassName(SETTINGS_PACKAGE, FingerprintEnrollIntroduction.class.getName());
+            intent.setClassName(SETTINGS_PACKAGE_NAME,
+                    FingerprintEnrollIntroduction.class.getName());
         } else if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
-            intent.setClassName(SETTINGS_PACKAGE, FaceEnrollIntroduction.class.getName());
+            intent.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
         }
 
         startActivity(intent);
diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java
index bca70d7..9c9f4fa 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollBase.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.content.Intent;
 import android.content.res.Resources;
@@ -148,7 +150,7 @@
 
     protected Intent getFingerprintEnrollingIntent() {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings", FingerprintEnrollEnrolling.class.getName());
+        intent.setClassName(SETTINGS_PACKAGE_NAME, FingerprintEnrollEnrolling.class.getName());
         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
         if (mUserId != UserHandle.USER_NULL) {
             intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
diff --git a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
index 379a02b..156d663 100644
--- a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 import android.content.Intent;
 import android.os.UserHandle;
@@ -114,7 +116,7 @@
                 return false;
             }
             Intent intent = new Intent();
-            intent.setClassName("com.android.settings", clazz);
+            intent.setClassName(SETTINGS_PACKAGE_NAME, clazz);
             intent.putExtra(Intent.EXTRA_USER_ID, userId);
             context.startActivity(intent);
             return true;
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 4c7276d..d696f2f 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -17,6 +17,8 @@
 package com.android.settings.biometrics.fingerprint;
 
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Activity;
 import android.app.Dialog;
 import android.app.admin.DevicePolicyManager;
@@ -460,7 +462,7 @@
             final String key = pref.getKey();
             if (KEY_FINGERPRINT_ADD.equals(key)) {
                 Intent intent = new Intent();
-                intent.setClassName("com.android.settings",
+                intent.setClassName(SETTINGS_PACKAGE_NAME,
                         FingerprintEnrollEnrolling.class.getName());
                 intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
                 intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
@@ -613,7 +615,7 @@
             if (!helper.launchConfirmationActivity(CONFIRM_REQUEST,
                     getString(R.string.security_settings_fingerprint_preference_title),
                     null, null, challenge, mUserId)) {
-                intent.setClassName("com.android.settings", ChooseLockGeneric.class.getName());
+                intent.setClassName(SETTINGS_PACKAGE_NAME, ChooseLockGeneric.class.getName());
                 intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
                         DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
                 intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS,
diff --git a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
index 6f776c9..d557bf9 100644
--- a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
+++ b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
@@ -69,6 +69,7 @@
     private Locale mLocale;
     private boolean mSelectByRegion;
     private TimeZoneData mTimeZoneData;
+    private Intent mPendingZonePickerRequestResult;
 
     private String mSelectedTimeZoneId;
     private TimeZoneInfo.Formatter mTimeZoneInfoFormatter;
@@ -136,12 +137,10 @@
         switch (requestCode) {
             case REQUEST_CODE_REGION_PICKER:
             case REQUEST_CODE_ZONE_PICKER: {
-                String regionId = data.getStringExtra(RegionSearchPicker.EXTRA_RESULT_REGION_ID);
-                String tzId = data.getStringExtra(RegionZonePicker.EXTRA_RESULT_TIME_ZONE_ID);
-                // Ignore the result if user didn't change the region or time zone.
-                if (!Objects.equals(regionId, use(RegionPreferenceController.class).getRegionId())
-                        || !Objects.equals(tzId, mSelectedTimeZoneId)) {
-                    onRegionZoneChanged(regionId, tzId);
+                if (mTimeZoneData == null) {
+                    mPendingZonePickerRequestResult = data;
+                } else {
+                    onZonePickerRequestResult(mTimeZoneData, data);
                 }
                 break;
             }
@@ -166,8 +165,11 @@
             mTimeZoneData = timeZoneData;
             setupForCurrentTimeZone();
             getActivity().invalidateOptionsMenu();
+            if (mPendingZonePickerRequestResult != null) {
+                onZonePickerRequestResult(timeZoneData, mPendingZonePickerRequestResult);
+                mPendingZonePickerRequestResult = null;
+            }
         }
-
     }
 
     private void startRegionPicker() {
@@ -226,9 +228,17 @@
         updatePreferenceStates();
     }
 
-    private void onRegionZoneChanged(String regionId, String tzId) {
+    private void onZonePickerRequestResult(TimeZoneData timeZoneData, Intent data) {
+        String regionId = data.getStringExtra(RegionSearchPicker.EXTRA_RESULT_REGION_ID);
+        String tzId = data.getStringExtra(RegionZonePicker.EXTRA_RESULT_TIME_ZONE_ID);
+        // Ignore the result if user didn't change the region or time zone.
+        if (Objects.equals(regionId, use(RegionPreferenceController.class).getRegionId())
+            && Objects.equals(tzId, mSelectedTimeZoneId)) {
+            return;
+        }
+
         FilteredCountryTimeZones countryTimeZones =
-                mTimeZoneData.lookupCountryTimeZones(regionId);
+                timeZoneData.lookupCountryTimeZones(regionId);
         if (countryTimeZones == null || !countryTimeZones.getTimeZoneIds().contains(tzId)) {
             Log.e(TAG, "Unknown time zone id is selected: " + tzId);
             return;
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index ed6a19f..5135fbf 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -429,7 +429,6 @@
         controllers.add(new CameraLaserSensorPreferenceController(context));
         controllers.add(new WifiDisplayCertificationPreferenceController(context));
         controllers.add(new WifiVerboseLoggingPreferenceController(context));
-        controllers.add(new WifiConnectedMacRandomizationPreferenceController(context));
         controllers.add(new MobileDataAlwaysOnPreferenceController(context));
         controllers.add(new TetheringHardwareAccelPreferenceController(context));
         controllers.add(new BluetoothDeviceNoNamePreferenceController(context));
diff --git a/src/com/android/settings/development/FileEncryptionPreferenceController.java b/src/com/android/settings/development/FileEncryptionPreferenceController.java
index a0628b0..8aadfb9 100644
--- a/src/com/android/settings/development/FileEncryptionPreferenceController.java
+++ b/src/com/android/settings/development/FileEncryptionPreferenceController.java
@@ -19,10 +19,9 @@
 import android.content.Context;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.os.SystemProperties;
 import android.os.storage.IStorageManager;
 import android.text.TextUtils;
-
+import android.sysprop.CryptoProperties;
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
 
@@ -36,9 +35,6 @@
     private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
     private static final String KEY_STORAGE_MANAGER = "mount";
 
-    @VisibleForTesting
-    static final String FILE_ENCRYPTION_PROPERTY_KEY = "ro.crypto.type";
-
     private final IStorageManager mStorageManager;
 
     public FileEncryptionPreferenceController(Context context) {
@@ -67,8 +63,7 @@
 
     @Override
     public void updateState(Preference preference) {
-        if (!TextUtils.equals("file",
-                SystemProperties.get(FILE_ENCRYPTION_PROPERTY_KEY, "none" /* default */))) {
+        if (!TextUtils.equals("file", CryptoProperties.type().orElse("none"))) {
             return;
         }
 
diff --git a/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java b/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java
deleted file mode 100644
index fed07f6..0000000
--- a/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class WifiConnectedMacRandomizationPreferenceController extends
-        DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
-        PreferenceControllerMixin {
-
-    private static final String WIFI_CONNECTED_MAC_RANDOMIZATION_KEY =
-            "wifi_connected_mac_randomization";
-
-    @VisibleForTesting
-    static final int SETTING_VALUE_ON = 1;
-    @VisibleForTesting
-    static final int SETTING_VALUE_OFF = 0;
-
-    public WifiConnectedMacRandomizationPreferenceController(Context context) {
-        super(context);
-    }
-
-    @Override
-    public boolean isAvailable() {
-        return mContext.getResources().getBoolean(
-                R.bool.config_wifi_support_connected_mac_randomization);
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return WIFI_CONNECTED_MAC_RANDOMIZATION_KEY;
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        final boolean isEnabled = (Boolean) newValue;
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED,
-                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
-        return true;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        final int enableMode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        ((SwitchPreference) mPreference).setChecked(enableMode != SETTING_VALUE_OFF);
-    }
-
-    @Override
-    protected void onDeveloperOptionsSwitchDisabled() {
-        super.onDeveloperOptionsSwitchDisabled();
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        ((SwitchPreference) mPreference).setChecked(false);
-    }
-}
diff --git a/src/com/android/settings/fuelgauge/BatteryCellParser.java b/src/com/android/settings/fuelgauge/BatteryCellParser.java
deleted file mode 100644
index 9139084..0000000
--- a/src/com/android/settings/fuelgauge/BatteryCellParser.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2016 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.fuelgauge;
-
-import android.os.BatteryStats.HistoryItem;
-import android.telephony.ServiceState;
-import android.util.SparseIntArray;
-
-import com.android.settings.Utils;
-import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
-
-public class BatteryCellParser implements BatteryInfo.BatteryDataParser, BatteryActiveProvider {
-
-    private final SparseIntArray mData = new SparseIntArray();
-
-    private int mLastValue;
-    private long mLength;
-    private long mLastTime;
-
-    protected int getValue(HistoryItem rec) {
-        int bin;
-        if (((rec.states & HistoryItem.STATE_PHONE_STATE_MASK)
-                >> HistoryItem.STATE_PHONE_STATE_SHIFT)
-                == ServiceState.STATE_POWER_OFF) {
-            bin = 0;
-        } else if ((rec.states & HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) {
-            bin = 1;
-        } else {
-            bin = (rec.states & HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_MASK)
-                    >> HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_SHIFT;
-            bin += 2;
-        }
-        return bin;
-    }
-
-    @Override
-    public void onParsingStarted(long startTime, long endTime) {
-        mLength = endTime - startTime;
-    }
-
-    @Override
-    public void onDataPoint(long time, HistoryItem record) {
-        int value = getValue(record);
-        if (value != mLastValue) {
-            mData.put((int) time, value);
-            mLastValue = value;
-        }
-        mLastTime = time;
-    }
-
-    @Override
-    public void onDataGap() {
-        if (mLastValue != 0) {
-            mData.put((int) mLastTime, 0);
-            mLastValue = 0;
-        }
-    }
-
-    @Override
-    public void onParsingDone() {
-        if (mLastValue != 0) {
-            mData.put((int) mLastTime, 0);
-            mLastValue = 0;
-        }
-    }
-
-    @Override
-    public long getPeriod() {
-        return mLength;
-    }
-
-    @Override
-    public boolean hasData() {
-        return mData.size() > 1;
-    }
-
-    @Override
-    public SparseIntArray getColorArray() {
-        SparseIntArray ret = new SparseIntArray();
-        for (int i = 0; i < mData.size(); i++) {
-            ret.put(mData.keyAt(i), getColor(mData.valueAt(i)));
-        }
-        return ret;
-    }
-
-    private int getColor(int i) {
-        return Utils.BADNESS_COLORS[i];
-    }
-}
diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
index 13ba5f6..02af00c 100644
--- a/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
+++ b/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.fuelgauge.batterytip.detectors;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 import android.os.BatteryStats;
 import android.text.format.DateUtils;
@@ -91,7 +93,7 @@
                 // When in test mode, add an app if necessary
                 if (mPolicy.testHighUsageTip && mHighUsageAppList.isEmpty()) {
                     mHighUsageAppList.add(new AppInfo.Builder()
-                            .setPackageName("com.android.settings")
+                            .setPackageName(SETTINGS_PACKAGE_NAME)
                             .setScreenOnTimeMs(TimeUnit.HOURS.toMillis(3))
                             .build());
                 }
diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
index 63bb977..70ae0ec 100644
--- a/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
+++ b/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.fuelgauge.batterytip.detectors;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 
 import androidx.annotation.VisibleForTesting;
@@ -87,7 +89,7 @@
     private BatteryTip getFakeData() {
         final List<AppInfo> highUsageApps = new ArrayList<>();
         highUsageApps.add(new AppInfo.Builder()
-                .setPackageName("com.android.settings")
+                .setPackageName(SETTINGS_PACKAGE_NAME)
                 .build());
         return new RestrictAppTip(BatteryTip.StateType.NEW, highUsageApps);
     }
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 9acda68..ff27ff2 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -23,6 +23,7 @@
 import android.widget.ImageView;
 import android.widget.Toolbar;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
@@ -50,6 +51,7 @@
 
         updateWindowProperties();
         setContentView(R.layout.settings_homepage_container);
+        setHomepageContainerPaddingTop();
 
         final Toolbar toolbar = findViewById(R.id.search_action_bar);
         FeatureFactory.getFactory(this).getSearchFeatureProvider()
@@ -86,4 +88,19 @@
 
         getWindow().setStatusBarColor(getResources().getColor(R.color.homepage_status_bar_color));
     }
+
+    @VisibleForTesting
+    void setHomepageContainerPaddingTop() {
+        final View view = this.findViewById(R.id.homepage_container);
+
+        final int statusBarHeight = getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.status_bar_height);
+        final int searchBarHeight = getResources().getDimensionPixelSize(R.dimen.search_bar_height);
+        final int searchBarMargin = getResources().getDimensionPixelSize(R.dimen.search_bar_margin);
+
+        // The top padding is the height of status bar + height of action bar(48dp) + top/bottom
+        // margins(16dp)
+        final int paddingTop = statusBarHeight + searchBarHeight + searchBarMargin * 2;
+        view.setPadding(0 /* left */, paddingTop, 0 /* right */, 0 /* bottom */);
+    }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/network/MobileNetworkSummaryController.java b/src/com/android/settings/network/MobileNetworkSummaryController.java
index cc15676..fff1fea 100644
--- a/src/com/android/settings/network/MobileNetworkSummaryController.java
+++ b/src/com/android/settings/network/MobileNetworkSummaryController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.network;
 
+import static android.telephony.TelephonyManager.MultiSimVariants.UNKNOWN;
+
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
@@ -23,6 +25,15 @@
 import android.content.Intent;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.telephony.euicc.EuiccManager;
+
+import com.android.settings.R;
+import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.widget.AddPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
+
+import java.util.List;
 
 import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
@@ -30,12 +41,6 @@
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
-import com.android.settings.R;
-import com.android.settings.network.telephony.MobileNetworkActivity;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-import java.util.List;
-
 public class MobileNetworkSummaryController extends AbstractPreferenceController implements
         SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
     private static final String TAG = "MobileNetSummaryCtlr";
@@ -44,7 +49,8 @@
 
     private SubscriptionManager mSubscriptionManager;
     private SubscriptionsChangeListener mChangeListener;
-    private PreferenceScreen mScreen;
+    private TelephonyManager mTelephonyMgr;
+    private AddPreference mPreference;
 
     /**
      * This controls the summary text and click behavior of the "Mobile network" item on the
@@ -64,6 +70,7 @@
     public MobileNetworkSummaryController(Context context, Lifecycle lifecycle) {
         super(context);
         mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
+        mTelephonyMgr = mContext.getSystemService(TelephonyManager.class);
         mChangeListener = new SubscriptionsChangeListener(context, this);
         lifecycle.addObserver(this);
     }
@@ -82,7 +89,7 @@
     @Override
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
-        mScreen = screen;
+        mPreference = screen.findPreference(getPreferenceKey());
     }
 
     @Override
@@ -100,29 +107,51 @@
         }
     }
 
-    private void update() {
-        if (mScreen != null) {
-            final Preference preference = mScreen.findPreference(getPreferenceKey());
-            refreshSummary(preference);
-            final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
-                    mSubscriptionManager);
+    private void startAddSimFlow() {
+        final Intent intent = new Intent(EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
+        mContext.startActivity(intent);
+    }
 
-            preference.setOnPreferenceClickListener(null);
-            preference.setFragment(null);
-            if (subs.size() == 0) {
-                preference.setOnPreferenceClickListener((Preference pref) -> {
-                    // TODO(asargent) - need to get correct intent to fire here
-                    return true;
-                });
-            } else if (subs.size() == 1) {
-                preference.setOnPreferenceClickListener((Preference pref) -> {
-                    final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
-                    mContext.startActivity(intent);
-                    return true;
-                });
+    private boolean shouldEnableAddButton() {
+        // The add button should only show up if the device is in multi-sim mode.
+        return mTelephonyMgr.getMultiSimConfiguration() != UNKNOWN;
+    }
+
+    private void update() {
+        if (mPreference == null) {
+            return;
+        }
+        final boolean enableAddButton = shouldEnableAddButton();
+        refreshSummary(mPreference);
+        if (!enableAddButton) {
+            mPreference.setOnAddClickListener(null);
+        } else {
+            mPreference.setOnAddClickListener(p -> {
+                startAddSimFlow();
+            });
+        }
+        final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
+                mSubscriptionManager);
+        mPreference.setOnPreferenceClickListener(null);
+        mPreference.setFragment(null);
+        mPreference.setEnabled(true);
+        if (subs.isEmpty()) {
+            if (enableAddButton) {
+                mPreference.setEnabled(false);
             } else {
-                preference.setFragment(MobileNetworkListFragment.class.getCanonicalName());
+                mPreference.setOnPreferenceClickListener((Preference pref) -> {
+                    startAddSimFlow();
+                    return true;
+                });
             }
+        } else if (subs.size() == 1) {
+            mPreference.setOnPreferenceClickListener((Preference pref) -> {
+                final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
+                mContext.startActivity(intent);
+                return true;
+            });
+        } else {
+            mPreference.setFragment(MobileNetworkListFragment.class.getCanonicalName());
         }
     }
 
@@ -142,6 +171,7 @@
 
     @Override
     public void onSubscriptionsChanged() {
+        refreshSummary(mPreference);
         update();
     }
 }
diff --git a/src/com/android/settings/notification/OWNERS b/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/src/com/android/settings/notification/OWNERS
+++ b/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index 3809a4a..7a685ab 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -125,7 +125,8 @@
             .setUseDefaultTitle() // use default title if title is null/empty
             .setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE))
             .setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION))
-            .setRequireConfirmation(mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION))
+            .setRequireConfirmation(
+                    mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true))
             .setNegativeButton(getResources().getString(
                     R.string.confirm_device_credential_use_alternate_method),
                     mClientExecutor, mNegativeButtonListener)
diff --git a/src/com/android/settings/password/ChooseLockSettingsHelper.java b/src/com/android/settings/password/ChooseLockSettingsHelper.java
index 32e8eaf..00e0bcd 100644
--- a/src/com/android/settings/password/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/password/ChooseLockSettingsHelper.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.Activity;
 import android.app.KeyguardManager;
@@ -408,7 +410,7 @@
         if (extras != null) {
             intent.putExtras(extras);
         }
-        intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
+        intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName());
         if (external) {
             intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
             if (mFragment != null) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 3fa2f6a..db0935d 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -17,6 +17,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Activity;
 import android.app.KeyguardManager;
 import android.app.admin.DevicePolicyManager;
@@ -62,7 +64,7 @@
 
     public static Intent createIntent(CharSequence title, CharSequence details) {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings",
+        intent.setClassName(SETTINGS_PACKAGE_NAME,
                 ConfirmDeviceCredentialActivity.class.getName());
         intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
         intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
@@ -71,7 +73,7 @@
 
     public static Intent createIntent(CharSequence title, CharSequence details, long challenge) {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings",
+        intent.setClassName(SETTINGS_PACKAGE_NAME,
                 ConfirmDeviceCredentialActivity.class.getName());
         intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
         intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
index e14ec81..bb953a1 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
@@ -17,6 +17,8 @@
 // TODO (b/35202196): move this class out of the root of the package.
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.Dialog;
 import android.app.KeyguardManager;
@@ -55,17 +57,16 @@
  */
 public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFragment {
 
-    public static final String PACKAGE = "com.android.settings";
-    public static final String TITLE_TEXT = PACKAGE + ".ConfirmCredentials.title";
-    public static final String HEADER_TEXT = PACKAGE + ".ConfirmCredentials.header";
-    public static final String DETAILS_TEXT = PACKAGE + ".ConfirmCredentials.details";
-    public static final String DARK_THEME = PACKAGE + ".ConfirmCredentials.darkTheme";
+    public static final String TITLE_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.title";
+    public static final String HEADER_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.header";
+    public static final String DETAILS_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.details";
+    public static final String DARK_THEME = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.darkTheme";
     public static final String SHOW_CANCEL_BUTTON =
-            PACKAGE + ".ConfirmCredentials.showCancelButton";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showCancelButton";
     public static final String SHOW_WHEN_LOCKED =
-            PACKAGE + ".ConfirmCredentials.showWhenLocked";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showWhenLocked";
     public static final String USE_FADE_ANIMATION =
-            PACKAGE + ".ConfirmCredentials.useFadeAnimation";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.useFadeAnimation";
 
     protected static final int USER_TYPE_PRIMARY = 1;
     protected static final int USER_TYPE_MANAGED_PROFILE = 2;
diff --git a/src/com/android/settings/password/PasswordUtils.java b/src/com/android/settings/password/PasswordUtils.java
index 5f118cf..2300b98 100644
--- a/src/com/android/settings/password/PasswordUtils.java
+++ b/src/com/android/settings/password/PasswordUtils.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.ActivityManager;
 import android.app.IActivityManager;
@@ -32,8 +34,6 @@
 
     private static final String TAG = "Settings";
 
-    private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
-
     /**
      * Returns whether the uid which the activity with {@code activityToken} is launched from has
      * been granted the {@code permission}.
diff --git a/src/com/android/settings/widget/ActionBarShadowController.java b/src/com/android/settings/widget/ActionBarShadowController.java
deleted file mode 100644
index 1b8d319..0000000
--- a/src/com/android/settings/widget/ActionBarShadowController.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2017 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.widget;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.view.View;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
-/**
- * A controller that adds shadow to actionbar when content view scrolls.
- * <p/>
- * It also works on custom views acting as an actionbar.
- */
-public class ActionBarShadowController implements LifecycleObserver, OnStart, OnStop {
-
-    @VisibleForTesting
-    static final float ELEVATION_HIGH = 8;
-    @VisibleForTesting
-    static final float ELEVATION_LOW = 0;
-
-    @VisibleForTesting
-    ScrollChangeWatcher mScrollChangeWatcher;
-    private RecyclerView mRecyclerView;
-    private boolean isScrollWatcherAttached;
-
-    public static ActionBarShadowController attachToRecyclerView(Activity activity,
-            Lifecycle lifecycle, RecyclerView recyclerView) {
-        return new ActionBarShadowController(activity, lifecycle, recyclerView);
-    }
-
-    public static ActionBarShadowController attachToRecyclerView(View anchorView,
-            Lifecycle lifecycle, RecyclerView recyclerView) {
-        return new ActionBarShadowController(anchorView, lifecycle, recyclerView);
-    }
-
-    private ActionBarShadowController(Activity activity, Lifecycle lifecycle,
-            RecyclerView recyclerView) {
-        mScrollChangeWatcher = new ScrollChangeWatcher(activity);
-        mRecyclerView = recyclerView;
-        attachScrollWatcher();
-        lifecycle.addObserver(this);
-    }
-
-    private ActionBarShadowController(View anchorView, Lifecycle lifecycle,
-            RecyclerView recyclerView) {
-        mScrollChangeWatcher = new ScrollChangeWatcher(anchorView);
-        mRecyclerView = recyclerView;
-        attachScrollWatcher();
-        lifecycle.addObserver(this);
-    }
-
-    @Override
-    public void onStop() {
-        detachScrollWatcher();
-    }
-
-    private void detachScrollWatcher() {
-        mRecyclerView.removeOnScrollListener(mScrollChangeWatcher);
-        isScrollWatcherAttached = false;
-    }
-
-    @Override
-    public void onStart() {
-        attachScrollWatcher();
-    }
-
-    private void attachScrollWatcher() {
-        if (!isScrollWatcherAttached) {
-            isScrollWatcherAttached = true;
-            mRecyclerView.addOnScrollListener(mScrollChangeWatcher);
-            mScrollChangeWatcher.updateDropShadow(mRecyclerView);
-        }
-    }
-
-    /**
-     * Update the drop shadow as the scrollable entity is scrolled.
-     */
-    final class ScrollChangeWatcher extends RecyclerView.OnScrollListener {
-
-        private final Activity mActivity;
-        private final View mAnchorView;
-
-        public ScrollChangeWatcher(Activity activity) {
-            mActivity = activity;
-            mAnchorView = null;
-        }
-
-        public ScrollChangeWatcher(View anchorView) {
-            mAnchorView = anchorView;
-            mActivity = null;
-        }
-
-        // RecyclerView scrolled.
-        @Override
-        public void onScrolled(RecyclerView view, int dx, int dy) {
-            updateDropShadow(view);
-        }
-
-        public void updateDropShadow(View view) {
-            final boolean shouldShowShadow = view.canScrollVertically(-1);
-            if (mAnchorView != null) {
-                mAnchorView.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);
-            } else if (mActivity != null) { // activity can become null when running monkey
-                final ActionBar actionBar = mActivity.getActionBar();
-                if (actionBar != null) {
-                    actionBar.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);
-                }
-            }
-        }
-    }
-
-}
diff --git a/src/com/android/settings/widget/AddPreference.java b/src/com/android/settings/widget/AddPreference.java
new file mode 100644
index 0000000..ce36ab3
--- /dev/null
+++ b/src/com/android/settings/widget/AddPreference.java
@@ -0,0 +1,85 @@
+/*
+ * 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.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.android.settings.R;
+import com.android.settingslib.RestrictedPreference;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.PreferenceViewHolder;
+
+/**
+ * A preference with a plus button on the side representing an "add" action. The plus button will
+ * only be visible when a non-null click listener is registered.
+ */
+public class AddPreference extends RestrictedPreference implements View.OnClickListener {
+
+    private OnAddClickListener mListener;
+    private View mWidgetFrame;
+
+    public AddPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @VisibleForTesting
+    int getAddWidgetResId() {
+        return R.id.add_preference_widget;
+    }
+
+    /** Sets a listener for clicks on the plus button. Passing null will cause the button to be
+     * hidden. */
+    public void setOnAddClickListener(OnAddClickListener listener) {
+        mListener = listener;
+       if (mWidgetFrame != null) {
+           mWidgetFrame.setVisibility(shouldHideSecondTarget() ? View.GONE : View.VISIBLE);
+       }
+    }
+
+    @Override
+    protected int getSecondTargetResId() {
+        return R.layout.preference_widget_add;
+    }
+
+    @Override
+    protected boolean shouldHideSecondTarget() {
+        return mListener == null;
+    }
+
+    @Override
+    public void onBindViewHolder(PreferenceViewHolder holder) {
+        super.onBindViewHolder(holder);
+        mWidgetFrame = holder.findViewById(android.R.id.widget_frame);
+        final View addWidget = holder.findViewById(getAddWidgetResId());
+        addWidget.setEnabled(true);
+        addWidget.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View view) {
+        if (view.getId() == getAddWidgetResId() && mListener != null) {
+            mListener.onAddClick(this);
+        }
+    }
+
+    public interface OnAddClickListener {
+        void onAddClick(AddPreference p);
+    }
+}
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java
index 2714859..5672178 100644
--- a/src/com/android/settings/widget/EntityHeaderController.java
+++ b/src/com/android/settings/widget/EntityHeaderController.java
@@ -49,6 +49,7 @@
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.ActionBarShadowController;
 import com.android.settingslib.widget.LayoutPreference;
 
 import java.lang.annotation.Retention;
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index a679d37..739ddd7 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -359,8 +359,16 @@
                         if (config != null && config.isPasspoint()) {
                             providerFriendlyName = config.providerFriendlyName;
                         }
+                        String suggestionOrSpecifierPackageName = null;
+                        if (config != null
+                                && (config.fromWifiNetworkSpecifier
+                                || config.fromWifiNetworkSuggestion)) {
+                            suggestionOrSpecifierPackageName = config.creatorName;
+                        }
                         String summary = AccessPoint.getSummary(
-                                mConfigUi.getContext(), state, isEphemeral, providerFriendlyName);
+                                mConfigUi.getContext(), state, isEphemeral,
+                                suggestionOrSpecifierPackageName,
+                                providerFriendlyName);
                         addRow(group, R.string.wifi_status, summary);
                     }
 
diff --git a/src/com/android/settings/wifi/WifiInfoPreferenceController.java b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
index e847712..2a8c7b5 100644
--- a/src/com/android/settings/wifi/WifiInfoPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
@@ -98,12 +98,11 @@
     public void updateWifiInfo() {
         if (mWifiMacAddressPref != null) {
             final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
-            final int macRandomizationMode = Settings.Global.getInt(mContext.getContentResolver(),
-                    Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+            final boolean macRandomizationSupported = mContext.getResources().getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported);
             final String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
 
-            if (macRandomizationMode == 1
-                    && WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
+            if (macRandomizationSupported && WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
                 mWifiMacAddressPref.setSummary(R.string.wifi_status_mac_randomized);
             } else if (TextUtils.isEmpty(macAddress)
                     || WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
diff --git a/src/com/android/settings/wifi/WifiStatusTest.java b/src/com/android/settings/wifi/WifiStatusTest.java
index 6c1a3fc..b063433 100644
--- a/src/com/android/settings/wifi/WifiStatusTest.java
+++ b/src/com/android/settings/wifi/WifiStatusTest.java
@@ -299,7 +299,7 @@
             WifiInfo info = mWifiManager.getConnectionInfo();
             String summary = AccessPoint.getSummary(this, info.getSSID(),
                     networkInfo.getDetailedState(),
-                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null);
+                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null, null);
             mNetworkState.setText(summary);
         }
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 52243d4..4523def 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -55,7 +55,7 @@
         @Override
         public void onConfiguratorSuccess(int code) {
             // Update success UI.
-            mHeaderIcon.setImageResource(R.drawable.ic_check_circle_green);
+            setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
             mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
             mSummary.setVisibility(View.INVISIBLE);
             mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
@@ -63,7 +63,11 @@
             mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
             mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
             mButtonRight.setText(R.string.done);
-            mButtonRight.setOnClickListener(v -> getActivity().finish());
+            mButtonRight.setOnClickListener(v -> {
+                final Activity activity = getActivity();
+                activity.setResult(Activity.RESULT_OK);
+                activity.finish();
+            });
         }
 
         @Override
@@ -110,7 +114,7 @@
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_devices_other_opaque_black);
+        setHeaderIconImageResource(R.drawable.ic_devices_other_opaque_black);
 
         final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
                 .getWifiDppQrCode();
@@ -138,10 +142,7 @@
 
         mButtonLeft = view.findViewById(R.id.button_left);
         mButtonLeft.setText(R.string.cancel);
-        mButtonLeft.setOnClickListener(v -> {
-            getActivity().setResult(Activity.RESULT_CANCELED);
-            getActivity().finish();
-        });
+        mButtonLeft.setOnClickListener(v -> getActivity().finish());
 
         mButtonRight = view.findViewById(R.id.button_right);
         mButtonRight.setText(R.string.wifi_dpp_share_wifi);
diff --git a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
index 6a229a1..72e845f 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
-import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.os.Bundle;
@@ -82,6 +81,8 @@
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
+        setHeaderIconImageResource(R.drawable.ic_wifi_signal_4);
+
         mTitle.setText(R.string.wifi_dpp_choose_network);
         mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
 
@@ -98,9 +99,7 @@
                     .ACTION_CONFIGURATOR_QR_CODE_GENERATOR.equals(action)) {
                 getFragmentManager().popBackStack();
             } else {
-                final Activity activity = getActivity();
-                activity.setResult(Activity.RESULT_CANCELED);
-                activity.finish();
+                getActivity().finish();
             }
         });
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index e5beea0..4aac538 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
-import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.os.Bundle;
@@ -160,7 +159,6 @@
         }
 
         if (cancelActivity) {
-            setResult(Activity.RESULT_CANCELED);
             finish();
         }
     }
@@ -279,8 +277,8 @@
         return mWifiDppQrCode;
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected boolean setWifiNetworkConfig(WifiNetworkConfig config) {
+    @VisibleForTesting
+    boolean setWifiNetworkConfig(WifiNetworkConfig config) {
         if(!WifiNetworkConfig.isValidConfig(config)) {
             return false;
         } else {
@@ -289,8 +287,8 @@
         }
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected boolean setWifiDppQrCode(WifiQrCode wifiQrCode) {
+    @VisibleForTesting
+    boolean setWifiDppQrCode(WifiQrCode wifiQrCode) {
         if (wifiQrCode == null) {
             return false;
         }
@@ -307,7 +305,6 @@
     public boolean onNavigateUp() {
         Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
         if (fragment instanceof WifiDppQrCodeGeneratorFragment) {
-            setResult(Activity.RESULT_CANCELED);
             finish();
             return true;
         } else if (fragment instanceof WifiDppQrCodeScannerFragment) {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 3dea7a0..df36ae5 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -117,7 +117,6 @@
                 break;
             default:
                 Log.e(TAG, "Launch with an invalid action");
-                setResult(Activity.RESULT_CANCELED);
                 finish();
         }
     }
@@ -141,7 +140,6 @@
 
     @Override
     public boolean onNavigateUp(){
-        setResult(Activity.RESULT_CANCELED);
         finish();
         return true;
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
index cd0db62..fab495d 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
@@ -21,6 +21,7 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
 
 /**
@@ -33,7 +34,8 @@
  * {@code WifiDppAddDeviceFragment}
  */
 public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
-    protected ImageView mHeaderIcon;
+    private ImageView mHeaderIcon;
+    private ImageView mDevicesCheckCircleGreenHeaderIcon;
     protected TextView mTitle;
     protected TextView mSummary;
 
@@ -42,7 +44,22 @@
         super.onViewCreated(view, savedInstanceState);
 
         mHeaderIcon = view.findViewById(android.R.id.icon);
+        mDevicesCheckCircleGreenHeaderIcon =
+                view.findViewById(R.id.devices_check_circle_green_icon);
         mTitle = view.findViewById(android.R.id.title);
         mSummary = view.findViewById(android.R.id.summary);
     }
+
+    protected void setHeaderIconImageResource(int resId) {
+        // ic_devices_check_circle_green is a LayerDrawable,
+        // it has different size from other VectorDrawable icons
+        if (resId == R.drawable.ic_devices_check_circle_green) {
+            mHeaderIcon.setVisibility(View.GONE);
+            mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.VISIBLE);
+        } else {
+            mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.GONE);
+            mHeaderIcon.setImageResource(resId);
+            mHeaderIcon.setVisibility(View.VISIBLE);
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index d0a9638..2264ba6 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -124,7 +124,8 @@
 
         mQrCodeView = view.findViewById(R.id.qrcode_view);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_qrcode_24dp);
+        setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
+
         final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
         mTitle.setText(R.string.wifi_dpp_share_wifi);
         mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 7beeeb2..9524fee 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -171,7 +171,7 @@
 
         mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_scan_24dp);
+        setHeaderIconImageResource(R.drawable.ic_scan_24dp);
         if (mIsConfiguratorMode) {
             mTitle.setText(R.string.wifi_dpp_add_device_to_network);
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index b43ee92..9c69032 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -139,7 +139,7 @@
             case AccessPoint.SECURITY_WEP:
                 return WifiQrCode.SECURITY_WEP;
             case AccessPoint.SECURITY_PSK:
-                return WifiQrCode.SECURITY_WPA;
+                return WifiQrCode.SECURITY_WPA_PSK;
             case AccessPoint.SECURITY_SAE:
                 return WifiQrCode.SECURITY_SAE;
             default:
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index 8e95b3e..979e602 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -19,7 +19,7 @@
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_NO_PASSWORD;
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_SAE;
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WEP;
-import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WPA;
+import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WPA_PSK;
 
 import android.content.Context;
 import android.content.Intent;
@@ -53,8 +53,8 @@
     private boolean mHiddenSsid;
     private int mNetworkId;
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected WifiNetworkConfig(String security, String ssid, String preSharedKey,
+    @VisibleForTesting
+    WifiNetworkConfig(String security, String ssid, String preSharedKey,
             boolean hiddenSsid, int networkId) {
         mSecurity = security;
         mSsid = ssid;
@@ -218,7 +218,7 @@
         }
 
         // DPP 1.0 only supports SAE and PSK.
-        if (SECURITY_SAE.equals(mSecurity) || SECURITY_WPA.equals(mSecurity)) {
+        if (SECURITY_SAE.equals(mSecurity) || SECURITY_WPA_PSK.equals(mSecurity)) {
             return true;
         }
 
@@ -256,7 +256,7 @@
             } else {
                 wifiConfiguration.wepKeys[0] = addQuotationIfNeeded(mPreSharedKey);
             }
-        } else if (mSecurity.startsWith(SECURITY_WPA)) {
+        } else if (mSecurity.startsWith(SECURITY_WPA_PSK)) {
             wifiConfiguration.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
 
             if (mPreSharedKey.matches("[0-9A-Fa-f]{64}")) {
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
index b078b01..89efc31 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
@@ -235,7 +235,7 @@
             if (mOnChooseNetworkListener != null) {
                 mOnChooseNetworkListener.onChooseNetwork(
                         new WifiNetworkConfig(
-                                WifiQrCode.SECURITY_WPA,
+                                WifiQrCode.SECURITY_WPA_PSK,
                                 /* ssid */ WifiNetworkConfig.FAKE_SSID,
                                 /* preSharedKey */ WifiNetworkConfig.FAKE_PASSWORD,
                                 /* hiddenSsid */ true,
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index d3f8ebf..a08fb44 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -66,7 +66,7 @@
     // Ignores password if security is SECURITY_NO_PASSWORD or absent
     public static final String SECURITY_NO_PASSWORD = "nopass";
     public static final String SECURITY_WEP = "WEP";
-    public static final String SECURITY_WPA = "WPA";
+    public static final String SECURITY_WPA_PSK = "WPA";
     public static final String SECURITY_SAE = "WPA3";
 
     private String mQrCode;
@@ -169,8 +169,8 @@
         return null;
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected String removeBackSlash(String input) {
+    @VisibleForTesting
+    String removeBackSlash(String input) {
         if (input == null) {
             return null;
         }
@@ -210,8 +210,8 @@
     }
 
     /** Available when {@code getScheme()} returns SCHEME_DPP */
-     @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected String getPublicKey() {
+    @VisibleForTesting
+    String getPublicKey() {
         return mPublicKey;
     }
 
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index d1500e7..1c1da38 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -85,6 +85,7 @@
     private boolean mWifiP2pSearching;
     private int mConnectedDevices;
     private boolean mLastGroupFormed = false;
+    private boolean mIsIgnoreInitConnectionInfoCallback = false;
 
     private P2pPeerCategoryPreferenceController mPeerCategoryController;
     private P2pPersistentCategoryPreferenceController mPersistentCategoryController;
@@ -131,6 +132,7 @@
                     startSearch();
                 }
                 mLastGroupFormed = wifip2pinfo.groupFormed;
+                mIsIgnoreInitConnectionInfoCallback = true;
             } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
                 mThisDevice = (WifiP2pDevice) intent.getParcelableExtra(
                         WifiP2pManager.EXTRA_WIFI_P2P_DEVICE);
@@ -338,6 +340,29 @@
         getActivity().registerReceiver(mReceiver, mIntentFilter);
         if (mWifiP2pManager != null) {
             mWifiP2pManager.requestPeers(mChannel, WifiP2pSettings.this);
+            mWifiP2pManager.requestDeviceInfo(mChannel, wifiP2pDevice -> {
+                if (DBG) {
+                    Log.d(TAG, "Get device info: " + wifiP2pDevice);
+                }
+                mThisDevice = wifiP2pDevice;
+                mThisDevicePreferenceController.updateDeviceName(wifiP2pDevice);
+            });
+            mIsIgnoreInitConnectionInfoCallback = false;
+            mWifiP2pManager.requestNetworkInfo(mChannel, networkInfo -> {
+                mWifiP2pManager.requestConnectionInfo(mChannel, wifip2pinfo -> {
+                    if (!mIsIgnoreInitConnectionInfoCallback) {
+                        if (networkInfo.isConnected()) {
+                            if (DBG) {
+                                Log.d(TAG, "Connected");
+                            }
+                        } else if (!mLastGroupFormed) {
+                            // Find peers when p2p doesn't connected.
+                            startSearch();
+                        }
+                        mLastGroupFormed = wifip2pinfo.groupFormed;
+                    }
+                });
+            });
         }
     }
 
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index 50133d9..b0733f4 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -3,11 +3,11 @@
 SETTINGS_AOSP_PATH := packages/apps/Settings
 
 #############################################################
-# Build SettingsTest.apk which includes test-only resources.#
+# Build SettingsRoboTestStub.apk which includes test-only resources.#
 #############################################################
 include $(CLEAR_VARS)
 
-LOCAL_PACKAGE_NAME := SettingsTest
+LOCAL_PACKAGE_NAME := SettingsRoboTestStub
 LOCAL_PRIVATE_PLATFORM_APIS := true
 LOCAL_CERTIFICATE := platform
 LOCAL_PRIVILEGED_MODULE := true
@@ -77,7 +77,7 @@
     mockito-robolectric-prebuilt \
     truth-prebuilt
 
-LOCAL_INSTRUMENTATION_FOR := SettingsTest
+LOCAL_INSTRUMENTATION_FOR := SettingsRoboTestStub
 
 LOCAL_MODULE_TAGS := optional
 
@@ -100,7 +100,7 @@
     mockito-robolectric-prebuilt \
     truth-prebuilt
 
-LOCAL_TEST_PACKAGE := SettingsTest
+LOCAL_TEST_PACKAGE := SettingsRoboTestStub
 
 LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src \
     frameworks/base/packages/SettingsLib/search/src \
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index da71273..b54781d 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -56,7 +56,6 @@
     <bool name="config_show_vibrate_input_devices">false</bool>
     <bool name="config_show_reset_dashboard">false</bool>
     <bool name="config_show_system_update_settings">false</bool>
-    <bool name="config_wifi_support_connected_mac_randomization">false</bool>
     <bool name="config_show_device_model">false</bool>
     <bool name="config_show_top_level_battery">false</bool>
     <bool name="config_show_top_level_connected_devices">false</bool>
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index 1252ece..15ae899 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -20,7 +20,6 @@
     <bool name="config_show_camera_laser_sensor">true</bool>
     <bool name="config_show_connectivity_monitor">true</bool>
     <bool name="config_display_recent_apps">true</bool>
-    <bool name="config_wifi_support_connected_mac_randomization">true</bool>
 
     <!-- Fake dimen value for restricted icon size - needed to get around Robolectric
          issue loading framework hidden resources -->
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 3dc0bc4..27aeccc 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -91,6 +91,8 @@
     private UserManager mUserManager;
     @Mock
     private PackageManager mPackageManager;
+
+    private Context mContext;
     private MenuItem mAppReset;
     private MenuItem mSortRecent;
     private MenuItem mSortFrequent;
@@ -99,6 +101,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
         mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
         mSortRecent = new RoboMenuItem(R.id.sort_order_recent_notification);
         mSortFrequent = new RoboMenuItem(R.id.sort_order_frequent_notification);
@@ -107,6 +110,7 @@
         when(mState.getBackgroundLooper()).thenReturn(Looper.myLooper());
 
         mFragment = spy(new ManageApplications());
+        when(mFragment.getContext()).thenReturn(mContext);
         when(mFragment.getActivity()).thenReturn(mActivity);
         when(mActivity.getResources()).thenReturn(mResources);
         when(mActivity.getSystemService(UserManager.class)).thenReturn(mUserManager);
@@ -460,6 +464,31 @@
         assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
     }
 
+    @Test
+    public void updateFilterView_hasFilterSet_shouldShowFilterAndHavePaddingTop() {
+        mFragment.mContentContainer = new View(mContext);
+        mFragment.mSpinnerHeader = new View(mContext);
+        mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
+
+        mFragment.mFilterAdapter.updateFilterView(true);
+
+        assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(
+                mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
+    }
+
+    @Test
+    public void updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop() {
+        mFragment.mContentContainer = new View(mContext);
+        mFragment.mSpinnerHeader = new View(mContext);
+        mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
+
+        mFragment.mFilterAdapter.updateFilterView(false);
+
+        assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.GONE);
+        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(0);
+    }
+
     private void setUpOptionMenus() {
         when(mMenu.findItem(anyInt())).thenAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
diff --git a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
index 68cbd32..61e650f 100644
--- a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
@@ -16,9 +16,6 @@
 
 package com.android.settings.development;
 
-import static com.android.settings.development.FileEncryptionPreferenceController
-        .FILE_ENCRYPTION_PROPERTY_KEY;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -29,9 +26,8 @@
 
 import android.content.Context;
 import android.os.RemoteException;
-import android.os.SystemProperties;
 import android.os.storage.IStorageManager;
-
+import android.sysprop.CryptoProperties;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
@@ -96,7 +92,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        SystemProperties.set(FILE_ENCRYPTION_PROPERTY_KEY, "foobar");
+        CryptoProperties.type("foobar");
 
         mController.updateState(mPreference);
 
@@ -110,7 +106,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        SystemProperties.set(FILE_ENCRYPTION_PROPERTY_KEY, "file");
+        CryptoProperties.type("file");
 
         mController.updateState(mPreference);
 
diff --git a/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java
deleted file mode 100644
index 60e7d47..0000000
--- a/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import static com.android.settings.development.WifiConnectedMacRandomizationPreferenceController
-        .SETTING_VALUE_OFF;
-import static com.android.settings.development.WifiConnectedMacRandomizationPreferenceController
-        .SETTING_VALUE_ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(RobolectricTestRunner.class)
-public class WifiConnectedMacRandomizationPreferenceControllerTest {
-
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
-
-    private Context mContext;
-    private SwitchPreference mPreference;
-    private WifiConnectedMacRandomizationPreferenceController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        mController = new WifiConnectedMacRandomizationPreferenceController(mContext);
-        mPreference = new SwitchPreference(mContext);
-        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
-            .thenReturn(mPreference);
-        mController.displayPreference(mPreferenceScreen);
-    }
-
-    @Test
-    public void isAvailable_trueSupportFlag_shouldReturnTrue() {
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
-    @Config(qualifiers = "mcc999")
-    public void isAvailable_falseSupportFlag_shouldReturnFalse() {
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void onPreferenceChange_settingEnabled_shouldEnableConnectedMacRandomization() {
-        mController.onPreferenceChange(mPreference, true /* new value */);
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_ON);
-    }
-
-    @Test
-    public void onPreferenceChange_settingDisabled_shouldDisableConnectedMacRandomization() {
-        mController.onPreferenceChange(mPreference, false /* new value */);
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
-    }
-
-    @Test
-    public void updateState_settingEnabled_shouldEnablePreference() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_ON);
-        mController.updateState(mPreference);
-
-        assertThat(mPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void updateState_settingDisabled_shouldDisablePreference() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        mController.updateState(mPreference);
-
-        assertThat(mPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
-        mController.onDeveloperOptionsSwitchDisabled();
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
-        assertThat(mPreference.isChecked()).isFalse();
-        assertThat(mPreference.isEnabled()).isFalse();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
index 3b024eb..275bfe0 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -60,7 +59,8 @@
         MockitoAnnotations.initMocks(this);
 
         FakeFeatureFactory.setupForTest();
-        doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
+        when(mSettingsActivity.getApplicationContext()).thenReturn(RuntimeEnvironment.application);
+        when(mFragment.getContext()).thenReturn(RuntimeEnvironment.application);
         mRestrictAppTip = spy(new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>()));
         mEarlyWarningTip = spy(
                 new EarlyWarningTip(BatteryTip.StateType.NEW, true /* powerSaveModeOn */));
diff --git a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
index 1af8c32..b100460 100644
--- a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
@@ -19,7 +19,9 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.util.FeatureFlagUtils;
+import android.view.View;
 
+import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.core.FeatureFlags;
 
@@ -44,4 +46,23 @@
         assertThat(shadowActivity.getNextStartedActivity().getComponent().getClassName())
                 .isEqualTo(SettingsActivity.class.getName());
     }
+
+    @Test
+    public void setHomepageContainerPaddingTop_shouldBeSetPaddingTop() {
+        final SettingsHomepageActivity activity = Robolectric.buildActivity(
+                SettingsHomepageActivity.class).create().get();
+        final int statusBarHeight = activity.getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.status_bar_height);
+        final int searchBarHeight = activity.getResources().getDimensionPixelSize(
+                R.dimen.search_bar_height);
+        final int searchBarMargin = activity.getResources().getDimensionPixelSize(
+                R.dimen.search_bar_margin);
+        final View view = activity.findViewById(R.id.homepage_container);
+
+        activity.setHomepageContainerPaddingTop();
+
+        final int actualPaddingTop = view.getPaddingTop();
+        assertThat(actualPaddingTop).isEqualTo(
+                statusBarHeight + searchBarHeight + searchBarMargin * 2);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
index f0c012d..6a1abd1 100644
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
@@ -16,10 +16,16 @@
 
 package com.android.settings.network;
 
+import static android.telephony.TelephonyManager.MultiSimVariants.DSDS;
+import static android.telephony.TelephonyManager.MultiSimVariants.UNKNOWN;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.notNull;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -28,8 +34,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
+import android.telephony.euicc.EuiccManager;
 
 import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.widget.AddPreference;
 
 import org.junit.After;
 import org.junit.Before;
@@ -44,7 +53,6 @@
 import java.util.Arrays;
 
 import androidx.lifecycle.Lifecycle;
-import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
 @RunWith(RobolectricTestRunner.class)
@@ -52,10 +60,12 @@
     @Mock
     private Lifecycle mLifecycle;
     @Mock
-    PreferenceScreen mPreferenceScreen;
+    private TelephonyManager mTelephonyManager;
 
-    Preference mPreference;
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
 
+    private AddPreference mPreference;
     private Context mContext;
     private MobileNetworkSummaryController mController;
 
@@ -63,8 +73,11 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(Robolectric.setupActivity(Activity.class));
+        when(mContext.getSystemService(eq(TelephonyManager.class))).thenReturn(mTelephonyManager);
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(UNKNOWN);
+
         mController = new MobileNetworkSummaryController(mContext, mLifecycle);
-        mPreference = new Preference(mContext);
+        mPreference = spy(new AddPreference(mContext, null));
         mPreference.setKey(mController.getPreferenceKey());
         when(mPreferenceScreen.findPreference(eq(mController.getPreferenceKey()))).thenReturn(
                 mPreference);
@@ -76,15 +89,21 @@
     }
 
     @Test
-    public void getSummary_noSubscriptions_correctSummary() {
+    public void getSummary_noSubscriptions_correctSummaryAndClickHandler() {
         mController.displayPreference(mPreferenceScreen);
         mController.onResume();
         assertThat(mController.getSummary()).isEqualTo("Add a network");
+
+        mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        verify(mContext).startActivity(intentCaptor.capture());
+        assertThat(intentCaptor.getValue().getAction()).isEqualTo(
+                EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
     }
 
     @Test
     public void getSummary_oneSubscription_correctSummaryAndClickHandler() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub1.getDisplayName()).thenReturn("sub1");
         SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
@@ -93,7 +112,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -101,8 +120,8 @@
 
     @Test
     public void getSummary_twoSubscriptions_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
 
@@ -115,8 +134,8 @@
 
     @Test
     public void getSummaryAfterUpdate_twoSubscriptionsBecomesOne_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
         when(sub1.getDisplayName()).thenReturn("sub1");
@@ -135,7 +154,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -143,8 +162,8 @@
 
     @Test
     public void getSummaryAfterUpdate_oneSubscriptionBecomesTwo_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
         when(sub1.getDisplayName()).thenReturn("sub1");
@@ -156,7 +175,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -168,4 +187,53 @@
         assertThat(mController.getSummary()).isEqualTo("2 SIMs");
         assertThat(mPreference.getFragment()).isEqualTo(MobileNetworkListFragment.class.getName());
     }
+
+    @Test
+    public void addButton_noSubscriptionsSingleSimMode_noAddClickListener() {
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_oneSubscriptionSingleSimMode_noAddClickListener() {
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_noSubscriptionsMultiSimMode_hasAddClickListenerAndPrefDisabled() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        assertThat(mPreference.isEnabled()).isFalse();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_oneSubscriptionMultiSimMode_hasAddClickListener() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_twoSubscriptionsMultiSimMode_hasAddClickListener() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/OWNERS b/tests/robotests/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/tests/robotests/src/com/android/settings/notification/OWNERS
+++ b/tests/robotests/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java b/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
deleted file mode 100644
index befac3f..0000000
--- a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2017 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.widget;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_START;
-import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.view.View;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class ActionBarShadowControllerTest {
-
-    @Mock
-    private RecyclerView mRecyclerView;
-    @Mock
-    private Activity mActivity;
-    @Mock
-    private ActionBar mActionBar;
-    private Lifecycle mLifecycle;
-    private LifecycleOwner mLifecycleOwner;
-    private View mView;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        when(mActivity.getActionBar()).thenReturn(mActionBar);
-        mView = new View(RuntimeEnvironment.application);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-    }
-
-    @Test
-    public void attachToRecyclerView_shouldAddScrollWatcherAndUpdateActionBar() {
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(false);
-
-        ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
-
-        verify(mActionBar).setElevation(ActionBarShadowController.ELEVATION_LOW);
-    }
-
-    @Test
-    public void attachToRecyclerView_customViewAsActionBar_shouldUpdateElevationOnScroll() {
-        // Setup
-        mView.setElevation(50);
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(false);
-        final ActionBarShadowController controller =
-                ActionBarShadowController.attachToRecyclerView(mView, mLifecycle, mRecyclerView);
-        assertThat(mView.getElevation()).isEqualTo(ActionBarShadowController.ELEVATION_LOW);
-
-        // Scroll
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(true);
-        controller.mScrollChangeWatcher.onScrolled(mRecyclerView, 10 /* dx */, 10 /* dy */);
-        assertThat(mView.getElevation()).isEqualTo(ActionBarShadowController.ELEVATION_HIGH);
-    }
-
-    @Test
-    public void attachToRecyclerView_lifecycleChange_shouldAttachDetach() {
-        ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
-
-        verify(mRecyclerView).addOnScrollListener(any());
-
-        mLifecycle.handleLifecycleEvent(ON_START);
-        mLifecycle.handleLifecycleEvent(ON_STOP);
-        verify(mRecyclerView).removeOnScrollListener(any());
-
-        mLifecycle.handleLifecycleEvent(ON_START);
-        verify(mRecyclerView, times(2)).addOnScrollListener(any());
-    }
-
-    @Test
-    public void onScrolled_nullAnchorViewAndActivity_shouldNotCrash() {
-        final Activity activity = null;
-        final ActionBarShadowController controller =
-                ActionBarShadowController.attachToRecyclerView(activity, mLifecycle, mRecyclerView);
-
-        // Scroll
-        controller.mScrollChangeWatcher.onScrolled(mRecyclerView, 10 /* dx */, 10 /* dy */);
-        // no crash
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java
new file mode 100644
index 0000000..3fccb34
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.widget;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+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.view.View;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import androidx.preference.PreferenceViewHolder;
+
+@RunWith(RobolectricTestRunner.class)
+public class AddPreferenceTest {
+
+    private Context mContext;
+    private PreferenceViewHolder mViewHolder;
+    private View mWidgetFrame;
+    private View mAddWidget;
+    private AddPreference mPreference;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        mPreference = new AddPreference(mContext, null);
+
+        final View view = spy(View.inflate(mContext, mPreference.getLayoutResource(), null));
+        mViewHolder = PreferenceViewHolder.createInstanceForTests(view);
+        mWidgetFrame = view.findViewById(android.R.id.widget_frame);
+        mAddWidget = spy(View.inflate(mContext, mPreference.getSecondTargetResId(), null));
+        when(mViewHolder.findViewById(mPreference.getAddWidgetResId())).thenReturn(mAddWidget);
+    }
+
+    @Test
+    public void onBindViewHolder_noListener_addButtonNotVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void onBindViewHolder_hasListener_addButtonVisible() {
+        mPreference.setOnAddClickListener(p -> {});
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerAddedAfterBinding_addButtonBecomesVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        mPreference.setOnAddClickListener(p -> {});
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerRemovedAfterBinding_addButtonNotVisible() {
+        mPreference.setOnAddClickListener(p -> {});
+
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.setOnAddClickListener(null);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerAddedAndRemovedAfterBinding_addButtonNotVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        mPreference.setOnAddClickListener(p -> {});
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.setOnAddClickListener(null);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void onClick_noListener_noCrash() {
+        mPreference.onBindViewHolder(mViewHolder);
+        // should be no crash here
+        mPreference.onClick(mAddWidget);
+    }
+
+    @Test
+    public void onClick_hasListenerBeforeBind_firesCorrectly() {
+        final AddPreference.OnAddClickListener listener = mock(
+                AddPreference.OnAddClickListener.class);
+        mPreference.setOnAddClickListener(listener);
+
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.onClick(mAddWidget);
+        verify(listener).onAddClick(eq(mPreference));
+    }
+
+    @Test
+    public void onClick_listenerAddedAfterBind_firesCorrectly() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        final AddPreference.OnAddClickListener listener = mock(
+                AddPreference.OnAddClickListener.class);
+        mPreference.setOnAddClickListener(listener);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.onClick(mAddWidget);
+        verify(listener).onAddClick(eq(mPreference));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
index c4a5c78..85d7726 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
@@ -29,6 +29,7 @@
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.IntentFilter;
+import android.content.res.Resources;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.provider.Settings;
@@ -65,6 +66,8 @@
     private Preference mMacPreference;
     @Mock
     private WifiInfo mWifiInfo;
+    @Mock
+    private Resources mResources;
 
     private Lifecycle mLifecycle;
     private LifecycleOwner mLifecycleOwner;
@@ -82,6 +85,7 @@
                 .thenReturn(mIpPreference);
         when(mWifiManager.getConnectionInfo()).thenReturn(mWifiInfo);
         when(mWifiManager.getCurrentNetwork()).thenReturn(null);
+        when(mContext.getResources()).thenReturn(mResources);
         mController = new WifiInfoPreferenceController(mContext, mLifecycle, mWifiManager);
     }
 
@@ -117,8 +121,9 @@
 
     @Test
     public void updateWifiInfo_nullWifiInfoWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiManager.getConnectionInfo()).thenReturn(null);
 
@@ -129,8 +134,9 @@
 
     @Test
     public void updateWifiInfo_nullMacWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(null);
 
@@ -141,8 +147,9 @@
 
     @Test
     public void updateWifiInfo_defaultMacWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(WifiInfo.DEFAULT_MAC_ADDRESS);
 
@@ -153,8 +160,9 @@
 
     @Test
     public void updateWifiInfo_validMacWithMacRandomizationOff_setValidMac() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(TEST_MAC_ADDRESS);
 
@@ -165,8 +173,9 @@
 
     @Test
     public void updateWifiInfo_nullWifiInfoWithMacRandomizationOn_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiManager.getConnectionInfo()).thenReturn(null);
 
@@ -177,8 +186,9 @@
 
     @Test
     public void updateWifiInfo_nullMacWithMacRandomizationOn_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(null);
 
@@ -189,8 +199,9 @@
 
     @Test
     public void updateWifiInfo_defaultMacWithMacRandomizationOn_setMacRandomized() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(WifiInfo.DEFAULT_MAC_ADDRESS);
 
@@ -201,8 +212,9 @@
 
     @Test
     public void updateWifiInfo_validMacWithMacRandomizationOn_setValidMac() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(TEST_MAC_ADDRESS);
 
diff --git a/tests/unit/src/com/android/settings/notification/OWNERS b/tests/unit/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/tests/unit/src/com/android/settings/notification/OWNERS
+++ b/tests/unit/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file