Merge "Update string for work profile face unlock" into qt-r1-dev
diff --git a/res/layout/dialog_back_gesture_sensitivity.xml b/res/layout/dialog_back_gesture_sensitivity.xml
new file mode 100644
index 0000000..37ef771
--- /dev/null
+++ b/res/layout/dialog_back_gesture_sensitivity.xml
@@ -0,0 +1,67 @@
+<?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
+  -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:padding="12dp">
+
+    <SeekBar
+        android:id="@+id/back_sensitivity_seekbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:min="0"
+        android:max="3"
+        style="@android:style/Widget.Material.SeekBar.Discrete"
+        android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_marginTop="2dp"
+        android:layout_marginBottom="8dp">
+
+        <TextView android:id="@+id/low_tick"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_weight="1"
+                  android:layout_marginBottom="2dp"
+                  android:layout_marginStart="12dp"
+                  android:gravity="start"
+                  android:text="@string/low_label"
+                  android:textAppearance="?android:attr/textAppearance"
+                  android:singleLine="true"
+                  android:ellipsize="marquee" />
+
+        <TextView android:id="@+id/high_tick"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_weight="1"
+                  android:layout_marginBottom="2dp"
+                  android:layout_marginEnd="12dp"
+                  android:gravity="end"
+                  android:text="@string/high_label"
+                  android:textAppearance="?android:attr/textAppearance"
+                  android:singleLine="true"
+                  android:ellipsize="marquee" />
+
+    </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index fbf1a24..f31a266 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -411,4 +411,7 @@
 
     <!-- Maximum height for SliceView, override on slices/view/src/main/res/values/dimens.xml -->
     <dimen name="abc_slice_large_height">480dp</dimen>
+
+    <!-- System navigation settings illustration height -->
+    <dimen name="system_navigation_illustration_height">320dp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7656253..e077ff8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5117,7 +5117,7 @@
     <!-- Title for a warning about security implications of enabling an accessibility
          service. [CHAR LIMIT=NONE] -->
     <string name="enable_service_title">Allow
-         <xliff:g id="service" example="TalkBack">%1$s</xliff:g> to have full contol of your
+         <xliff:g id="service" example="TalkBack">%1$s</xliff:g> to have full control of your
         device?</string>
     <!-- Title for the list of capabilities of an accessibility service. -->
     <string name="capabilities_list_title"><xliff:g id="service" example="TalkBack">%1$s</xliff:g>
@@ -5174,7 +5174,7 @@
     </string>
 
     <!-- Title for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_service_action_perform_title">View and platform actions</string>
+    <string name="accessibility_service_action_perform_title">View and perform actions</string>
 
     <!-- Description for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_service_action_perform_description">It can track your interactions
@@ -6088,10 +6088,6 @@
     <string name="sms_access_restriction_enabled">Restrict SMS &amp; call log access</string>
     <!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
     <string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS &amp; call log permissions</string>
-    <!-- Title for the new device identifier access restrictions [CHAR LIMIT=50]-->
-    <string name="device_identifier_access_restrictions_title">Disable device identifier restrictions</string>
-    <!-- Summary for the new device identifier access restrictions [CHAR LIMIT=NONE]-->
-    <string name="device_identifier_access_restrictions_summary">Disable the new access restrictions for device identifiers</string>
 
 
     <!-- Message when there are no available trust agents to display -->
@@ -10241,6 +10237,17 @@
     <!-- Content description for the Information icon [CHAR LIMIT=30] -->
     <string name="information_label">Information</string>
 
+    <!-- Label on the left side of sensitivity adjustment slider [CHAR LIMIT=30] -->
+    <string name="low_label">Low</string>
+    <!-- Label on the right side of sensitivity adjustment slider [CHAR LIMIT=30] -->
+    <string name="high_label">High</string>
+
+    <!-- Message for the dialog that explains how increasing sensitivity can affect gestures along the edges. [CHAR LIMIT=NONE] -->
+    <string name="back_sensitivity_dialog_message">\nHigher sensitivity may conflict with any app gestures along the edges of the screen.</string>
+
+    <!-- Title for the dialog that is shown to adjust the back sensitivity [CHAR LIMIT=60] -->
+    <string name="back_sensitivity_dialog_title">Back Sensitivity</string>
+
     <!-- Preference and settings suggestion title text for ambient display double tap (phone) [CHAR LIMIT=60]-->
     <string name="ambient_display_title" product="default">Double-tap to check phone</string>
     <!-- Preference and settings suggestion title text for ambient display double tap (tablet) [CHAR LIMIT=60]-->
@@ -10664,12 +10671,21 @@
     <string name="game_driver_app_preference_default">Default</string>
     <!-- The game driver value for Game Driver app preference [CHAR LIMIT=50] -->
     <string name="game_driver_app_preference_game_driver">Game Driver</string>
+    <!-- The game driver value for Prerelease Game Driver app preference [CHAR LIMIT=50] -->
+    <string name="game_driver_app_preference_prerelease_driver">Prerelease Driver</string>
     <!-- The system value for Game Driver app preference [CHAR LIMIT=50] -->
     <string name="game_driver_app_preference_system">System Graphics Driver</string>
+    <!-- All the values for Game Driver all apps preference [CHAR LIMIT=50] -->
+    <string-array name="game_driver_all_apps_preference_values">
+        <item>@string/game_driver_app_preference_default</item>
+        <item>@string/game_driver_app_preference_game_driver</item>
+        <item>@string/game_driver_app_preference_prerelease_driver</item>
+    </string-array>
     <!-- All the values for Game Driver app preference [CHAR LIMIT=50] -->
     <string-array name="game_driver_app_preference_values">
         <item>@string/game_driver_app_preference_default</item>
         <item>@string/game_driver_app_preference_game_driver</item>
+        <item>@string/game_driver_app_preference_prerelease_driver</item>
         <item>@string/game_driver_app_preference_system</item>
     </string-array>
 
diff --git a/res/xml/adaptive_sleep_detail.xml b/res/xml/adaptive_sleep_detail.xml
index 606bb55..568e694 100644
--- a/res/xml/adaptive_sleep_detail.xml
+++ b/res/xml/adaptive_sleep_detail.xml
@@ -28,6 +28,14 @@
         settings:preview="@drawable/adaptive_sleep"
         settings:controller="com.android.settings.widget.VideoPreferenceController"/>
 
+    <Preference
+        android:key="adaptive_sleep_permission"
+        android:title="@string/adaptive_sleep_title_no_permission"
+        android:summary="@string/adaptive_sleep_summary_no_permission"
+        android:icon="@drawable/ic_info_outline_24"
+        settings:controller="com.android.settings.display.AdaptiveSleepPermissionPreferenceController"
+    />
+
     <com.android.settingslib.RestrictedSwitchPreference
         android:key="adaptive_sleep"
         android:title="@string/adaptive_sleep_title"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index b819dbb..7cf52fa 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -562,11 +562,6 @@
             android:summary="@string/sms_access_restriction_enabled_summary" />
 
         <SwitchPreference
-            android:key="device_identifier_access_restrictions"
-            android:title="@string/device_identifier_access_restrictions_title"
-            android:summary="@string/device_identifier_access_restrictions_summary" />
-
-        <SwitchPreference
             android:key="notification_bubbles"
             android:title="@string/notification_bubbles_title"
             android:summary="@string/notification_bubbles_developer_setting_summary"/>
diff --git a/res/xml/game_driver_settings.xml b/res/xml/game_driver_settings.xml
index a04724a..6daeefb 100644
--- a/res/xml/game_driver_settings.xml
+++ b/res/xml/game_driver_settings.xml
@@ -21,11 +21,14 @@
     android:key="game_driver_settings"
     android:title="@string/game_driver_dashboard_title">
 
-    <SwitchPreference
+    <ListPreference
         android:key="game_driver_all_apps_preference"
         android:title="@string/game_driver_all_apps_preference_title"
+        android:dialogTitle="@string/game_driver_all_apps_preference_title"
+        android:entries="@array/game_driver_all_apps_preference_values"
+        android:entryValues="@array/game_driver_all_apps_preference_values"
         settings:controller="com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController">
-    </SwitchPreference>
+    </ListPreference>
 
     <PreferenceCategory
         android:key="game_driver_category"
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index 7057ec5..aa789b9 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -62,14 +62,6 @@
         android:summary="@string/summary_placeholder"
         settings:searchable="false"/>
 
-    <!-- Bypass lock screen -->
-    <SwitchPreference
-        android:key="privacy_lockscreen_bypass"
-        android:title="@string/lockscreen_bypass_title"
-        android:summary="@string/lockscreen_bypass_summary"
-        settings:keywords="@string/keywords_lockscreen_bypass"
-        settings:controller="com.android.settings.security.LockscreenBypassPreferenceController" />
-
     <!-- Privacy Service -->
     <PreferenceCategory
         android:key="privacy_services"
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index 69e8a3b..611d33f 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -30,13 +30,6 @@
             android:summary="@string/summary_placeholder"
             settings:keywords="@string/keywords_lock_screen_notif"/>
 
