Merge "[Settings] Enabling first stage of threading"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2c1c76e..c8fc45d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -918,6 +918,24 @@
         </activity>
 
         <activity
+                android:name="Settings$DarkThemeSettingsActivity"
+                android:label="@string/dark_ui_auto_mode_title"
+                android:enabled="true">
+            <intent-filter android:priority="32">
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.android.settings.SHORTCUT" />
+            </intent-filter>
+            <intent-filter android:priority="1">
+                <action android:name="android.settings.DARK_THEME_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.display.darkmode.DarkModeSettingsFragment" />
+            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+                android:value="true" />
+        </activity>
+
+        <activity
             android:name="Settings$NightDisplaySuggestionActivity"
             android:enabled="@*android:bool/config_nightDisplayAvailable"
             android:icon="@drawable/ic_suggestion_night_display">
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 8df986f..eb2b869 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1014,19 +1014,19 @@
         <item>\?</item>
     </string-array>
 
-    <!-- Display color space adjustment modes for accessibility -->
-    <string-array name="daltonizer_type_entries" translatable="false">
-        <item>@string/daltonizer_mode_deuteranomaly</item>
-        <item>@string/daltonizer_mode_protanomaly</item>
-        <item>@string/daltonizer_mode_tritanomaly</item>
+    <!-- Keys for color space adjustment modes for accessibility -->
+    <string-array name="daltonizer_mode_keys" translatable="false">
+        <item>daltonizer_mode_deuteranomaly</item>
+        <item>daltonizer_mode_protanomaly</item>
+        <item>daltonizer_mode_tritanomaly</item>
     </string-array>
 
     <!-- Values for display color space adjustment modes for accessibility -->
-    <string-array name="daltonizer_type_values" translatable="false">
+    <integer-array name="daltonizer_type_values" translatable="false">
         <item>12</item>
         <item>11</item>
         <item>13</item>
-    </string-array>
+    </integer-array>
 
     <!-- Battery saver mode: allowable trigger threshold levels. -->
     <integer-array name="battery_saver_trigger_values" translatable="false" >
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 43018c5..d9020e8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4922,6 +4922,18 @@
     <string name="enable_quick_setting">Show in Quick Settings</string>
     <!-- Title for the preference to configure the type of color space correction to apply. [CHAR LIMIT=NONE] -->
     <string name="daltonizer_type">Correction mode</string>
