Merge "Add factory reset intent to the settings app." into main
diff --git a/OWNERS b/OWNERS
index c98be3e..69ae4f9 100644
--- a/OWNERS
+++ b/OWNERS
@@ -3,11 +3,13 @@
# People who can approve changes for submission
cantol@google.com
+cechkahn@google.com
chaohuiw@google.com
chiujason@google.com
dswliu@google.com
edgarwang@google.com
hanxu@google.com
+jiannan@google.com
millchen@google.com
songchenxi@google.com
songferngwang@google.com
diff --git a/res/layout/switch_bar.xml b/res/layout/switch_bar.xml
deleted file mode 100644
index 3bdfbd4..0000000
--- a/res/layout/switch_bar.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <TextView
- android:id="@+id/switch_text"
- android:layout_height="wrap_content"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_gravity="center_vertical"
- android:maxLines="2"
- android:ellipsize="end"
- android:textAppearance="@style/TextAppearance.Switch"
- android:textColor="?android:attr/textColorPrimaryInverse"
- android:textAlignment="viewStart"/>
-
- <ImageView
- android:id="@+id/restricted_icon"
- android:layout_width="@dimen/restricted_icon_size"
- android:layout_height="@dimen/restricted_icon_size"
- android:tint="?android:attr/colorAccent"
- android:theme="@android:style/Theme.Material"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="@dimen/restricted_icon_margin_end"
- android:visibility="gone" />
-
- <com.android.settings.widget.ToggleSwitch
- android:id="@+id/switch_widget"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:theme="@style/Widget.SwitchBar.Switch"/>
-
-</merge>
-
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 7888191..b83b2fa 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -16,8 +16,6 @@
<resources
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <color name="switchbar_switch_track_tint">#82000000</color>
- <color name="switchbar_switch_thumb_tint">@android:color/black</color>
<color name="homepage_accessibility_background">#783BE5</color>
<color name="homepage_support_background">#3F5FBD</color>
<color name="contextual_card_background">@*android:color/material_grey_900</color>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index b13447f..391a304 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -24,9 +24,6 @@
<dimen name="actionbar_contentInsetStart">24dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">80dp</dimen>
- <!-- SwitchBar sub settings margin start / end -->
- <dimen name="switchbar_subsettings_margin_start">80dp</dimen>
-
<dimen name="settings_panel_width">560dp</dimen>
<!-- Lock pattern view size, align sysui biometric_auth_pattern_view_size -->
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 82c3fef..363817c 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -20,8 +20,4 @@
<dimen name="actionbar_contentInsetStart">128dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">128dp</dimen>
- <!-- SwitchBar sub settings margin start / end -->
- <dimen name="switchbar_subsettings_margin_start">128dp</dimen>
- <dimen name="switchbar_subsettings_margin_end">128dp</dimen>
-
</resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 6480d48..d09d2fd 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -19,10 +19,6 @@
<dimen name="actionbar_contentInsetStart">80dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">80dp</dimen>
- <!-- SwitchBar sub settings margin start / end -->
- <dimen name="switchbar_subsettings_margin_start">80dp</dimen>
- <dimen name="switchbar_subsettings_margin_end">80dp</dimen>
-
<!-- Lock pattern view size, align sysui biometric_auth_pattern_view_size -->
<dimen name="biometric_auth_pattern_view_size">348dp</dimen>
</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 6f024a3..40a7c58 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -112,12 +112,8 @@
<attr name="appCount" format="integer" />
</declare-styleable>
+ <!-- TODO: Clean up this -->
<attr name="switchBarTheme" format="reference" />
- <attr name="switchBarMarginStart" format="dimension" />
- <attr name="switchBarMarginEnd" format="dimension" />
- <attr name="switchBarBackgroundColor" format="color" />
- <attr name="switchBarBackgroundActivatedColor" format="color" />
- <attr name="switchBarRestrictionIcon" format="reference" />
<attr name="preferenceBackgroundColor" format="color" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 657ba11..ae97945 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -72,10 +72,6 @@
<color name="contextual_card_background">@*android:color/background_device_default_light</color>
<!-- End of dashboard/homepage icon background colors -->
- <color name="switchbar_background_color">@*android:color/material_grey_600</color>
- <color name="switchbar_switch_track_tint">#BFFFFFFF</color>
- <color name="switchbar_switch_thumb_tint">@android:color/white</color>
-
<color name="battery_good_color_light">#43a047</color> <!-- Material Green 600 -->
<color name="battery_bad_color_light">#f44336</color> <!-- Material Red 500 -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 205e2a3..1c19833 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -75,10 +75,6 @@
<!-- Preference icon foreground image inset (from background edge to foreground edge) -->
<dimen name="preference_icon_foreground_image_inset">12dp</dimen>
- <!-- SwitchBar sub settings margin start / end -->
- <dimen name="switchbar_subsettings_margin_start">72dp</dimen>
- <dimen name="switchbar_subsettings_margin_end">16dp</dimen>
-
<!-- Search bar -->
<dimen name="search_bar_margin">16dp</dimen>
<dimen name="search_bar_height">52dp</dimen>
@@ -239,11 +235,6 @@
<dimen name="accessibility_qs_tooltip_margin">20dp</dimen>
<dimen name="accessibility_qs_tooltip_margin_top">27dp</dimen>
- <!-- Restricted icon in switch bar -->
- <dimen name="restricted_icon_margin_end">16dp</dimen>
- <!-- Restricted icon size in switch bar -->
- <dimen name="restricted_icon_size">@*android:dimen/config_restrictedIconSize</dimen>
-
<!-- Padding for Gestures settings screen -->
<dimen name="gestures_play_button_size">36dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ee78a45..1f5c743 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -215,10 +215,6 @@
<style name="TextAppearance.Medium" parent="@android:style/TextAppearance.DeviceDefault.Medium"/>
<style name="TextAppearance.Small" parent="@android:style/TextAppearance.DeviceDefault.Small"/>
- <style name="TextAppearance.Switch"
- parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
- <item name="android:textSize">16sp</item>
- </style>
<style name="TextAppearance.CategoryTitle"
parent="@*android:style/TextAppearance.DeviceDefault.Body2">
@@ -242,11 +238,6 @@
<item name="android:textColor">?android:attr/colorError</item>
</style>
- <style name="TextAppearance.Small.SwitchBar">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- <item name="android:textStyle">normal</item>
- </style>
-
<style name="TextAppearance.RemoveDialogContent"
parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:textSize">16sp</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 1431cd7..b149bb8 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -52,8 +52,6 @@
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Widget.ActionBar</item>
- <item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
-
<item name="preferenceBackgroundColor">@drawable/preference_background</item>
<!-- For AndroidX AlertDialog -->
@@ -88,7 +86,6 @@
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Widget.ActionBar.SubSettings</item>
- <item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
@@ -109,23 +106,9 @@
<item name="android:textColorHint">?android:attr/textColorSecondary</item>
</style>
- <style name="ThemeOverlay.SwitchBar.Settings.Base" parent="@*android:style/ThemeOverlay.DeviceDefault.ActionBar">
- <item name="android:elevation">1dp</item>
- <item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
- <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">@color/switchbar_background_color</item>
- <item name="switchBarBackgroundActivatedColor">?android:attr/colorAccent</item>
- <item name="switchBarRestrictionIcon">@*android:drawable/ic_info</item>
- </style>
-
- <style name="ThemeOverlay.SwitchBar.Settings" parent="ThemeOverlay.SwitchBar.Settings.Base"/>
-
- <style name="Widget.SwitchBar.Switch" parent="@android:style/Widget.Material.CompoundButton.Switch">
- <item name="android:trackTint">@color/switchbar_switch_track_tint</item>
- <item name="android:thumbTint">@color/switchbar_switch_thumb_tint</item>
- <item name="android:minHeight">@dimen/min_tap_target_size</item>
- <item name="android:minWidth">@dimen/min_tap_target_size</item>
- </style>
+ <!-- TODO: Clean up this -->
+ <style name="ThemeOverlay.SwitchBar.Settings"
+ parent="@*android:style/ThemeOverlay.DeviceDefault.ActionBar" />
<style name="ThemeOverlay.AlertDialog" parent="@android:style/ThemeOverlay.Material.Dialog.Alert">
<item name="android:windowSoftInputMode">adjustResize</item>
diff --git a/res/xml/accessibility_audio_adjustment.xml b/res/xml/accessibility_audio_adjustment.xml
index c38b4ad..92e6d8d 100644
--- a/res/xml/accessibility_audio_adjustment.xml
+++ b/res/xml/accessibility_audio_adjustment.xml
@@ -21,7 +21,7 @@
android:persistent="false"
android:title="@string/accessibility_audio_adjustment_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_primary_mono"
android:persistent="false"
android:summary="@string/accessibility_toggle_primary_mono_summary"
diff --git a/res/xml/accessibility_button_settings.xml b/res/xml/accessibility_button_settings.xml
index ab9fc41..2b1392d 100644
--- a/res/xml/accessibility_button_settings.xml
+++ b/res/xml/accessibility_button_settings.xml
@@ -56,7 +56,7 @@
android:title="@string/accessibility_button_size_title"
settings:controller="com.android.settings.accessibility.FloatingMenuSizePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="accessibility_button_fade"
android:persistent="false"
android:summary="@string/accessibility_button_fade_summary"
diff --git a/res/xml/accessibility_color_and_motion.xml b/res/xml/accessibility_color_and_motion.xml
index a313526..3b2e78d 100644
--- a/res/xml/accessibility_color_and_motion.xml
+++ b/res/xml/accessibility_color_and_motion.xml
@@ -49,7 +49,7 @@
settings:controller="com.android.settings.display.DarkUIPreferenceController"
settings:searchable="false"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:icon="@drawable/ic_accessibility_animation"
android:key="toggle_disable_animations"
android:persistent="false"
@@ -57,7 +57,7 @@
android:title="@string/accessibility_disable_animations"
settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_large_pointer_icon"
android:persistent="false"
android:summary="@string/accessibility_toggle_large_pointer_icon_summary"
diff --git a/res/xml/accessibility_hearing_aids.xml b/res/xml/accessibility_hearing_aids.xml
index b13eb74..20c8e29 100644
--- a/res/xml/accessibility_hearing_aids.xml
+++ b/res/xml/accessibility_hearing_aids.xml
@@ -53,7 +53,7 @@
android:fragment="com.android.settings.accessibility.AccessibilityAudioRoutingFragment"
settings:controller="com.android.settings.accessibility.HearingAidAudioRoutingPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="hearing_aid_compatibility"
android:order="30"
android:title="@string/accessibility_hac_mode_title"
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index f90d8b6..0f4065b 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -141,7 +141,7 @@
android:persistent="false"
android:title="@string/audio_category_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_audio_description"
android:persistent="false"
android:icon="@drawable/ic_audio_description"
diff --git a/res/xml/accessibility_shortcuts_settings.xml b/res/xml/accessibility_shortcuts_settings.xml
index 2863335..c807056 100644
--- a/res/xml/accessibility_shortcuts_settings.xml
+++ b/res/xml/accessibility_shortcuts_settings.xml
@@ -28,7 +28,7 @@
android:summary="@string/accessibility_button_summary"
settings:controller="com.android.settings.accessibility.AccessibilityButtonPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="accessibility_shortcut_preference"
android:persistent="false"
android:title="@string/accessibility_shortcut_service_on_lock_screen_title"
diff --git a/res/xml/accessibility_system_controls.xml b/res/xml/accessibility_system_controls.xml
index 37c4d67..460214f 100644
--- a/res/xml/accessibility_system_controls.xml
+++ b/res/xml/accessibility_system_controls.xml
@@ -36,7 +36,7 @@
settings:searchable="false"
settings:controller="com.android.settings.gestures.OneHandedEnablePreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_power_button_ends_call_preference"
android:persistent="false"
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
@@ -44,7 +44,7 @@
<!-- Standard auto-rotation preference that will be shown when device state based auto-rotation
settings are NOT available. -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_lock_screen_rotation_preference"
android:persistent="false"
android:title="@string/accelerometer_title"
diff --git a/res/xml/accessibility_text_reading_options.xml b/res/xml/accessibility_text_reading_options.xml
index 09954b3..0711a3f 100644
--- a/res/xml/accessibility_text_reading_options.xml
+++ b/res/xml/accessibility_text_reading_options.xml
@@ -45,7 +45,7 @@
settings:iconStartContentDescription="@string/screen_zoom_make_smaller_desc"
settings:keywords="@string/keywords_display_size" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_force_bold_text"
android:persistent="false"
android:title="@string/force_bold_text"
@@ -53,7 +53,7 @@
"com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"
settings:keywords="@string/keywords_bold_text" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="toggle_high_text_contrast_preference"
android:persistent="false"
android:summary="@string/accessibility_toggle_high_text_contrast_preference_summary"
diff --git a/res/xml/accessibility_vibration_intensity_settings.xml b/res/xml/accessibility_vibration_intensity_settings.xml
index 13dc03b..f9a5578 100644
--- a/res/xml/accessibility_vibration_intensity_settings.xml
+++ b/res/xml/accessibility_vibration_intensity_settings.xml
@@ -35,7 +35,7 @@
app:keywords="@string/keywords_ring_vibration"
app:controller="com.android.settings.accessibility.RingVibrationIntensityPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_intensity_preference_ramping_ringer"
android:title="@string/vibrate_when_ringing_option_ramping_ringer"
app:keywords="@string/keywords_ramping_ringer_vibration"
@@ -77,7 +77,7 @@
app:keywords="@string/keywords_media_vibration"
app:controller="com.android.settings.accessibility.MediaVibrationIntensityPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_intensity_preference_keyboard"
android:title="@string/accessibility_keyboard_vibration_title"
app:keywords="@string/keywords_keyboard_vibration"
diff --git a/res/xml/accessibility_vibration_settings.xml b/res/xml/accessibility_vibration_settings.xml
index 0435cb4..3ce92a6 100644
--- a/res/xml/accessibility_vibration_settings.xml
+++ b/res/xml/accessibility_vibration_settings.xml
@@ -29,13 +29,13 @@
android:key="vibration_category_call"
android:title="@string/accessibility_call_vibration_category_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_ring"
android:title="@string/accessibility_ring_vibration_title"
app:keywords="@string/keywords_ring_vibration"
app:controller="com.android.settings.accessibility.RingVibrationTogglePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_ramping_ringer"
android:title="@string/vibrate_when_ringing_option_ramping_ringer"
app:keywords="@string/keywords_ramping_ringer_vibration"
@@ -47,13 +47,13 @@
android:key="vibration_category_notification_alarm"
android:title="@string/accessibility_notification_alarm_vibration_category_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_notification"
android:title="@string/accessibility_notification_vibration_title"
app:keywords="@string/keywords_notification_vibration"
app:controller="com.android.settings.accessibility.NotificationVibrationTogglePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_alarm"
android:title="@string/accessibility_alarm_vibration_title"
app:keywords="@string/keywords_alarm_vibration"
@@ -65,19 +65,19 @@
android:key="vibration_category_haptics"
android:title="@string/accessibility_interactive_haptics_category_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_touch"
android:title="@string/accessibility_touch_vibration_title"
app:keywords="@string/keywords_touch_vibration"
app:controller="com.android.settings.accessibility.HapticFeedbackTogglePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_media"
android:title="@string/accessibility_media_vibration_title"
app:keywords="@string/keywords_media_vibration"
app:controller="com.android.settings.accessibility.MediaVibrationTogglePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibration_preference_keyboard"
android:title="@string/accessibility_keyboard_vibration_title"
app:keywords="@string/keywords_keyboard_vibration"
diff --git a/res/xml/accounts_dashboard_settings.xml b/res/xml/accounts_dashboard_settings.xml
index c8627e7..f332d52 100644
--- a/res/xml/accounts_dashboard_settings.xml
+++ b/res/xml/accounts_dashboard_settings.xml
@@ -49,21 +49,21 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="202"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_work_account_data"
android:title="@string/account_settings_menu_auto_sync_work"
android:summary="@string/auto_sync_account_summary"
settings:forWork="true"
android:order="203"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_personal_account_data"
android:title="@string/account_settings_menu_auto_sync_personal"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_dashboard_settings_credman.xml b/res/xml/accounts_dashboard_settings_credman.xml
index 83c16a2..7bcf62d 100644
--- a/res/xml/accounts_dashboard_settings_credman.xml
+++ b/res/xml/accounts_dashboard_settings_credman.xml
@@ -49,21 +49,21 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="202"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_work_account_data"
android:title="@string/account_settings_menu_auto_sync_work"
android:summary="@string/auto_sync_account_summary"
settings:forWork="true"
android:order="203"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_personal_account_data"
android:title="@string/account_settings_menu_auto_sync_personal"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_personal_dashboard_settings.xml b/res/xml/accounts_personal_dashboard_settings.xml
index e0ba71b..2d4d682 100644
--- a/res/xml/accounts_personal_dashboard_settings.xml
+++ b/res/xml/accounts_personal_dashboard_settings.xml
@@ -50,14 +50,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_personal_account_data"
android:title="@string/account_settings_menu_auto_sync_personal"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_personal_dashboard_settings_credman.xml b/res/xml/accounts_personal_dashboard_settings_credman.xml
index b87e866..835fcb7 100644
--- a/res/xml/accounts_personal_dashboard_settings_credman.xml
+++ b/res/xml/accounts_personal_dashboard_settings_credman.xml
@@ -50,14 +50,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_personal_account_data"
android:title="@string/account_settings_menu_auto_sync_personal"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_private_dashboard_settings.xml b/res/xml/accounts_private_dashboard_settings.xml
index 79bcce9..cc1a4fd 100644
--- a/res/xml/accounts_private_dashboard_settings.xml
+++ b/res/xml/accounts_private_dashboard_settings.xml
@@ -50,14 +50,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_private_account_data"
android:title="@string/account_settings_menu_auto_sync_private"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_private_dashboard_settings_credman.xml b/res/xml/accounts_private_dashboard_settings_credman.xml
index 88b2736..e9abcf8 100644
--- a/res/xml/accounts_private_dashboard_settings_credman.xml
+++ b/res/xml/accounts_private_dashboard_settings_credman.xml
@@ -51,14 +51,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_private_account_data"
android:title="@string/account_settings_menu_auto_sync_private"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_work_dashboard_settings.xml b/res/xml/accounts_work_dashboard_settings.xml
index 3269933..ad5e359 100644
--- a/res/xml/accounts_work_dashboard_settings.xml
+++ b/res/xml/accounts_work_dashboard_settings.xml
@@ -51,14 +51,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_work_account_data"
android:title="@string/account_settings_menu_auto_sync_work"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/accounts_work_dashboard_settings_credman.xml b/res/xml/accounts_work_dashboard_settings_credman.xml
index bb9976e..8afbba8 100644
--- a/res/xml/accounts_work_dashboard_settings_credman.xml
+++ b/res/xml/accounts_work_dashboard_settings_credman.xml
@@ -50,14 +50,14 @@
android:key="dashboard_tile_placeholder"
android:order="130"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_account_data"
android:title="@string/auto_sync_account_title"
android:summary="@string/auto_sync_account_summary"
android:order="200"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_sync_work_account_data"
android:title="@string/account_settings_menu_auto_sync_work"
android:summary="@string/auto_sync_account_summary"
diff --git a/res/xml/all_tether_prefs.xml b/res/xml/all_tether_prefs.xml
index 0aee621..8673d31 100644
--- a/res/xml/all_tether_prefs.xml
+++ b/res/xml/all_tether_prefs.xml
@@ -36,7 +36,7 @@
android:persistent="false"
android:title="@string/wifi_hotspot_password_title"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_tether_auto_turn_off_2"
android:title="@string/wifi_hotspot_auto_off_title"
android:summary="@string/wifi_hotspot_auto_off_summary"/>
@@ -57,28 +57,28 @@
android:key="tethering_options_group"
android:title="@string/tethering_interface_options"
settings:searchable="false">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_usb_tethering"
android:title="@string/usb_tethering_button_text"
android:summary="@string/usb_tethering_subtext"
settings:controller="com.android.settings.network.UsbTetherPreferenceController"
settings:keywords="@string/keywords_hotspot_tethering" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_bluetooth_tethering_2"
android:title="@string/bluetooth_tether_checkbox_text"
android:summary="@string/bluetooth_tethering_subtext"
settings:controller="com.android.settings.network.BluetoothTetherPreferenceController"
settings:keywords="@string/keywords_hotspot_tethering" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_ethernet_tethering_2"
android:title="@string/ethernet_tether_checkbox_text"
android:summary="@string/ethernet_tethering_subtext"
settings:controller="com.android.settings.network.EthernetTetherPreferenceController"
settings:keywords="@string/keywords_hotspot_tethering"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="disable_wifi_tethering"
android:title="@string/disable_wifi_hotspot_title"
android:summary="@string/summary_placeholder"
diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml
index 0c39948..e5c04e0 100644
--- a/res/xml/apn_editor.xml
+++ b/res/xml/apn_editor.xml
@@ -143,7 +143,7 @@
android:entryValues="@array/apn_protocol_values"
android:persistent="false"
/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:title="@string/carrier_enabled"
android:key="carrier_enabled"
android:enabled="false"
diff --git a/res/xml/app_info_settings.xml b/res/xml/app_info_settings.xml
index 73241b7..0782f67 100644
--- a/res/xml/app_info_settings.xml
+++ b/res/xml/app_info_settings.xml
@@ -139,7 +139,7 @@
settings:controller=
"com.android.settings.applications.appinfo.AppHibernationPreferenceCategoryController">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="hibernation_switch"
android:title="@string/unused_apps_switch"
android:summary="@string/unused_apps_switch_summary"
diff --git a/res/xml/auto_rotate_settings.xml b/res/xml/auto_rotate_settings.xml
index 38aa5f0..e8303b1 100644
--- a/res/xml/auto_rotate_settings.xml
+++ b/res/xml/auto_rotate_settings.xml
@@ -28,7 +28,7 @@
android:title="@string/auto_rotate_settings_primary_switch_title"
settings:controller="com.android.settings.display.AutoRotateSwitchBarController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_rotate_switch"
android:title="@string/auto_rotate_settings_primary_switch_title"
settings:controller="com.android.settings.display.AutoRotatePreferenceController"/>
@@ -50,7 +50,7 @@
android:title="@string/ambient_camera_summary_battery_saver_on"
settings:controller="com.android.settings.display.SmartAutoRotateBatterySaverController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="face_based_rotate"
android:title="@string/auto_rotate_switch_face_based"
settings:controller="com.android.settings.display.SmartAutoRotateController" />
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
index 52b8b1a..74ef856 100644
--- a/res/xml/battery_saver_settings.xml
+++ b/res/xml/battery_saver_settings.xml
@@ -34,7 +34,7 @@
settings:keywords="@string/keywords_battery_saver_schedule"
settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverSchedulePreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:order="80"
android:key="battery_saver_sticky"
android:title="@string/battery_saver_sticky_title_new"
diff --git a/res/xml/billing_cycle.xml b/res/xml/billing_cycle.xml
index 77f8bc3..000abac 100644
--- a/res/xml/billing_cycle.xml
+++ b/res/xml/billing_cycle.xml
@@ -23,7 +23,7 @@
android:key="billing_cycle"
android:title="@string/app_usage_cycle" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="set_data_warning"
android:title="@string/set_data_warning"/>
@@ -31,7 +31,7 @@
android:key="data_warning"
android:title="@string/data_warning" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="set_data_limit"
android:title="@string/set_data_limit" />
diff --git a/res/xml/button_navigation_settings.xml b/res/xml/button_navigation_settings.xml
index 2459b60..1de011c 100644
--- a/res/xml/button_navigation_settings.xml
+++ b/res/xml/button_navigation_settings.xml
@@ -30,7 +30,7 @@
settings:lottie_imageAssetsFolder="button_nav_menu"
settings:lottie_rawRes="@raw/lottie_button_nav_menu"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="assistant_long_press_home_gesture"
android:title="@string/assistant_long_press_home_gesture_title"
android:summary="@string/assistant_long_press_home_gesture_summary"
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index ee88215..bfca03d 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -98,7 +98,7 @@
android:summary="@string/lock_screen_notifs_redact_work_summary"
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notification_lockscreen_bypass"
android:order="16"
android:title="@string/lockscreen_bypass_title"
@@ -120,7 +120,7 @@
settings:controller="com.android.settings.notification.zen.ZenModePreferenceController"
/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lock_screen_show_only_unseen_notifs"
android:order="18"
android:title="@string/unseen_notifs_lock_screen"
@@ -148,27 +148,27 @@
android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings"/>
</com.android.settingslib.RestrictedPreference>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="silent_icons"
android:order="21"
android:title="@string/silent_notifications_status_bar"
settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_snooze_options"
android:order="22"
android:title="@string/snooze_options_title"
settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
<!-- Notification badging -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notification_badging"
android:order="23"
android:title="@string/notification_badging_title"
settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
<!-- Pulse notification light, on devices that support it -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notification_pulse"
android:order="24"
android:title="@string/notification_pulse_title"
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index a1eae91..3c66998 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -69,7 +69,7 @@
android:fragment="com.android.settings.print.PrintSettingsFragment"
android:order="-3"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="uwb_settings"
android:title="@string/uwb_settings_title"
android:order="100"
diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml
index 593c428..e7170ca 100644
--- a/res/xml/date_time_prefs.xml
+++ b/res/xml/date_time_prefs.xml
@@ -53,7 +53,7 @@
settings:controller="com.android.settings.datetime.LocationProviderStatusPreferenceController"/>
<!-- This preference gets removed if location-based time zone detection is not supported -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="location_time_zone_detection"
android:title="@string/location_time_zone_detection_toggle_title"
settings:controller="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceController"/>
@@ -72,11 +72,11 @@
android:key="time_format_preference_category"
android:title="@string/time_format_category_title"
settings:keywords="@string/keywords_time_format">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_24hour"
android:title="@string/date_time_24hour_auto"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="24 hour"
android:title="@string/date_time_24hour" />
</PreferenceCategory>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 234733b..b053424 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -123,12 +123,12 @@
android:dialogTitle="@string/select_webview_provider_dialog_title"
android:fragment="com.android.settings.webview.WebViewAppPicker" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="color_temperature"
android:title="@string/color_temperature"
android:summary="@string/color_temperature_desc" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="ota_disable_automatic_update"
android:title="@string/ota_disable_automatic_update"
android:summary="@string/ota_disable_automatic_update_summary" />
@@ -175,39 +175,39 @@
android:summary="@string/enable_adb_wireless_summary"
settings:keywords="@string/keywords_adb_wireless" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="adb_authorization_timeout"
android:title="@string/adb_authorization_timeout_title"
android:summary="@string/adb_authorization_timeout_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_terminal"
android:title="@string/enable_terminal_title"
android:summary="@string/enable_terminal_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bugreport_in_power"
android:title="@string/bugreport_in_power"
android:summary="@string/bugreport_in_power_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_verbose_vendor_logging"
android:title="@string/enable_verbose_vendor_logging"
android:summary="@string/enable_verbose_vendor_logging_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="automatic_system_server_heap_dumps"
android:title="@string/automatic_system_heap_dump_title"
android:summary="@string/automatic_system_heap_dump_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="debug_view_attributes"
android:title="@string/debug_view_attributes" />
<Preference android:key="debug_app"
android:title="@string/debug_app" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wait_for_debugger"
android:title="@string/wait_for_debugger"
android:summary="@string/wait_for_debugger_summary" />
@@ -217,7 +217,7 @@
android:title="@string/verify_apps_over_usb_title"
android:summary="@string/verify_apps_over_usb_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="art_verifier_for_debuggable"
android:title="@string/art_verifier_for_debuggable_title"
android:summary="@string/art_verifier_for_debuggable_summary" />
@@ -236,7 +236,7 @@
android:entries="@array/select_logpersist_titles"
android:entryValues="@array/select_logpersist_values" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="camera_laser_sensor_switch"
android:title="@string/camera_laser_sensor_switch" />
@@ -245,12 +245,12 @@
android:title="@string/feature_flags_dashboard_title"
android:fragment="com.android.settings.development.featureflags.FeatureFlagsDashboard" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_gpu_debug_layers"
android:title="@string/enable_gpu_debug_layers"
android:summary="@string/enable_gpu_debug_layers_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_angle_as_system_driver"
android:title="@string/enable_angle_as_system_driver"
android:summary="@string/enable_angle_as_system_driver_summary" />
@@ -268,22 +268,22 @@
settings:controller="com.android.settings.spa.development.compat.PlatformCompatPreferenceController"
/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_refresh_rate"
android:title="@string/show_refresh_rate"
android:summary="@string/show_refresh_rate_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="overlay_settings"
android:title="@string/overlay_settings_title"
android:summary="@string/overlay_settings_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="pref_key_peak_refresh_rate"
android:title="@string/force_high_refresh_rate_toggle"
android:summary="@string/force_high_refresh_rate_desc" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="allow_mock_modem"
android:title="@string/allow_mock_modem"
android:summary="@string/allow_mock_modem_summary" />
@@ -299,32 +299,32 @@
android:title="@string/debug_networking_category"
android:order="400">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_display_certification"
android:title="@string/wifi_display_certification"
android:summary="@string/wifi_display_certification_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_verbose_logging"
android:title="@string/wifi_verbose_logging"
android:summary="@string/wifi_verbose_logging_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_scan_throttling"
android:title="@string/wifi_scan_throttling"
android:summary="@string/wifi_scan_throttling_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_non_persistent_mac_randomization"
android:title="@string/wifi_non_persistent_mac_randomization"
android:summary="@string/wifi_non_persistent_mac_randomization_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="mobile_data_always_on"
android:title="@string/mobile_data_always_on"
android:summary="@string/mobile_data_always_on_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="tethering_hardware_offload"
android:title="@string/tethering_hardware_offload"
android:summary="@string/tethering_hardware_offload_summary" />
@@ -342,35 +342,35 @@
android:fragment="com.android.settings.connecteddevice.usb.UsbDefaultFragment"
android:title="@string/usb_default_label"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_show_devices_without_names"
android:title="@string/bluetooth_show_devices_without_names"
android:summary="@string/bluetooth_show_devices_without_names_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_disable_absolute_volume"
android:title="@string/bluetooth_disable_absolute_volume"
android:summary="@string/bluetooth_disable_absolute_volume_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_disable_leaudio"
android:title="@string/bluetooth_disable_leaudio"
android:summary="@string/bluetooth_disable_leaudio_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_show_leaudio_device_details"
android:title="@string/bluetooth_show_leaudio_device_details"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_bypass_leaudio_allowlist"
android:title="@string/bluetooth_bypass_leaudio_allowlist"
android:summary="@string/bluetooth_bypass_leaudio_allowlist_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_disable_le_audio_hw_offload"
android:title="@string/bluetooth_disable_le_audio_hw_offload" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_disable_a2dp_hw_offload"
android:title="@string/bluetooth_disable_a2dp_hw_offload" />
@@ -388,7 +388,7 @@
android:entries="@array/bluetooth_map_versions"
android:entryValues="@array/bluetooth_map_version_values" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="bluetooth_hd_audio_settings"
android:title="@string/bluetooth_profile_a2dp_high_quality_unknown_codec"/>
@@ -439,17 +439,17 @@
android:entries="@array/bluetooth_max_connected_audio_devices"
android:entryValues="@array/bluetooth_max_connected_audio_devices_values" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="nfc_stack_debuglog_enabled"
android:title="@string/nfc_stack_debuglog_title"
android:summary="@string/nfc_stack_debuglog_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="nfc_verbose_vendor_log"
android:title="@string/nfc_verbose_vendor_log_title"
android:summary="@string/nfc_verbose_vendor_log_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="nfc_snoop_log"
android:title="@string/nfc_snoop_log_title"
android:summary="@string/nfc_snoop_log_summary"/>
@@ -461,17 +461,17 @@
android:title="@string/debug_input_category"
android:order="500">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_touches"
android:title="@string/show_touches"
android:summary="@string/show_touches_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="pointer_location"
android:title="@string/pointer_location"
android:summary="@string/pointer_location_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_key_presses"
android:title="@string/show_key_presses"
android:summary="@string/show_key_presses_summary" />
@@ -483,17 +483,17 @@
android:title="@string/debug_drawing_category"
android:order="600">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_screen_updates"
android:title="@string/show_screen_updates"
android:summary="@string/show_screen_updates_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="debug_layout"
android:title="@string/debug_layout"
android:summary="@string/debug_layout_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_rtl_layout_all_locales"
android:title="@string/force_rtl_layout_all_locales"
android:summary="@string/force_rtl_layout_all_locales_summary" />
@@ -531,7 +531,7 @@
android:title="@string/display_cutout_emulation"
settings:keywords="@string/display_cutout_emulation_keywords" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transparent_navigation_bar"
android:title="@string/transparent_navigation_bar"
android:summary="@string/transparent_navigation_bar_summary" />
@@ -549,12 +549,12 @@
android:title="@string/debug_hw_drawing_category"
android:order="700">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_hw_screen_updates"
android:title="@string/show_hw_screen_updates"
android:summary="@string/show_hw_screen_updates_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_hw_layers_updates"
android:title="@string/show_hw_layers_updates"
android:summary="@string/show_hw_layers_updates_summary" />
@@ -571,21 +571,21 @@
android:entries="@array/show_non_rect_clip_entries"
android:entryValues="@array/show_non_rect_clip_values" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="hwui_force_dark"
android:title="@string/hwui_force_dark_title"
android:summary="@string/hwui_force_dark_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_blurs_on_windows"
android:title="@string/window_blurs"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_msaa"
android:title="@string/force_msaa"
android:summary="@string/force_msaa_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="disable_overlays"
android:title="@string/disable_overlays"
android:summary="@string/disable_overlays_summary" />
@@ -621,7 +621,7 @@
android:title="@string/debug_monitoring_category"
android:order="900">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="strict_mode"
android:title="@string/strict_mode"
android:summary="@string/strict_mode_summary" />
@@ -640,7 +640,7 @@
android:title="@string/debug_applications_category"
android:order="1000">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="immediately_destroy_activities"
android:title="@string/immediately_destroy_activities"
android:summary="@string/immediately_destroy_activities_summary" />
@@ -656,12 +656,12 @@
android:fragment="com.android.settings.applications.appops.BackgroundCheckSummary"
android:title="@string/background_check_pref" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_first_crash_dialog"
android:title="@string/show_first_crash_dialog"
android:summary="@string/show_first_crash_dialog_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_all_anrs"
android:title="@string/show_all_anrs"
android:summary="@string/show_all_anrs_summary" />
@@ -672,7 +672,7 @@
android:entries="@array/cached_apps_freezer_entries"
android:entryValues="@array/cached_apps_freezer_values" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_notification_channel_warnings"
android:title="@string/show_notification_channel_warnings"
android:summary="@string/show_notification_channel_warnings_summary" />
@@ -692,32 +692,32 @@
android:title="@string/tare_title" >
</Preference>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_allow_on_external"
android:title="@string/force_allow_on_external"
android:summary="@string/force_allow_on_external_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_resizable_activities"
android:title="@string/force_resizable_activities"
android:summary="@string/force_resizable_activities_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_freeform_support"
android:title="@string/enable_freeform_support"
android:summary="@string/enable_freeform_support_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_desktop_mode_on_external_displays"
android:title="@string/force_desktop_mode"
android:summary="@string/force_desktop_mode_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_non_resizable_multi_window"
android:title="@string/enable_non_resizable_multi_window"
android:summary="@string/enable_non_resizable_multi_window_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="back_navigation_animation"
android:title="@string/back_navigation_animation"
android:summary="@string/back_navigation_animation_summary" />
@@ -726,12 +726,12 @@
android:key="reset_shortcut_manager_throttling"
android:title="@string/reset_shortcut_manager_throttling" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="disable_phantom_process_monitor"
android:title="@string/disable_phantom_process_monitor_title"
android:summary="@string/disable_phantom_process_monitor_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="force_enable_notes_role"
android:title="@string/enable_notes_role_title"
android:summary="@string/enable_notes_role_summary" />
@@ -793,12 +793,12 @@
<Preference android:key="mock_location_app"
android:title="@string/mock_location_app" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_gnss_raw_meas_full_tracking"
android:title="@string/enable_gnss_raw_meas_full_tracking"
android:summary="@string/enable_gnss_raw_meas_full_tracking_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:title="@string/location_indicator_settings_title"
android:summary="@string/location_indicator_settings_description"
android:defaultValue="true"
@@ -811,7 +811,7 @@
android:title="@string/input_method_category"
android:order="1400">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="stylus_handwriting"
android:title="@string/stylus_handwriting"
android:defaultValue="true"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index c5e559c..2df360d 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -108,7 +108,7 @@
Standard auto-rotation preference that will be shown when device state based
auto-rotation settings are NOT available.
-->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_rotate"
android:title="@string/accelerometer_title"
settings:keywords="@string/keywords_auto_rotate"
@@ -132,19 +132,19 @@
settings:keywords="@string/keywords_screen_resolution"
settings:controller="com.android.settings.display.ScreenResolutionController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="display_white_balance"
android:title="@string/display_white_balance_title"
android:summary="@string/display_white_balance_summary"
settings:controller="com.android.settings.display.DisplayWhiteBalancePreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="peak_refresh_rate"
android:title="@string/peak_refresh_rate_title"
android:summary="@string/peak_refresh_rate_summary"
settings:controller="com.android.settings.display.PeakRefreshRatePreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_operator_name"
android:title="@string/show_operator_name_title"
android:summary="@string/show_operator_name_summary"/>
@@ -156,16 +156,16 @@
settings:keywords="@string/keywords_screensaver"
settings:controller="com.android.settings.display.ScreenSaverPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="camera_gesture"
android:title="@string/camera_gesture_title"
android:summary="@string/camera_gesture_desc"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lift_to_wake"
android:title="@string/lift_to_wake_title"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="tap_to_wake"
android:title="@string/tap_to_wake"
android:summary="@string/tap_to_wake_summary"/>
diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml
index f4d7607..fb5dd52 100644
--- a/res/xml/double_tap_power_settings.xml
+++ b/res/xml/double_tap_power_settings.xml
@@ -26,7 +26,7 @@
settings:searchable="false"
app:lottie_rawRes="@drawable/quickly_open_camera"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_double_tap_power"
android:title="@string/double_tap_power_for_camera_title"
android:summary="@string/double_tap_power_for_camera_summary"
diff --git a/res/xml/double_tap_screen_settings.xml b/res/xml/double_tap_screen_settings.xml
index f982331..80e9bc4 100644
--- a/res/xml/double_tap_screen_settings.xml
+++ b/res/xml/double_tap_screen_settings.xml
@@ -24,7 +24,7 @@
android:key="gesture_double_tap_screen_video"
app:lottie_rawRes="@raw/lottie_tap_to_check_phone" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_double_tap_screen"
android:title="@string/ambient_display_title"
android:summary="@string/ambient_display_summary"
diff --git a/res/xml/double_twist_gesture_settings.xml b/res/xml/double_twist_gesture_settings.xml
index 674ba51..699755b 100644
--- a/res/xml/double_twist_gesture_settings.xml
+++ b/res/xml/double_twist_gesture_settings.xml
@@ -27,7 +27,7 @@
settings:lottie_rawRes="@raw/flip_camera_for_selfie_lottie"
settings:dynamicColor="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_double_twist"
android:title="@string/double_twist_for_camera_mode_title"
android:summary="@string/double_twist_for_camera_mode_summary"
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index 8377a06..6996908 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -40,13 +40,13 @@
android:layout="@layout/dream_picker_layout"/>
</PreferenceCategory>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="dream_complications_toggle"
android:title="@string/dream_complications_toggle_title"
android:summary="@string/dream_complications_toggle_summary"
settings:controller="com.android.settings.dream.DreamComplicationPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="dream_home_controls_toggle"
android:title="@string/dream_home_controls_toggle_title"
android:summary="@string/dream_home_controls_toggle_summary"
diff --git a/res/xml/emergency_gesture_settings.xml b/res/xml/emergency_gesture_settings.xml
index 9fd644f..8367988 100644
--- a/res/xml/emergency_gesture_settings.xml
+++ b/res/xml/emergency_gesture_settings.xml
@@ -28,7 +28,7 @@
android:title="@string/emergency_gesture_screen_summary"
app:allowDividerAbove="false"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="emergency_gesture_sound"
android:icon="@drawable/ic_hearing"
android:title="@string/emergency_gesture_sound_setting_title"
diff --git a/res/xml/flash_notifications_settings.xml b/res/xml/flash_notifications_settings.xml
index 85cc2cb..bc76f6d 100644
--- a/res/xml/flash_notifications_settings.xml
+++ b/res/xml/flash_notifications_settings.xml
@@ -30,7 +30,7 @@
settings:lottie_rawRes="@drawable/flash_notifications_illustration"
settings:controller="com.android.settings.accessibility.FlashNotificationIllustrationPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="camera_flash_notification_preference"
android:persistent="false"
android:title="@string/camera_flash_notification_title"
diff --git a/res/xml/gesture_navigation_settings.xml b/res/xml/gesture_navigation_settings.xml
index 022583c..a4b5af9 100644
--- a/res/xml/gesture_navigation_settings.xml
+++ b/res/xml/gesture_navigation_settings.xml
@@ -28,7 +28,7 @@
android:persistent="false"
android:title="@string/assistant_gesture_category_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="assistant_gesture_corner_swipe"
android:title="@string/assistant_corner_gesture_title"
android:summary="@string/assistant_corner_gesture_summary"
diff --git a/res/xml/keyboard_settings.xml b/res/xml/keyboard_settings.xml
index b18338b..21b2bb0 100644
--- a/res/xml/keyboard_settings.xml
+++ b/res/xml/keyboard_settings.xml
@@ -63,7 +63,7 @@
android:dialogTitle="@string/pointer_speed" />
</PreferenceCategory>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibrate_input_devices"
android:title="@string/vibrate_input_devices"
android:summary="@string/vibrate_input_devices_summary"
diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml
index a5f6f63..1848f86 100644
--- a/res/xml/language_and_input.xml
+++ b/res/xml/language_and_input.xml
@@ -110,7 +110,7 @@
android:dialogTitle="@string/pointer_speed" />
</PreferenceCategory>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibrate_input_devices"
android:title="@string/vibrate_input_devices"
android:summary="@string/vibrate_input_devices_summary"
diff --git a/res/xml/manage_assist.xml b/res/xml/manage_assist.xml
index 141444a..527dfd0 100644
--- a/res/xml/manage_assist.xml
+++ b/res/xml/manage_assist.xml
@@ -28,17 +28,17 @@
android:summary="@string/summary_placeholder"
settings:searchable="false"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="context"
android:title="@string/assist_access_context_title"
android:summary="@string/assist_access_context_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="screenshot"
android:title="@string/assist_access_screenshot_title"
android:summary="@string/assist_access_screenshot_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="flash"
android:title="@string/assist_flash_title"
android:summary="@string/assist_flash_summary" />
diff --git a/res/xml/manage_domain_url_settings.xml b/res/xml/manage_domain_url_settings.xml
index e820e78..07194e4 100644
--- a/res/xml/manage_domain_url_settings.xml
+++ b/res/xml/manage_domain_url_settings.xml
@@ -25,7 +25,7 @@
android:key="web_action_category"
android:title="@string/web_action_section_title"
settings:controller="com.android.settings.applications.managedomainurls.WebActionCategoryController">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="instant_app_web_action_toggle"
android:title="@string/web_action_enable_title"
android:summary="@string/web_action_enable_summary"
diff --git a/res/xml/managed_profile_settings.xml b/res/xml/managed_profile_settings.xml
index ddfb869..4dcfc4d 100644
--- a/res/xml/managed_profile_settings.xml
+++ b/res/xml/managed_profile_settings.xml
@@ -31,7 +31,7 @@
settings:useAdditionalSummary="true"
settings:controller="com.android.settings.accounts.ContactSearchPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="cross_profile_calendar"
android:summary="@string/cross_profile_calendar_summary"
android:title="@string/cross_profile_calendar_title"
diff --git a/res/xml/media_controls_settings.xml b/res/xml/media_controls_settings.xml
index 822639a..96a2ee4 100644
--- a/res/xml/media_controls_settings.xml
+++ b/res/xml/media_controls_settings.xml
@@ -20,20 +20,20 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/media_controls_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="media_controls_resume_switch"
android:title="@string/media_controls_resume_title"
android:summary="@string/media_controls_resume_description"
app:keywords="@string/keywords_media_controls"
app:controller="com.android.settings.sound.MediaControlsPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="media_controls_lockscreen"
android:title="@string/media_controls_lockscreen_title"
android:summary="@string/media_controls_lockscreen_description"
app:controller="com.android.settings.sound.MediaControlsLockScreenPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="media_controls_recommendations"
android:title="@string/media_controls_recommendations_title"
android:summary="@string/media_controls_recommendations_description"
diff --git a/res/xml/more_security_privacy_settings.xml b/res/xml/more_security_privacy_settings.xml
index 42ca418..8358c73 100644
--- a/res/xml/more_security_privacy_settings.xml
+++ b/res/xml/more_security_privacy_settings.xml
@@ -42,7 +42,7 @@
android:summary="@string/unlock_set_unlock_mode_pattern"
settings:keywords="@string/keywords_lockscreen" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="visiblepattern_profile"
android:title="@string/lockpattern_settings_enable_visible_pattern_title_profile"
settings:controller="com.android.settings.security.VisiblePatternProfilePreferenceController" />
@@ -86,7 +86,7 @@
settings:searchable="false"/>
<!-- Show media on lock screen -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="privacy_media_controls_lockscreen"
android:title="@string/media_controls_lockscreen_title"
android:summary="@string/media_controls_lockscreen_description"
@@ -98,7 +98,7 @@
ContentCaptureService implementations defines a custom settings activitiy on its manifest.
Hence, we show both here, but the controller itself will decide if it's available or not.
-->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="content_capture"
android:title="@string/content_capture"
android:summary="@string/content_capture_summary"
@@ -195,7 +195,7 @@
settings:keywords="@string/keywords_app_pinning"
settings:controller="com.android.settings.security.ScreenPinningPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:order="290"
android:key="confirm_sim_deletion"
android:title="@string/confirm_sim_deletion_title"
diff --git a/res/xml/nfc_and_payment_settings.xml b/res/xml/nfc_and_payment_settings.xml
index b7900f8..5fb7c69 100644
--- a/res/xml/nfc_and_payment_settings.xml
+++ b/res/xml/nfc_and_payment_settings.xml
@@ -30,7 +30,7 @@
settings:lottie_rawRes="@drawable/nfc_detection_point"
settings:controller="com.android.settings.nfc.NfcDetectionPointController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="nfc_secure_settings"
android:title="@string/nfc_secure_settings_title"
settings:controller="com.android.settings.nfc.SecureNfcPreferenceController"
diff --git a/res/xml/physical_keyboard_settings.xml b/res/xml/physical_keyboard_settings.xml
index 40851a9..d8e66bb 100644
--- a/res/xml/physical_keyboard_settings.xml
+++ b/res/xml/physical_keyboard_settings.xml
@@ -21,7 +21,7 @@
<PreferenceCategory
android:key="keyboard_options_category"
android:title="@string/keyboard_options_category">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_virtual_keyboard_switch"
android:title="@string/show_ime"
android:summary="@string/show_ime_summary"
diff --git a/res/xml/pick_up_gesture_settings.xml b/res/xml/pick_up_gesture_settings.xml
index 38dad0a..e863080 100644
--- a/res/xml/pick_up_gesture_settings.xml
+++ b/res/xml/pick_up_gesture_settings.xml
@@ -27,7 +27,7 @@
app:lottie_rawRes="@raw/lottie_lift_to_check_phone"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_pick_up"
android:title="@string/ambient_display_pickup_title"
android:summary="@string/ambient_display_pickup_summary"
diff --git a/res/xml/polite_notifications_settings.xml b/res/xml/polite_notifications_settings.xml
index 5e09c3b..36f64f2 100644
--- a/res/xml/polite_notifications_settings.xml
+++ b/res/xml/polite_notifications_settings.xml
@@ -27,14 +27,14 @@
android:entryValues="@array/notification_polite_options_values"
settings:controller="com.android.settings.notification.PoliteNotificationFilterController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notification_polite_vibrate_unlocked"
android:persistent="false"
android:title="@string/notification_polite_vibrate_unlocked"
android:summary="@string/notification_polite_vibrate_unlocked_summary"
settings:controller="com.android.settings.notification.PoliteNotifVibrateUnlockedToggleController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notification_polite_work_profile"
android:persistent="false"
android:title="@string/notification_polite_work"
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index 121e1fe..e62f5c0 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -51,7 +51,7 @@
settings:keywords="@string/keywords_battery_saver"
settings:controller="com.android.settings.fuelgauge.BatterySaverController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="battery_percentage"
android:title="@string/battery_percentage"
android:summary="@string/battery_percentage_description"
diff --git a/res/xml/privacy_controls_settings.xml b/res/xml/privacy_controls_settings.xml
index cc88e0c..c7c3035 100644
--- a/res/xml/privacy_controls_settings.xml
+++ b/res/xml/privacy_controls_settings.xml
@@ -35,7 +35,7 @@
settings:controller="com.android.settings.privacy.MicToggleController"/>
<!-- Clipboard access notifications -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_clip_access_notification"
android:title="@string/show_clip_access_notification"
android:summary="@string/show_clip_access_notification_summary"
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index d84dca5..551501b 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -86,7 +86,7 @@
settings:controller="com.android.settings.privacy.MicToggleController"/>
<!-- Show passwords -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_password"
android:title="@string/show_password"
android:summary="@string/show_password_summary"
@@ -99,7 +99,7 @@
android:summary="@string/summary_placeholder"/>
<!-- Show media on lock screen -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="privacy_media_controls_lockscreen"
android:title="@string/media_controls_lockscreen_title"
android:summary="@string/media_controls_lockscreen_description"
@@ -136,7 +136,7 @@
Hence, we show both here, but the controller itself will decide if it's available or not.
-->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="content_capture"
android:title="@string/content_capture"
android:summary="@string/content_capture_summary"
@@ -149,7 +149,7 @@
settings:controller="com.android.settings.privacy.EnableContentCaptureWithServiceSettingsPreferenceController"/>
<!-- Clipboard access notifications -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="show_clip_access_notification"
android:title="@string/show_clip_access_notification"
android:summary="@string/show_clip_access_notification_summary"
diff --git a/res/xml/private_space_settings.xml b/res/xml/private_space_settings.xml
index 0277254..1c473db 100644
--- a/res/xml/private_space_settings.xml
+++ b/res/xml/private_space_settings.xml
@@ -25,13 +25,13 @@
<PreferenceCategory
android:title="@string/security_header">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="private_space_use_one_lock"
android:title="@string/private_space_one_lock_title"
settings:controller="com.android.settings.privatespace.UseOneLockController"
settings:searchable="false" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="private_space_hidden"
android:title="@string/private_space_hide_title"
settings:controller="com.android.settings.privatespace.HidePrivateSpaceController"
diff --git a/res/xml/reduce_bright_colors_settings.xml b/res/xml/reduce_bright_colors_settings.xml
index 00ab585..d092e13 100644
--- a/res/xml/reduce_bright_colors_settings.xml
+++ b/res/xml/reduce_bright_colors_settings.xml
@@ -30,7 +30,7 @@
settings:tickMark="@android:color/transparent"
/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="rbc_persist"
android:persistent="false"
android:title="@string/reduce_bright_colors_persist_preference_title" />
diff --git a/res/xml/screen_lock_settings.xml b/res/xml/screen_lock_settings.xml
index 00dd7ae..3f732b9 100644
--- a/res/xml/screen_lock_settings.xml
+++ b/res/xml/screen_lock_settings.xml
@@ -23,17 +23,17 @@
settings:searchable="false">
<!-- available in pattern -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title" />
<!-- available in pin -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_pin_confirm"
android:title="@string/lock_screen_auto_pin_confirm_title"
android:summary="@string/lock_screen_auto_pin_confirm_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enhancedPinPrivacy"
android:title="@string/lockpattern_settings_enhanced_pin_privacy_title"
android:summary="@string/lockpattern_settings_enhanced_pin_privacy_summary" />
@@ -48,7 +48,7 @@
android:entryValues="@array/lock_after_timeout_values" />
<!-- available in pin/pattern/password -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
diff --git a/res/xml/screen_pinning_settings.xml b/res/xml/screen_pinning_settings.xml
index 7689043..2c4402d 100644
--- a/res/xml/screen_pinning_settings.xml
+++ b/res/xml/screen_pinning_settings.xml
@@ -23,7 +23,7 @@
android:title="@string/app_pinning_intro"
settings:searchable="false"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="use_screen_lock"
android:title="@string/screen_pinning_unlock_none"
settings:allowDividerAbove="true"/>
diff --git a/res/xml/security_advanced_settings.xml b/res/xml/security_advanced_settings.xml
index 4570dac..89834b4 100644
--- a/res/xml/security_advanced_settings.xml
+++ b/res/xml/security_advanced_settings.xml
@@ -106,7 +106,7 @@
settings:keywords="@string/keywords_app_pinning"
settings:controller="com.android.settings.security.ScreenPinningPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:order="290"
android:key="confirm_sim_deletion"
android:title="@string/confirm_sim_deletion_title"
@@ -142,7 +142,7 @@
android:summary="@string/unlock_set_unlock_mode_pattern"
settings:keywords="@string/keywords_lockscreen" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="visiblepattern_profile"
android:title="@string/lockpattern_settings_enable_visible_pattern_title_profile"
settings:controller="com.android.settings.security.VisiblePatternProfilePreferenceController" />
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index 80e8fe6..cb1ce44 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -28,7 +28,7 @@
android:summary="@string/summary_placeholder"
settings:keywords="@string/keywords_lock_screen_notif"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="security_display_lockscreen_bypass"
android:title="@string/lockscreen_bypass_title"
android:summary="@string/lockscreen_bypass_summary"
@@ -45,25 +45,25 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lockscreen_privacy_wallet_switch"
android:title="@string/lockscreen_privacy_wallet_setting_toggle"
android:summary="@string/lockscreen_privacy_wallet_summary"
settings:controller="com.android.settings.display.WalletPrivacyPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lock_screen_show_qr_scanner"
android:title="@string/lockscreen_privacy_qr_code_scanner_setting_toggle"
android:summary="@string/lockscreen_privacy_qr_code_scanner_summary"
settings:controller="com.android.settings.display.QRCodeScannerPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lockscreen_privacy_controls_switch"
android:title="@string/lockscreen_privacy_controls_setting_toggle"
android:summary="@string/lockscreen_privacy_controls_summary"
settings:controller="com.android.settings.display.ControlsPrivacyPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lockscreen_trivial_controls_switch"
android:title="@string/lockscreen_trivial_controls_setting_toggle"
android:summary="@string/lockscreen_trivial_controls_summary"
@@ -74,7 +74,7 @@
android:title="@string/lockscreen_quick_affordances_title"
settings:controller="com.android.settings.display.CustomizableLockScreenQuickAffordancesPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="lockscreen_double_line_clock_switch"
android:title="@string/lockscreen_double_line_clock_setting_toggle"
android:summary="@string/lockscreen_double_line_clock_summary"
@@ -116,7 +116,7 @@
settings:searchable="false"
settings:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="ambient_display_notification"
android:title="@string/doze_title"
android:summary="@string/doze_summary"
diff --git a/res/xml/security_settings_combined_biometric.xml b/res/xml/security_settings_combined_biometric.xml
index 7d01472..c545b47 100644
--- a/res/xml/security_settings_combined_biometric.xml
+++ b/res/xml/security_settings_combined_biometric.xml
@@ -66,7 +66,7 @@
settings:keywords="@string/keywords_biometric_unlock"
settings:controller="com.android.settings.biometrics.combination.BiometricSettingsKeyguardPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="biometric_settings_biometric_app"
android:title="@string/biometric_settings_use_biometric_for_apps"
settings:keywords="@string/keywords_biometric_unlock"
diff --git a/res/xml/security_settings_combined_biometric_profile.xml b/res/xml/security_settings_combined_biometric_profile.xml
index 22d19ac..1ab4106 100644
--- a/res/xml/security_settings_combined_biometric_profile.xml
+++ b/res/xml/security_settings_combined_biometric_profile.xml
@@ -45,7 +45,7 @@
<PreferenceCategory
android:key="biometric_ways_to_use">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="biometric_settings_biometric_app_profile"
android:title="@string/biometric_settings_use_biometric_for_apps"
settings:keywords="@string/keywords_biometric_unlock"
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index 9fc8a1f..fd3498e 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -28,7 +28,7 @@
android:title="@string/biometric_settings_use_biometric_unlock_phone"
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsKeyguardPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="security_settings_face_app"
android:title="@string/biometric_settings_use_biometric_for_apps"
settings:keywords="@string/keywords_face_unlock"
@@ -44,14 +44,14 @@
<PreferenceCategory
android:key="security_settings_face_manage_category"
android:title="@string/security_settings_face_settings_preferences_category">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="security_settings_face_require_attention"
android:title="@string/security_settings_face_settings_require_attention"
android:summary="@string/security_settings_face_settings_require_attention_details"
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="security_settings_face_require_confirmation"
android:title="@string/security_settings_face_settings_require_confirmation"
android:summary="@string/security_settings_face_settings_require_confirmation_details"
diff --git a/res/xml/sim_lock_settings.xml b/res/xml/sim_lock_settings.xml
index 174e5c2..02db847 100644
--- a/res/xml/sim_lock_settings.xml
+++ b/res/xml/sim_lock_settings.xml
@@ -15,10 +15,9 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/sim_lock_settings">
+ android:title="@string/sim_lock_settings">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="sim_toggle"
android:title="@string/sim_pin_toggle"
android:summaryOn="@string/sim_lock_on"
diff --git a/res/xml/smart_battery_detail.xml b/res/xml/smart_battery_detail.xml
index 9795125..4047674 100644
--- a/res/xml/smart_battery_detail.xml
+++ b/res/xml/smart_battery_detail.xml
@@ -26,14 +26,14 @@
android:key="auto_awesome_battery"
settings:lottie_rawRes="@raw/auto_awesome_battery_lottie" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="smart_battery"
android:title="@string/smart_battery_title"
android:summary="@string/smart_battery_summary"
settings:controller="com.android.settings.fuelgauge.SmartBatteryPreferenceController"
settings:allowDividerAbove="true"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_restriction"
android:title="@string/battery_auto_restriction_title"
android:summary="@string/battery_auto_restriction_summary"
diff --git a/res/xml/smart_forwarding_switch.xml b/res/xml/smart_forwarding_switch.xml
index dda9d5a..a278cdf 100644
--- a/res/xml/smart_forwarding_switch.xml
+++ b/res/xml/smart_forwarding_switch.xml
@@ -1,10 +1,9 @@
<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="smart_forwarding_preference"
- android:title="@string/smart_forwarding_title">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="smart_forwarding_preference"
+ android:title="@string/smart_forwarding_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="smart_forwarding_switch"
android:title="Smart forwarding"
android:summaryOff="@string/smart_forwarding_summary_disabled"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 57e3249..15312c8 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -169,37 +169,37 @@
android:order="-60"/>
<!-- Dial pad tones -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="dial_pad_tones"
android:title="@string/dial_pad_tones_title"
android:order="-50"/>
<!-- Screen locking sounds -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="screen_locking_sounds"
android:title="@string/screen_locking_sounds_title"
android:order="-45"/>
<!-- Charging sounds -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="charging_sounds"
android:title="@string/charging_sounds_title"
android:order="-40"/>
<!-- Docking sounds -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="docking_sounds"
android:title="@string/docking_sounds_title"
android:order="-35"/>
<!-- Touch sounds -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="touch_sounds"
android:title="@string/touch_sounds_title"
android:order="-30"/>
<!-- Show vibrate icon in status bar -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="vibrate_icon"
android:title="@string/vibrate_icon_title"
android:order="-27"/>
@@ -212,7 +212,7 @@
android:order="-20"/>
<!-- Boot sounds -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="boot_sounds"
android:title="@string/boot_sounds_title"
android:order="-15"/>
diff --git a/res/xml/sound_work_settings.xml b/res/xml/sound_work_settings.xml
index 8e48fac..a7ab57a 100644
--- a/res/xml/sound_work_settings.xml
+++ b/res/xml/sound_work_settings.xml
@@ -19,7 +19,7 @@
android:title="@string/sound_work_settings">
<!-- Use the same sounds of the work profile -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="work_use_personal_sounds"
android:title="@string/work_use_personal_sounds_title"
android:summary="@string/work_use_personal_sounds_summary"
diff --git a/res/xml/spatial_audio_settings.xml b/res/xml/spatial_audio_settings.xml
index 13d3b25..7355f98 100644
--- a/res/xml/spatial_audio_settings.xml
+++ b/res/xml/spatial_audio_settings.xml
@@ -24,12 +24,12 @@
android:title="@string/spatial_audio_text"
settings:searchable="false"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="spatial_audio"
android:title="@string/spatial_audio_speaker"
settings:controller="com.android.settings.notification.SpatialAudioPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="spatial_audio_wired_headphones"
android:title="@string/spatial_audio_wired_headphones"
settings:controller="com.android.settings.notification.SpatialAudioWiredHeadphonesController"/>
diff --git a/res/xml/swipe_to_notification_settings.xml b/res/xml/swipe_to_notification_settings.xml
index 9d681a1..766a894 100644
--- a/res/xml/swipe_to_notification_settings.xml
+++ b/res/xml/swipe_to_notification_settings.xml
@@ -26,7 +26,7 @@
settings:searchable="false"
app:lottie_rawRes="@raw/lottie_swipe_fingerprint"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_swipe_down_fingerprint"
android:title="@string/fingerprint_swipe_for_notifications_title"
android:summary="@string/fingerprint_swipe_for_notifications_summary"
diff --git a/res/xml/tap_screen_gesture_settings.xml b/res/xml/tap_screen_gesture_settings.xml
index 468b416..6b2674b 100644
--- a/res/xml/tap_screen_gesture_settings.xml
+++ b/res/xml/tap_screen_gesture_settings.xml
@@ -26,7 +26,7 @@
settings:searchable="false"
app:lottie_rawRes="@raw/lottie_tap_to_check_phone"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_tap"
android:title="@string/ambient_display_tap_screen_title"
android:summary="@string/ambient_display_tap_screen_summary"
diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml
index a6e0a39..89bd631 100644
--- a/res/xml/tether_prefs.xml
+++ b/res/xml/tether_prefs.xml
@@ -37,13 +37,13 @@
android:summary="@string/usb_tethering_subtext"
settings:keywords="@string/keywords_hotspot_tethering" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_bluetooth_tethering"
android:title="@string/bluetooth_tether_checkbox_text"
android:summary="@string/bluetooth_tethering_subtext"
settings:keywords="@string/keywords_hotspot_tethering" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_ethernet_tethering"
android:title="@string/ethernet_tether_checkbox_text"
android:summary="@string/ethernet_tethering_subtext"
diff --git a/res/xml/trackpad_gesture_settings.xml b/res/xml/trackpad_gesture_settings.xml
index 6cac7f6..c2cdbdf 100644
--- a/res/xml/trackpad_gesture_settings.xml
+++ b/res/xml/trackpad_gesture_settings.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/trackpad_touchpad_gesture_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_go_back"
android:title="@string/trackpad_go_back_title"
android:summary="@string/trackpad_go_back_summary"
@@ -27,7 +27,7 @@
android:order="10"
settings:controller="com.android.settings.inputmethod.TrackpadGoBackPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_go_home"
android:title="@string/trackpad_go_home_title"
android:summary="@string/trackpad_go_home_summary"
@@ -35,7 +35,7 @@
android:order="20"
settings:controller="com.android.settings.inputmethod.TrackpadGoHomePreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_recent_apps"
android:title="@string/trackpad_recent_apps_title"
android:summary="@string/trackpad_recent_apps_summary"
@@ -43,7 +43,7 @@
android:order="30"
settings:controller="com.android.settings.inputmethod.TrackpadRecentAppsPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_notifications"
android:title="@string/trackpad_notifications_title"
android:summary="@string/trackpad_notifications_summary"
@@ -51,7 +51,7 @@
android:order="40"
settings:controller="com.android.settings.inputmethod.TrackpadNotificationsPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="gesture_switch_apps"
android:title="@string/trackpad_switch_apps_title"
android:summary="@string/trackpad_switch_apps_summary"
diff --git a/res/xml/trackpad_settings.xml b/res/xml/trackpad_settings.xml
index 19ce259..84ea528 100644
--- a/res/xml/trackpad_settings.xml
+++ b/res/xml/trackpad_settings.xml
@@ -28,14 +28,14 @@
android:fragment="com.android.settings.inputmethod.TrackpadTouchGestureSettings"
settings:controller="com.android.settings.inputmethod.TrackpadTouchGestureSettingsController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="trackpad_tap_to_click"
android:title="@string/trackpad_tap_to_click"
android:icon="@drawable/ic_trackpad_tap_to_click"
settings:controller="com.android.settings.inputmethod.TrackpadTapToClickPreferenceController"
android:order="10"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="trackpad_reverse_scrolling"
android:title="@string/trackpad_reverse_scrolling_title"
android:summary="@string/trackpad_reverse_scrolling_summary"
@@ -43,7 +43,7 @@
settings:controller="com.android.settings.inputmethod.TrackpadReverseScrollingPreferenceController"
android:order="20"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="trackpad_bottom_right_tap"
android:title="@string/trackpad_bottom_right_tap_title"
android:summary="@string/trackpad_bottom_right_tap_summary"
diff --git a/res/xml/transcode_settings.xml b/res/xml/transcode_settings.xml
index 5c3bb7c..dd57515 100644
--- a/res/xml/transcode_settings.xml
+++ b/res/xml/transcode_settings.xml
@@ -21,27 +21,27 @@
android:title="@string/transcode_settings_title"
settings:searchable="false">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transcode_user_control"
android:title="@string/transcode_user_control"
settings:controller="com.android.settings.development.transcode.TranscodeUserControlPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transcode_enable_all"
android:title="@string/transcode_enable_all"
settings:controller="com.android.settings.development.transcode.TranscodeGlobalTogglePreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transcode_default"
android:title="@string/transcode_default"
settings:controller="com.android.settings.development.transcode.TranscodeDefaultOptionPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transcode_notification"
android:title="@string/transcode_notification"
settings:controller="com.android.settings.development.transcode.TranscodeNotificationPreferenceController" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="transcode_disable_cache"
android:title="@string/transcode_disable_cache"
settings:controller="com.android.settings.development.transcode.TranscodeDisableCachePreferenceController" />
diff --git a/res/xml/user_details_settings.xml b/res/xml/user_details_settings.xml
index 068039c..8e15d14 100644
--- a/res/xml/user_details_settings.xml
+++ b/res/xml/user_details_settings.xml
@@ -21,11 +21,11 @@
<com.android.settingslib.RestrictedPreference
android:key="switch_user"
android:icon="@drawable/ic_swap" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="user_grant_admin"
android:icon="@drawable/ic_admin_panel_settings"
android:title="@string/user_grant_admin" />
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_calling"
android:icon="@drawable/ic_phone"
android:title="@string/user_enable_calling_sms" />
diff --git a/res/xml/wifi_configure_settings.xml b/res/xml/wifi_configure_settings.xml
index 2ab7b6a..bf795d0 100644
--- a/res/xml/wifi_configure_settings.xml
+++ b/res/xml/wifi_configure_settings.xml
@@ -19,14 +19,14 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/wifi_configure_settings_preference_title">
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="enable_wifi_wakeup"
android:title="@string/wifi_wakeup"
android:icon="@drawable/ic_auto_wifi"
android:summary="@string/wifi_wakeup_summary"
settings:controller="com.android.settings.wifi.WifiWakeupPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="notify_open_networks"
android:title="@string/wifi_notify_open_networks"
android:icon="@drawable/ic_open_wifi_notifications"
@@ -34,7 +34,7 @@
settings:keywords="@string/keywords_wifi_notify_open_networks"
settings:controller="com.android.settings.wifi.NotifyOpenNetworksPreferenceController"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_cellular_data_fallback"
android:title="@string/wifi_cellular_data_fallback_title"
android:summary="@string/wifi_cellular_data_fallback_summary"
diff --git a/res/xml/wifi_network_details_fragment2.xml b/res/xml/wifi_network_details_fragment2.xml
index 0062474..56e7b04 100644
--- a/res/xml/wifi_network_details_fragment2.xml
+++ b/res/xml/wifi_network_details_fragment2.xml
@@ -102,7 +102,7 @@
android:title="@string/wifi_subscription"
android:summary="@string/wifi_subscription_summary"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="auto_connect"
android:title="@string/wifi_auto_connect_title"
android:summary="@string/wifi_auto_connect_summary"/>
diff --git a/res/xml/wifi_tether_settings.xml b/res/xml/wifi_tether_settings.xml
index b8b810f..4924bf9 100644
--- a/res/xml/wifi_tether_settings.xml
+++ b/res/xml/wifi_tether_settings.xml
@@ -44,12 +44,12 @@
android:persistent="false"
android:title="@string/wifi_hotspot_password_title"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_tether_auto_turn_off"
android:title="@string/wifi_hotspot_auto_off_title"
android:summary="@string/wifi_hotspot_auto_off_summary"/>
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="wifi_tether_maximize_compatibility"
android:title="@string/wifi_hotspot_maximize_compatibility"/>
diff --git a/res/xml/zen_mode_calls_settings.xml b/res/xml/zen_mode_calls_settings.xml
index a0b39a9c..447353e 100644
--- a/res/xml/zen_mode_calls_settings.xml
+++ b/res/xml/zen_mode_calls_settings.xml
@@ -29,7 +29,7 @@
</PreferenceCategory>
<!-- Repeat callers -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_repeat_callers"
android:title="@string/zen_mode_repeat_callers_title"
settings:allowDividerAbove="true"/>
diff --git a/res/xml/zen_mode_custom_rule_calls_settings.xml b/res/xml/zen_mode_custom_rule_calls_settings.xml
index 4dca2ad..4bc3cb6 100644
--- a/res/xml/zen_mode_custom_rule_calls_settings.xml
+++ b/res/xml/zen_mode_custom_rule_calls_settings.xml
@@ -35,7 +35,7 @@
android:title="@string/zen_mode_starred_contacts_title"/>
<!-- Repeat callers -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_repeat_callers"
android:title="@string/zen_mode_repeat_callers_title" />
</PreferenceCategory>
diff --git a/res/xml/zen_mode_custom_rule_configuration.xml b/res/xml/zen_mode_custom_rule_configuration.xml
index 664c09a..906d642 100644
--- a/res/xml/zen_mode_custom_rule_configuration.xml
+++ b/res/xml/zen_mode_custom_rule_configuration.xml
@@ -34,31 +34,31 @@
android:title="@string/zen_mode_messages" />
<!-- Alarms -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_rule_alarms"
android:title="@string/zen_mode_alarms"
android:summary="@string/zen_mode_alarms_summary"/>
<!-- Media -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_rule_media"
android:title="@string/zen_mode_media"
android:summary="@string/zen_mode_media_summary"/>
<!-- System -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_rule_system"
android:title="@string/zen_mode_system"
android:summary="@string/zen_mode_system_summary"/>
<!-- Reminders -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_rule_reminders"
android:title="@string/zen_mode_reminders"
android:summary="@string/zen_mode_reminders_summary"/>
<!-- Events -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_rule_events"
android:title="@string/zen_mode_events"
android:summary="@string/zen_mode_events_summary"/>
diff --git a/res/xml/zen_mode_schedule_rule_settings.xml b/res/xml/zen_mode_schedule_rule_settings.xml
index 874f5c9..82483f3 100644
--- a/res/xml/zen_mode_schedule_rule_settings.xml
+++ b/res/xml/zen_mode_schedule_rule_settings.xml
@@ -42,7 +42,7 @@
<!-- Start time/End time added and removed here! :-) -->
<!-- Exit DND mode with alarm -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="exit_at_alarm"
android:title="@string/zen_mode_schedule_alarm_title"
android:summary="@string/zen_mode_schedule_alarm_summary"
diff --git a/res/xml/zen_mode_sound_vibration_settings.xml b/res/xml/zen_mode_sound_vibration_settings.xml
index 2db42ac..ab22159 100644
--- a/res/xml/zen_mode_sound_vibration_settings.xml
+++ b/res/xml/zen_mode_sound_vibration_settings.xml
@@ -20,29 +20,29 @@
android:title="@string/zen_category_exceptions" >
<!-- Alarms -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_alarms"
android:title="@string/zen_mode_alarms"/>
<!-- Media -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_media"
android:title="@string/zen_mode_media"
android:summary="@string/zen_mode_media_summary"/>
<!-- System -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_system"
android:title="@string/zen_mode_system"
android:summary="@string/zen_mode_system_summary"/>
<!-- Reminders -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_reminders"
android:title="@string/zen_mode_reminders"/>
<!-- Events -->
- <SwitchPreference
+ <SwitchPreferenceCompat
android:key="zen_mode_events"
android:title="@string/zen_mode_events"/>
diff --git a/src/com/android/settings/TrustedCredentialsFragment.java b/src/com/android/settings/TrustedCredentialsFragment.java
index ca95c1a..a150850 100644
--- a/src/com/android/settings/TrustedCredentialsFragment.java
+++ b/src/com/android/settings/TrustedCredentialsFragment.java
@@ -52,13 +52,13 @@
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.BaseExpandableListAdapter;
+import android.widget.CompoundButton;
import android.widget.ExpandableListView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
-import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -456,10 +456,10 @@
return "Group" + getUserIdByGroup(groupPosition);
}
- private class ViewHolder {
+ private static class ViewHolder {
private TextView mSubjectPrimaryView;
private TextView mSubjectSecondaryView;
- private Switch mSwitch;
+ private CompoundButton mSwitch;
}
}
diff --git a/src/com/android/settings/accessibility/ShortcutPreference.java b/src/com/android/settings/accessibility/ShortcutPreference.java
index 81bc586..4b6868e 100644
--- a/src/com/android/settings/accessibility/ShortcutPreference.java
+++ b/src/com/android/settings/accessibility/ShortcutPreference.java
@@ -21,8 +21,8 @@
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
+import android.widget.CompoundButton;
import android.widget.LinearLayout;
-import android.widget.Switch;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
@@ -88,7 +88,7 @@
mSettingsEditable ? outValue.resourceId : /* Remove background */ 0);
}
- Switch switchWidget =
+ CompoundButton switchWidget =
holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
if (switchWidget != null) {
// Consumes move events to ignore drag actions.
diff --git a/src/com/android/settings/applications/appops/AppOpsCategory.java b/src/com/android/settings/applications/appops/AppOpsCategory.java
index 57d7dc4..95ee256 100644
--- a/src/com/android/settings/applications/appops/AppOpsCategory.java
+++ b/src/com/android/settings/applications/appops/AppOpsCategory.java
@@ -29,9 +29,9 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
+import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ListView;
-import android.widget.Switch;
import android.widget.TextView;
import androidx.fragment.app.ListFragment;
@@ -244,14 +244,12 @@
public static class AppListAdapter extends BaseAdapter {
private final Resources mResources;
private final LayoutInflater mInflater;
- private final AppOpsState mState;
List<AppOpEntry> mList;
- public AppListAdapter(Context context, AppOpsState state) {
+ public AppListAdapter(Context context) {
mResources = context.getResources();
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mState = state;
}
public void setData(List<AppOpEntry> data) {
@@ -294,7 +292,7 @@
((TextView) view.findViewById(R.id.op_name)).setText(
item.getTimeText(mResources, false));
view.findViewById(R.id.op_time).setVisibility(View.GONE);
- ((Switch) view.findViewById(R.id.op_switch)).setChecked(
+ ((CompoundButton) view.findViewById(R.id.op_switch)).setChecked(
item.getPrimaryOpMode() == AppOpsManager.MODE_ALLOWED);
return view;
@@ -318,7 +316,7 @@
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
- mAdapter = new AppListAdapter(getActivity(), mState);
+ mAdapter = new AppListAdapter(getActivity());
setListAdapter(mAdapter);
// Start out with a progress indicator.
@@ -332,7 +330,7 @@
AppOpEntry entry = mAdapter.getItem(position);
if (entry != null) {
// We treat this as tapping on the check box, toggling the app op state.
- Switch sw = v.findViewById(R.id.op_switch);
+ CompoundButton sw = v.findViewById(R.id.op_switch);
boolean checked = !sw.isChecked();
sw.setChecked(checked);
AppOpsManager.OpEntry op = entry.getOpEntry(0);
diff --git a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
index 4021110..b0905ba 100644
--- a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
@@ -47,7 +47,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
-import android.widget.Switch;
+import android.widget.CompoundButton;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
@@ -969,7 +969,7 @@
}
// Stores a reference to the switch view.
- private @Nullable Switch mSwitch;
+ private @Nullable CompoundButton mSwitch;
// Switch text for on and off states
private @NonNull boolean mChecked = false;
@@ -1022,7 +1022,7 @@
// Setup the switch.
View checkableView =
view.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
- if (checkableView instanceof Switch switchView) {
+ if (checkableView instanceof CompoundButton switchView) {
switchView.setChecked(mChecked);
switchView.setOnClickListener(mListener);
diff --git a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
index dbb97e9..c94edc6 100644
--- a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
+++ b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
@@ -31,9 +31,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
-import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.StringRes;
@@ -67,7 +67,7 @@
@VisibleForTesting
final ViewGroup mWidgetContainer;
@VisibleForTesting
- final Switch mSwitch;
+ final CompoundButton mSwitch;
final ImageView mAddIcon;
final ProgressBar mProgressBar;
@@ -173,10 +173,6 @@
mAppName.setContentDescription(contentDescription);
}
- void setIcon(int drawableRes) {
- mAppIcon.setImageResource(drawableRes);
- }
-
void setIcon(Drawable icon) {
if (icon == null) {
return;
@@ -219,7 +215,8 @@
}
}
- void updateSwitch(Switch.OnCheckedChangeListener listener, boolean enabled, boolean checked) {
+ void updateSwitch(CompoundButton.OnCheckedChangeListener listener, boolean enabled,
+ boolean checked) {
if (mSwitch != null && mWidgetContainer != null) {
mWidgetContainer.setFocusable(false);
mWidgetContainer.setClickable(false);
diff --git a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
index 8ab3ee4..bb9876b 100644
--- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
+++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
@@ -647,7 +647,8 @@
}
void updateInterface() {
- findViewById(R.id.restricted_icon).setVisibility(View.GONE);
+ findViewById(com.android.settingslib.widget.restricted.R.id.restricted_icon)
+ .setVisibility(View.GONE);
mAdminIcon.setImageDrawable(mDeviceAdmin.loadIcon(getPackageManager()));
mAdminName.setText(mDeviceAdmin.loadLabel(getPackageManager()));
try {
@@ -682,7 +683,8 @@
final boolean hasBaseRestriction = hasBaseCantRemoveProfileRestriction();
if ((hasBaseRestriction && mDPM.isOrganizationOwnedDeviceWithManagedProfile())
|| (admin != null && !hasBaseRestriction)) {
- findViewById(R.id.restricted_icon).setVisibility(View.VISIBLE);
+ findViewById(com.android.settingslib.widget.restricted.R.id.restricted_icon)
+ .setVisibility(View.VISIBLE);
}
mActionButton.setEnabled(admin == null && !hasBaseRestriction);
} else if (isProfileOwner || mDeviceAdmin.getComponent().equals(
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java b/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
index f6ba0f9..86c1a50 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
@@ -22,7 +22,6 @@
import android.view.LayoutInflater;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
-import android.widget.Switch;
import android.widget.TextView;
import com.android.settings.R;
@@ -32,7 +31,7 @@
*/
public class FaceEnrollAccessibilityToggle extends LinearLayout {
- private Switch mSwitch;
+ private final CompoundButton mSwitch;
public FaceEnrollAccessibilityToggle(Context context) {
this(context, null /* attrs */);
@@ -76,7 +75,7 @@
mSwitch.setOnCheckedChangeListener(listener);
}
- public Switch getSwitch() {
+ public CompoundButton getSwitch() {
return mSwitch;
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index de49ce1..eaa0b96 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -63,12 +63,6 @@
};
public BluetoothEnabler(Context context, SwitchWidgetController switchController,
- MetricsFeatureProvider metricsFeatureProvider, int metricsEvent) {
- this(context, switchController, metricsFeatureProvider, metricsEvent,
- new RestrictionUtils());
- }
-
- public BluetoothEnabler(Context context, SwitchWidgetController switchController,
MetricsFeatureProvider metricsFeatureProvider, int metricsEvent,
RestrictionUtils restrictionUtils) {
mContext = context;
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index a3f9bd4..33e6fc3 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -32,8 +32,8 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.CompoundButton;
import android.widget.EditText;
-import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.VisibleForTesting;
@@ -342,8 +342,8 @@
TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead);
TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message);
- Switch contactSharing = (Switch) view.findViewById(
- R.id.phonebook_sharing_message_confirm_pin);
+ CompoundButton contactSharing =
+ view.findViewById(R.id.phonebook_sharing_message_confirm_pin);
view.findViewById(R.id.phonebook_sharing).setVisibility(
mPairingController.isContactSharingVisible() ? View.VISIBLE : View.GONE);
mPairingController.setContactSharingState();
diff --git a/src/com/android/settings/connecteddevice/audiosharing/AudioSharingSwitchBarController.java b/src/com/android/settings/connecteddevice/audiosharing/AudioSharingSwitchBarController.java
index f2a332b..1400720 100644
--- a/src/com/android/settings/connecteddevice/audiosharing/AudioSharingSwitchBarController.java
+++ b/src/com/android/settings/connecteddevice/audiosharing/AudioSharingSwitchBarController.java
@@ -33,13 +33,11 @@
private final Context mContext;
private final SettingsMainSwitchBar mSwitchBar;
- private final Switch mSwitch;
AudioSharingSwitchBarController(Context context, SettingsMainSwitchBar switchBar) {
mContext = context;
mSwitchBar = switchBar;
- mSwitch = mSwitchBar.getSwitch();
- mSwitch.setChecked(false);
+ mSwitchBar.setChecked(false);
}
@Override
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index f0cf59a..b88c345 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -334,9 +334,6 @@
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
- if (switchView != mSwitchBar.getSwitch()) {
- return;
- }
final boolean developmentEnabledState =
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(getContext());
if (isChecked != developmentEnabledState) {
diff --git a/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarController.java b/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarController.java
index b1faefa..79a28a5 100644
--- a/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarController.java
+++ b/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarController.java
@@ -43,16 +43,13 @@
GraphicsDriverContentObserver.OnGraphicsDriverContentChangedListener,
LifecycleObserver, OnStart, OnStop {
- private final Context mContext;
private final ContentResolver mContentResolver;
- @VisibleForTesting
- SwitchWidgetController mSwitchWidgetController;
+ private final SwitchWidgetController mSwitchWidgetController;
@VisibleForTesting
GraphicsDriverContentObserver mGraphicsDriverContentObserver;
GraphicsDriverGlobalSwitchBarController(
Context context, SwitchWidgetController switchWidgetController) {
- mContext = context;
mContentResolver = context.getContentResolver();
mGraphicsDriverContentObserver =
new GraphicsDriverContentObserver(new Handler(Looper.getMainLooper()), this);
diff --git a/src/com/android/settings/development/tare/TareHomePage.java b/src/com/android/settings/development/tare/TareHomePage.java
index cfe8d5e..0eb93fc 100644
--- a/src/com/android/settings/development/tare/TareHomePage.java
+++ b/src/com/android/settings/development/tare/TareHomePage.java
@@ -35,7 +35,6 @@
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
-import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
@@ -45,7 +44,7 @@
public class TareHomePage extends Activity {
private static final String TAG = "TareHomePage";
- private Switch mOnSwitch;
+ private CompoundButton mOnSwitch;
private Button mRevButton;
private TextView mAlarmManagerView;
private TextView mJobSchedulerView;
diff --git a/src/com/android/settings/inputmethod/SpellCheckerPreference.java b/src/com/android/settings/inputmethod/SpellCheckerPreference.java
index 116f1c7..3c1ffeb 100644
--- a/src/com/android/settings/inputmethod/SpellCheckerPreference.java
+++ b/src/com/android/settings/inputmethod/SpellCheckerPreference.java
@@ -45,6 +45,7 @@
public SpellCheckerPreference(final Context context, final SpellCheckerInfo[] scis) {
super(context, null);
+ setSingleLineTitle(false);
mScis = scis;
setWidgetLayoutResource(R.layout.preference_widget_gear);
CharSequence[] labels = new CharSequence[scis.length];
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index 465da39..1532448 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -45,7 +45,6 @@
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
-import android.widget.Switch;
import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference;
@@ -175,10 +174,6 @@
panelOpen = open;
}
- List<Preference> getChildren() {
- return mChildren;
- }
-
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
@@ -197,7 +192,7 @@
ViewGroup widget = (ViewGroup) view.findViewById(android.R.id.widget_frame);
widget.setEnabled(!isImmutable());
if (widget.getChildCount() > 0) {
- final Switch toggle = (Switch) widget.getChildAt(0);
+ final CompoundButton toggle = (CompoundButton) widget.getChildAt(0);
toggle.setEnabled(!isImmutable());
toggle.setTag(this);
toggle.setClickable(true);
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java
deleted file mode 100644
index 6e5e834..0000000
--- a/src/com/android/settings/widget/SwitchBar.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.widget;
-
-import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.SpannableStringBuilder;
-import android.text.TextUtils;
-import android.text.style.TextAppearanceSpan;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.Switch;
-import android.widget.TextView;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.RestrictedLockUtils;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener {
-
- public interface OnSwitchChangeListener {
- /**
- * Called when the checked state of the Switch has changed.
- *
- * @param switchView The Switch view whose state has changed.
- * @param isChecked The new checked state of switchView.
- */
- void onSwitchChanged(Switch switchView, boolean isChecked);
- }
-
- private static final int[] XML_ATTRIBUTES = {
- R.attr.switchBarMarginStart,
- R.attr.switchBarMarginEnd,
- R.attr.switchBarBackgroundColor,
- R.attr.switchBarBackgroundActivatedColor,
- R.attr.switchBarRestrictionIcon};
-
- private final List<OnSwitchChangeListener> mSwitchChangeListeners = new ArrayList<>();
- private final MetricsFeatureProvider mMetricsFeatureProvider;
- private final TextAppearanceSpan mSummarySpan;
-
- private ToggleSwitch mSwitch;
- private ImageView mRestrictedIcon;
- private TextView mTextView;
- private String mLabel;
- private String mSummary;
- private String mOnText;
- private String mOffText;
- @ColorInt
- private int mBackgroundColor;
- @ColorInt
- private int mBackgroundActivatedColor;
-
- private boolean mLoggingIntialized;
- private boolean mDisabledByAdmin;
- private EnforcedAdmin mEnforcedAdmin = null;
- private String mMetricsTag;
-
-
- public SwitchBar(Context context) {
- this(context, null);
- }
-
- public SwitchBar(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public SwitchBar(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public SwitchBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
-
- LayoutInflater.from(context).inflate(R.layout.switch_bar, this);
- // Set the whole SwitchBar focusable and clickable.
- setFocusable(true);
- setClickable(true);
-
- final TypedArray a = context.obtainStyledAttributes(attrs, XML_ATTRIBUTES);
- final int switchBarMarginStart = (int) a.getDimension(0, 0);
- final int switchBarMarginEnd = (int) a.getDimension(1, 0);
- mBackgroundColor = a.getColor(2, 0);
- mBackgroundActivatedColor = a.getColor(3, 0);
- final Drawable restrictedIconDrawable = a.getDrawable(4);
- a.recycle();
-
- mTextView = findViewById(R.id.switch_text);
- mSummarySpan = new TextAppearanceSpan(mContext, R.style.TextAppearance_Small_SwitchBar);
- ViewGroup.MarginLayoutParams lp = (MarginLayoutParams) mTextView.getLayoutParams();
- lp.setMarginStart(switchBarMarginStart);
-
- mSwitch = findViewById(R.id.switch_widget);
- // Prevent onSaveInstanceState() to be called as we are managing the state of the Switch
- // on our own
- mSwitch.setSaveEnabled(false);
- // Set the ToggleSwitch non-focusable and non-clickable to avoid multiple focus.
- mSwitch.setFocusable(false);
- mSwitch.setClickable(false);
-
- lp = (MarginLayoutParams) mSwitch.getLayoutParams();
- lp.setMarginEnd(switchBarMarginEnd);
- setBackgroundColor(mBackgroundColor);
-
- setSwitchBarText(R.string.switch_on_text, R.string.switch_off_text);
-
- addOnSwitchChangeListener(
- (switchView, isChecked) -> setTextViewLabelAndBackground(isChecked));
-
- mRestrictedIcon = findViewById(R.id.restricted_icon);
- mRestrictedIcon.setImageDrawable(restrictedIconDrawable);
- mRestrictedIcon.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mDisabledByAdmin) {
- mMetricsFeatureProvider.action(
- SettingsEnums.PAGE_UNKNOWN,
- SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE,
- SettingsEnums.PAGE_UNKNOWN,
- mMetricsTag + "/switch_bar|restricted",
- 1);
-
- RestrictedLockUtils.sendShowAdminSupportDetailsIntent(context,
- mEnforcedAdmin);
- }
- }
- });
-
- // Default is hide
- setVisibility(View.GONE);
-
- mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
- }
-
- // Override the performClick method to eliminate redundant click.
- @Override
- public boolean performClick() {
- return getDelegatingView().performClick();
- }
-
- public void setMetricsTag(String tag) {
- mMetricsTag = tag;
- }
-
- public void setTextViewLabelAndBackground(boolean isChecked) {
- mLabel = isChecked ? mOnText : mOffText;
- setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
- updateText();
- }
-
- public void setSwitchBarText(int onTextId, int offTextId) {
- mOnText = getResources().getString(onTextId);
- mOffText = getResources().getString(offTextId);
- setTextViewLabelAndBackground(isChecked());
- }
-
- public void setSwitchBarText(String onText, String offText) {
- mOnText = onText;
- mOffText = offText;
- setTextViewLabelAndBackground(isChecked());
- }
-
- public void setSummary(String summary) {
- mSummary = summary;
- updateText();
- }
-
- private void updateText() {
- if (TextUtils.isEmpty(mSummary)) {
- mTextView.setText(mLabel);
- return;
- }
- final SpannableStringBuilder ssb = new SpannableStringBuilder(mLabel).append('\n');
- final int start = ssb.length();
- ssb.append(mSummary);
- ssb.setSpan(mSummarySpan, start, ssb.length(), 0);
- mTextView.setText(ssb);
- }
-
- public void setChecked(boolean checked) {
- setTextViewLabelAndBackground(checked);
- mSwitch.setChecked(checked);
- }
-
- public void setCheckedInternal(boolean checked) {
- setTextViewLabelAndBackground(checked);
- mSwitch.setCheckedInternal(checked);
- }
-
- public boolean isChecked() {
- return mSwitch.isChecked();
- }
-
- public void setEnabled(boolean enabled) {
- if (enabled && mDisabledByAdmin) {
- setDisabledByAdmin(null);
- return;
- }
- super.setEnabled(enabled);
- mTextView.setEnabled(enabled);
- mSwitch.setEnabled(enabled);
- }
-
- @VisibleForTesting
- View getDelegatingView() {
- return mDisabledByAdmin ? mRestrictedIcon : mSwitch;
- }
-
- /**
- * If admin is not null, disables the text and switch but keeps the view clickable.
- * Otherwise, calls setEnabled which will enables the entire view including
- * the text and switch.
- */
- public void setDisabledByAdmin(EnforcedAdmin admin) {
- mEnforcedAdmin = admin;
- if (admin != null) {
- super.setEnabled(true);
- mDisabledByAdmin = true;
- mTextView.setEnabled(false);
- mSwitch.setEnabled(false);
- mSwitch.setVisibility(View.GONE);
- mRestrictedIcon.setVisibility(View.VISIBLE);
- } else {
- mDisabledByAdmin = false;
- mSwitch.setVisibility(View.VISIBLE);
- mRestrictedIcon.setVisibility(View.GONE);
- setEnabled(true);
- }
- }
-
- public final ToggleSwitch getSwitch() {
- return mSwitch;
- }
-
- public void show() {
- if (!isShowing()) {
- setVisibility(View.VISIBLE);
- mSwitch.setOnCheckedChangeListener(this);
- }
- }
-
- public void hide() {
- if (isShowing()) {
- setVisibility(View.GONE);
- mSwitch.setOnCheckedChangeListener(null);
- }
- }
-
- public boolean isShowing() {
- return (getVisibility() == View.VISIBLE);
- }
-
- public void propagateChecked(boolean isChecked) {
- final int count = mSwitchChangeListeners.size();
- for (int n = 0; n < count; n++) {
- mSwitchChangeListeners.get(n).onSwitchChanged(mSwitch, isChecked);
- }
- }
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if (mLoggingIntialized) {
- mMetricsFeatureProvider.action(
- SettingsEnums.PAGE_UNKNOWN,
- SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE,
- SettingsEnums.PAGE_UNKNOWN,
- mMetricsTag + "/switch_bar",
- isChecked ? 1 : 0);
- }
- mLoggingIntialized = true;
- propagateChecked(isChecked);
- }
-
- public void addOnSwitchChangeListener(OnSwitchChangeListener listener) {
- if (mSwitchChangeListeners.contains(listener)) {
- throw new IllegalStateException("Cannot add twice the same OnSwitchChangeListener");
- }
- mSwitchChangeListeners.add(listener);
- }
-
- public void removeOnSwitchChangeListener(OnSwitchChangeListener listener) {
- if (!mSwitchChangeListeners.contains(listener)) {
- throw new IllegalStateException("Cannot remove OnSwitchChangeListener");
- }
- mSwitchChangeListeners.remove(listener);
- }
-
- static class SavedState extends BaseSavedState {
- boolean checked;
- boolean visible;
-
- SavedState(Parcelable superState) {
- super(superState);
- }
-
- /**
- * Constructor called from {@link #CREATOR}
- */
- private SavedState(Parcel in) {
- super(in);
- checked = (Boolean) in.readValue(null);
- visible = (Boolean) in.readValue(null);
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- super.writeToParcel(out, flags);
- out.writeValue(checked);
- out.writeValue(visible);
- }
-
- @Override
- public String toString() {
- return "SwitchBar.SavedState{"
- + Integer.toHexString(System.identityHashCode(this))
- + " checked=" + checked
- + " visible=" + visible + "}";
- }
-
- public static final Parcelable.Creator<SavedState> CREATOR
- = new Parcelable.Creator<SavedState>() {
- public SavedState createFromParcel(Parcel in) {
- return new SavedState(in);
- }
-
- public SavedState[] newArray(int size) {
- return new SavedState[size];
- }
- };
- }
-
- @Override
- public Parcelable onSaveInstanceState() {
- Parcelable superState = super.onSaveInstanceState();
-
- SavedState ss = new SavedState(superState);
- ss.checked = mSwitch.isChecked();
- ss.visible = isShowing();
- return ss;
- }
-
- @Override
- public void onRestoreInstanceState(Parcelable state) {
- SavedState ss = (SavedState) state;
-
- super.onRestoreInstanceState(ss.getSuperState());
-
- mSwitch.setCheckedInternal(ss.checked);
- setTextViewLabelAndBackground(ss.checked);
- setVisibility(ss.visible ? View.VISIBLE : View.GONE);
- mSwitch.setOnCheckedChangeListener(ss.visible ? this : null);
-
- requestLayout();
- }
-}
diff --git a/src/com/android/settings/widget/SwitchBarController.java b/src/com/android/settings/widget/SwitchBarController.java
deleted file mode 100644
index 3a086b6..0000000
--- a/src/com/android/settings/widget/SwitchBarController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.widget;
-
-import android.widget.Switch;
-
-import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
-
-/*
- * The switch controller that is used to update the switch widget in the SwitchBar layout.
- */
-public class SwitchBarController extends SwitchWidgetController implements
- SwitchBar.OnSwitchChangeListener {
-
- private final SwitchBar mSwitchBar;
-
- public SwitchBarController(SwitchBar switchBar) {
- mSwitchBar = switchBar;
- }
-
- @Override
- public void setupView() {
- mSwitchBar.show();
- }
-
- @Override
- public void teardownView() {
- mSwitchBar.hide();
- }
-
- @Override
- public void setTitle(String title) {
- }
-
- @Override
- public void startListening() {
- mSwitchBar.addOnSwitchChangeListener(this);
- }
-
- @Override
- public void stopListening() {
- mSwitchBar.removeOnSwitchChangeListener(this);
- }
-
- @Override
- public void setChecked(boolean checked) {
- mSwitchBar.setChecked(checked);
- }
-
- @Override
- public boolean isChecked() {
- return mSwitchBar.isChecked();
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- mSwitchBar.setEnabled(enabled);
- }
-
- @Override
- public void onSwitchChanged(Switch switchView, boolean isChecked) {
- if (mListener != null) {
- mListener.onSwitchToggled(isChecked);
- }
- }
-
- @Override
- public void setDisabledByAdmin(EnforcedAdmin admin) {
- mSwitchBar.setDisabledByAdmin(admin);
- }
-}
diff --git a/src/com/android/settings/widget/ToggleSwitch.java b/src/com/android/settings/widget/ToggleSwitch.java
deleted file mode 100644
index b392c8e..0000000
--- a/src/com/android/settings/widget/ToggleSwitch.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.widget;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.Switch;
-
-public class ToggleSwitch extends Switch {
-
- private ToggleSwitch.OnBeforeCheckedChangeListener mOnBeforeListener;
-
- public interface OnBeforeCheckedChangeListener {
- boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked);
- }
-
- public ToggleSwitch(Context context) {
- super(context);
- }
-
- public ToggleSwitch(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public ToggleSwitch(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- public ToggleSwitch(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- }
-
- public void setOnBeforeCheckedChangeListener(OnBeforeCheckedChangeListener listener) {
- mOnBeforeListener = listener;
- }
-
- @Override
- public void setChecked(boolean checked) {
- if (mOnBeforeListener != null
- && mOnBeforeListener.onBeforeCheckedChanged(this, checked)) {
- return;
- }
- super.setChecked(checked);
- }
-
- public void setCheckedInternal(boolean checked) {
- super.setChecked(checked);
- }
-}
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSwitchBarController.java b/src/com/android/settings/wifi/tether/WifiTetherSwitchBarController.java
index d6ca524..75a3789 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSwitchBarController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSwitchBarController.java
@@ -54,7 +54,6 @@
private final Context mContext;
private final SettingsMainSwitchBar mSwitchBar;
- private final Switch mSwitch;
private final ConnectivityManager mConnectivityManager;
private final WifiManager mWifiManager;
@@ -78,7 +77,6 @@
WifiTetherSwitchBarController(Context context, SettingsMainSwitchBar switchBar) {
mContext = context;
mSwitchBar = switchBar;
- mSwitch = mSwitchBar.getSwitch();
mDataSaverBackend = new DataSaverBackend(context);
mConnectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -153,8 +151,8 @@
if (state == WIFI_AP_STATE_ENABLING || state == WIFI_AP_STATE_DISABLING) return;
final boolean shouldBeChecked = (state == WIFI_AP_STATE_ENABLED);
- if (mSwitch.isChecked() != shouldBeChecked) {
- mSwitch.setChecked(shouldBeChecked);
+ if (mSwitchBar.isChecked() != shouldBeChecked) {
+ mSwitchBar.setChecked(shouldBeChecked);
}
updateWifiSwitch();
}
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index 8203cf5..323e742 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -20,8 +20,4 @@
<bool name="config_show_camera_laser_sensor">true</bool>
<bool name="config_show_connectivity_monitor">true</bool>
<bool name="config_show_smooth_display">true</bool>
-
- <!-- Fake dimen value for restricted icon size - needed to get around Robolectric
- issue loading framework hidden resources -->
- <dimen name="restricted_icon_size">24dp</dimen>
</resources>
diff --git a/tests/robotests/res/values/themes.xml b/tests/robotests/res/values/themes.xml
index 0fe6328..c33a3a0 100644
--- a/tests/robotests/res/values/themes.xml
+++ b/tests/robotests/res/values/themes.xml
@@ -19,13 +19,4 @@
<item name="colorPrimaryVariant">@android:color/white</item>
</style>
- <style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.ActionBar">
- <item name="android:textColorPrimary">@android:color/white</item>
- <item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
- <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">?android:attr/textColorSecondary</item>
- <item name="switchBarBackgroundActivatedColor">?android:attr/colorAccent</item>
- <item name="switchBarRestrictionIcon">@drawable/ic_help</item>
- </style>
-
</resources>
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
index cc1087e..4b82782 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
@@ -39,8 +39,6 @@
import androidx.preference.PreferenceViewHolder;
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.SwitchBarController;
import com.android.settings.widget.SwitchWidgetController;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedSwitchPreference;
@@ -80,6 +78,7 @@
private SwitchWidgetController.OnSwitchChangeListener mCallback;
private Context mContext;
+ @Mock
private SwitchWidgetController mSwitchController;
private BluetoothEnabler mBluetoothEnabler;
private ShadowBluetoothAdapter mShadowBluetoothAdapter;
@@ -90,7 +89,6 @@
mContext = spy(RuntimeEnvironment.application);
mRestrictedSwitchPreference = new RestrictedSwitchPreference(mContext);
- mSwitchController = spy(new SwitchBarController(new SwitchBar(mContext)));
mBluetoothEnabler = new BluetoothEnabler(
mContext,
mSwitchController,
@@ -215,7 +213,7 @@
verify(mSwitchController, never()).setChecked(anyBoolean());
mBluetoothEnabler.resume(mContext);
verify(mSwitchController, never()).setChecked(false);
- verify(mSwitchController).setChecked(true);
+ when(mSwitchController.isChecked()).thenReturn(true);
// Now simulate bluetooth being turned off via an event.
BroadcastReceiver receiver = captor.getValue();
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
index fca338d..3189b47 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
@@ -27,7 +27,6 @@
import android.content.Context;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
-import android.widget.Switch;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
@@ -65,7 +64,6 @@
})
public class DevelopmentSettingsDashboardFragmentTest {
- private Switch mSwitch;
private Context mContext;
private ShadowUserManager mShadowUserManager;
private DevelopmentSettingsDashboardFragment mDashboard;
@@ -75,7 +73,6 @@
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
SettingsMainSwitchBar switchBar = new SettingsMainSwitchBar(mContext);
- mSwitch = switchBar.getSwitch();
mDashboard = spy(new DevelopmentSettingsDashboardFragment());
ReflectionHelpers.setField(mDashboard, "mSwitchBar", switchBar);
mShadowUserManager = Shadow.extract(mContext.getSystemService(Context.USER_SERVICE));
@@ -163,7 +160,7 @@
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
- mDashboard.onSwitchChanged(mSwitch, false /* isChecked */);
+ mDashboard.onSwitchChanged(null, false /* isChecked */);
assertThat(ShadowEnableDevelopmentSettingWarningDialog.mShown).isFalse();
}
@@ -175,7 +172,7 @@
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
- mDashboard.onSwitchChanged(mSwitch, true /* isChecked */);
+ mDashboard.onSwitchChanged(null, true /* isChecked */);
assertThat(ShadowEnableDevelopmentSettingWarningDialog.mShown).isTrue();
}
@@ -187,7 +184,7 @@
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
- mDashboard.onSwitchChanged(mSwitch, false /* isChecked */);
+ mDashboard.onSwitchChanged(null, false /* isChecked */);
assertThat(ShadowEnableDevelopmentSettingWarningDialog.mShown).isFalse();
assertThat(DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)).isFalse();
@@ -206,7 +203,7 @@
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
- mDashboard.onSwitchChanged(mSwitch, false /* isChecked */);
+ mDashboard.onSwitchChanged(null, false /* isChecked */);
AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
diff --git a/tests/robotests/src/com/android/settings/development/WirelessDebuggingEnablerTest.java b/tests/robotests/src/com/android/settings/development/WirelessDebuggingEnablerTest.java
index 1baf483..14c0bc7 100644
--- a/tests/robotests/src/com/android/settings/development/WirelessDebuggingEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WirelessDebuggingEnablerTest.java
@@ -29,8 +29,7 @@
import com.android.settings.testutils.shadow.ShadowUtils;
import com.android.settings.testutils.shadow.ShadowWirelessDebuggingPreferenceController;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.SwitchBarController;
+import com.android.settings.widget.SwitchWidgetController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.After;
@@ -49,23 +48,22 @@
public class WirelessDebuggingEnablerTest {
@Mock
- private SwitchBar mSwitchBar;
+ private SwitchWidgetController mSwitchWidgetController;
@Mock
private WirelessDebuggingEnabler.OnEnabledListener mListener;
private WirelessDebuggingEnabler mWirelessDebuggingEnabler;
private Context mContext;
- private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mLifecycleOwner = () -> mLifecycle;
+ LifecycleOwner mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mWirelessDebuggingEnabler = spy(new WirelessDebuggingEnabler(
- mContext, new SwitchBarController(mSwitchBar), mListener, mLifecycle));
+ mContext, mSwitchWidgetController, mListener, mLifecycle));
}
@After
@@ -75,14 +73,14 @@
@Test
public void onCreation_shouldShowSwitchBar() {
- verify(mSwitchBar).show();
+ verify(mSwitchWidgetController).setupView();
}
@Test
public void teardownSwitchController_shouldHideSwitchBar() {
mWirelessDebuggingEnabler.teardownSwitchController();
- verify(mSwitchBar).hide();
+ verify(mSwitchWidgetController).teardownView();
}
@Test
@@ -92,7 +90,7 @@
Global.ADB_WIFI_ENABLED, 0 /* setting disabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(false);
+ verify(mSwitchWidgetController).setChecked(false);
verify(mListener).onEnabled(false);
Global.putInt(mContext.getContentResolver(),
@@ -101,7 +99,7 @@
ReflectionHelpers.getField(mWirelessDebuggingEnabler, "mSettingsObserver");
observer.onChange(true, Global.getUriFor(Global.ADB_WIFI_ENABLED));
- verify(mSwitchBar).setChecked(true);
+ verify(mSwitchWidgetController).setChecked(true);
// Should also get a callback
verify(mListener).onEnabled(true);
}
@@ -112,7 +110,7 @@
Global.ADB_WIFI_ENABLED, 1 /* setting enabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(true);
+ verify(mSwitchWidgetController).setChecked(true);
verify(mListener).onEnabled(true);
Global.putInt(mContext.getContentResolver(),
@@ -121,7 +119,7 @@
ReflectionHelpers.getField(mWirelessDebuggingEnabler, "mSettingsObserver");
observer.onChange(true, Global.getUriFor(Global.ADB_WIFI_ENABLED));
- verify(mSwitchBar).setChecked(false);
+ verify(mSwitchWidgetController).setChecked(false);
// Should also get a callback
verify(mListener).onEnabled(false);
}
@@ -133,7 +131,7 @@
Global.ADB_WIFI_ENABLED, 0 /* setting disabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(false);
+ verify(mSwitchWidgetController).setChecked(false);
verify(mListener).onEnabled(false);
mWirelessDebuggingEnabler.onSwitchToggled(true);
@@ -149,7 +147,7 @@
Global.ADB_WIFI_ENABLED, 0 /* setting disabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(false);
+ verify(mSwitchWidgetController).setChecked(false);
verify(mListener).onEnabled(false);
mWirelessDebuggingEnabler.onSwitchToggled(true);
@@ -165,7 +163,7 @@
Global.ADB_WIFI_ENABLED, 1 /* setting disabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(true);
+ verify(mSwitchWidgetController).setChecked(true);
verify(mListener).onEnabled(true);
mWirelessDebuggingEnabler.onSwitchToggled(false);
@@ -181,7 +179,7 @@
Global.ADB_WIFI_ENABLED, 1 /* setting disabled */);
mWirelessDebuggingEnabler.onResume();
- verify(mSwitchBar).setChecked(true);
+ verify(mSwitchWidgetController).setChecked(true);
verify(mListener).onEnabled(true);
mWirelessDebuggingEnabler.onSwitchToggled(false);
diff --git a/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarControllerTest.java
index 838703d..cedc060 100644
--- a/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverGlobalSwitchBarControllerTest.java
@@ -27,8 +27,6 @@
import android.content.Context;
import android.provider.Settings;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.SwitchBarController;
import com.android.settings.widget.SwitchWidgetController;
import org.junit.Before;
@@ -43,8 +41,6 @@
public class GraphicsDriverGlobalSwitchBarControllerTest {
@Mock
- private SwitchBar mSwitchBar;
- @Mock
private SwitchWidgetController mSwitchWidgetController;
@Mock
private GraphicsDriverContentObserver mGraphicsDriverContentObserver;
@@ -65,9 +61,9 @@
Settings.Global.putInt(
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
- verify(mSwitchBar).setChecked(true);
+ verify(mSwitchWidgetController).setChecked(true);
}
@Test
@@ -75,34 +71,33 @@
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
- verify(mSwitchBar).setChecked(false);
+ verify(mSwitchWidgetController).setChecked(false);
}
@Test
public void constructor_developmentSettingsEnabled_shouldEnableSwitchBar() {
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
- verify(mSwitchBar).setEnabled(true);
+ verify(mSwitchWidgetController).setEnabled(true);
}
@Test
public void constructor_developmentSettingsDisabled_shouldDisableSwitchBar() {
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
- verify(mSwitchBar).setEnabled(false);
+ verify(mSwitchWidgetController).setEnabled(false);
}
@Test
public void onStart_shouldStartListeningAndRegister() {
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
- mController.mSwitchWidgetController = mSwitchWidgetController;
+ mContext, mSwitchWidgetController);
mController.mGraphicsDriverContentObserver = mGraphicsDriverContentObserver;
mController.onStart();
@@ -113,8 +108,7 @@
@Test
public void onStop_shouldStopListeningAndUnregister() {
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
- mController.mSwitchWidgetController = mSwitchWidgetController;
+ mContext, mSwitchWidgetController);
mController.mGraphicsDriverContentObserver = mGraphicsDriverContentObserver;
mController.onStop();
@@ -127,7 +121,7 @@
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
mController.onSwitchToggled(true);
assertThat(Settings.Global.getInt(
@@ -141,7 +135,7 @@
Settings.Global.putInt(
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController = new GraphicsDriverGlobalSwitchBarController(
- mContext, new SwitchBarController(mSwitchBar));
+ mContext, mSwitchWidgetController);
mController.onSwitchToggled(false);
assertThat(Settings.Global.getInt(
diff --git a/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java b/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
index bb4b0c4..e7a31ce 100644
--- a/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
@@ -33,6 +33,7 @@
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -51,8 +52,6 @@
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.network.TetherEnabler.OnTetherStateUpdateListener;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.SwitchBarController;
import com.android.settings.widget.SwitchWidgetController;
import org.junit.Before;
@@ -82,8 +81,8 @@
@Mock
private BluetoothAdapter mBluetoothAdapter;
- private SwitchBar mSwitchBar;
private TetherEnabler mEnabler;
+ @Mock
private SwitchWidgetController mSwitchWidgetController;
private static final String[] USB_TETHERED = {"usb"};
@@ -93,8 +92,6 @@
Context context = spy(ApplicationProvider.getApplicationContext());
AtomicReference<BluetoothPan> panReference = spy(AtomicReference.class);
- mSwitchBar = spy(new SwitchBar(context));
- mSwitchWidgetController = spy(new SwitchBarController(mSwitchBar));
when(context.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(context.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
mConnectivityManager);
@@ -115,7 +112,8 @@
when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(USB_TETHERED);
mEnabler.onStart();
- assertThat(mSwitchBar.isChecked()).isTrue();
+
+ verify(mSwitchWidgetController).setChecked(true);
}
@Test
@@ -150,26 +148,29 @@
mEnabler.onStart();
mEnabler.startTethering(TetheringManager.TETHERING_WIFI);
+ clearInvocations(mSwitchWidgetController);
when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[0]);
mEnabler.mOnStartTetheringCallback.onTetheringFailed();
- assertThat(mSwitchBar.isChecked()).isFalse();
- assertThat(mSwitchBar.isEnabled()).isTrue();
+ verify(mSwitchWidgetController).setEnabled(true);
+ verify(mSwitchWidgetController).setChecked(false);
}
@Test
public void onDataSaverChanged_setsEnabledCorrectly() {
- mSwitchBar.setEnabled(true);
+ mSwitchWidgetController.setEnabled(true);
// try to turn data saver on
+ clearInvocations(mSwitchWidgetController);
when(mNetworkPolicyManager.getRestrictBackground()).thenReturn(true);
mEnabler.onDataSaverChanged(true);
- assertThat(mSwitchBar.isEnabled()).isFalse();
+ verify(mSwitchWidgetController).setEnabled(false);
// lets turn data saver off again
+ clearInvocations(mSwitchWidgetController);
when(mNetworkPolicyManager.getRestrictBackground()).thenReturn(false);
mEnabler.onDataSaverChanged(false);
- assertThat(mSwitchBar.isEnabled()).isTrue();
+ verify(mSwitchWidgetController).setEnabled(true);
}
@Test
@@ -250,7 +251,7 @@
ReflectionHelpers.setField(mEnabler, "mDataSaverEnabled", false);
mEnabler.updateState(null/*tethered*/);
- verify(mSwitchBar).setEnabled(true);
+ verify(mSwitchWidgetController).setEnabled(true);
}
@Test
@@ -263,7 +264,7 @@
ReflectionHelpers.setField(mEnabler, "mDataSaverEnabled", false);
mEnabler.updateState(null/*tethered*/);
- verify(mSwitchBar).setEnabled(true);
+ verify(mSwitchWidgetController).setEnabled(true);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/users/MultiUserSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/users/MultiUserSwitchBarControllerTest.java
index 718e01b..1cfb3f6 100644
--- a/tests/robotests/src/com/android/settings/users/MultiUserSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/users/MultiUserSwitchBarControllerTest.java
@@ -17,8 +17,8 @@
package com.android.settings.users;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import android.content.Context;
@@ -26,8 +26,7 @@
import android.os.UserManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.SwitchBarController;
+import com.android.settings.widget.SwitchWidgetController;
import org.junit.After;
import org.junit.Before;
@@ -43,14 +42,14 @@
private Context mContext;
private ShadowUserManager mUserManager;
- private SwitchBarController mSwitchBarController;
+ private SwitchWidgetController mSwitchWidgetController;
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mUserManager = ShadowUserManager.getShadow();
- mSwitchBarController = spy(new SwitchBarController(new SwitchBar(mContext)));
+ mSwitchWidgetController = mock(SwitchWidgetController.class);
mUserManager.setSupportsMultipleUsers(true);
}
@@ -65,9 +64,9 @@
UserManager.DISALLOW_USER_SWITCH, true);
final MultiUserSwitchBarController controller = new MultiUserSwitchBarController(mContext,
- mSwitchBarController, null);
+ mSwitchWidgetController, null);
- verify(mSwitchBarController).setDisabledByAdmin(any());
+ verify(mSwitchWidgetController).setDisabledByAdmin(any());
}
@Test
@@ -76,8 +75,8 @@
UserManager.DISALLOW_USER_SWITCH, false);
final MultiUserSwitchBarController controller = new MultiUserSwitchBarController(mContext,
- mSwitchBarController, null);
+ mSwitchWidgetController, null);
- verify(mSwitchBarController, never()).setDisabledByAdmin(any());
+ verify(mSwitchWidgetController, never()).setDisabledByAdmin(any());
}
}
diff --git a/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java b/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java
index 49b7840..2b7f462 100644
--- a/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java
+++ b/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java
@@ -19,45 +19,42 @@
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
+import android.widget.CompoundButton;
import android.widget.TextView;
-import com.android.settings.R;
-import com.android.settingslib.RestrictedLockUtils;
+import androidx.test.core.app.ApplicationProvider;
-import org.junit.Before;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.widget.mainswitch.R;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class SettingsMainSwitchBarTest {
- private SettingsMainSwitchBar mMainSwitchBar;
+ private final Context mContext = ApplicationProvider.getApplicationContext();
+ private final SettingsMainSwitchBar mMainSwitchBar = new SettingsMainSwitchBar(mContext);
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- final Context context = RuntimeEnvironment.application;
- mMainSwitchBar = new SettingsMainSwitchBar(context);
- }
+ private final TextView mTitle = mMainSwitchBar.findViewById(R.id.switch_text);
+
+ private final CompoundButton mSwitchWidget =
+ mMainSwitchBar.findViewById(android.R.id.switch_widget);
@Test
public void disabledByAdmin_shouldBeDisabled() {
mMainSwitchBar.setDisabledByAdmin(new RestrictedLockUtils.EnforcedAdmin());
- TextView title = (TextView) mMainSwitchBar.findViewById(R.id.switch_text);
- assertThat(title.isEnabled()).isFalse();
- assertThat(mMainSwitchBar.getSwitch().isEnabled()).isFalse();
+ assertThat(mTitle.isEnabled()).isFalse();
+ assertThat(mSwitchWidget.isEnabled()).isFalse();
}
@Test
public void disabledByAdmin_setNull_shouldBeEnabled() {
mMainSwitchBar.setDisabledByAdmin(null);
- TextView title = (TextView) mMainSwitchBar.findViewById(R.id.switch_text);
- assertThat(title.isEnabled()).isTrue();
- assertThat(mMainSwitchBar.getSwitch().isEnabled()).isTrue();
+ assertThat(mTitle.isEnabled()).isTrue();
+ assertThat(mSwitchWidget.isEnabled()).isTrue();
}
}
diff --git a/tests/robotests/src/com/android/settings/widget/SwitchBarTest.java b/tests/robotests/src/com/android/settings/widget/SwitchBarTest.java
deleted file mode 100644
index 0c297f4..0000000
--- a/tests/robotests/src/com/android/settings/widget/SwitchBarTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.widget;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.robolectric.RuntimeEnvironment.application;
-
-import android.content.Context;
-import android.graphics.drawable.ColorDrawable;
-import android.widget.TextView;
-
-import com.android.settings.R;
-import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class SwitchBarTest {
-
- private static final int COLOR_BACKGROUND = 1;
- private static final int COLOR_BACKGROUND_ACTIVATED = 2;
-
- private Context mContext;
- private SwitchBar mBar;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mBar = new SwitchBar(application, Robolectric.buildAttributeSet()
- .addAttribute(R.attr.switchBarBackgroundColor, String.valueOf(COLOR_BACKGROUND))
- .addAttribute(R.attr.switchBarBackgroundActivatedColor,
- String.valueOf(COLOR_BACKGROUND_ACTIVATED))
- .build());
- }
-
- @Test
- public void cycleChecked_defaultLabel_shouldUpdateTextAndBackground() {
- final int defaultOnText = R.string.switch_on_text;
- final int defaultOffText = R.string.switch_off_text;
-
- assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
- .isEqualTo(mContext.getString(defaultOffText));
-
- mBar.setChecked(true);
-
- assertThat(mBar.getBackground()).isInstanceOf(ColorDrawable.class);
- assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
- .isEqualTo(mContext.getString(defaultOnText));
- }
-
- @Test
- public void cycleChecked_customLabel_shouldUpdateTextAndBackground() {
- final int onText = R.string.main_clear_progress_text;
- final int offText = R.string.clear_user_data_text;
-
- mBar.setSwitchBarText(onText, offText);
- assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
- .isEqualTo(mContext.getString(offText));
-
- mBar.setChecked(true);
- assertThat(mBar.getBackground()).isInstanceOf(ColorDrawable.class);
-
- assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
- .isEqualTo(mContext.getString(onText));
- }
-
- @Test
- public void setCheck_customLabelWithStringType_shouldUpdateTextAndBackground() {
- final String onText = mContext.getString(
- R.string.accessibility_service_primary_switch_title);
- final String offText = mContext.getString(
- R.string.accessibility_service_primary_switch_title);
- final TextView switchBarTextView = ((TextView) mBar.findViewById(R.id.switch_text));
-
- mBar.setSwitchBarText(onText, offText);
-
- assertThat(switchBarTextView.getText()).isEqualTo(offText);
-
- mBar.setChecked(true);
-
- assertThat(mBar.getBackground()).isInstanceOf(ColorDrawable.class);
- assertThat(switchBarTextView.getText()).isEqualTo(onText);
- }
-
- @Test
- public void disabledByAdmin_shouldDelegateToRestrictedIcon() {
- mBar.setDisabledByAdmin(new EnforcedAdmin());
- assertThat(mBar.getDelegatingView().getId()).isEqualTo(R.id.restricted_icon);
- }
-
- @Test
- public void notDisabledByAdmin_shouldDelegateToSwitch() {
- mBar.setDisabledByAdmin(null);
- assertThat(mBar.getDelegatingView().getId()).isEqualTo(R.id.switch_widget);
- }
-
- @Test
- public void performClick_shouldIsCheckedValueChange() {
- boolean isChecked = mBar.isChecked();
- mBar.performClick();
- assertThat(mBar.isChecked()).isEqualTo(!isChecked);
- }
-}
diff --git a/tests/unit/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceControllerTest.java
index b0cd780..9edbf9e 100644
--- a/tests/unit/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceControllerTest.java
@@ -28,9 +28,8 @@
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import android.telephony.ims.ProvisioningManager;
-import androidx.preference.SwitchPreference;
+import androidx.preference.TwoStatePreference;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -57,13 +56,11 @@
private SubscriptionManager mSubscriptionManager;
@Mock
private CarrierConfigCache mCarrierConfigCache;
- @Mock
- private ProvisioningManager mProvisioningManager;
private MockVolteQueryImsState mQueryImsState;
private Enhanced4gLtePreferenceController mController;
- private SwitchPreference mPreference;
+ private TwoStatePreference mPreference;
private PersistableBundle mCarrierConfig;
private Context mContext;
diff --git a/tests/unit/src/com/android/settings/network/telephony/NrAdvancedCallingPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/NrAdvancedCallingPreferenceControllerTest.java
index 053fb4d..bed8ef1 100644
--- a/tests/unit/src/com/android/settings/network/telephony/NrAdvancedCallingPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/NrAdvancedCallingPreferenceControllerTest.java
@@ -29,7 +29,7 @@
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import androidx.preference.SwitchPreference;
+import androidx.preference.TwoStatePreference;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -57,7 +57,7 @@
private CarrierConfigCache mCarrierConfigCache;
private NrAdvancedCallingPreferenceController mController;
- private SwitchPreference mPreference;
+ private TwoStatePreference mPreference;
private PersistableBundle mCarrierConfig;
private Context mContext;