-        <SwitchPreference
-            android:key="security_lockscreen_bypass"
-            android:title="@string/lockscreen_bypass_title"
-            android:summary="@string/lockscreen_bypass_summary"
-            settings:searchable="false"
-            settings:controller="com.android.settings.security.LockscreenBypassPreferenceController" />
-
         <com.android.settingslib.RestrictedSwitchPreference
             android:key="security_lockscreen_add_users_when_locked"
             android:title="@string/user_add_on_lockscreen_menu"
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index fc812f4..862c1a5 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="security_settings_face_settings_page"
     android:title="@string/security_settings_face_preference_title">
 
@@ -39,6 +40,12 @@
             android:title="@string/security_settings_face_settings_use_face_for_apps"
             app:keywords="@string/keywords_face_unlock"
             app:controller="com.android.settings.biometrics.face.FaceSettingsAppPreferenceController"/>
+        <SwitchPreference
+            android:key="security_lockscreen_bypass"
+            android:title="@string/lockscreen_bypass_title"
+            android:summary="@string/lockscreen_bypass_summary"
+            settings:searchable="false"
+            settings:controller="com.android.settings.biometrics.face.FaceSettingsLockscreenBypassPreferenceController" />
     </PreferenceCategory>
 
     <PreferenceCategory
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index d5414c9..d94686e 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -47,6 +47,8 @@
     private boolean mHasPassword;
     private boolean mBiometricUnlockDisabledByAdmin;
     private TextView mErrorText;