+    <!-- Title shown for deuteranomaly (red-green color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_deuteranomaly_title">Red-green</string>
+    <!-- Title shown for protanomaly (red-green color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_protanomaly_title">Green-red</string>
+    <!-- Title shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_tritanomaly_title">Blue-yellow</string>
+    <!-- Summary shown for deuteranomaly (red-green color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_deuteranomaly_summary">Deuteranomaly</string>
+    <!-- Summary shown for protanomaly (red-green color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_protanomaly_summary">Protanomaly</string>
+    <!-- Summary shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
+    <string name="daltonizer_mode_tritanomaly_summary">Tritanomaly</string>
 
     <!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
     <plurals name="accessibilty_autoclick_preference_subtitle_extremely_short_delay">
diff --git a/res/xml/accessibility_daltonizer_settings.xml b/res/xml/accessibility_daltonizer_settings.xml
index 496c515..22e0510 100644
--- a/res/xml/accessibility_daltonizer_settings.xml
+++ b/res/xml/accessibility_daltonizer_settings.xml
@@ -18,19 +18,32 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="daltonizer_preference_screen"
+    android:persistent="false"
     android:title="@string/accessibility_display_daltonizer_preference_title">
 
-    <ListPreference
-        android:entries="@array/daltonizer_type_entries"
-        android:entryValues="@array/daltonizer_type_values"
-        android:key="type"
-        android:summary="%s"
-        android:title="@string/daltonizer_type"
-        android:icon="@drawable/ic_accessibility_illustration_colorblind" />
+    <com.android.settingslib.widget.RadioButtonPreference
+        android:key="daltonizer_mode_deuteranomaly"
+        android:persistent="false"
+        android:summary="@string/daltonizer_mode_deuteranomaly_summary"
+        android:title="@string/daltonizer_mode_deuteranomaly_title"
+        settings:allowDividerAbove="true" />
+
+    <com.android.settingslib.widget.RadioButtonPreference
+        android:key="daltonizer_mode_protanomaly"
+        android:persistent="false"
+        android:summary="@string/daltonizer_mode_protanomaly_summary"
+        android:title="@string/daltonizer_mode_protanomaly_title" />
+
+    <com.android.settingslib.widget.RadioButtonPreference
+        android:key="daltonizer_mode_tritanomaly"
+        android:persistent="false"
+        android:summary="@string/daltonizer_mode_tritanomaly_summary"
+        android:title="@string/daltonizer_mode_tritanomaly_title" />
 
     <com.android.settingslib.widget.FooterPreference
         android:key="daltonizer_footer"
-        android:title="@string/accessibility_display_daltonizer_preference_subtitle"
+        android:persistent="false"
         android:selectable="false"
-        settings:searchable="false"/>
+        android:title="@string/accessibility_display_daltonizer_preference_subtitle"
+        settings:searchable="false" />
 </PreferenceScreen>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index e13e820..a7b602c 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -18,68 +18,78 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="accessibility_settings_screen"
-    android:title="@string/accessibility_settings"
-    android:persistent="true">
+    android:persistent="false"
+    android:title="@string/accessibility_settings">
 
     <Preference
-        android:key="accessibility_shortcut_preference"
-        android:title="@string/accessibility_global_gesture_preference_title"
         android:fragment="com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment"
+        android:key="accessibility_shortcut_preference"
+        android:persistent="false"
+        android:title="@string/accessibility_global_gesture_preference_title"
         settings:controller="com.android.settings.accessibility.AccessibilityShortcutPreferenceController"/>
 
     <PreferenceCategory
         android:key="user_installed_services_category"
-        android:title="@string/user_installed_services_category_title">
-    </PreferenceCategory>
+        android:persistent="false"
+        android:title="@string/user_installed_services_category_title"/>
 
     <PreferenceCategory
         android:key="screen_reader_category"
+        android:persistent="false"
         android:title="@string/screen_reader_category_title">
 
         <Preference
-            android:key="tts_settings_preference"
-            android:title="@string/tts_settings_title"
             android:fragment="com.android.settings.tts.TextToSpeechSettings"
+            android:key="tts_settings_preference"
+            android:persistent="false"
+            android:title="@string/tts_settings_title"
             settings:controller="com.android.settings.language.TtsPreferenceController"/>
     </PreferenceCategory>
 
     <PreferenceCategory
         android:key="display_category"
+        android:persistent="false"
         android:title="@string/display_category_title">
 
         <Preference
-            android:key="font_size_preference_screen"
-            android:title="@string/title_font_size"
             android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
+            android:key="font_size_preference_screen"
+            android:persistent="false"
+            android:title="@string/title_font_size"
             settings:controller="com.android.settings.display.FontSizePreferenceController"
             settings:searchable="false"/>
 
-        <com.android.settings.display.ScreenZoomPreference
-            android:key="accessibility_settings_screen_zoom"
+     <com.android.settings.display.ScreenZoomPreference
             android:fragment="com.android.settings.display.ScreenZoomSettings"
+            android:key="accessibility_settings_screen_zoom"
+            android:persistent="false"
             android:title="@string/screen_zoom_title"
             settings:searchable="false"/>
 
-        <SwitchPreference
+       <SwitchPreference
             android:key="dark_ui_mode_accessibility"
+            android:persistent="false"
             android:title="@string/dark_ui_mode"
             settings:controller="com.android.settings.display.DarkUIPreferenceController"
             settings:searchable="false"/>
 
-        <Preference
-            android:key="magnification_preference_screen"
-            android:title="@string/accessibility_screen_magnification_title"
-            android:icon="@drawable/ic_accessibility_magnification"
+       <Preference
             android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
+            android:icon="@drawable/ic_accessibility_magnification"
+            android:key="magnification_preference_screen"
+            android:persistent="false"
+            android:title="@string/accessibility_screen_magnification_title"
             settings:controller="com.android.settings.accessibility.MagnificationPreferenceController"/>
 
         <SwitchPreference
             android:key="toggle_large_pointer_icon"
+            android:persistent="false"
             android:title="@string/accessibility_toggle_large_pointer_icon_title"
             settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
 
         <SwitchPreference
             android:key="toggle_disable_animations"
+            android:persistent="false"
             android:title="@string/accessibility_disable_animations"
             settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
 
@@ -87,111 +97,124 @@
 
     <PreferenceCategory
         android:key="interaction_control_category"
+        android:persistent="false"
         android:title="@string/interaction_control_category_title">
 
         <Preference
-            android:key="autoclick_preference"
-            android:title="@string/accessibility_autoclick_preference_title"
             android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
+            android:key="autoclick_preference"
+            android:persistent="false"
+            android:title="@string/accessibility_autoclick_preference_title"
             settings:controller="com.android.settings.accessibility.AutoclickPreferenceController"/>
 
         <SwitchPreference
             android:key="toggle_power_button_ends_call_preference"
-            android:title="@string/accessibility_power_button_ends_call_prerefence_title"
             android:persistent="false"
+            android:title="@string/accessibility_power_button_ends_call_prerefence_title"
             settings:controller="com.android.settings.accessibility.PowerButtonEndsCallPreferenceController"/>
-        
+
         <SwitchPreference
             android:key="toggle_lock_screen_rotation_preference"
-            android:title="@string/accelerometer_title"
             android:persistent="false"
+            android:title="@string/accelerometer_title"
             settings:controller="com.android.settings.accessibility.LockScreenRotationPreferenceController"/>
 
         <ListPreference
-            android:key="select_long_press_timeout_preference"
-            android:title="@string/accessibility_long_press_timeout_preference_title"
             android:entries="@array/long_press_timeout_selector_titles"
             android:entryValues="@array/long_press_timeout_selector_values"
+            android:key="select_long_press_timeout_preference"
             android:persistent="false"
+            android:title="@string/accessibility_long_press_timeout_preference_title"
             settings:controller="com.android.settings.accessibility.SelectLongPressTimeoutPreferenceController"/>
 
         <Preference
-            android:key="accessibility_control_timeout_preference_fragment"
-            android:title="@string/accessibility_setting_item_control_timeout_title"
-            android:persistent="false"
             android:fragment="com.android.settings.accessibility.AccessibilityControlTimeoutPreferenceFragment"
+            android:key="accessibility_control_timeout_preference_fragment"
+            android:persistent="false"
+            android:title="@string/accessibility_setting_item_control_timeout_title"
             settings:controller="com.android.settings.accessibility.AccessibilityTimeoutPreferenceController"/>
 
         <Preference
-            android:key="vibration_preference_screen"
-            android:title="@string/accessibility_vibration_settings_title"
             android:fragment="com.android.settings.accessibility.VibrationSettings"
+            android:key="vibration_preference_screen"
+            android:persistent="false"
+            android:title="@string/accessibility_vibration_settings_title"
             settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>
 
         <Preference
-            android:key="gesture_system_navigation_input_summary_accessibility"
-            android:title="@string/system_navigation_title"
             android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings"
-            settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController" />
+            android:key="gesture_system_navigation_input_summary_accessibility"
+            android:persistent="false"
+            android:title="@string/system_navigation_title"
+            settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"/>
 
     </PreferenceCategory>
 
     <PreferenceCategory
         android:key="audio_and_captions_category"
+        android:persistent="false"
         android:title="@string/audio_and_captions_category_title">
 
         <Preference
             android:key="live_caption"
-            android:title="@string/live_caption_title"
+            android:persistent="false"
             android:summary="@string/live_caption_summary"
+            android:title="@string/live_caption_title"
             settings:controller="com.android.settings.accessibility.LiveCaptionPreferenceController"/>
 
         <SwitchPreference
             android:key="toggle_master_mono"
-            android:title="@string/accessibility_toggle_master_mono_title"
-            android:summary="@string/accessibility_toggle_master_mono_summary"
             android:persistent="false"
+            android:summary="@string/accessibility_toggle_master_mono_summary"
+            android:title="@string/accessibility_toggle_master_mono_title"
             settings:controller="com.android.settings.accessibility.MasterMonoPreferenceController"/>
 
         <com.android.settings.accessibility.BalanceSeekBarPreference
             android:key="seekbar_master_balance"
+            android:persistent="false"
             android:title="@string/accessibility_toggle_master_balance_title"/>
 
         <Preference
             android:key="hearing_aid_preference"
+            android:persistent="false"
             android:summary="@string/accessibility_hearingaid_not_connected_summary"
             android:title="@string/accessibility_hearingaid_title"
             settings:controller="com.android.settings.accessibility.AccessibilityHearingAidPreferenceController"/>
 
         <Preference
-            android:key="captioning_preference_screen"
-            android:title="@string/accessibility_captioning_title"
             android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
+            android:key="captioning_preference_screen"
+            android:persistent="false"
+            android:title="@string/accessibility_captioning_title"
             settings:controller="com.android.settings.accessibility.CaptioningPreferenceController"/>
+
     </PreferenceCategory>
 
     <PreferenceCategory
         android:key="experimental_category"
+        android:persistent="false"
         android:title="@string/experimental_category_title">
 
         <SwitchPreference
             android:key="toggle_high_text_contrast_preference"
+            android:persistent="false"
             android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
             settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
 
         <Preference
-            android:key="daltonizer_preference"
-            android:title="@string/accessibility_display_daltonizer_preference_title"
-            android:icon="@drawable/ic_daltonizer"
             android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
+            android:icon="@drawable/ic_daltonizer"
+            android:key="daltonizer_preference"
+            android:persistent="false"
+            android:title="@string/accessibility_display_daltonizer_preference_title"
             settings:controller="com.android.settings.accessibility.DaltonizerPreferenceController"/>
 
         <SwitchPreference
-            android:key="toggle_inversion_preference"
-            android:title="@string/accessibility_display_inversion_preference_title"
-            android:summary="@string/accessibility_display_inversion_preference_subtitle"
-            android:persistent="false"
             android:icon="@drawable/ic_color_inversion"
+            android:key="toggle_inversion_preference"
+            android:persistent="false"
+            android:summary="@string/accessibility_display_inversion_preference_subtitle"
+            android:title="@string/accessibility_display_inversion_preference_title"
             settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
     </PreferenceCategory>
 </PreferenceScreen>
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 604333f..4a31897 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -964,7 +964,7 @@
     }
 
     private boolean isEmergencyCallCapable() {
-        return getResources().getBoolean(com.android.internal.R.bool.config_voice_capable);
+        return getTelephonyManager().isVoiceCapable();
     }
 
     private void takeEmergencyCallAction() {
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index c6b7e62..e203699 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -52,6 +52,7 @@
     public static class LocalePickerActivity extends SettingsActivity { /* empty */ }
     public static class LanguageAndInputSettingsActivity extends SettingsActivity { /* empty */ }
     public static class UserDictionarySettingsActivity extends SettingsActivity { /* empty */ }
+    public static class DarkThemeSettingsActivity extends SettingsActivity { /* empty */ }
     public static class DisplaySettingsActivity extends SettingsActivity { /* empty */ }
     public static class NightDisplaySettingsActivity extends SettingsActivity { /* empty */ }
     public static class NightDisplaySuggestionActivity extends NightDisplaySettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index b5a1539..bef4f1b 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1060,9 +1060,9 @@
     public static Fragment getTargetFragment(Activity activity, String fragmentName, Bundle args) {
         Fragment f = null;
         final boolean isPersonal = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
-                == ProfileSelectFragment.PERSONAL : false;
+                == ProfileSelectFragment.ProfileType.PERSONAL : false;
         final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
-                == ProfileSelectFragment.WORK : false;
+                == ProfileSelectFragment.ProfileType.WORK : false;
         if (FeatureFlagUtils.isEnabled(activity, FeatureFlags.PERSONAL_WORK_PROFILE)
                 && UserManager.get(activity).getUserProfiles().size() > 1
                 && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
diff --git a/src/com/android/settings/accessibility/AccessibilityUtil.java b/src/com/android/settings/accessibility/AccessibilityUtil.java
index 1cb5ffb..ac9cd09 100644
--- a/src/com/android/settings/accessibility/AccessibilityUtil.java
+++ b/src/com/android/settings/accessibility/AccessibilityUtil.java
@@ -16,12 +16,44 @@
 
 package com.android.settings.accessibility;
 
+import android.accessibilityservice.AccessibilityServiceInfo;
 import android.content.Context;
+import android.os.Build;
 import android.provider.Settings;
 
+import androidx.annotation.IntDef;
+
 import com.android.settings.R;
 
-public class AccessibilityUtil {
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/** Provides utility methods to accessibility settings only. */
+final class AccessibilityUtil {
+
+    private AccessibilityUtil(){}
+
+    /**
+     * Annotation for different accessibilityService fragment UI type.
+     *
+     * {@code LEGACY} for displaying appearance aligned with sdk version Q accessibility service
+     * page, but only hardware shortcut allowed.
+     * {@code HEADLESS} for displaying appearance without switch bar.
+     * {@code INTUITIVE} for displaying appearance with new design.
+     */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef({
+            AccessibilityServiceFragmentType.LEGACY,
+            AccessibilityServiceFragmentType.HEADLESS,
+            AccessibilityServiceFragmentType.INTUITIVE,
+    })
+
+    public @interface AccessibilityServiceFragmentType {
+        int LEGACY = 0;
+        int HEADLESS = 1;
+        int INTUITIVE = 2;
+    }
+
     /**
      * Return On/Off string according to the setting which specifies the integer value 1 or 0. This
      * setting is defined in the secure system settings {@link android.provider.Settings.Secure}.
@@ -33,4 +65,25 @@
                 : R.string.accessibility_feature_state_off;
         return context.getResources().getText(resId);
     }
+
+    /**
+     * Gets the corresponding fragment type of a given accessibility service
+     *
+     * @param accessibilityServiceInfo The accessibilityService's info
+     * @return int from {@link AccessibilityServiceFragmentType}
+     */
+    static @AccessibilityServiceFragmentType int getAccessibilityServiceFragmentType(
+            AccessibilityServiceInfo accessibilityServiceInfo) {
+        final int targetSdk = accessibilityServiceInfo.getResolveInfo()
+                .serviceInfo.applicationInfo.targetSdkVersion;
+        final boolean requestA11yButton = (accessibilityServiceInfo.flags
+                & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
+
+        if (targetSdk <= Build.VERSION_CODES.Q) {
+            return AccessibilityServiceFragmentType.LEGACY;
+        }
+        return requestA11yButton
+                ? AccessibilityServiceFragmentType.HEADLESS
+                : AccessibilityServiceFragmentType.INTUITIVE;
+    }
 }
diff --git a/src/com/android/settings/accessibility/DaltonizerPreferenceController.java b/src/com/android/settings/accessibility/DaltonizerPreferenceController.java
index c02a362..efdfaed 100644
--- a/src/com/android/settings/accessibility/DaltonizerPreferenceController.java
+++ b/src/com/android/settings/accessibility/DaltonizerPreferenceController.java
@@ -16,25 +16,143 @@
 
 package com.android.settings.accessibility;
 
+import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.provider.Settings;
+import android.view.accessibility.AccessibilityManager;
 
+import androidx.lifecycle.LifecycleObserver;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.RadioButtonPreference;
 
-public class DaltonizerPreferenceController extends BasePreferenceController {
+import com.google.common.primitives.Ints;
 
-    public DaltonizerPreferenceController(Context context, String preferenceKey) {
+import java.util.HashMap;
+import java.util.Map;
+
+/** Controller class that control accessibility daltonizer settings. */
+public class DaltonizerPreferenceController extends BasePreferenceController implements
+        LifecycleObserver, RadioButtonPreference.OnClickListener {
+    private static final String TYPE = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER;
+
+    // pair the preference key and daltonizer value.
+    private final Map<String, Integer> mAccessibilityDaltonizerKeyToValueMap = new HashMap<>();
+
+    // RadioButtonPreference key, each preference represent a daltonizer value.
+    private final ContentResolver mContentResolver;
+    private final Resources mResources;
+    private DaltonizerPreferenceController.OnChangeListener mOnChangeListener;
+    private RadioButtonPreference mPreference;
+    private int mAccessibilityDaltonizerValue;
+
+    public DaltonizerPreferenceController(Context context, Lifecycle lifecycle,
+            String preferenceKey) {
         super(context, preferenceKey);
+
+        mContentResolver = context.getContentResolver();
+        mResources = context.getResources();
+
+        if (lifecycle != null) {
+            lifecycle.addObserver(this);
+        }
+    }
+
+    protected static int getSecureAccessibilityDaltonizerValue(ContentResolver resolver,
+            String name) {
+        final String daltonizerStringValue = Settings.Secure.getString(resolver, name);
+        if (daltonizerStringValue == null) {
+            return AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY;
+        }
+        final Integer daltonizerIntValue = Ints.tryParse(daltonizerStringValue);
+        return daltonizerIntValue == null ? AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY
+                : daltonizerIntValue;
+    }
+
+    public void setOnChangeListener(DaltonizerPreferenceController.OnChangeListener listener) {
+        mOnChangeListener = listener;
+    }
+
+    private Map<String, Integer> getDaltonizerValueToKeyMap() {
+        if (mAccessibilityDaltonizerKeyToValueMap.size() == 0) {
+
+            final String[] daltonizerKeys = mResources.getStringArray(
+                    R.array.daltonizer_mode_keys);
+
+            final int[] daltonizerValues = mResources.getIntArray(
+                    R.array.daltonizer_type_values);
+
+            final int daltonizerValueCount = daltonizerValues.length;
+            for (int i = 0; i < daltonizerValueCount; i++) {
+                mAccessibilityDaltonizerKeyToValueMap.put(daltonizerKeys[i], daltonizerValues[i]);
+            }
+        }
+        return mAccessibilityDaltonizerKeyToValueMap;
+    }
+
+    private void putSecureString(String name, String value) {
+        Settings.Secure.putString(mContentResolver, name, value);
+    }
+
+    private void handlePreferenceChange(String value) {
+        putSecureString(TYPE, value);
     }
 
     @Override
     public int getAvailabilityStatus() {
-        return AVAILABLE_UNSEARCHABLE;
+        return AVAILABLE;
     }
 
     @Override
-    public CharSequence getSummary() {
-        return AccessibilityUtil.getSummary(mContext,
-                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreference = (RadioButtonPreference)
+                screen.findPreference(getPreferenceKey());
+        mPreference.setOnClickListener(this);
+        updateState(mPreference);
     }
+
+    @Override
+    public void onRadioButtonClicked(RadioButtonPreference preference) {
+        final int value = getDaltonizerValueToKeyMap().get(mPreferenceKey);
+        handlePreferenceChange(String.valueOf(value));
+        if (mOnChangeListener != null) {
+            mOnChangeListener.onCheckedChanged(mPreference);
+        }
+    }
+
+    private int getAccessibilityDaltonizerValue() {
+        final int daltonizerValue = getSecureAccessibilityDaltonizerValue(mContentResolver,
+                TYPE);
+        return daltonizerValue;
+    }
+
+    protected void updatePreferenceCheckedState(int value) {
+        if (mAccessibilityDaltonizerValue == value) {
+            mPreference.setChecked(true);
+        }
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        mAccessibilityDaltonizerValue = getAccessibilityDaltonizerValue();
+
+        // reset RadioButton
+        mPreference.setChecked(false);
+        final int preferenceValue = getDaltonizerValueToKeyMap().get(mPreference.getKey());
+        updatePreferenceCheckedState(preferenceValue);
+    }
+
+    /** Listener interface handles checked event. */
+    public interface OnChangeListener {
+        /** A hook that is called when preference checked.*/
+        void onCheckedChanged(Preference preference);
+    }
+
 }
\ No newline at end of file
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index e02a74a..f127b53 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -18,34 +18,56 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.hardware.display.ColorDisplayManager;
-import android.os.Bundle;
-import android.provider.SearchIndexableResource;
+import android.content.res.Resources;
 import android.provider.Settings;
-import android.view.accessibility.AccessibilityManager;
 import android.widget.Switch;
 
-import androidx.preference.ListPreference;
 import androidx.preference.Preference;
 
 import com.android.settings.R;
 import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.Indexable;
 import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.search.SearchIndexable;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @SearchIndexable
-public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment
-        implements Preference.OnPreferenceChangeListener, SwitchBar.OnSwitchChangeListener {
-    private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED;
-    private static final String TYPE = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER;
-    private static final int DEFAULT_TYPE = AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY;
-    private static final String KEY_DALTONIZER_FOOTER = "daltonizer_footer";
+public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment
+        implements DaltonizerPreferenceController.OnChangeListener,
+        SwitchBar.OnSwitchChangeListener {
 
-    private ListPreference mType;
+    private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED;
+
+    private static final List<AbstractPreferenceController> sControllers = new ArrayList<>();
+
+    @Override
+    public void onCheckedChanged(Preference preference) {
+        for (AbstractPreferenceController controller : sControllers) {
+            controller.updateState(preference);
+        }
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        for (AbstractPreferenceController controller :
+                buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
+            ((DaltonizerPreferenceController) controller).setOnChangeListener(this);
+            ((DaltonizerPreferenceController) controller).displayPreference(getPreferenceScreen());
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        for (AbstractPreferenceController controller :
+                buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
+            ((DaltonizerPreferenceController) controller).setOnChangeListener(null);
+        }
+    }
 
     @Override
     public int getMetricsCategory() {
@@ -57,16 +79,6 @@
         return R.string.help_url_color_correction;
     }
 
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        mType = (ListPreference) findPreference("type");
-
-        final Preference footer = findPreference(KEY_DALTONIZER_FOOTER);
-        footer.setVisible(!ColorDisplayManager.isColorTransformAccelerated(getActivity()));
-        initPreferences();
-    }
 
     @Override
     protected int getPreferenceScreenResId() {
@@ -75,26 +87,7 @@
 
     @Override
     protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
-        Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? 1 : 0);
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        if (preference == mType) {
-            Settings.Secure.putInt(getContentResolver(), TYPE, Integer.parseInt((String) newValue));
-            preference.setSummary("%s");
-        }
-
-        return true;
-    }
-
-    @Override
-    protected void onInstallSwitchBarToggleSwitch() {
-        super.onInstallSwitchBarToggleSwitch();
-
-        mSwitchBar.setCheckedInternal(
-                Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1);
-        mSwitchBar.addOnSwitchChangeListener(this);
+        Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? 0 : 1);
     }
 
     @Override
@@ -110,25 +103,34 @@
         switchBar.setSwitchBarText(switchBarText, switchBarText);
     }
 
-    private void initPreferences() {
-        final String value = Integer.toString(
-                Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE));
-        mType.setValue(value);
-        mType.setOnPreferenceChangeListener(this);
-        final int index = mType.findIndexOfValue(value);
-        if (index < 0) {
-            // We're using a mode controlled by developer preferences.
-            mType.setSummary(getString(R.string.daltonizer_type_overridden,
-                    getString(R.string.simulate_color_space)));
-        }
+    @Override
+    public void onSwitchChanged(Switch switchView, boolean isChecked) {
+        Settings.Secure.putInt(getContentResolver(), ENABLED, isChecked ? 1 : 0);
     }
 
     @Override
-    public void onSwitchChanged(Switch switchView, boolean isChecked) {
-        onPreferenceToggled(mPreferenceKey, isChecked);
+    protected void onInstallSwitchBarToggleSwitch() {
+        super.onInstallSwitchBarToggleSwitch();
+        mSwitchBar.setCheckedInternal(
+                Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1);
+        mSwitchBar.addOnSwitchChangeListener(this);
+    }
+
+    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
+            Lifecycle lifecycle) {
+        if (sControllers.size() == 0) {
+            final Resources resources = context.getResources();
+            final String[] daltonizerKeys = resources.getStringArray(
+                    R.array.daltonizer_mode_keys);
+
+            for (int i = 0; i < daltonizerKeys.length; i++) {
+                sControllers.add(new DaltonizerPreferenceController(
+                        context, lifecycle, daltonizerKeys[i]));
+            }
+        }
+        return sControllers;
     }
 
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider(R.xml.accessibility_daltonizer_settings);
-
 }
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index bee9071..53b5ea3 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -73,7 +73,7 @@
 
         final AccountPreferenceController accountPrefController =
                 new AccountPreferenceController(context, parent, authorities,
-                        ProfileSelectFragment.ALL);
+                        ProfileSelectFragment.ProfileType.ALL);
         if (parent != null) {
             parent.getSettingsLifecycle().addObserver(accountPrefController);
         }
diff --git a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
index e0db7f5..f29326e 100644
--- a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
@@ -71,7 +71,7 @@
 
         final AccountPreferenceController accountPrefController =
                 new AccountPreferenceController(context, parent, authorities,
-                        ProfileSelectFragment.PERSONAL);
+                        ProfileSelectFragment.ProfileType.PERSONAL);
         if (parent != null) {
             parent.getSettingsLifecycle().addObserver(accountPrefController);
         }
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index 36a7012..1f27963 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -277,10 +277,10 @@
             final int profilesCount = profiles.size();
             for (int i = 0; i < profilesCount; i++) {
                 if (profiles.get(i).isManagedProfile()
-                        && (mType & ProfileSelectFragment.WORK) != 0) {
+                        && (mType & ProfileSelectFragment.ProfileType.WORK) != 0) {
                     updateProfileUi(profiles.get(i));
                 } else if (!profiles.get(i).isManagedProfile()
-                        && (mType & ProfileSelectFragment.PERSONAL) != 0) {
+                        && (mType & ProfileSelectFragment.ProfileType.PERSONAL) != 0) {
                     updateProfileUi(profiles.get(i));
                 }
             }
@@ -324,7 +324,7 @@
             preferenceGroup.setContentDescription(
                     mContext.getString(R.string.account_settings));
         } else if (userInfo.isManagedProfile()) {
-            if (mType == ProfileSelectFragment.ALL) {
+            if (mType == ProfileSelectFragment.ProfileType.ALL) {
                 preferenceGroup.setTitle(R.string.category_work);
                 final String workGroupSummary = getWorkGroupSummary(context, userInfo);
                 preferenceGroup.setSummary(workGroupSummary);
@@ -336,7 +336,7 @@
                     DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
             profileData.managedProfilePreference = newManagedProfileSettings();
         } else {
-            if (mType == ProfileSelectFragment.ALL) {
+            if (mType == ProfileSelectFragment.ProfileType.ALL) {
                 preferenceGroup.setTitle(R.string.category_personal);
                 preferenceGroup.setContentDescription(
                         mContext.getString(R.string.accessibility_category_personal));
diff --git a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
index 8dfa934..853c66b 100644
--- a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
@@ -71,7 +71,7 @@
 
         final AccountPreferenceController accountPrefController =
                 new AccountPreferenceController(context, parent, authorities,
-                        ProfileSelectFragment.WORK);
+                        ProfileSelectFragment.ProfileType.WORK);
         if (parent != null) {
             parent.getSettingsLifecycle().addObserver(accountPrefController);
         }
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 4ce8fa4..7da89e4 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -102,9 +102,9 @@
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
 import com.android.settings.fuelgauge.HighPowerDetail;
-import com.android.settings.notification.app.AppNotificationSettings;
 import com.android.settings.notification.ConfigureNotificationSettings;
 import com.android.settings.notification.NotificationBackend;
+import com.android.settings.notification.app.AppNotificationSettings;
 import com.android.settings.widget.LoadingViewController;
 import com.android.settings.wifi.AppStateChangeWifiStateBridge;
 import com.android.settings.wifi.ChangeWifiStateDetails;
@@ -311,9 +311,9 @@
         final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance();
         mFilter = appFilterRegistry.get(appFilterRegistry.getDefaultFilterType(mListType));
         mIsPersonalOnly = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
-                == ProfileSelectFragment.PERSONAL : false;
+                == ProfileSelectFragment.ProfileType.PERSONAL : false;
         mIsWorkOnly = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
-                == ProfileSelectFragment.WORK : false;
+                == ProfileSelectFragment.ProfileType.WORK : false;
         mWorkUserId = args != null ? args.getInt(EXTRA_WORK_ID) : NO_USER_SPECIFIED;
         mExpandSearch = activity.getIntent().getBooleanExtra(EXTRA_EXPAND_SEARCH_VIEW, false);
 
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 86b628e..3afe450 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -62,6 +62,7 @@
     private FaceSettingsAttentionPreferenceController mAttentionController;
     private FaceSettingsRemoveButtonPreferenceController mRemoveController;
     private FaceSettingsEnrollButtonPreferenceController mEnrollController;
+    private FaceSettingsLockscreenBypassPreferenceController mLockscreenController;
     private List<AbstractPreferenceController> mControllers;
 
     private List<Preference> mTogglePreferences;
@@ -136,7 +137,7 @@
         Preference attentionPref = findPreference(FaceSettingsAttentionPreferenceController.KEY);
         Preference confirmPref = findPreference(FaceSettingsConfirmPreferenceController.KEY);
         Preference bypassPref =
-                findPreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
+                findPreference(mLockscreenController.getPreferenceKey());
         mTogglePreferences = new ArrayList<>(
                 Arrays.asList(keyguardPref, appPref, attentionPref, confirmPref, bypassPref));
 
@@ -145,12 +146,10 @@
 
         // There is no better way to do this :/
         for (AbstractPreferenceController controller : mControllers) {
-            if (controller instanceof  FaceSettingsPreferenceController) {
+            if (controller instanceof FaceSettingsPreferenceController) {
                 ((FaceSettingsPreferenceController) controller).setUserId(mUserId);
             } else if (controller instanceof FaceSettingsEnrollButtonPreferenceController) {
                 ((FaceSettingsEnrollButtonPreferenceController) controller).setUserId(mUserId);
-            } else if (controller instanceof FaceSettingsLockscreenBypassPreferenceController) {
-                ((FaceSettingsLockscreenBypassPreferenceController) controller).setUserId(mUserId);
             }
         }
         mRemoveController.setUserId(mUserId);
@@ -158,7 +157,7 @@
         // Don't show keyguard controller for work profile settings.
         if (mUserManager.isManagedProfile(mUserId)) {
             removePreference(FaceSettingsKeyguardPreferenceController.KEY);
-            removePreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
+            removePreference(mLockscreenController.getPreferenceKey());
         }
 
         if (savedInstanceState != null) {
@@ -167,6 +166,14 @@
     }
 
     @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+
+        mLockscreenController = use(FaceSettingsLockscreenBypassPreferenceController.class);
+        mLockscreenController.setUserId(mUserId);
+    }
+
+    @Override
     public void onResume() {
         super.onResume();
 
@@ -269,7 +276,6 @@
             Lifecycle lifecycle) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         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/FaceSettingsLockscreenBypassPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
index 44165b8..cef174d 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java
@@ -30,16 +30,10 @@
 public class FaceSettingsLockscreenBypassPreferenceController
         extends FaceSettingsPreferenceController {
 
-    static final String KEY = "security_lockscreen_bypass";
-
     @VisibleForTesting
     protected FaceManager mFaceManager;
     private UserManager mUserManager;
 
-    public FaceSettingsLockscreenBypassPreferenceController(Context context) {
-        this(context, KEY);
-    }
-
     public FaceSettingsLockscreenBypassPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
         if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java
index 94bdfe8..a1d86be 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingController.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java
@@ -294,8 +294,7 @@
         if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
             mDevice.setPairingConfirmation(true);
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
-            byte[] pinBytes = BluetoothDevice.convertPinToBytes(mPasskeyFormatted);
-            mDevice.setPin(pinBytes);
+            mDevice.setPin(mPasskeyFormatted);
         }
     }
 
@@ -391,17 +390,9 @@
         switch (mType) {
             case BluetoothDevice.PAIRING_VARIANT_PIN:
             case BluetoothDevice.PAIRING_VARIANT_PIN_16_DIGITS:
-                byte[] pinBytes = BluetoothDevice.convertPinToBytes(passkey);
-                if (pinBytes == null) {
-                    return;
-                }
-                mDevice.setPin(pinBytes);
+                mDevice.setPin(passkey);
                 break;
 
-            case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
-                int pass = Integer.parseInt(passkey);
-                mDevice.setPasskey(pass);
-                break;
 
             case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
             case BluetoothDevice.PAIRING_VARIANT_CONSENT:
@@ -410,11 +401,9 @@
 
             case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
             case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN:
-                // Do nothing.
-                break;
-
             case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
-                mDevice.setRemoteOutOfBandData();
+            case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
+                // Do nothing.
                 break;
 
             default:
@@ -428,7 +417,7 @@
      */
     public void onCancel() {
         Log.d(TAG, "Pairing dialog canceled");
-        mDevice.cancelPairingUserInput();
+        mDevice.cancelPairing();
     }
 
     /**
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingService.java b/src/com/android/settings/bluetooth/BluetoothPairingService.java
index d93e57d..53e93d9 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingService.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingService.java
@@ -85,7 +85,7 @@
             } else if (action.equals(ACTION_DISMISS_PAIRING)) {
                 Log.d(TAG, "Notification cancel " + mDevice.getAddress() + " (" +
                         mDevice.getName() + ")");
-                mDevice.cancelPairingUserInput();
+                mDevice.cancelPairing();
             } else {
                 int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
                         BluetoothDevice.ERROR);
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index 91c333a..4f20a01 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -28,4 +28,5 @@
             "settings_wifi_details_datausage_header";
     public static final String PERSONAL_WORK_PROFILE = "settings_work_profile";
     public static final String CONTROLLER_ENHANCEMENT = "settings_controller_loading_enhancement";
+    public static final String CONDITIONAL_CARDS = "settings_conditionals";
 }
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 92dc74f..4ad4c5f 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -75,6 +75,7 @@
 import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings;
 import com.android.settings.deviceinfo.legal.ModuleLicensesDashboard;
 import com.android.settings.display.NightDisplaySettings;
+import com.android.settings.display.darkmode.DarkModeSettingsFragment;
 import com.android.settings.dream.DreamSettings;
 import com.android.settings.enterprise.EnterprisePrivacySettings;
 import com.android.settings.fuelgauge.AdvancedPowerUsageDetail;
@@ -285,7 +286,8 @@
             PreviouslyConnectedDeviceDashboardFragment.class.getName(),
             BatterySaverScheduleSettings.class.getName(),
             MobileNetworkListFragment.class.getName(),
-            GlobalActionsPanelSettings.class.getName()
+            GlobalActionsPanelSettings.class.getName(),
+            DarkModeSettingsFragment.class.getName()
     };
 
     public static final String[] SETTINGS_FOR_RESTRICTED = {
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
index de23ec0..79228c2 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
@@ -53,26 +53,29 @@
      * Denotes the profile type.
      */
     @Retention(RetentionPolicy.SOURCE)
-    @IntDef({PERSONAL, WORK, ALL})
+    @IntDef({
+            ProfileType.PERSONAL,
+            ProfileType.WORK,
+            ProfileType.ALL
+    })
     public @interface ProfileType {
+        /**
+         * It is personal work profile.
+         */
+        int PERSONAL = 1;
+
+        /**
+         * It is work profile
+         */
+        int WORK = 1 << 1;
+
+        /**
+         * It is personal and work profile
+         */
+        int ALL = PERSONAL | WORK;
     }
 
     /**
-     * It is personal work profile.
-     */
-    public static final int PERSONAL = 1;
-
-    /**
-     * It is work profile
-     */
-    public static final int WORK = 1 << 1;
-
-    /**
-     * It is personal and work profile
-     */
-    public static final int ALL = PERSONAL | WORK;
-
-    /**
      * Used in fragment argument and pass {@link ProfileType} to it
      */
     public static final String EXTRA_PROFILE = "profile";
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
index a448f57..17fed11 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
@@ -30,12 +30,12 @@
     @Override
     public Fragment[] getFragments() {
         final Bundle workOnly = getArguments() != null ? getArguments().deepCopy() : new Bundle();
-        workOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.WORK);
+        workOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.WORK);
         final Fragment workFragment = new ManageApplications();
         workFragment.setArguments(workOnly);
 
         final Bundle personalOnly = getArguments() != null ? getArguments() : new Bundle();
-        personalOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.PERSONAL);
+        personalOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.PERSONAL);
         final Fragment personalFragment = new ManageApplications();
         personalFragment.setArguments(personalOnly);
         return new Fragment[]{
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
index c204ad4..bb39cdb 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
@@ -37,7 +37,7 @@
 
         final Bundle storageBundle = new Bundle();
         storageBundle.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
-        storageBundle.putInt(EXTRA_PROFILE, ProfileSelectFragment.PERSONAL);
+        storageBundle.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.PERSONAL);
 
         final Fragment storageDashboardFragment = new StorageDashboardFragment();
         storageDashboardFragment.setArguments(storageBundle);
diff --git a/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceController.java
new file mode 100644
index 0000000..9e4b99e
--- /dev/null
+++ b/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceController.java
@@ -0,0 +1,133 @@
+/*
+ * 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.bluetooth;
+
+import android.bluetooth.BluetoothCodecConfig;
+import android.content.Context;
+import android.util.Log;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.development.BluetoothA2dpConfigStore;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Dialog preference controller to set the Bluetooth A2DP config of sample rate
+ */
+public class BluetoothSampleRateDialogPreferenceController extends
+        AbstractBluetoothDialogPreferenceController {
+
+    private static final String KEY = "bluetooth_sample_rate_settings";
+    private static final String TAG = "BtSampleRateCtr";
+
+    public BluetoothSampleRateDialogPreferenceController(Context context, Lifecycle lifecycle,
+                                                         BluetoothA2dpConfigStore store) {
+        super(context, lifecycle, store);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY;
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        ((BaseBluetoothDialogPreference) mPreference).setCallback(this);
+    }
+
+    @Override
+    protected void writeConfigurationValues(final int index) {
+        int sampleRateValue = BluetoothCodecConfig.SAMPLE_RATE_NONE; // default
+        switch (index) {
+            case 0:
+                final BluetoothCodecConfig currentConfig = getCurrentCodecConfig();
+                if (currentConfig != null) {
+                    sampleRateValue = getHighestSampleRate(getSelectableByCodecType(
+                            currentConfig.getCodecType()));
+                }
+                break;
+            case 1:
+                sampleRateValue = BluetoothCodecConfig.SAMPLE_RATE_44100;
+                break;
+            case 2:
+                sampleRateValue = BluetoothCodecConfig.SAMPLE_RATE_48000;
+                break;
+            case 3:
+                sampleRateValue = BluetoothCodecConfig.SAMPLE_RATE_88200;
+                break;
+            case 4:
+                sampleRateValue = BluetoothCodecConfig.SAMPLE_RATE_96000;
+                break;
+            default:
+                break;
+        }
+        mBluetoothA2dpConfigStore.setSampleRate(sampleRateValue);
+    }
+
+    @Override
+    protected int getCurrentIndexByConfig(BluetoothCodecConfig config) {
+        if (config == null) {
+            Log.e(TAG, "Unable to get current config index. Config is null.");
+        }
+        return convertCfgToBtnIndex(config.getSampleRate());
+    }
+
+    @Override
+    public List<Integer> getSelectableIndex() {
+        List<Integer> selectableIndex = new ArrayList<>();
+        selectableIndex.add(getDefaultIndex());
+        final BluetoothCodecConfig currentConfig = getCurrentCodecConfig();
+        if (currentConfig != null) {
+            final int configs =
+                    getSelectableByCodecType(currentConfig.getCodecType()).getSampleRate();
+            for (int sampleRate : SAMPLE_RATES) {
+                if ((configs & sampleRate) != 0) {
+                    selectableIndex.add(convertCfgToBtnIndex(sampleRate));
+                }
+            }
+        }
+        return selectableIndex;
+    }
+
+    @VisibleForTesting
+    int convertCfgToBtnIndex(int config) {
+        int index = getDefaultIndex();
+        switch (config) {
+            case BluetoothCodecConfig.SAMPLE_RATE_44100:
+                index = 1;
+                break;
+            case BluetoothCodecConfig.SAMPLE_RATE_48000:
+                index = 2;
+                break;
+            case BluetoothCodecConfig.SAMPLE_RATE_88200:
+                index = 3;
+                break;
+            case BluetoothCodecConfig.SAMPLE_RATE_96000:
+                index = 4;
+                break;
+            default:
+                Log.e(TAG, "Unsupported config:" + config);
+                break;
+        }
+        return index;
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index b36ad43..bbd87ab 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -87,7 +87,7 @@
         StorageManager sm = activity.getSystemService(StorageManager.class);
         mVolume = Utils.maybeInitializeVolume(sm, getArguments());
         mPersonalOnly = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE)
-                == ProfileSelectFragment.PERSONAL;
+                == ProfileSelectFragment.ProfileType.PERSONAL;
         if (mVolume == null) {
             activity.finish();
             return;
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index 857f535..0751141 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -26,6 +26,7 @@
 import android.os.PersistableBundle;
 import android.os.UserHandle;
 import android.telephony.CarrierConfigManager;
+import android.telephony.CellSignalStrength;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
@@ -48,6 +49,8 @@
 import com.android.settingslib.core.lifecycle.events.OnPause;
 import com.android.settingslib.core.lifecycle.events.OnResume;
 
+import java.util.List;
+
 public class SimStatusDialogController implements LifecycleObserver, OnResume, OnPause {
 
     private final static String TAG = "SimStatusDialogCtrl";
@@ -430,11 +433,37 @@
     }
 
     private int getDbm(SignalStrength signalStrength) {
-        return signalStrength.getDbm();
+        List<CellSignalStrength> cellSignalStrengthList = signalStrength.getCellSignalStrengths();
+        int dbm = -1;
+        if (cellSignalStrengthList == null) {
+            return dbm;
+        }
+
+        for (CellSignalStrength cell : cellSignalStrengthList) {
+            if (cell.getDbm() != -1) {
+                dbm = cell.getDbm();
+                break;
+            }
+        }
+
+        return dbm;
     }
 
     private int getAsuLevel(SignalStrength signalStrength) {
-        return signalStrength.getAsuLevel();
+        List<CellSignalStrength> cellSignalStrengthList = signalStrength.getCellSignalStrengths();
+        int asu = -1;
+        if (cellSignalStrengthList == null) {
+            return asu;
+        }
+
+        for (CellSignalStrength cell : cellSignalStrengthList) {
+            if (cell.getAsuLevel() != -1) {
+                asu = cell.getAsuLevel();
+                break;
+            }
+        }
+
+        return asu;
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index 164eca7..1f58ea9 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -405,7 +405,8 @@
         } else {
             final Bundle args = new Bundle(2 + additionalCapacity);
             args.putInt(ProfileSelectFragment.EXTRA_PROFILE,
-                    mIsWorkProfile ? ProfileSelectFragment.WORK : ProfileSelectFragment.ALL);
+                    mIsWorkProfile ? ProfileSelectFragment.ProfileType.WORK
+                            : ProfileSelectFragment.ProfileType.ALL);
             args.putInt(ManageApplications.EXTRA_WORK_ID, mUserId);
             return args;
         }
diff --git a/src/com/android/settings/fuelgauge/BatteryWifiParser.java b/src/com/android/settings/fuelgauge/BatteryWifiParser.java
index 014c069..2aa6749 100644
--- a/src/com/android/settings/fuelgauge/BatteryWifiParser.java
+++ b/src/com/android/settings/fuelgauge/BatteryWifiParser.java
@@ -14,8 +14,8 @@
 
 package com.android.settings.fuelgauge;
 
-import android.os.BatteryStats;
 import android.os.BatteryStats.HistoryItem;
+import android.os.BatteryStatsManager;
 
 public class BatteryWifiParser extends BatteryFlagParser {
 
@@ -27,12 +27,12 @@
     protected boolean isSet(HistoryItem record) {
         switch ((record.states2 & HistoryItem.STATE2_WIFI_SUPPL_STATE_MASK)
                 >> HistoryItem.STATE2_WIFI_SUPPL_STATE_SHIFT) {
-            case BatteryStats.WIFI_SUPPL_STATE_DISCONNECTED:
-            case BatteryStats.WIFI_SUPPL_STATE_DORMANT:
-            case BatteryStats.WIFI_SUPPL_STATE_INACTIVE:
-            case BatteryStats.WIFI_SUPPL_STATE_INTERFACE_DISABLED:
-            case BatteryStats.WIFI_SUPPL_STATE_INVALID:
-            case BatteryStats.WIFI_SUPPL_STATE_UNINITIALIZED:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_DISCONNECTED:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_DORMANT:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_INACTIVE:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_INTERFACE_DISABLED:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_INVALID:
+            case BatteryStatsManager.WIFI_SUPPL_STATE_UNINITIALIZED:
                 return false;
         }
         return true;
diff --git a/src/com/android/settings/network/telephony/MobileDataSlice.java b/src/com/android/settings/network/telephony/MobileDataSlice.java
index 65eaf87..152028c 100644
--- a/src/com/android/settings/network/telephony/MobileDataSlice.java
+++ b/src/com/android/settings/network/telephony/MobileDataSlice.java
@@ -38,11 +38,11 @@
 
 import com.android.settings.R;
 import com.android.settings.Utils;
-import com.android.settings.network.AirplaneModePreferenceController;
 import com.android.settings.network.MobileDataContentObserver;
 import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.slices.CustomSliceable;
 import com.android.settings.slices.SliceBackgroundWorker;
+import com.android.settingslib.WirelessUtils;
 
 import com.google.common.annotations.VisibleForTesting;
 
@@ -184,10 +184,7 @@
 
     @VisibleForTesting
     boolean isAirplaneModeEnabled() {
-        // Generic key since we only want the method check - no UI.
-        AirplaneModePreferenceController controller = new AirplaneModePreferenceController(mContext,
-                "key" /* Key */);
-        return controller.isChecked();
+        return WirelessUtils.isAirplaneModeOn(mContext);
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/notification/AlarmVolumePreferenceController.java b/src/com/android/settings/notification/AlarmVolumePreferenceController.java
index d6a4110..15657f1 100644
--- a/src/com/android/settings/notification/AlarmVolumePreferenceController.java
+++ b/src/com/android/settings/notification/AlarmVolumePreferenceController.java
@@ -42,6 +42,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public boolean useDynamicSliceSummary() {
         return true;
     }
diff --git a/src/com/android/settings/notification/CallVolumePreferenceController.java b/src/com/android/settings/notification/CallVolumePreferenceController.java
index ded57b3..d505227 100644
--- a/src/com/android/settings/notification/CallVolumePreferenceController.java
+++ b/src/com/android/settings/notification/CallVolumePreferenceController.java
@@ -44,6 +44,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public boolean useDynamicSliceSummary() {
         return true;
     }
diff --git a/src/com/android/settings/notification/MediaVolumePreferenceController.java b/src/com/android/settings/notification/MediaVolumePreferenceController.java
index ae3146c..e18d2e5 100644
--- a/src/com/android/settings/notification/MediaVolumePreferenceController.java
+++ b/src/com/android/settings/notification/MediaVolumePreferenceController.java
@@ -43,6 +43,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public boolean useDynamicSliceSummary() {
         return true;
     }
diff --git a/src/com/android/settings/notification/NotificationVolumePreferenceController.java b/src/com/android/settings/notification/NotificationVolumePreferenceController.java
index c82d04b..0fe0d62 100644
--- a/src/com/android/settings/notification/NotificationVolumePreferenceController.java
+++ b/src/com/android/settings/notification/NotificationVolumePreferenceController.java
@@ -45,6 +45,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public String getPreferenceKey() {
         return KEY_NOTIFICATION_VOLUME;
     }
diff --git a/src/com/android/settings/notification/RemoteVolumePreferenceController.java b/src/com/android/settings/notification/RemoteVolumePreferenceController.java
index 802d75f..bb41975 100644
--- a/src/com/android/settings/notification/RemoteVolumePreferenceController.java
+++ b/src/com/android/settings/notification/RemoteVolumePreferenceController.java
@@ -197,6 +197,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public boolean useDynamicSliceSummary() {
         return true;
     }
diff --git a/src/com/android/settings/notification/RingVolumePreferenceController.java b/src/com/android/settings/notification/RingVolumePreferenceController.java
index 08efc93..5e7d067 100644
--- a/src/com/android/settings/notification/RingVolumePreferenceController.java
+++ b/src/com/android/settings/notification/RingVolumePreferenceController.java
@@ -96,6 +96,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public boolean useDynamicSliceSummary() {
         return true;
     }
diff --git a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
index b043cb1..503b5bc 100644
--- a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
+++ b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
@@ -78,6 +78,11 @@
     }
 
     @Override
+    public boolean isPublicSlice() {
+        return true;
+    }
+
+    @Override
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         Preference preference = screen.findPreference(KEY_VIBRATE_WHEN_RINGING);
diff --git a/src/com/android/settings/security/SimLockPreferenceController.java b/src/com/android/settings/security/SimLockPreferenceController.java
index d4def6b..3b23daa 100644
--- a/src/com/android/settings/security/SimLockPreferenceController.java
+++ b/src/com/android/settings/security/SimLockPreferenceController.java
@@ -38,7 +38,7 @@
     private final CarrierConfigManager mCarrierConfigManager;
     private final UserManager mUserManager;
     private final SubscriptionManager mSubscriptionManager;
-    private final TelephonyManager mTelephonyManager;
+    private TelephonyManager mTelephonyManager;
 
     public SimLockPreferenceController(Context context) {
         super(context, KEY_SIM_LOCK);
@@ -99,7 +99,9 @@
 
         if (subInfoList != null) {
             for (SubscriptionInfo subInfo : subInfoList) {
-                if (mTelephonyManager.hasIccCard(subInfo.getSimSlotIndex())) {
+                mTelephonyManager = mTelephonyManager
+                        .createForSubscriptionId(subInfo.getSimSlotIndex());
+                if (mTelephonyManager.hasIccCard()) {
                     return true;
                 }
             }
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
index 70d86d0..c4d8ead 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
@@ -18,7 +18,13 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.content.ComponentName;
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.os.Build;
 import android.provider.Settings;
 
 import com.android.settings.R;
@@ -28,12 +34,18 @@
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
 
 @RunWith(RobolectricTestRunner.class)
-public class AccessibilityUtilTest {
+public final class AccessibilityUtilTest {
     private static final int ON = 1;
     private static final int OFF = 0;
     private static final String SECURE_TEST_KEY = "secure_test_key";
+    private static final String DUMMY_PACKAGE_NAME = "com.dummy.example";
+    private static final String DUMMY_CLASS_NAME = DUMMY_PACKAGE_NAME + ".dummy_a11y_service";
+    private static final String DUMMY_COMPONENT_NAME = DUMMY_PACKAGE_NAME + "/" + DUMMY_CLASS_NAME;
     private Context mContext;
 
     @Before
@@ -68,4 +80,66 @@
         assertThat(result)
                 .isEqualTo(mContext.getText(R.string.accessibility_feature_state_off));
     }
+
+    @Test
+    public void getAccessibilityServiceFragmentType_targetSdkQ_legacyType() {
+        final AccessibilityServiceInfo info = getMockAccessibilityServiceInfo();
+
+        info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion = Build.VERSION_CODES.Q;
+        info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON;
+
+        assertThat(AccessibilityUtil.getAccessibilityServiceFragmentType(info)).isEqualTo(
+                AccessibilityUtil.AccessibilityServiceFragmentType.LEGACY);
+
+    }
+
+    @Test
+    public void getAccessibilityServiceFragmentType_targetSdkR_HaveA11yButton_headlessType() {
+        final AccessibilityServiceInfo info = getMockAccessibilityServiceInfo();
+
+        info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion = Build.VERSION_CODES.R;
+        info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON;
+
+        assertThat(AccessibilityUtil.getAccessibilityServiceFragmentType(info)).isEqualTo(
+                AccessibilityUtil.AccessibilityServiceFragmentType.HEADLESS);
+
+    }
+
+    @Test
+    public void getAccessibilityServiceFragmentType_targetSdkR_NoA11yButton_intuitiveType() {
+        final AccessibilityServiceInfo info = getMockAccessibilityServiceInfo();
+
+        info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion = Build.VERSION_CODES.R;
+        info.flags |= ~AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON;
+
+        assertThat(AccessibilityUtil.getAccessibilityServiceFragmentType(info)).isEqualTo(
+                AccessibilityUtil.AccessibilityServiceFragmentType.INTUITIVE);
+
+    }
+
+
+    private AccessibilityServiceInfo getMockAccessibilityServiceInfo() {
+        final ApplicationInfo applicationInfo = new ApplicationInfo();
+        final ServiceInfo serviceInfo = new ServiceInfo();
+        applicationInfo.packageName = DUMMY_PACKAGE_NAME;
+        serviceInfo.packageName = DUMMY_PACKAGE_NAME;
+        serviceInfo.name = DUMMY_CLASS_NAME;
+        serviceInfo.applicationInfo = applicationInfo;
+
+        final ResolveInfo resolveInfo = new ResolveInfo();
+        resolveInfo.serviceInfo = serviceInfo;
+
+        try {
+            final AccessibilityServiceInfo info = new AccessibilityServiceInfo(resolveInfo,
+                    mContext);
+            final ComponentName componentName = ComponentName.unflattenFromString(
+                    DUMMY_COMPONENT_NAME);
+            info.setComponentName(componentName);
+            return info;
+        } catch (XmlPullParserException | IOException e) {
+            // Do nothing
+        }
+
+        return null;
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/DaltonizerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/DaltonizerPreferenceControllerTest.java
index e236cd4..86520a8 100644
--- a/tests/robotests/src/com/android/settings/accessibility/DaltonizerPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/DaltonizerPreferenceControllerTest.java
@@ -18,53 +18,100 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ContentResolver;
 import android.content.Context;
 import android.provider.Settings;
 
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.RadioButtonPreference;
 
 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 DaltonizerPreferenceControllerTest {
-    private static final int ON = 1;
-    private static final int OFF = 0;
+public class DaltonizerPreferenceControllerTest implements
+        DaltonizerPreferenceController.OnChangeListener {
+    private static final String PREF_KEY = "daltonizer_mode_protanomaly";
+    private static final String PREF_VALUE = "11";
+    private static final String PREF_FAKE_VALUE = "-1";
 
-    private Context mContext;
     private DaltonizerPreferenceController mController;
 
+    @Mock
+    private RadioButtonPreference mMockPref;
+    private Context mContext;
+    private ContentResolver mContentResolver;
+
+    @Mock
+    private PreferenceScreen mScreen;
+
     @Before
     public void setUp() {
+        MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        mController = new DaltonizerPreferenceController(mContext, "color_correction");
+        mController = new DaltonizerPreferenceController(mContext, mock(Lifecycle.class), PREF_KEY);
+        mController.setOnChangeListener(this);
+        mContentResolver = mContext.getContentResolver();
+
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mMockPref);
+        when(mMockPref.getKey()).thenReturn(PREF_KEY);
+        mController.displayPreference(mScreen);
+    }
+
+    @Override
+    public void onCheckedChanged(Preference preference) {
+        mController.updateState(preference);
     }
 
     @Test
-    public void getAvailabilityStatus_shouldReturnAvailableUnsearchable() {
-        assertThat(mController.getAvailabilityStatus())
-                .isEqualTo(BasePreferenceController.AVAILABLE_UNSEARCHABLE);
+    public void isAvailable() {
+        assertThat(mController.isAvailable()).isTrue();
     }
 
     @Test
-    public void getSummary_enabledColorCorrection_shouldReturnOnSummary() {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, ON);
+    public void updateState_notChecked() {
+        Settings.Secure.putString(mContentResolver,
+                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, PREF_FAKE_VALUE);
 
-        assertThat(mController.getSummary())
-                .isEqualTo(mContext.getText(R.string.accessibility_feature_state_on));
+        mController.updateState(mMockPref);
+
+        // the first checked state is set to false by control
+        verify(mMockPref, atLeastOnce()).setChecked(false);
+        verify(mMockPref, never()).setChecked(true);
     }
 
     @Test
-    public void getSummary_disabledColorCorrection_shouldReturnOffSummary() {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, OFF);
+    public void updateState_checked() {
+        Settings.Secure.putString(mContentResolver,
+                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, PREF_VALUE);
 
-        assertThat(mController.getSummary())
-                .isEqualTo(mContext.getText(R.string.accessibility_feature_state_off));
+        mController.updateState(mMockPref);
+
+        // the first checked state is set to false by control
+        verify(mMockPref, atLeastOnce()).setChecked(false);
+        verify(mMockPref, atLeastOnce()).setChecked(true);
+    }
+
+    @Test
+    public void onRadioButtonClick_shouldReturnDaltonizerValue() {
+        mController.onRadioButtonClicked(mMockPref);
+        final String accessibilityDaltonizerValue = Settings.Secure.getString(mContentResolver,
+                Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER);
+
+        assertThat(accessibilityDaltonizerValue).isEqualTo(PREF_VALUE);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
index d4a855f..65395a0 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
@@ -98,7 +98,7 @@
             .thenReturn(new AuthenticatorDescription[0]);
         when(mAccountManager.getAccountsAsUser(anyInt())).thenReturn(new Account[0]);
         mController = new AccountPreferenceController(mContext, mFragment, null, mAccountHelper,
-                ProfileSelectFragment.ALL);
+                ProfileSelectFragment.ProfileType.ALL);
     }
 
     @After
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java
new file mode 100644
index 0000000..d274a57
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.bluetooth;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothCodecConfig;
+import android.bluetooth.BluetoothCodecStatus;
+import android.content.Context;
+
+import androidx.lifecycle.LifecycleOwner;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.development.BluetoothA2dpConfigStore;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(RobolectricTestRunner.class)
+public class BluetoothSampleRateDialogPreferenceControllerTest {
+
+    @Mock
+    private BluetoothA2dp mBluetoothA2dp;
+    @Mock
+    private PreferenceScreen mScreen;
+
+    private BluetoothSampleRateDialogPreferenceController mController;
+    private BluetoothSampleRateDialogPreference mPreference;
+    private BluetoothA2dpConfigStore mBluetoothA2dpConfigStore;
+    private BluetoothCodecStatus mCodecStatus;
+    private BluetoothCodecConfig mCodecConfigAAC;
+    private BluetoothCodecConfig mCodecConfigSBC;
+    private Context mContext;
+    private LifecycleOwner mLifecycleOwner;
+    private Lifecycle mLifecycle;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mLifecycleOwner = () -> mLifecycle;
+        mLifecycle = new Lifecycle(mLifecycleOwner);
+        mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
+        mController = spy(new BluetoothSampleRateDialogPreferenceController(mContext, mLifecycle,
+                mBluetoothA2dpConfigStore));
+        mPreference = new BluetoothSampleRateDialogPreference(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+        mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC,
+                BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT,
+                BluetoothCodecConfig.SAMPLE_RATE_48000 | BluetoothCodecConfig.SAMPLE_RATE_88200,
+                BluetoothCodecConfig.BITS_PER_SAMPLE_NONE,
+                BluetoothCodecConfig.CHANNEL_MODE_NONE,
+                0, 0, 0, 0);
+        mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC,
+                BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT,
+                BluetoothCodecConfig.SAMPLE_RATE_96000,
+                BluetoothCodecConfig.BITS_PER_SAMPLE_NONE,
+                BluetoothCodecConfig.CHANNEL_MODE_NONE,
+                0, 0, 0, 0);
+    }
+
+    @Test
+    public void writeConfigurationValues_selectDefault_setHighest() {
+        mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
+        BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
+        mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
+        when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
+        mController.onBluetoothServiceConnected(mBluetoothA2dp);
+
+        mController.writeConfigurationValues(0);
+        verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
+    }
+
+    @Test
+    public void writeConfigurationValues_checkSampleRate() {
+        mController.writeConfigurationValues(1);
+        verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_44100);
+
+        mController.writeConfigurationValues(2);
+        verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_48000);
+
+        mController.writeConfigurationValues(3);
+        verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
+
+        mController.writeConfigurationValues(4);
+        verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_96000);
+    }
+
+    @Test
+    public void getCurrentIndexByConfig_verifyIndex() {
+        assertThat(mController.getCurrentIndexByConfig(mCodecConfigSBC)).isEqualTo(
+                mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_96000));
+    }
+
+    @Test
+    public void getSelectableIndex_verifyList() {
+        BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
+        mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
+        when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
+        mController.onBluetoothServiceConnected(mBluetoothA2dp);
+        List<Integer> indexList = new ArrayList<>();
+        indexList.add(mController.getDefaultIndex());
+        indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_48000));
+        indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_88200));
+
+        assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
+        assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
index 3ecdcff..5a74804 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -45,6 +45,10 @@
 import android.content.pm.PackageInfo;
 import android.os.PersistableBundle;
 import android.telephony.CarrierConfigManager;
+import android.telephony.CellSignalStrength;
+import android.telephony.CellSignalStrengthCdma;
+import android.telephony.CellSignalStrengthLte;
+import android.telephony.CellSignalStrengthWcdma;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
@@ -73,6 +77,9 @@
 import org.robolectric.shadows.ShadowPackageManager;
 import org.robolectric.util.ReflectionHelpers;
 
+import java.util.ArrayList;
+import java.util.List;
+
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {ShadowDeviceInfoUtils.class})
 public class SimStatusDialogControllerTest {
@@ -90,6 +97,12 @@
     @Mock
     private SignalStrength mSignalStrength;
     @Mock
+    private CellSignalStrengthCdma mCellSignalStrengthCdma;
+    @Mock
+    private CellSignalStrengthLte mCellSignalStrengthLte;
+    @Mock
+    private CellSignalStrengthWcdma mCellSignalStrengthWcdma;
+    @Mock
     private CarrierConfigManager mCarrierConfigManager;
     @Mock
     private PersistableBundle mPersistableBundle;
@@ -113,8 +126,15 @@
         mController = spy(new SimStatusDialogController(mDialog, mLifecycle, 0 /* phone id */));
         ShadowDeviceInfoUtils.setPhoneNumber("");
         doReturn(mServiceState).when(mController).getCurrentServiceState();
-        doReturn(0).when(mSignalStrength).getDbm();
-        doReturn(0).when(mSignalStrength).getAsuLevel();
+        //CellSignalStrength setup
+        doReturn(0).when(mCellSignalStrengthCdma).getDbm();
+        doReturn(0).when(mCellSignalStrengthCdma).getAsuLevel();
+        doReturn(0).when(mCellSignalStrengthLte).getDbm();
+        doReturn(0).when(mCellSignalStrengthLte).getAsuLevel();
+        doReturn(0).when(mCellSignalStrengthWcdma).getDbm();
+        doReturn(0).when(mCellSignalStrengthWcdma).getAsuLevel();
+
+        doReturn(null).when(mSignalStrength).getCellSignalStrengths();
         doReturn(mPhoneStateListener).when(mController).getPhoneStateListener();
         doReturn(mSignalStrength).when(mController).getSignalStrength();
         doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt());
@@ -226,18 +246,36 @@
     }
 
     @Test
-    public void initialize_updateSignalStrengthWith50_shouldUpdateSignalStrengthTo50() {
-        final int signalDbm = 50;
-        final int signalAsu = 50;
-        doReturn(signalDbm).when(mSignalStrength).getDbm();
-        doReturn(signalAsu).when(mSignalStrength).getAsuLevel();
+    public void initialize_updateSignalStrengthWithLte50Wcdma40_shouldUpdateSignalStrengthTo50() {
+        final int lteDbm = 50;
+        final int lteAsu = 50;
+        final int wcdmaDbm = 40;
+        final int wcdmaAsu = 40;
+        setupCellSignalStrength_lteWcdma(lteDbm, lteAsu, wcdmaDbm, wcdmaAsu);
         when(mPersistableBundle.getBoolean(
                 CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(true);
 
         mController.initialize();
 
         final String signalStrengthString =
-                mContext.getString(R.string.sim_signal_strength, signalDbm, signalAsu);
+                mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu);
+        verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString);
+    }
+
+    @Test
+    public void initialize_updateSignalStrengthWithLte50Cdma30_shouldUpdateSignalStrengthTo50() {
+        final int lteDbm = 50;
+        final int lteAsu = 50;
+        final int cdmaDbm = 30;
+        final int cdmaAsu = 30;
+        setupCellSignalStrength_lteCdma(lteDbm, lteAsu, cdmaDbm, cdmaAsu);
+        when(mPersistableBundle.getBoolean(
+                CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(true);
+
+        mController.initialize();
+
+        final String signalStrengthString =
+                mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu);
         verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString);
     }
 
@@ -248,17 +286,16 @@
         when(mPersistableBundle.getBoolean(
                 CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(true);
 
-        final int signalDbm = 50;
-        final int signalAsu = 50;
-        doReturn(signalDbm).when(mSignalStrength).getDbm();
-        doReturn(signalAsu).when(mSignalStrength).getAsuLevel();
+        final int lteDbm = 50;
+        final int lteAsu = 50;
+        setupCellSignalStrength_lteOnly(lteDbm, lteAsu);
         when(mPersistableBundle.getBoolean(
                 CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(true);
 
         mController.initialize();
 
         final String signalStrengthString =
-                mContext.getString(R.string.sim_signal_strength, signalDbm, signalAsu);
+                mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu);
         verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString);
     }
 
@@ -423,4 +460,41 @@
         // we should not crash when running the following line
         mController.initialize();
     }
+
+    private void setupCellSignalStrength_lteWcdma(int lteDbm, int lteAsu, int wcdmaDbm,
+            int wcdmaAsu) {
+        doReturn(lteDbm).when(mCellSignalStrengthLte).getDbm();
+        doReturn(lteAsu).when(mCellSignalStrengthLte).getAsuLevel();
+        doReturn(wcdmaDbm).when(mCellSignalStrengthWcdma).getDbm();
+        doReturn(wcdmaAsu).when(mCellSignalStrengthWcdma).getAsuLevel();
+
+        List<CellSignalStrength> cellSignalStrengthList = new ArrayList<>(2);
+        cellSignalStrengthList.add(mCellSignalStrengthLte);
+        cellSignalStrengthList.add(mCellSignalStrengthWcdma);
+
+        doReturn(cellSignalStrengthList).when(mSignalStrength).getCellSignalStrengths();
+    }
+
+    private void setupCellSignalStrength_lteCdma(int lteDbm, int lteAsu, int cdmaDbm, int cdmaAsu) {
+        doReturn(lteDbm).when(mCellSignalStrengthLte).getDbm();
+        doReturn(lteAsu).when(mCellSignalStrengthLte).getAsuLevel();
+        doReturn(cdmaDbm).when(mCellSignalStrengthCdma).getDbm();
+        doReturn(cdmaAsu).when(mCellSignalStrengthCdma).getAsuLevel();
+
+        List<CellSignalStrength> cellSignalStrengthList = new ArrayList<>(2);
+        cellSignalStrengthList.add(mCellSignalStrengthLte);
+        cellSignalStrengthList.add(mCellSignalStrengthCdma);
+
+        doReturn(cellSignalStrengthList).when(mSignalStrength).getCellSignalStrengths();
+    }
+
+    private void setupCellSignalStrength_lteOnly(int lteDbm, int lteAsu) {
+        doReturn(lteDbm).when(mCellSignalStrengthLte).getDbm();
+        doReturn(lteAsu).when(mCellSignalStrengthLte).getAsuLevel();
+
+        List<CellSignalStrength> cellSignalStrengthList = new ArrayList<>(2);
+        cellSignalStrengthList.add(mCellSignalStrengthLte);
+
+        doReturn(cellSignalStrengthList).when(mSignalStrength).getCellSignalStrengths();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/AlarmVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/AlarmVolumePreferenceControllerTest.java
index 2120cd9..5253372 100644
--- a/tests/robotests/src/com/android/settings/notification/AlarmVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/AlarmVolumePreferenceControllerTest.java
@@ -78,4 +78,9 @@
     public void isSliceableCorrectKey_returnsTrue() {
         assertThat(mController.isSliceable()).isTrue();
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/CallVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/CallVolumePreferenceControllerTest.java
index 966d4e1..ed65d5b 100644
--- a/tests/robotests/src/com/android/settings/notification/CallVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/CallVolumePreferenceControllerTest.java
@@ -102,4 +102,9 @@
         new CallVolumePreferenceController(mContext, "bad_key");
         assertThat(controller.isSliceable()).isFalse();
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/MediaVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/MediaVolumePreferenceControllerTest.java
index 657b352..7cfcaff 100644
--- a/tests/robotests/src/com/android/settings/notification/MediaVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/MediaVolumePreferenceControllerTest.java
@@ -63,4 +63,9 @@
                 mContext);
         assertThat(controller.isSliceable()).isTrue();
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java
index 8e1b015..fe4744f 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java
@@ -102,4 +102,9 @@
                 new NotificationVolumePreferenceController(mContext);
         assertThat(controller.isSliceable()).isTrue();
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
index 175599a..44fc04f 100644
--- a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java
@@ -218,4 +218,9 @@
 
         assertThat(mController.mPreference.getProgress()).isEqualTo(CURRENT_POS);
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java
index e89edb4..5e484a3 100644
--- a/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java
@@ -104,4 +104,9 @@
                 new RingVolumePreferenceController(mContext);
         assertThat(controller.isSliceable()).isTrue();
     }
+
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
index a1b65c5..ec275c1 100644
--- a/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
@@ -44,9 +44,9 @@
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.robolectric.annotation.Config;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.shadows.ShadowContentResolver;
 
@@ -225,4 +225,8 @@
         assertThat(controller.isSliceable()).isFalse();
     }
 
+    @Test
+    public void isPublicSlice_returnTrue() {
+        assertThat(mController.isPublicSlice()).isTrue();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
index 0ae33a0..ebafceb 100644
--- a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
@@ -141,7 +141,8 @@
         final List<SubscriptionInfo> subscriptionInfoList = new ArrayList<>();
         SubscriptionInfo info = mock(SubscriptionInfo.class);
         subscriptionInfoList.add(info);
-        when(mTelephonyManager.hasIccCard(anyInt())).thenReturn(true);
+        when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
+        when(mTelephonyManager.hasIccCard()).thenReturn(true);
         when(mSubscriptionManager.getActiveSubscriptionInfoList(eq(true)))
                 .thenReturn(subscriptionInfoList);
     }