+    protected boolean mConfirmingCredentials;
+    protected boolean mNextClicked;
 
     /**
      * @return true if the biometric is disabled by a device administrator
@@ -149,10 +151,12 @@
 
         if (!mHasPassword) {
             // No password registered, launch into enrollment wizard.
+            mConfirmingCredentials = true;
             launchChooseLock();
         } else if (mToken == null) {
             // It's possible to have a token but mLaunchedConfirmLock == false, since
             // ChooseLockGeneric can pass us a token.
+            mConfirmingCredentials = true;
             launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
         }
     }
@@ -182,6 +186,7 @@
 
     @Override
     protected void onNextButtonClick(View view) {
+        mNextClicked = true;
         if (checkMaxEnrolled() == 0) {
             // Lock thingy is already set up, launch directly to the next page
             launchNextEnrollingActivity(mToken);
@@ -249,12 +254,14 @@
                 mToken = data.getByteArrayExtra(
                         ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
                 overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+                mConfirmingCredentials = false;
                 return;
             } else {
                 setResult(resultCode, data);
                 finish();
             }
         } else if (requestCode == CONFIRM_REQUEST) {
+            mConfirmingCredentials = false;
             if (resultCode == RESULT_OK && data != null) {
                 mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
                 overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 16b0fcb..4bf5a1d 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -61,6 +61,7 @@
     private Handler mHandler;
     private Intent mResultIntent;
     private TextView mDescriptionText;
+    private boolean mNextClicked;
 
     private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
             new CompoundButton.OnCheckedChangeListener() {
@@ -185,6 +186,17 @@
     }
 
     @Override
+    protected void onStop() {
+        super.onStop();
+
+        if (!isChangingConfigurations() && !WizardManagerHelper.isAnySetupWizard(getIntent())
+                && !mNextClicked) {
+            setResult(RESULT_SKIP);
+            finish();
+        }
+    }
+
+    @Override
     protected void onNextButtonClick(View view) {
         final Intent intent = new Intent();
         if (mToken != null) {
@@ -193,6 +205,7 @@
         if (mUserId != UserHandle.USER_NULL) {
             intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
         }
+        intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary);
         final String flattenedString = getString(R.string.config_face_enroll);
         if (!TextUtils.isEmpty(flattenedString)) {
             ComponentName componentName = ComponentName.unflattenFromString(flattenedString);
@@ -204,6 +217,7 @@
         if (mResultIntent != null) {
             intent.putExtras(mResultIntent);
         }
+        mNextClicked = true;
         WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
         startActivityForResult(intent, BIOMETRIC_FIND_SENSOR_REQUEST);
     }
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index 525c1a3..6686c96 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -78,6 +78,16 @@
     }
 
     @Override
+    protected void onStop() {
+        super.onStop();
+
+        if (!isChangingConfigurations() && !mConfirmingCredentials && !mNextClicked
+                && !WizardManagerHelper.isAnySetupWizard(getIntent())) {
+            finish();
+        }
+    }
+
+    @Override
     protected boolean isDisabledByAdmin() {
         return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
                 this, DevicePolicyManager.KEYGUARD_DISABLE_FACE, mUserId) != null;
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 2ec5f7a..b33c104 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -128,8 +128,10 @@
         Preference appPref = findPreference(FaceSettingsAppPreferenceController.KEY);
         Preference attentionPref = findPreference(FaceSettingsAttentionPreferenceController.KEY);
         Preference confirmPref = findPreference(FaceSettingsConfirmPreferenceController.KEY);
+        Preference bypassPref =
+                findPreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
         mTogglePreferences = new ArrayList<>(
-                Arrays.asList(keyguardPref, appPref, attentionPref, confirmPref));
+                Arrays.asList(keyguardPref, appPref, attentionPref, confirmPref, bypassPref));
 
         mRemoveButton = findPreference(FaceSettingsRemoveButtonPreferenceController.KEY);
         mEnrollButton = findPreference(FaceSettingsEnrollButtonPreferenceController.KEY);
@@ -147,6 +149,7 @@
         // Don't show keyguard controller for work profile settings.
         if (mUserManager.isManagedProfile(mUserId)) {
             removePreference(FaceSettingsKeyguardPreferenceController.KEY);
+            removePreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
         }
 
         if (savedInstanceState != null) {
@@ -253,6 +256,7 @@
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         controllers.add(new FaceSettingsVideoPreferenceController(context));
         controllers.add(new FaceSettingsKeyguardPreferenceController(context));
+        controllers.add(new FaceSettingsLockscreenBypassPreferenceController(context));
         controllers.add(new FaceSettingsAppPreferenceController(context));
         controllers.add(new FaceSettingsAttentionPreferenceController(context));
         controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceController.java
index c64455a..9ec1ad1 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceController.java
@@ -18,16 +18,13 @@
 
 import static android.provider.Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED;
 
-import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.hardware.face.FaceManager;
-import android.os.UserHandle;
 import android.provider.Settings;
 
 import androidx.preference.Preference;
 
 import com.android.settings.Utils;
-import com.android.settings.core.TogglePreferenceController;
 
 /**
  * Preference controller for Face settings page controlling the ability to unlock the phone
@@ -87,13 +84,4 @@
             preference.setEnabled(true);
         }
     }
-
-    private boolean adminDisabled() {
-        DevicePolicyManager dpm =
-                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
-        return dpm != null &&
-                (dpm.getKeyguardDisabledFeatures(null, UserHandle.myUserId())
-                        & DevicePolicyManager.KEYGUARD_DISABLE_FACE)
-                        != 0;
-    }
 }
diff --git a/src/com/android/settings/security/LockscreenBypassPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
similarity index 66%
rename from src/com/android/settings/security/LockscreenBypassPreferenceController.java
rename to src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
index dfa127b..8d1b543 100644
--- a/src/com/android/settings/security/LockscreenBypassPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
@@ -11,25 +11,33 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.settings.security;
+package com.android.settings.biometrics.face;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.hardware.face.FaceManager;
 import android.provider.Settings;
 
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.core.TogglePreferenceController;
+import androidx.preference.Preference;
 
-public class LockscreenBypassPreferenceController extends TogglePreferenceController {
+import com.android.internal.annotations.VisibleForTesting;
+
+public class FaceSettingsLockscreenBypassPreferenceController
+        extends FaceSettingsPreferenceController {
+
+    static final String KEY = "security_lockscreen_bypass";
 
     @VisibleForTesting
     protected FaceManager mFaceManager;
 
-    public LockscreenBypassPreferenceController(Context context, String preferenceKey) {
+    public FaceSettingsLockscreenBypassPreferenceController(Context context) {
+        this(context, KEY);
+    }
+
+    public FaceSettingsLockscreenBypassPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
         if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
             mFaceManager = context.getSystemService(FaceManager.class);
@@ -52,6 +60,20 @@
     }
 
     @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        if (!FaceSettings.isAvailable(mContext)) {
+            preference.setEnabled(false);
+        } else if (adminDisabled()) {
+            preference.setEnabled(false);
+        } else if (!mFaceManager.hasEnrolledTemplates(getUserId())) {
+            preference.setEnabled(false);
+        } else {
+            preference.setEnabled(true);
+        }
+    }
+
+    @Override
     public int getAvailabilityStatus() {
         if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
             return mFaceManager.hasEnrolledTemplates() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
index b8ac118..55e093b 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
@@ -16,7 +16,9 @@
 
 package com.android.settings.biometrics.face;
 
+import android.app.admin.DevicePolicyManager;
 import android.content.Context;
+import android.os.UserHandle;
 
 import com.android.settings.core.TogglePreferenceController;
 
@@ -38,4 +40,13 @@
     protected int getUserId() {
         return mUserId;
     }
+
+    protected boolean adminDisabled() {
+        DevicePolicyManager dpm =
+                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+        return dpm != null &&
+                (dpm.getKeyguardDisabledFeatures(null, UserHandle.myUserId())
+                        & DevicePolicyManager.KEYGUARD_DISABLE_FACE)
+                        != 0;
+    }
 }
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index b253702..f384d85 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -480,7 +480,6 @@
         controllers.add(new ResizableActivityPreferenceController(context));
         controllers.add(new FreeformWindowsPreferenceController(context));
         controllers.add(new DesktopModePreferenceController(context));
-        controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
         controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
         controllers.add(new BubbleGlobalPreferenceController(context));
         controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
diff --git a/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
deleted file mode 100644
index f4e5953..0000000
--- a/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.development;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.provider.DeviceConfig;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.Utils;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class DeviceIdentifierAccessRestrictionsPreferenceController
-        extends DeveloperOptionsPreferenceController
-        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
-
-    private static final String DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY =
-            "device_identifier_access_restrictions";
-
-    // The settings that should be set when the new device identifier access restrictions are
-    // disabled.
-    private static final String[] RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS = {
-            Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED,
-            Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED,
-            Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED
-    };
-
-    private ContentResolver mContentResolver;
-
-    public DeviceIdentifierAccessRestrictionsPreferenceController(Context context) {
-        super(context);
-        mContentResolver = context.getContentResolver();
-    }
-
-    @Override
-    public boolean isAvailable() {
-        // If the new access restrictions have been disabled from the server side then do not
-        // display the option.
-        boolean disabledFromServerSide = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
-                        Utils.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED, false);
-        return !disabledFromServerSide;
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY;
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        writeSetting((boolean) newValue);
-        return true;
-    }
-
-    private void writeSetting(boolean isEnabled) {
-        for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
-            Settings.Global.putInt(mContentResolver, relaxCheckSetting, isEnabled ? 1 : 0);
-        }
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        boolean isEnabled = true;
-        for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
-            if (Settings.Global.getInt(mContentResolver, relaxCheckSetting, 0) == 0) {
-                isEnabled = false;
-                break;
-            }
-        }
-        ((SwitchPreference) mPreference).setChecked(isEnabled);
-    }
-
-    @Override
-    protected void onDeveloperOptionsSwitchDisabled() {
-        super.onDeveloperOptionsSwitchDisabled();
-        writeSetting(false);
-        ((SwitchPreference) mPreference).setChecked(false);
-    }
-}
diff --git a/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceController.java b/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceController.java
index 09659be..489408d 100644
--- a/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceController.java
+++ b/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceController.java
@@ -64,12 +64,14 @@
     private final String mPreferenceTitle;
     private final String mPreferenceDefault;
     private final String mPreferenceGameDriver;
+    private final String mPreferencePrereleaseDriver;
     private final String mPreferenceSystem;
     @VisibleForTesting
     GameDriverContentObserver mGameDriverContentObserver;
 
     private final List<AppInfo> mAppInfos;
     private final Set<String> mDevOptInApps;
+    private final Set<String> mDevPrereleaseOptInApps;
     private final Set<String> mDevOptOutApps;
 
     private PreferenceGroup mPreferenceGroup;
@@ -88,6 +90,8 @@
         mPreferenceDefault = resources.getString(R.string.game_driver_app_preference_default);
         mPreferenceGameDriver =
                 resources.getString(R.string.game_driver_app_preference_game_driver);
+        mPreferencePrereleaseDriver =
+                resources.getString(R.string.game_driver_app_preference_prerelease_driver);
         mPreferenceSystem = resources.getString(R.string.game_driver_app_preference_system);
 
         // TODO: Move this task to background if there's potential ANR/Jank.
@@ -96,6 +100,8 @@
 
         mDevOptInApps =
                 getGlobalSettingsString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS);
+        mDevPrereleaseOptInApps = getGlobalSettingsString(
+                mContentResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS);
         mDevOptOutApps =
                 getGlobalSettingsString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS);
     }
@@ -147,21 +153,31 @@
         // opt-in and opt-out apps. Then set the new summary text.
         if (value.equals(mPreferenceSystem)) {
             mDevOptInApps.remove(packageName);
+            mDevPrereleaseOptInApps.remove(packageName);
             mDevOptOutApps.add(packageName);
         } else if (value.equals(mPreferenceGameDriver)) {
             mDevOptInApps.add(packageName);
+            mDevPrereleaseOptInApps.remove(packageName);
+            mDevOptOutApps.remove(packageName);
+        } else if (value.equals(mPreferencePrereleaseDriver)) {
+            mDevOptInApps.remove(packageName);
+            mDevPrereleaseOptInApps.add(packageName);
             mDevOptOutApps.remove(packageName);
         } else {
             mDevOptInApps.remove(packageName);
+            mDevPrereleaseOptInApps.remove(packageName);
             mDevOptOutApps.remove(packageName);
         }
         listPref.setValue(value);
         listPref.setSummary(value);
 
-        // Push the updated Sets for opt-in and opt-out apps to
-        // corresponding Settings.Global.GAME_DRIVER_OPT_(IN|OUT)_APPS
+        // Push the updated Sets for stable/prerelease opt-in and opt-out apps to
+        // corresponding Settings.Global.GAME_DRIVER(_PRERELEASE)?_OPT_(IN|OUT)_APPS
         Settings.Global.putString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS,
                 String.join(",", mDevOptInApps));
+        Settings.Global.putString(mContentResolver,
+                Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS,
+                String.join(",", mDevPrereleaseOptInApps));
         Settings.Global.putString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS,
                 String.join(",", mDevOptOutApps));
 
@@ -233,10 +249,13 @@
         listPreference.setEntryValues(mEntryList);
 
         // Initialize preference default and summary with the opt in/out choices
-        // from Settings.Global.GAME_DRIVER_OPT_(IN|OUT)_APPS
+        // from Settings.Global.GAME_DRIVER(_PRERELEASE)?_OPT_(IN|OUT)_APPS
         if (mDevOptOutApps.contains(packageName)) {
             listPreference.setValue(mPreferenceSystem);
             listPreference.setSummary(mPreferenceSystem);
+        } else if (mDevPrereleaseOptInApps.contains(packageName)) {
+            listPreference.setValue(mPreferencePrereleaseDriver);
+            listPreference.setSummary(mPreferencePrereleaseDriver);
         } else if (mDevOptInApps.contains(packageName)) {
             listPreference.setValue(mPreferenceGameDriver);
             listPreference.setSummary(mPreferenceGameDriver);
diff --git a/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java b/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
index dd48f69..290e4b2 100644
--- a/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
+++ b/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
@@ -18,15 +18,17 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.os.Handler;
 import android.os.Looper;
 import android.provider.Settings;
 
 import androidx.annotation.VisibleForTesting;
+import androidx.preference.ListPreference;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
 
+import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnStart;
@@ -43,19 +45,30 @@
 
     public static final int GAME_DRIVER_DEFAULT = 0;
     public static final int GAME_DRIVER_ALL_APPS = 1;
-    public static final int GAME_DRIVER_OFF = 2;
+    public static final int GAME_DRIVER_PRERELEASE_ALL_APPS = 2;
+    public static final int GAME_DRIVER_OFF = 3;
 
     private final Context mContext;
     private final ContentResolver mContentResolver;
+    private final String mPreferenceDefault;
+    private final String mPreferenceGameDriver;
+    private final String mPreferencePrereleaseDriver;
     @VisibleForTesting
     GameDriverContentObserver mGameDriverContentObserver;
 
-    private SwitchPreference mPreference;
+    private ListPreference mPreference;
 
     public GameDriverEnableForAllAppsPreferenceController(Context context, String key) {
         super(context, key);
         mContext = context;
         mContentResolver = context.getContentResolver();
+
+        final Resources resources = context.getResources();
+        mPreferenceDefault = resources.getString(R.string.game_driver_app_preference_default);
+        mPreferenceGameDriver =
+                resources.getString(R.string.game_driver_app_preference_game_driver);
+        mPreferencePrereleaseDriver =
+                resources.getString(R.string.game_driver_app_preference_prerelease_driver);
         mGameDriverContentObserver =
                 new GameDriverContentObserver(new Handler(Looper.getMainLooper()), this);
     }
@@ -89,31 +102,44 @@
 
     @Override
     public void updateState(Preference preference) {
-        final SwitchPreference switchPreference = (SwitchPreference) preference;
-        switchPreference.setVisible(isAvailable());
-        switchPreference.setChecked(
-                Settings.Global.getInt(
-                        mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
-                == GAME_DRIVER_ALL_APPS);
+        final ListPreference listPref = (ListPreference) preference;
+        listPref.setVisible(isAvailable());
+        final int currentChoice = Settings.Global.getInt(
+                mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+        if (currentChoice == GAME_DRIVER_ALL_APPS) {
+            listPref.setValue(mPreferenceGameDriver);
+            listPref.setSummary(mPreferenceGameDriver);
+        } else if (currentChoice == GAME_DRIVER_PRERELEASE_ALL_APPS) {
+            listPref.setValue(mPreferencePrereleaseDriver);
+            listPref.setSummary(mPreferencePrereleaseDriver);
+        } else {
+            listPref.setValue(mPreferenceDefault);
+            listPref.setSummary(mPreferenceDefault);
+        }
     }
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
-        final boolean isChecked = (boolean) newValue;
-        final int gameDriver = Settings.Global.getInt(
+        final ListPreference listPref = (ListPreference) preference;
+        final String value = newValue.toString();
+        final int currentChoice = Settings.Global.getInt(
                 mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
-
-        if (isChecked && gameDriver == GAME_DRIVER_ALL_APPS) {
-            return true;
+        final int userChoice;
+        if (value.equals(mPreferenceGameDriver)) {
+            userChoice = GAME_DRIVER_ALL_APPS;
+        } else if (value.equals(mPreferencePrereleaseDriver)) {
+            userChoice = GAME_DRIVER_PRERELEASE_ALL_APPS;
+        } else {
+            userChoice = GAME_DRIVER_DEFAULT;
         }
+        listPref.setValue(value);
+        listPref.setSummary(value);
 
-        if (!isChecked && (gameDriver == GAME_DRIVER_DEFAULT || gameDriver == GAME_DRIVER_OFF)) {
-            return true;
+        if (userChoice != currentChoice) {
+            Settings.Global.putInt(
+                    mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, userChoice);
         }
 
-        Settings.Global.putInt(mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS,
-                isChecked ? GAME_DRIVER_ALL_APPS : GAME_DRIVER_DEFAULT);
-
         return true;
     }
 
diff --git a/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java b/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
index d84c28f..15f71e0 100644
--- a/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
+++ b/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
@@ -19,6 +19,7 @@
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
+import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_PRERELEASE_ALL_APPS;
 
 import android.content.ContentResolver;
 import android.content.Context;
@@ -83,7 +84,8 @@
                 mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
 
         if (isChecked
-                && (gameDriver == GAME_DRIVER_DEFAULT || gameDriver == GAME_DRIVER_ALL_APPS)) {
+                && (gameDriver == GAME_DRIVER_DEFAULT || gameDriver == GAME_DRIVER_ALL_APPS
+                        || gameDriver == GAME_DRIVER_PRERELEASE_ALL_APPS)) {
             return true;
         }
 
diff --git a/src/com/android/settings/display/AdaptiveSleepDetailPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepDetailPreferenceController.java
index ab7465c..0e2358c 100644
--- a/src/com/android/settings/display/AdaptiveSleepDetailPreferenceController.java
+++ b/src/com/android/settings/display/AdaptiveSleepDetailPreferenceController.java
@@ -21,11 +21,9 @@
 import androidx.preference.Preference;
 
 public class AdaptiveSleepDetailPreferenceController extends AdaptiveSleepPreferenceController {
-    private final Context mContext;
 
     public AdaptiveSleepDetailPreferenceController(Context context, String key) {
         super(context, key);
-        mContext = context;
     }
 
     @Override
@@ -45,7 +43,6 @@
     @Override
     public void updateState(Preference preference) {
         super.updateState(preference);
-        preference.setEnabled(AdaptiveSleepPreferenceController.hasSufficientPermission(
-                mContext.getPackageManager()));
+        preference.setEnabled(hasSufficientPermission(mContext.getPackageManager()));
     }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java
new file mode 100644
index 0000000..9e6bca4
--- /dev/null
+++ b/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java
@@ -0,0 +1,63 @@
+/*
+ * 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.display;
+
+import static com.android.settings.display.AdaptiveSleepPreferenceController.hasSufficientPermission;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class AdaptiveSleepPermissionPreferenceController extends BasePreferenceController {
+    final static String PREF_NAME = "adaptive_sleep_permission";
+    private final Intent mIntent;
+
+    public AdaptiveSleepPermissionPreferenceController(Context context, String key) {
+        super(context, key);
+        final String packageName = context.getPackageManager().getAttentionServicePackageName();
+        mIntent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+        mIntent.setData(Uri.parse("package:" + packageName));
+    }
+
+    @Override
+    @AvailabilityStatus
+    public int getAvailabilityStatus() {
+        return AVAILABLE_UNSEARCHABLE;
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
+            mContext.startActivity(mIntent);
+            return true;
+        }
+        return super.handlePreferenceTreeClick(preference);
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
+            preference.setVisible(!hasSufficientPermission(mContext.getPackageManager()));
+        }
+    }
+}
diff --git a/src/com/android/settings/display/AdaptiveSleepSettings.java b/src/com/android/settings/display/AdaptiveSleepSettings.java
index 94abe1a..66e20b4 100644
--- a/src/com/android/settings/display/AdaptiveSleepSettings.java
+++ b/src/com/android/settings/display/AdaptiveSleepSettings.java
@@ -16,21 +16,16 @@
 
 package com.android.settings.display;
 
-import static com.android.settings.display.AdaptiveSleepPreferenceController.hasSufficientPermission;
 import static com.android.settings.homepage.contextualcards.slices.ContextualAdaptiveSleepSlice.PREF;
 import static com.android.settings.homepage.contextualcards.slices.ContextualAdaptiveSleepSlice.PREF_KEY_INTERACTED;
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.Uri;
 import android.os.Bundle;
 import android.provider.SearchIndexableResource;
 
 import androidx.preference.Preference;
 
-import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
@@ -45,11 +40,6 @@
 
     private static final String TAG = "AdaptiveSleepSettings";
     private Context mContext;
-    private String mPackageName;
-    private PackageManager mPackageManager;
-
-    @VisibleForTesting
-    Preference mPermissionRequiredPreference;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -57,15 +47,16 @@
         final FooterPreference footerPreference =
                 mFooterPreferenceMixin.createFooterPreference();
         mContext = getContext();
-        mPermissionRequiredPreference = createPermissionMissionPreference();
 
         footerPreference.setIcon(R.drawable.ic_privacy_shield_24dp);
         footerPreference.setTitle(R.string.adaptive_sleep_privacy);
 
-        getPreferenceScreen().addPreference(mPermissionRequiredPreference);
-        mPermissionRequiredPreference.setVisible(false);
-        mPackageManager = mContext.getPackageManager();
-        mPackageName = mPackageManager.getAttentionServicePackageName();
+        Preference permissionPreference = findPreference(
+                AdaptiveSleepPermissionPreferenceController.PREF_NAME);
+        if (permissionPreference != null) {
+            permissionPreference.setVisible(false);
+        }
+
         mContext.getSharedPreferences(PREF, Context.MODE_PRIVATE)
                 .edit()
                 .putBoolean(PREF_KEY_INTERACTED, true)
@@ -73,17 +64,6 @@
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
-        if (!hasSufficientPermission(mPackageManager)) {
-            mPermissionRequiredPreference.setVisible(true);
-        }
-        else {
-            mPermissionRequiredPreference.setVisible(false);
-        }
-    }
-
-    @Override
     protected int getPreferenceScreenResId() {
         return R.xml.adaptive_sleep_detail;
     }
@@ -113,29 +93,4 @@
                     return Arrays.asList(sir);
                 }
             };
-
-    private Preference createPermissionMissionPreference() {
-        Preference preference = new Preference(mContext, null);
-        preference.setIcon(R.drawable.ic_info_outline_24);
-        // Makes sure it's above the toggle.
-        preference.setOrder(1);
-        preference.setPersistent(true);
-        preference.setTitle(R.string.adaptive_sleep_title_no_permission);
-        preference.setSummary(R.string.adaptive_sleep_summary_no_permission);
-        preference.setOnPreferenceClickListener(p -> {
-            final Intent intent = new Intent(
-                    android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
-            intent.setData(Uri.parse("package:" + mPackageName));
-            mContext.startActivity(intent);
-            return true;
-        });
-        return preference;
-    }
-
-    @VisibleForTesting
-    void setupForTesting(PackageManager packageManager, Context context) {
-        mContext = context;
-        mPackageManager = packageManager;
-        mPermissionRequiredPreference = createPermissionMissionPreference();
-    }
 }
diff --git a/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java b/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java
new file mode 100644
index 0000000..164705b
--- /dev/null
+++ b/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.settings.gestures;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.om.IOverlayManager;
+import android.os.Bundle;
+import android.os.ServiceManager;
+import android.view.View;
+import android.widget.SeekBar;
+
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+
+/**
+ * Dialog to set the back gesture's sensitivity in Gesture navigation mode.
+ */
+public class GestureNavigationBackSensitivityDialog extends InstrumentedDialogFragment {
+    private static final String TAG = "GestureNavigationBackSensitivityDialog";
+    private static final String KEY_BACK_SENSITIVITY = "back_sensitivity";
+
+    public static void show(SystemNavigationGestureSettings parent, int sensitivity) {
+        if (!parent.isAdded()) {
+            return;
+        }
+
+        final GestureNavigationBackSensitivityDialog dialog =
+                new GestureNavigationBackSensitivityDialog();
+        final Bundle bundle = new Bundle();
+        bundle.putInt(KEY_BACK_SENSITIVITY, sensitivity);
+        dialog.setArguments(bundle);
+        dialog.setTargetFragment(parent, 0);
+        dialog.show(parent.getFragmentManager(), TAG);
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        // TODO(135211145): Use a separate metrics category for this dialog.
+        return SettingsEnums.SETTINGS_GESTURE_SWIPE_UP;
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        final View view = getActivity().getLayoutInflater().inflate(
+                R.layout.dialog_back_gesture_sensitivity, null);
+        final SeekBar seekBar = view.findViewById(R.id.back_sensitivity_seekbar);
+        seekBar.setProgress(getArguments().getInt(KEY_BACK_SENSITIVITY));
+        return new AlertDialog.Builder(getContext())
+                .setTitle(R.string.back_sensitivity_dialog_title)
+                .setMessage(R.string.back_sensitivity_dialog_message)
+                .setView(view)
+                .setPositiveButton(R.string.okay, (dialog, which) -> {
+                    int sensitivity = seekBar.getProgress();
+                    getArguments().putInt(KEY_BACK_SENSITIVITY, sensitivity);
+                    SystemNavigationGestureSettings.setBackSensitivity(getActivity(),
+                            getOverlayManager(), sensitivity);
+                })
+                .create();
+    }
+
+    private IOverlayManager getOverlayManager() {
+        return IOverlayManager.Stub.asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java b/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java
new file mode 100644
index 0000000..e69db27
--- /dev/null
+++ b/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.settings.gestures;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.os.Bundle;
+
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+
+/**
+ * Dialog to notify user that gesture navigation is not available because of unsupported launcher.
+ */
+public class GestureNavigationNotAvailableDialog extends InstrumentedDialogFragment {
+    private static final String TAG = "GestureNavigationNotAvailableDialog";
+
+    public static void show(SystemNavigationGestureSettings parent) {
+        if (!parent.isAdded()) {
+            return;
+        }
+
+        final GestureNavigationNotAvailableDialog dialog =
+                new GestureNavigationNotAvailableDialog();
+        dialog.setTargetFragment(parent, 0);
+        dialog.show(parent.getFragmentManager(), TAG);
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        // TODO(135211145): Use a separate metrics category for this dialog.
+        return SettingsEnums.SETTINGS_GESTURE_SWIPE_UP;
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        final Context context = getActivity();
+        final String defaultHomeAppName = SystemNavigationPreferenceController
+                .getDefaultHomeAppName(context);
+        final String message = getString(R.string.gesture_not_supported_dialog_message,
+                defaultHomeAppName);
+        return new AlertDialog.Builder(context)
+                .setMessage(message)
+                .setPositiveButton(R.string.okay, null)
+                .create();
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
index 28b76b2..b3d090d 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -23,14 +23,15 @@
 
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_GONE;
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_INFO;
+import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_SETTING;
 
-import android.app.AlertDialog;
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.om.IOverlayManager;
+import android.content.om.OverlayInfo;
 import android.graphics.drawable.Drawable;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -65,6 +66,11 @@
     private static final String TAG = "SystemNavigationGesture";
 
     @VisibleForTesting
+    static final String SHARED_PREFERENCES_NAME = "system_navigation_settings_preferences";
+    @VisibleForTesting
+    static final String PREFS_BACK_SENSITIVITY_KEY = "system_navigation_back_sensitivity";
+
+    @VisibleForTesting
     static final String KEY_SYSTEM_NAV_3BUTTONS = "system_nav_3buttons";
     @VisibleForTesting
     static final String KEY_SYSTEM_NAV_2BUTTONS = "system_nav_2buttons";
@@ -74,6 +80,25 @@
     public static final String PREF_KEY_SUGGESTION_COMPLETE =
             "pref_system_navigation_suggestion_complete";
 
+    @VisibleForTesting
+    static final String NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK
+            = "com.android.internal.systemui.navbar.gestural_narrow_back";
+    @VisibleForTesting
+    static final String NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK
+            = "com.android.internal.systemui.navbar.gestural_wide_back";
+    @VisibleForTesting
+    static final String NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK
+            = "com.android.internal.systemui.navbar.gestural_extra_wide_back";
+    @VisibleForTesting
+    static final String[] BACK_GESTURE_INSET_OVERLAYS = {
+            NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK,
+            NAV_BAR_MODE_GESTURAL_OVERLAY,
+            NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK,
+            NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK
+    };
+    @VisibleForTesting
+    static int BACK_GESTURE_INSET_DEFAULT_OVERLAY = 1;
+
     private IOverlayManager mOverlayManager;
 
     private VideoPreference mVideoPreference;
@@ -91,6 +116,9 @@
 
         mVideoPreference = new VideoPreference(context);
         setIllustrationVideo(mVideoPreference, getDefaultKey());
+        mVideoPreference.setHeight( /* Illustration height in dp */
+                getResources().getDimension(R.dimen.system_navigation_illustration_height)
+                        / getResources().getDisplayMetrics().density);
     }
 
     @Override
@@ -99,11 +127,6 @@
     }
 
     @Override
-    protected int getPreferenceScreenResId() {
-        return R.xml.system_navigation_gesture_settings;
-    }
-
-    @Override
     public void updateCandidates() {
         final String defaultKey = getDefaultKey();
         final String systemDefaultKey = getSystemDefaultKey();
@@ -126,6 +149,39 @@
     }
 
     @Override
+    public void bindPreferenceExtra(RadioButtonPreference pref,
+            String key, CandidateInfo info, String defaultKey, String systemDefaultKey) {
+        if (!(info instanceof NavModeCandidateInfo)
+                || !(pref instanceof RadioButtonPreferenceWithExtraWidget)) {
+            return;
+        }
+
+        pref.setSummary(((NavModeCandidateInfo) info).loadSummary());
+
+        RadioButtonPreferenceWithExtraWidget p = (RadioButtonPreferenceWithExtraWidget) pref;
+        if (info.getKey() == KEY_SYSTEM_NAV_GESTURAL) {
+            if (SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher(
+                    getContext())) {
+                p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING);
+                p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog
+                        .show(this, getBackSensitivity(getContext(), mOverlayManager)));
+            } else {
+                p.setEnabled(false);
+                p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_INFO);
+                p.setExtraWidgetOnClickListener((v) ->
+                        GestureNavigationNotAvailableDialog.show(this));
+            }
+        } else {
+            p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
+        }
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.system_navigation_gesture_settings;
+    }
+
+    @Override
     protected List<? extends CandidateInfo> getCandidates() {
         final Context c = getContext();
         List<NavModeCandidateInfo> candidates = new ArrayList<>();
@@ -169,7 +225,7 @@
             return false;
         }
 
-        setCurrentSystemNavigationMode(mOverlayManager, key);
+        setCurrentSystemNavigationMode(c, mOverlayManager, key);
         setIllustrationVideo(mVideoPreference, key);
         if (TextUtils.equals(KEY_SYSTEM_NAV_GESTURAL, key) && (
                 isAnyServiceSupportAccessibilityButton() || isNavBarMagnificationEnabled())) {
@@ -181,6 +237,37 @@
     }
 
     @VisibleForTesting
+    static void setBackSensitivity(Context context, IOverlayManager overlayManager,
+            int sensitivity) {
+        if (sensitivity < 0 || sensitivity >= BACK_GESTURE_INSET_OVERLAYS.length) {
+            throw new IllegalArgumentException("Sensitivity out of range.");
+        }
+
+        // Store the sensitivity level, to be able to restore when user returns to Gesture Nav mode
+        context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit()
+                .putInt(PREFS_BACK_SENSITIVITY_KEY, sensitivity).apply();
+        if (getCurrentSystemNavigationMode(context) == KEY_SYSTEM_NAV_GESTURAL) {
+            setNavBarInteractionMode(overlayManager, BACK_GESTURE_INSET_OVERLAYS[sensitivity]);
+        }
+    }
+
+    @VisibleForTesting
+    static int getBackSensitivity(Context context, IOverlayManager overlayManager) {
+        for (int i = 0; i < BACK_GESTURE_INSET_OVERLAYS.length; i++) {
+            OverlayInfo info = null;
+            try {
+                info = overlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[i], USER_CURRENT);
+            } catch (RemoteException e) { /* Do nothing */ }
+            if (info != null && info.isEnabled()) {
+                return i;
+            }
+        }
+        // If Gesture nav is not selected, read the value from shared preferences.
+        return context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+                .getInt(PREFS_BACK_SENSITIVITY_KEY, BACK_GESTURE_INSET_DEFAULT_OVERLAY);
+    }
+
+    @VisibleForTesting
     static String getCurrentSystemNavigationMode(Context context) {
         if (SystemNavigationPreferenceController.isEdgeToEdgeEnabled(context)) {
             return KEY_SYSTEM_NAV_GESTURAL;
@@ -192,10 +279,12 @@
     }
 
     @VisibleForTesting
-    static void setCurrentSystemNavigationMode(IOverlayManager overlayManager, String key) {
+    static void setCurrentSystemNavigationMode(Context context, IOverlayManager overlayManager,
+            String key) {
         switch (key) {
             case KEY_SYSTEM_NAV_GESTURAL:
-                setNavBarInteractionMode(overlayManager, NAV_BAR_MODE_GESTURAL_OVERLAY);
+                int sensitivity = getBackSensitivity(context, overlayManager);
+                setNavBarInteractionMode(overlayManager, BACK_GESTURE_INSET_OVERLAYS[sensitivity]);
                 break;
             case KEY_SYSTEM_NAV_2BUTTONS:
                 setNavBarInteractionMode(overlayManager, NAV_BAR_MODE_2BUTTON_OVERLAY);
@@ -206,10 +295,8 @@
         }
     }
 
-    /**
-     * Enables the specified overlay package.
-     */
-    static void setNavBarInteractionMode(IOverlayManager overlayManager, String overlayPackage) {
+    private static void setNavBarInteractionMode(IOverlayManager overlayManager,
+            String overlayPackage) {
         try {
             overlayManager.setEnabledExclusiveInCategory(overlayPackage, USER_CURRENT);
         } catch (RemoteException e) {
@@ -217,7 +304,7 @@
         }
     }
 
-    static void setIllustrationVideo(VideoPreference videoPref, String systemNavKey) {
+    private static void setIllustrationVideo(VideoPreference videoPref, String systemNavKey) {
         videoPref.setVideo(0, 0);
         switch (systemNavKey) {
             case KEY_SYSTEM_NAV_GESTURAL:
@@ -233,41 +320,6 @@
         }
     }
 
-    @Override
-    public void bindPreferenceExtra(RadioButtonPreference pref,
-            String key, CandidateInfo info, String defaultKey, String systemDefaultKey) {
-        if (!(info instanceof NavModeCandidateInfo)
-                || !(pref instanceof RadioButtonPreferenceWithExtraWidget)) {
-            return;
-        }
-
-        pref.setSummary(((NavModeCandidateInfo) info).loadSummary());
-
-        RadioButtonPreferenceWithExtraWidget p = (RadioButtonPreferenceWithExtraWidget) pref;
-        if (info.getKey() == KEY_SYSTEM_NAV_GESTURAL
-                && !SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher(
-                        getContext())) {
-            p.setEnabled(false);
-            p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_INFO);
-            p.setExtraWidgetOnClickListener((v) -> {
-                showGestureNavDisabledDialog();
-            });
-        } else {
-            p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
-        }
-    }
-
-    private void showGestureNavDisabledDialog() {
-        final String defaultHomeAppName = SystemNavigationPreferenceController
-                .getDefaultHomeAppName(getContext());
-        final String message = getString(R.string.gesture_not_supported_dialog_message,
-                defaultHomeAppName);
-        AlertDialog d = new AlertDialog.Builder(getContext())
-                .setMessage(message)
-                .setPositiveButton(R.string.okay, null)
-                .show();
-    }
-
     private boolean isAnyServiceSupportAccessibilityButton() {
         final AccessibilityManager ams = (AccessibilityManager) getContext().getSystemService(
                 Context.ACCESSIBILITY_SERVICE);
diff --git a/src/com/android/settings/network/telephony/DefaultSubscriptionController.java b/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
index 02a2d58..9eb5f8c 100644
--- a/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
+++ b/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
@@ -121,6 +121,11 @@
         }
         mPreference.setVisible(true);
 
+        // TODO(b/135142209) - for now we need to manually ensure we're registered as a change
+        // listener, because this might not have happened during displayPreference if
+        // getAvailabilityStatus returned CONDITIONALLY_UNAVAILABLE at the time.
+        mPreference.setOnPreferenceChangeListener(this);
+
         final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(mManager);
 
         // We'll have one entry for each available subscription, plus one for a "ask me every
diff --git a/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java b/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
index c71ee35..4d4d3ef 100644
--- a/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
@@ -114,6 +114,10 @@
         if (mSimCallManager != null) {
             Intent intent = MobileNetworkUtils.buildPhoneAccountConfigureIntent(mContext,
                     mSimCallManager);
+            if (intent == null) {
+                // Do nothing in this case since preference is invisible
+                return;
+            }
             final PackageManager pm = mContext.getPackageManager();
             List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
             preference.setTitle(resolutions.get(0).loadLabel(pm));
diff --git a/src/com/android/settings/notification/ZenModeAutomaticRulesPreferenceController.java b/src/com/android/settings/notification/ZenModeAutomaticRulesPreferenceController.java
index 499bfbc..2f62f45 100644
--- a/src/com/android/settings/notification/ZenModeAutomaticRulesPreferenceController.java
+++ b/src/com/android/settings/notification/ZenModeAutomaticRulesPreferenceController.java
@@ -69,7 +69,7 @@
             for (int i = 0; i < sortedRules.length; i++) {
                 ZenRulePreference pref = (ZenRulePreference) mPreferenceCategory.getPreference(i);
                 // we are either:
-                // 1. updating the enabled state or name of the rule
+                // 1. updating everything about the rule
                 // 2. rule was added or deleted, so reload the entire list
                 if (Objects.equals(pref.mId, sortedRules[i].getKey())) {
                     AutomaticZenRule rule = sortedRules[i].getValue();
diff --git a/src/com/android/settings/notification/ZenRulePreference.java b/src/com/android/settings/notification/ZenRulePreference.java
index 8bc602a..fb6e92a 100644
--- a/src/com/android/settings/notification/ZenRulePreference.java
+++ b/src/com/android/settings/notification/ZenRulePreference.java
@@ -49,7 +49,7 @@
     final ZenServiceListing mServiceListing;
     final PackageManager mPm;
     final MetricsFeatureProvider mMetricsFeatureProvider;
-    final AutomaticZenRule mRule;
+    AutomaticZenRule mRule;
     CharSequence mName;
 
     private Intent mIntent;
@@ -122,14 +122,14 @@
         if (!mRule.getName().equals(rule.getName())) {
             mName = rule.getName();
             setTitle(mName);
-            mRule.setName(mName.toString());
         }
 
         if (mRule.isEnabled() != rule.isEnabled()) {
-            mRule.setEnabled(rule.isEnabled());
             setChecked(mRule.isEnabled());
             setSummary(computeRuleSummary(mRule));
         }
+
+        mRule = rule;
     }
 
     @Override
diff --git a/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidget.java b/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidget.java
index 6a47ce5..19fd923 100644
--- a/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidget.java
+++ b/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidget.java
@@ -27,6 +27,7 @@
 public class RadioButtonPreferenceWithExtraWidget extends RadioButtonPreference {
     public static final int EXTRA_WIDGET_VISIBILITY_GONE = 0;
     public static final int EXTRA_WIDGET_VISIBILITY_INFO = 1;
+    public static final int EXTRA_WIDGET_VISIBILITY_SETTING = 2;
 
     private View mExtraWidgetDivider;
     private ImageView mExtraWidget;
@@ -66,6 +67,15 @@
             mExtraWidget.setClickable(true);
             mExtraWidget.setVisibility(View.VISIBLE);
             mExtraWidgetDivider.setVisibility(View.VISIBLE);
+            if (mExtraWidgetVisibility == EXTRA_WIDGET_VISIBILITY_INFO) {
+                mExtraWidget.setImageResource(R.drawable.ic_settings_about);
+                mExtraWidget.setContentDescription(
+                        getContext().getResources().getText(R.string.information_label));
+            } else if (mExtraWidgetVisibility == EXTRA_WIDGET_VISIBILITY_SETTING) {
+                mExtraWidget.setImageResource(R.drawable.ic_settings_accent);
+                mExtraWidget.setContentDescription(
+                        getContext().getResources().getText(R.string.settings_label));
+            }
         }
     }
 
diff --git a/tests/robotests/src/com/android/settings/security/LockscreenBypassPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceControllerTest.java
similarity index 89%
rename from tests/robotests/src/com/android/settings/security/LockscreenBypassPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceControllerTest.java
index 1b8817b..cbcebfc 100644
--- a/tests/robotests/src/com/android/settings/security/LockscreenBypassPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceControllerTest.java
@@ -14,7 +14,7 @@
  * limitations under the License
  */
 
-package com.android.settings.security;
+package com.android.settings.biometrics.face;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -36,14 +36,14 @@
 import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
-public class LockscreenBypassPreferenceControllerTest {
+public class FaceSettingsLockscreenBypassPreferenceControllerTest {
 
     @Mock
     private FaceManager mFaceManager;
     private SwitchPreference mPreference;
 
     private Context mContext;
-    private LockscreenBypassPreferenceController mController;
+    private FaceSettingsLockscreenBypassPreferenceController mController;
 
     @Before
     public void setUp() {
@@ -51,7 +51,7 @@
         mContext = RuntimeEnvironment.application;
         mPreference = new SwitchPreference(mContext);
 
-        mController = new LockscreenBypassPreferenceController(mContext, "TestKey");
+        mController = new FaceSettingsLockscreenBypassPreferenceController(mContext);
         ReflectionHelpers.setField(mController, "mFaceManager", mFaceManager);
     }
 
diff --git a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceControllerTest.java
index f6fa8e0..f007ce2 100644
--- a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverAppPreferenceControllerTest.java
@@ -56,7 +56,8 @@
 
     private static final int DEFAULT = 0;
     private static final int GAME_DRIVER = 1;
-    private static final int SYSTEM = 2;
+    private static final int PRERELEASE_DRIVER = 2;
+    private static final int SYSTEM = 3;
     private static final String TEST_APP_NAME = "testApp";
     private static final String TEST_PKG_NAME = "testPkg";
 
@@ -181,7 +182,7 @@
 
     @Test
     public void createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes() {
-        loadConfig(TEST_PKG_NAME, "");
+        loadConfig(TEST_PKG_NAME, "", "");
         final ListPreference preference =
                 mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
 
@@ -196,8 +197,24 @@
     }
 
     @Test
+    public void createPreference_configPRERELEASE_DRIVER_shouldSetPrereleaseDriverAttributes() {
+        loadConfig("", TEST_PKG_NAME, "");
+        final ListPreference preference =
+                mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
+
+        assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
+        assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
+        assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
+        assertThat(preference.getEntries()).isEqualTo(mValueList);
+        assertThat(preference.getEntryValues()).isEqualTo(mValueList);
+        assertThat(preference.getEntry()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
+        assertThat(preference.getValue()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
+        assertThat(preference.getSummary()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
+    }
+
+    @Test
     public void createPreference_configSystem_shouldSetSystemAttributes() {
-        loadConfig("", TEST_PKG_NAME);
+        loadConfig("", "", TEST_PKG_NAME);
         final ListPreference preference =
                 mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
 
@@ -274,10 +291,12 @@
         when(mContext.getPackageManager()).thenReturn(mPackageManager);
     }
 
-    private void loadDefaultConfig() { loadConfig("", ""); }
+    private void loadDefaultConfig() { loadConfig("", "", ""); }
 
-    private void loadConfig(String optIn, String optOut) {
+    private void loadConfig(String optIn, String prereleaseOptIn, String optOut) {
         Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS, optIn);
+        Settings.Global.putString(
+                mResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, prereleaseOptIn);
         Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS, optOut);
 
         mController = new GameDriverAppPreferenceController(mContext, "testKey");
diff --git a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
index 3d418d9..df59971 100644
--- a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
@@ -21,6 +21,7 @@
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
+import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_PRERELEASE_ALL_APPS;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -30,10 +31,13 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.provider.Settings;
 
+import androidx.preference.ListPreference;
 import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
+
+import com.android.settings.R;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -49,13 +53,16 @@
     @Mock
     private PreferenceScreen mScreen;
     @Mock
-    private SwitchPreference mPreference;
+    private ListPreference mPreference;
     @Mock
     private GameDriverContentObserver mGameDriverContentObserver;
 
     private Context mContext;
     private ContentResolver mResolver;
     private GameDriverEnableForAllAppsPreferenceController mController;
+    private String mPreferenceDefault;
+    private String mPreferenceGameDriver;
+    private String mPreferencePrereleaseDriver;
 
     @Before
     public void setUp() {
@@ -63,6 +70,13 @@
         mContext = RuntimeEnvironment.application;
         mResolver = mContext.getContentResolver();
 
+        final Resources resources = mContext.getResources();
+        mPreferenceDefault = resources.getString(R.string.game_driver_app_preference_default);
+        mPreferenceGameDriver =
+                resources.getString(R.string.game_driver_app_preference_game_driver);
+        mPreferencePrereleaseDriver =
+                resources.getString(R.string.game_driver_app_preference_prerelease_driver);
+
         Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
         Settings.Global.putInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
@@ -95,12 +109,13 @@
     }
 
     @Test
-    public void displayPreference_shouldAddSwitchPreference() {
+    public void displayPreference_shouldAddListPreference() {
         Settings.Global.putInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
         mController.updateState(mPreference);
 
-        verify(mPreference).setChecked(false);
+        verify(mPreference).setValue(mPreferenceDefault);
+        verify(mPreference).setSummary(mPreferenceDefault);
     }
 
     @Test
@@ -120,39 +135,64 @@
     }
 
     @Test
-    public void updateState_availableAndGameDriverDefault_visibleAndUncheck() {
+    public void updateState_availableAndDefault_visibleAndDefault() {
         Settings.Global.putInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
         mController.updateState(mPreference);
 
         verify(mPreference, atLeastOnce()).setVisible(true);
-        verify(mPreference).setChecked(false);
+        verify(mPreference).setValue(mPreferenceDefault);
+        verify(mPreference).setSummary(mPreferenceDefault);
     }
 
     @Test
-    public void updateState_availableAndGameDriverAllApps_visibleAndCheck() {
+    public void updateState_availableAndGameDriver_visibleAndGameDriver() {
         Settings.Global.putInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
         mController.updateState(mPreference);
 
         verify(mPreference, atLeastOnce()).setVisible(true);
-        verify(mPreference).setChecked(true);
+        verify(mPreference).setValue(mPreferenceGameDriver);
+        verify(mPreference).setSummary(mPreferenceGameDriver);
     }
 
     @Test
-    public void updateState_gameDriverOff_notVisibleAndUncheck() {
+    public void updateState_availableAndPrereleaseDriver_visibleAndPrereleaseDriver() {
+        Settings.Global.putInt(
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_PRERELEASE_ALL_APPS);
+        mController.updateState(mPreference);
+
+        verify(mPreference, atLeastOnce()).setVisible(true);
+        verify(mPreference).setValue(mPreferencePrereleaseDriver);
+        verify(mPreference).setSummary(mPreferencePrereleaseDriver);
+    }
+
+    @Test
+    public void updateState_gameDriverOff_notVisibleAndSystemDriver() {
         Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
         mController.updateState(mPreference);
 
         verify(mPreference).setVisible(false);
-        verify(mPreference).setChecked(false);
+        verify(mPreference).setValue(mPreferenceDefault);
+        verify(mPreference).setSummary(mPreferenceDefault);
     }
 
     @Test
-    public void onPreferenceChange_check_shouldUpdateSettingsGlobal() {
+    public void onPreferenceChange_default_shouldUpdateSettingsGlobal() {
+        Settings.Global.putInt(
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
+        mController.onPreferenceChange(mPreference, mPreferenceDefault);
+
+        assertThat(Settings.Global.getInt(
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
+                .isEqualTo(GAME_DRIVER_DEFAULT);
+    }
+
+    @Test
+    public void onPreferenceChange_gameDriver_shouldUpdateSettingsGlobal() {
         Settings.Global.putInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
-        mController.onPreferenceChange(mPreference, true);
+        mController.onPreferenceChange(mPreference, mPreferenceGameDriver);
 
         assertThat(Settings.Global.getInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
@@ -160,13 +200,13 @@
     }
 
     @Test
-    public void onPreferenceChange_uncheck_shouldUpdateSettingsGlobal() {
+    public void onPreferenceChange_prereleaseDriver_shouldUpdateSettingsGlobal() {
         Settings.Global.putInt(
-                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
-        mController.onPreferenceChange(mPreference, false);
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+        mController.onPreferenceChange(mPreference, mPreferencePrereleaseDriver);
 
         assertThat(Settings.Global.getInt(
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
-                .isEqualTo(GAME_DRIVER_DEFAULT);
+                .isEqualTo(GAME_DRIVER_PRERELEASE_ALL_APPS);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceControllerTest.java
new file mode 100644
index 0000000..f2edf98
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceControllerTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.settings.display;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+
+import androidx.preference.Preference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class AdaptiveSleepPermissionPreferenceControllerTest {
+    private final static String PACKAGE_NAME = "package_name";
+    private AdaptiveSleepPermissionPreferenceController mController;
+    @Mock
+    private PackageManager mPackageManager;
+    @Mock
+    private Preference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        Context context = Mockito.spy(RuntimeEnvironment.application);
+        doReturn(mPackageManager).when(context).getPackageManager();
+        doReturn(PACKAGE_NAME).when(mPackageManager).getAttentionServicePackageName();
+        doReturn(PackageManager.PERMISSION_GRANTED).when(mPackageManager).checkPermission(
+                Manifest.permission.CAMERA, PACKAGE_NAME);
+        mController = new AdaptiveSleepPermissionPreferenceController(context, "test_key");
+        doReturn(mController.getPreferenceKey()).when(mPreference).getKey();
+    }
+
+    @Test
+    public void getAvailabilityStatus_returnAvailableUnsearchable() {
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
+    }
+
+    @Test
+    public void updateStates_permissionGranted_preferenceInvisible() {
+        mController.updateState(mPreference);
+
+        verify(mPreference).setVisible(false);
+    }
+
+    @Test
+    public void updateStates_permissionRevoked_preferenceVisible() {
+        doReturn(PackageManager.PERMISSION_DENIED).when(mPackageManager).checkPermission(
+                Manifest.permission.CAMERA, PACKAGE_NAME);
+
+        mController.updateState(mPreference);
+
+        verify(mPreference).setVisible(true);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/display/AdaptiveSleepSettingsTest.java b/tests/robotests/src/com/android/settings/display/AdaptiveSleepSettingsTest.java
deleted file mode 100644
index 971ebc5..0000000
--- a/tests/robotests/src/com/android/settings/display/AdaptiveSleepSettingsTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.settings.display;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.pm.PackageManager;
-
-import androidx.preference.PreferenceScreen;
-
-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 AdaptiveSleepSettingsTest {
-    private AdaptiveSleepSettings mSettings;
-    private static final String PACKAGE_NAME = "package_name";
-    @Mock
-    private PackageManager mPackageManager;
-    @Mock
-    private PreferenceScreen mScreen;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        Context context = RuntimeEnvironment.application;
-        mSettings = spy(new AdaptiveSleepSettings());
-
-        doReturn(PACKAGE_NAME).when(mPackageManager).getAttentionServicePackageName();
-        doReturn(PackageManager.PERMISSION_GRANTED).when(mPackageManager).checkPermission(
-                Manifest.permission.CAMERA, PACKAGE_NAME);
-        doReturn(mScreen).when(mSettings).getPreferenceScreen();
-
-        mSettings.setupForTesting(mPackageManager, context);
-        mSettings.onAttach(context);
-
-    }
-
-    @Test
-    public void onResume_hasPermission_preferenceInvisible() {
-        mSettings.onResume();
-
-        assertThat(mSettings.mPermissionRequiredPreference.isVisible()).isFalse();
-    }
-
-    @Test
-    public void onResume_noPermission_preferenceVisible() {
-        doReturn(PackageManager.PERMISSION_DENIED).when(mPackageManager).checkPermission(
-                Manifest.permission.CAMERA, PACKAGE_NAME);
-
-        mSettings.onResume();
-
-        assertThat(mSettings.mPermissionRequiredPreference.isVisible()).isTrue();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
index 1f3a758..24cb9ed 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
@@ -24,21 +24,30 @@
 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
 
+import static com.android.settings.gestures.SystemNavigationGestureSettings.BACK_GESTURE_INSET_DEFAULT_OVERLAY;
+import static com.android.settings.gestures.SystemNavigationGestureSettings.BACK_GESTURE_INSET_OVERLAYS;
 import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_2BUTTONS;
 import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_3BUTTONS;
 import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_GESTURAL;
+import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK;
+import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK;
+import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK;
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.mock;
+import static junit.framework.Assert.assertEquals;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.content.Context;
 import android.content.om.IOverlayManager;
-import android.os.ServiceManager;
+import android.content.om.OverlayInfo;
 import android.provider.SearchIndexableResource;
-import android.text.TextUtils;
 
 import com.android.internal.R;
 import com.android.settings.testutils.shadow.SettingsShadowResources;
@@ -46,6 +55,8 @@
 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;
@@ -57,17 +68,25 @@
 public class SystemNavigationGestureSettingsTest {
 
     private Context mContext;
-
-    private IOverlayManager mOverlayManager;
-
     private SystemNavigationGestureSettings mSettings;
 
-    @Before
-    public void setUp() {
-        mContext = RuntimeEnvironment.application;
-        mOverlayManager = mock(IOverlayManager.class);
+    @Mock
+    private IOverlayManager mOverlayManager;
+    @Mock
+    private OverlayInfo mOverlayInfoEnabled;
+    @Mock
+    private OverlayInfo mOverlayInfoDisabled;
 
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+
+        mContext = RuntimeEnvironment.application;
         mSettings = new SystemNavigationGestureSettings();
+
+        when(mOverlayInfoDisabled.isEnabled()).thenReturn(false);
+        when(mOverlayInfoEnabled.isEnabled()).thenReturn(true);
+        when(mOverlayManager.getOverlayInfo(any(), anyInt())).thenReturn(mOverlayInfoDisabled);
     }
 
     @Test
@@ -82,34 +101,111 @@
 
     @Test
     public void testGetCurrentSystemNavigationMode() {
-        SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
-                NAV_BAR_MODE_GESTURAL);
-        assertThat(TextUtils.equals(mSettings.getCurrentSystemNavigationMode(mContext),
-                KEY_SYSTEM_NAV_GESTURAL)).isTrue();
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_GESTURAL);
+        assertEquals(KEY_SYSTEM_NAV_GESTURAL, mSettings.getCurrentSystemNavigationMode(mContext));
 
-        SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
-                NAV_BAR_MODE_3BUTTON);
-        assertThat(TextUtils.equals(mSettings.getCurrentSystemNavigationMode(mContext),
-                KEY_SYSTEM_NAV_3BUTTONS)).isTrue();
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON);
+        assertEquals(KEY_SYSTEM_NAV_3BUTTONS, mSettings.getCurrentSystemNavigationMode(mContext));
 
-        SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
-                NAV_BAR_MODE_2BUTTON);
-        assertThat(TextUtils.equals(mSettings.getCurrentSystemNavigationMode(mContext),
-                KEY_SYSTEM_NAV_2BUTTONS)).isTrue();
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_2BUTTON);
+        assertEquals(KEY_SYSTEM_NAV_2BUTTONS, mSettings.getCurrentSystemNavigationMode(mContext));
     }
 
     @Test
     public void testSetCurrentSystemNavigationMode() throws Exception {
-        mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_GESTURAL);
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 0);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_GESTURAL);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK, USER_CURRENT);
+
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 1);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_GESTURAL);
         verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
                 NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT);
 
-        mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_2BUTTONS);
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_GESTURAL);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
+
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_GESTURAL);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK, USER_CURRENT);
+
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_2BUTTONS);
         verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
                 NAV_BAR_MODE_2BUTTON_OVERLAY, USER_CURRENT);
 
-        mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_3BUTTONS);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_3BUTTONS);
         verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
                 NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
     }
+
+    @Test
+    public void testSetCurrentSystemNavigationMode_backSensitivityValuePersists() throws Exception {
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON);
+
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_3BUTTONS);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
+
+        // Return to Gesture navigation, without setting the sensitivity value.
+        mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
+                KEY_SYSTEM_NAV_GESTURAL);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
+    }
+
+    @Test
+    public void testGetBackSensitivity_default() {
+        assertEquals(BACK_GESTURE_INSET_DEFAULT_OVERLAY,
+                mSettings.getBackSensitivity(mContext, mOverlayManager));
+    }
+
+    @Test
+    public void testBackSensitivitySetterAndGetter_currentNavModeNotGestural() throws Exception {
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON);
+
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
+        assertEquals(3, mSettings.getBackSensitivity(mContext, mOverlayManager));
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
+        assertEquals(2, mSettings.getBackSensitivity(mContext, mOverlayManager));
+
+        verify(mOverlayManager, never()).setEnabledExclusiveInCategory(any(), anyInt());
+    }
+
+    @Test
+    public void testBackSensitivitySetterAndGetter_currentNavModeIsGestural() throws Exception {
+        SettingsShadowResources.overrideResource(
+                R.integer.config_navBarInteractionMode, NAV_BAR_MODE_GESTURAL);
+
+        when(mOverlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[3], USER_CURRENT))
+                .thenReturn(mOverlayInfoEnabled);
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
+        assertEquals(3, mSettings.getBackSensitivity(mContext, mOverlayManager));
+
+        when(mOverlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[2], USER_CURRENT))
+                .thenReturn(mOverlayInfoEnabled);
+        mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
+        assertEquals(2, mSettings.getBackSensitivity(mContext, mOverlayManager));
+
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
+        verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
+                NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK, USER_CURRENT);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
index 7dd636a..dbdad50 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
@@ -204,6 +204,28 @@
     }
 
     @Test
+    public void onPreferenceChange_prefBecomesAvailable_onPreferenceChangeCallbackNotNull() {
+        final SubscriptionInfo sub1 = createMockSub(111, "sub1");
+        final SubscriptionInfo sub2 = createMockSub(222, "sub2");
+
+        // Start with only one sub active, so the pref is not available
+        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
+        doReturn(sub1.getSubscriptionId()).when(mController).getDefaultSubscriptionId();
+
+        mController.displayPreference(mScreen);
+        assertThat(mController.isAvailable()).isFalse();
+
+        // Now make two subs be active - the pref should become available, and the
+        // onPreferenceChange callback should be properly wired up.
+        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        mController.onSubscriptionsChanged();
+        assertThat(mController.isAvailable()).isTrue();
+        assertThat(mListPreference.getOnPreferenceChangeListener()).isEqualTo(mController);
+        mListPreference.callChangeListener("222");
+        verify(mController).setDefaultSubscription(eq(222));
+    }
+
+    @Test
     public void onSubscriptionsChanged_twoSubscriptionsDefaultChanges_selectedEntryGetsUpdated() {
         final SubscriptionInfo sub1 = createMockSub(111, "sub1");
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
diff --git a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
index 1a0126e..42422f9 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
@@ -27,6 +27,7 @@
 import android.content.Intent;
 import android.os.PersistableBundle;
 import android.provider.Settings;
+import android.telecom.PhoneAccountHandle;
 import android.telephony.CarrierConfigManager;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -118,6 +119,14 @@
     }
 
     @Test
+    public void updateState_invalidPhoneAccountHandle_shouldNotCrash() {
+        mController.mSimCallManager = new PhoneAccountHandle(null /* invalid */, "");
+
+        //Should not crash
+        mController.updateState(mPreference);
+    }
+
+    @Test
     public void updateState_wfcNonRoaming() {
         assertNull(mController.mSimCallManager);
         mCarrierConfig.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, false);
diff --git a/tests/robotests/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidgetTest.java b/tests/robotests/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidgetTest.java
index b84b3bb..2e2d786 100644
--- a/tests/robotests/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidgetTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RadioButtonPreferenceWithExtraWidgetTest.java
@@ -18,6 +18,7 @@
 
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_GONE;
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_INFO;
+import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_SETTING;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -104,6 +105,18 @@
         assertEquals(View.VISIBLE, mExtraWidget.getVisibility());
         assertEquals(View.VISIBLE, mExtraWidgetDivider.getVisibility());
         assertThat(mExtraWidget.isClickable()).isTrue();
+        assertEquals(mContext.getResources().getText(R.string.information_label),
+                mExtraWidget.getContentDescription());
+    }
+
+    @Test
+    public void testSetExtraWidgetVisibility_setting() {
+        mPreference.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING);
+        assertEquals(View.VISIBLE, mExtraWidget.getVisibility());
+        assertEquals(View.VISIBLE, mExtraWidgetDivider.getVisibility());
+        assertThat(mExtraWidget.isClickable()).isTrue();
+        assertEquals(mContext.getResources().getText(R.string.settings_label),
+                mExtraWidget.getContentDescription());
     }
 
     @Test