diff --git a/res-product/values/strings.xml b/res-product/values/strings.xml
index d5ef1c888f6..32e545bd7c2 100644
--- a/res-product/values/strings.xml
+++ b/res-product/values/strings.xml
@@ -89,6 +89,12 @@
Use your face to unlock your tablet or for authentication in apps, like when you sign in to apps or approve a purchase
Use your face to unlock your device or for authentication in apps, like when you sign in to apps or approve a purchase
+
+
+
+
+
+
Allow your child to use their face to unlock their phone
@@ -107,6 +113,18 @@
Using your child\u2019s face to unlock their tablet may be less secure than a strong pattern or PIN.
Using your child\u2019s face to unlock their device may be less secure than a strong pattern or PIN.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -161,6 +179,12 @@
+
+
+
+
+
+
@@ -193,6 +217,8 @@
Use your face to unlock your device or verify it\u2019s you, like when you sign in to apps or approve a purchase.\n\nKeep in mind:\nYou can only have one face set up at a time. To add another face, delete the current one.\n\nLooking at the device can unlock it when you don\u2019t intend to.\n\nYour device can be unlocked by someone else if it\u2019s held up to your face, even if your eyes are closed.\n\nYour device can be unlocked by someone who looks a lot like you, like an identical sibling.
Use your fingerprint to unlock your %s or verify it\u2019s you, like when you sign in to apps or approve a purchase
+
+ Use your fingerprints to unlock your %s or verify it\u2019s you in apps
Allow your child to use their fingerprint to unlock their phone or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.
@@ -241,6 +267,18 @@
Your child\u2019s tablet can be unlocked when they don\u2019t intend to, like if someone holds it up to their finger.
Your child\u2019s device can be unlocked when they don\u2019t intend to, like if someone holds it up to their finger.
+
+
+
+
+
+
+
+
+
+
+
+
Use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps
diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml
index 082408d1583..44ed589004f 100644
--- a/res/color/dream_card_color_state_list.xml
+++ b/res/color/dream_card_color_state_list.xml
@@ -17,6 +17,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/res/color/dream_card_icon_color_state_list.xml b/res/color/dream_card_icon_color_state_list.xml
index ed34ae39357..f3e08721b92 100644
--- a/res/color/dream_card_icon_color_state_list.xml
+++ b/res/color/dream_card_icon_color_state_list.xml
@@ -17,6 +17,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/res/color/dream_card_summary_color_state_list.xml b/res/color/dream_card_summary_color_state_list.xml
index a1845f44d95..7252abed0cb 100644
--- a/res/color/dream_card_summary_color_state_list.xml
+++ b/res/color/dream_card_summary_color_state_list.xml
@@ -17,6 +17,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/res/color/dream_card_text_color_state_list.xml b/res/color/dream_card_text_color_state_list.xml
index b39bbed75c9..c4b3ef5f414 100644
--- a/res/color/dream_card_text_color_state_list.xml
+++ b/res/color/dream_card_text_color_state_list.xml
@@ -17,6 +17,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/res/color/modes_icon_selectable_background.xml b/res/color/modes_icon_selectable_background.xml
index f9280c60d6c..b3b393562d3 100644
--- a/res/color/modes_icon_selectable_background.xml
+++ b/res/color/modes_icon_selectable_background.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
-
-
-
+
+
+
diff --git a/res/color/modes_icon_selectable_icon.xml b/res/color/modes_icon_selectable_icon.xml
index 8a517d5f474..a5ab92b1d5b 100644
--- a/res/color/modes_icon_selectable_icon.xml
+++ b/res/color/modes_icon_selectable_icon.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
-
-
-
+
+
+
diff --git a/res/drawable/accessibility_contrast_button_background.xml b/res/drawable/accessibility_contrast_button_background.xml
index 7e41aaebee4..5f0f5ad09ec 100644
--- a/res/drawable/accessibility_contrast_button_background.xml
+++ b/res/drawable/accessibility_contrast_button_background.xml
@@ -22,9 +22,9 @@
-
-
+
@@ -41,7 +41,7 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
@@ -55,7 +55,7 @@
android:left="@dimen/contrast_button_stroke_width"
android:right="@dimen/contrast_button_stroke_width">
-
+
diff --git a/res/drawable/broadcast_button_outline.xml b/res/drawable/broadcast_button_outline.xml
index c8658a9fccd..1645ad07a25 100644
--- a/res/drawable/broadcast_button_outline.xml
+++ b/res/drawable/broadcast_button_outline.xml
@@ -29,7 +29,7 @@
-
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_bottom_appbar_background.xml b/res/drawable/color_contrast_preview_bottom_appbar_background.xml
index f3392fb01b5..7ffe3742c56 100644
--- a/res/drawable/color_contrast_preview_bottom_appbar_background.xml
+++ b/res/drawable/color_contrast_preview_bottom_appbar_background.xml
@@ -17,7 +17,7 @@
-
+
-
+
diff --git a/res/drawable/color_contrast_preview_dialog_background.xml b/res/drawable/color_contrast_preview_dialog_background.xml
index f60a271ec3d..61219ac36d7 100644
--- a/res/drawable/color_contrast_preview_dialog_background.xml
+++ b/res/drawable/color_contrast_preview_dialog_background.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_icon_edit_background.xml b/res/drawable/color_contrast_preview_icon_edit_background.xml
index 61fe4fef8f6..b6b2930f134 100644
--- a/res/drawable/color_contrast_preview_icon_edit_background.xml
+++ b/res/drawable/color_contrast_preview_icon_edit_background.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_icon_group_background.xml b/res/drawable/color_contrast_preview_icon_group_background.xml
index 46cd40d9acf..284d9caea88 100644
--- a/res/drawable/color_contrast_preview_icon_group_background.xml
+++ b/res/drawable/color_contrast_preview_icon_group_background.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_icon_inbox_background.xml b/res/drawable/color_contrast_preview_icon_inbox_background.xml
index 45d82852456..b63d9181cfa 100644
--- a/res/drawable/color_contrast_preview_icon_inbox_background.xml
+++ b/res/drawable/color_contrast_preview_icon_inbox_background.xml
@@ -17,7 +17,7 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_icon_star_background.xml b/res/drawable/color_contrast_preview_icon_star_background.xml
index 335ee886f7f..027d3e15904 100644
--- a/res/drawable/color_contrast_preview_icon_star_background.xml
+++ b/res/drawable/color_contrast_preview_icon_star_background.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/color_contrast_preview_tag_background.xml b/res/drawable/color_contrast_preview_tag_background.xml
index a7b051aa280..91b090cd963 100644
--- a/res/drawable/color_contrast_preview_tag_background.xml
+++ b/res/drawable/color_contrast_preview_tag_background.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/dream_default_preview_icon.xml b/res/drawable/dream_default_preview_icon.xml
index 8989929fdd7..be3f128a39d 100644
--- a/res/drawable/dream_default_preview_icon.xml
+++ b/res/drawable/dream_default_preview_icon.xml
@@ -20,6 +20,6 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
\ No newline at end of file
diff --git a/res/drawable/dream_preview_rounded_bg.xml b/res/drawable/dream_preview_rounded_bg.xml
index 7cae599b6c8..c7034e7fbef 100644
--- a/res/drawable/dream_preview_rounded_bg.xml
+++ b/res/drawable/dream_preview_rounded_bg.xml
@@ -17,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/ic_article_24dp.xml b/res/drawable/ic_article_24dp.xml
index 0b38daaf643..bf9d2f7f8c7 100644
--- a/res/drawable/ic_article_24dp.xml
+++ b/res/drawable/ic_article_24dp.xml
@@ -22,6 +22,6 @@
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
diff --git a/res/drawable/ic_article_filled_24dp.xml b/res/drawable/ic_article_filled_24dp.xml
index e22d151beb7..9e5f24c0aad 100644
--- a/res/drawable/ic_article_filled_24dp.xml
+++ b/res/drawable/ic_article_filled_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/ic_chat_bubble_24dp.xml b/res/drawable/ic_chat_bubble_24dp.xml
index c7ad6bf28a1..5b6536b9655 100644
--- a/res/drawable/ic_chat_bubble_24dp.xml
+++ b/res/drawable/ic_chat_bubble_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/ic_edit_24dp.xml b/res/drawable/ic_edit_24dp.xml
index e663b5275c0..fdd82f579d3 100644
--- a/res/drawable/ic_edit_24dp.xml
+++ b/res/drawable/ic_edit_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/ic_eyeglasses.xml b/res/drawable/ic_eyeglasses.xml
new file mode 100644
index 00000000000..c35d7b30529
--- /dev/null
+++ b/res/drawable/ic_eyeglasses.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
diff --git a/res/drawable/ic_familiar_face_and_zone.xml b/res/drawable/ic_familiar_face_and_zone.xml
new file mode 100644
index 00000000000..dbef199e896
--- /dev/null
+++ b/res/drawable/ic_familiar_face_and_zone.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_group_24dp.xml b/res/drawable/ic_group_24dp.xml
index 92815c2cc2f..1c65fc26a4f 100644
--- a/res/drawable/ic_group_24dp.xml
+++ b/res/drawable/ic_group_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/ic_inbox_24dp.xml b/res/drawable/ic_inbox_24dp.xml
index 7800ea145ef..18cc3e951ae 100644
--- a/res/drawable/ic_inbox_24dp.xml
+++ b/res/drawable/ic_inbox_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/ic_modifier_keys_reset.xml b/res/drawable/ic_modifier_keys_reset.xml
index 5345c2578f9..9fdbab0b53a 100644
--- a/res/drawable/ic_modifier_keys_reset.xml
+++ b/res/drawable/ic_modifier_keys_reset.xml
@@ -21,7 +21,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?androidprv:attr/materialColorPrimary">
+ android:tint="@androidprv:color/materialColorPrimary">
diff --git a/res/drawable/ic_privacy_tip.xml b/res/drawable/ic_privacy_tip.xml
new file mode 100644
index 00000000000..8f34eb65f22
--- /dev/null
+++ b/res/drawable/ic_privacy_tip.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/res/drawable/ic_security_privacy_safe.xml b/res/drawable/ic_security_privacy_safe.xml
new file mode 100644
index 00000000000..99aeaef2496
--- /dev/null
+++ b/res/drawable/ic_security_privacy_safe.xml
@@ -0,0 +1,10 @@
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_star_24dp.xml b/res/drawable/ic_star_24dp.xml
index 667db94e0fd..449067875c4 100644
--- a/res/drawable/ic_star_24dp.xml
+++ b/res/drawable/ic_star_24dp.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
diff --git a/res/drawable/modifier_key_bordered.xml b/res/drawable/modifier_key_bordered.xml
index 2931679685d..a3c7cc5d318 100644
--- a/res/drawable/modifier_key_bordered.xml
+++ b/res/drawable/modifier_key_bordered.xml
@@ -25,7 +25,7 @@
+ android:color="@androidprv:color/materialColorPrimary"/>
diff --git a/res/drawable/modifier_key_colored.xml b/res/drawable/modifier_key_colored.xml
index 995d7336564..4610738127e 100644
--- a/res/drawable/modifier_key_colored.xml
+++ b/res/drawable/modifier_key_colored.xml
@@ -22,7 +22,7 @@
-
-
+
diff --git a/res/drawable/modifier_key_lisetview_background.xml b/res/drawable/modifier_key_lisetview_background.xml
index 3353cfdaab2..a0d8c03bfac 100644
--- a/res/drawable/modifier_key_lisetview_background.xml
+++ b/res/drawable/modifier_key_lisetview_background.xml
@@ -22,7 +22,7 @@
-
-
+
diff --git a/res/drawable/pointer_icon_fill_container_background.xml b/res/drawable/pointer_icon_fill_container_background.xml
index ca930a74540..7f6bf533073 100644
--- a/res/drawable/pointer_icon_fill_container_background.xml
+++ b/res/drawable/pointer_icon_fill_container_background.xml
@@ -18,5 +18,5 @@
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
-
+
diff --git a/res/drawable/preference_circular_icons_plus_item_background.xml b/res/drawable/preference_circular_icons_plus_item_background.xml
index faaa1fd11fe..e261c76af46 100644
--- a/res/drawable/preference_circular_icons_plus_item_background.xml
+++ b/res/drawable/preference_circular_icons_plus_item_background.xml
@@ -21,5 +21,5 @@
-
+
\ No newline at end of file
diff --git a/res/drawable/rounded_bg.xml b/res/drawable/rounded_bg.xml
index ae12af895dc..0e2743de1c3 100644
--- a/res/drawable/rounded_bg.xml
+++ b/res/drawable/rounded_bg.xml
@@ -17,7 +17,7 @@
-
+
-
+ android:color="@androidprv:color/materialColorPrimary"/>
diff --git a/res/drawable/trackpad_button_done_colored.xml b/res/drawable/trackpad_button_done_colored.xml
index 995d7336564..4610738127e 100644
--- a/res/drawable/trackpad_button_done_colored.xml
+++ b/res/drawable/trackpad_button_done_colored.xml
@@ -22,7 +22,7 @@
-
-
+
diff --git a/res/drawable/user_select_background.xml b/res/drawable/user_select_background.xml
index 7b75160213d..490246c49fe 100644
--- a/res/drawable/user_select_background.xml
+++ b/res/drawable/user_select_background.xml
@@ -19,13 +19,13 @@
android:color="@color/settingslib_ripple_color">
-
-
+
-
-
+
diff --git a/res/drawable/volume_dialog_button_background_outline.xml b/res/drawable/volume_dialog_button_background_outline.xml
index 36ffb93f7a4..f8df90e604b 100644
--- a/res/drawable/volume_dialog_button_background_outline.xml
+++ b/res/drawable/volume_dialog_button_background_outline.xml
@@ -21,7 +21,7 @@
+ android:textColor="@androidprv:color/materialColorOnSurface"/>
+ android:textColor="@androidprv:color/materialColorOnSurface"/>
+ android:textColor="@androidprv:color/materialColorOnSurface"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/homepage_preference.xml b/res/layout/homepage_preference.xml
index 38cb4910d81..5f106c7e093 100644
--- a/res/layout/homepage_preference.xml
+++ b/res/layout/homepage_preference.xml
@@ -78,7 +78,7 @@
android:layout_gravity="start"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:textColor="@androidprv:color/materialColorOnSurfaceVariant"
android:maxLines="4"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
diff --git a/res/layout/homepage_preference_v2.xml b/res/layout/homepage_preference_v2.xml
index ebb7ca9dae6..76eb4032d88 100644
--- a/res/layout/homepage_preference_v2.xml
+++ b/res/layout/homepage_preference_v2.xml
@@ -78,7 +78,7 @@
android:layout_gravity="start"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:textColor="@androidprv:color/materialColorOnSurfaceVariant"
android:maxLines="4"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
diff --git a/res/layout/modifier_key_item.xml b/res/layout/modifier_key_item.xml
index 683f631f14a..00190367569 100644
--- a/res/layout/modifier_key_item.xml
+++ b/res/layout/modifier_key_item.xml
@@ -31,7 +31,7 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:src="@drawable/ic_check_24dp"
- android:tint="?androidprv:attr/materialColorPrimary"/>
+ android:tint="@androidprv:color/materialColorPrimary"/>
diff --git a/res/layout/notification_ls_minimalism_selector.xml b/res/layout/notification_ls_minimalism_selector.xml
index d37ad5401a2..cf34561082d 100644
--- a/res/layout/notification_ls_minimalism_selector.xml
+++ b/res/layout/notification_ls_minimalism_selector.xml
@@ -74,7 +74,7 @@
android:singleLine="true"
android:textSize="@dimen/contrast_button_text_size"
android:text="@string/lock_screen_notifs_show_compact"
- android:textColor="?androidprv:attr/materialColorOnSurface"/>
+ android:textColor="@androidprv:color/materialColorOnSurface"/>
+ android:textColor="@androidprv:color/materialColorOnSurface"/>
diff --git a/res/layout/pointer_icon_stroke_style_layout.xml b/res/layout/pointer_icon_stroke_style_layout.xml
index 01b58b294ce..a68b5967357 100644
--- a/res/layout/pointer_icon_stroke_style_layout.xml
+++ b/res/layout/pointer_icon_stroke_style_layout.xml
@@ -31,7 +31,7 @@
android:layout_marginTop="@dimen/pointer_stroke_style_padding"
android:text="@string/pointer_stroke_style"
android:textSize="14sp"
- android:textColor="?androidprv:attr/materialColorPrimary"
+ android:textColor="@androidprv:color/materialColorPrimary"
android:textAlignment="viewStart"
android:fontWeight="500"
android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/preference_background.xml b/res/layout/preference_background.xml
index 51718b8fd5c..1c69be4ac7e 100644
--- a/res/layout/preference_background.xml
+++ b/res/layout/preference_background.xml
@@ -65,7 +65,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
- android:textColor="?androidprv:attr/materialColorOnPrimaryContainer"
+ android:textColor="@androidprv:color/materialColorOnPrimaryContainer"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:hyphenationFrequency="normalFast"
@@ -78,7 +78,7 @@
android:layout_alignStart="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?androidprv:attr/materialColorOnPrimaryContainer"
+ android:textColor="@androidprv:color/materialColorOnPrimaryContainer"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="4"
diff --git a/res/layout/preference_circular_icons_plus_item.xml b/res/layout/preference_circular_icons_plus_item.xml
index 98820863410..352708806b7 100644
--- a/res/layout/preference_circular_icons_plus_item.xml
+++ b/res/layout/preference_circular_icons_plus_item.xml
@@ -26,7 +26,7 @@
android:padding="4dp"
android:drawablePadding="0dp"
android:background="@drawable/preference_circular_icons_plus_item_background"
- android:textColor="?androidprv:attr/materialColorOnSecondaryContainer"
+ android:textColor="@androidprv:color/materialColorOnSecondaryContainer"
android:maxLines="1"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="6sp" />
\ No newline at end of file
diff --git a/res/layout/preference_widget_arrow.xml b/res/layout/preference_widget_arrow.xml
index f36f693f012..50edb3c0bd6 100644
--- a/res/layout/preference_widget_arrow.xml
+++ b/res/layout/preference_widget_arrow.xml
@@ -23,5 +23,5 @@
android:layout_gravity="center_vertical"
android:contentDescription="@null"
android:scaleType="center"
- android:tint="?androidprv:attr/materialColorOnPrimaryContainer"
+ android:tint="@androidprv:color/materialColorOnPrimaryContainer"
android:src="@drawable/ic_arrow_forward" />
\ No newline at end of file
diff --git a/res/layout/trackpad_gesture_preview.xml b/res/layout/trackpad_gesture_preview.xml
index 15cc743196d..978da06319c 100644
--- a/res/layout/trackpad_gesture_preview.xml
+++ b/res/layout/trackpad_gesture_preview.xml
@@ -82,7 +82,7 @@
android:paddingVertical="14dp"
android:drawablePadding="9dp"
style="@style/TrackpadButtonDone"
- android:textColor="?androidprv:attr/materialColorOnPrimary"
+ android:textColor="@androidprv:color/materialColorOnPrimary"
android:text="@string/gesture_button_next"/>
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 69f17f64b88..a117e47a93f 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -19,7 +19,7 @@
#783BE5
#3F5FBD
@*android:color/material_grey_900
- ?androidprv:attr/materialColorSurfaceBright
+ @androidprv:color/materialColorSurfaceBright
#5F6368
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 91598fe6309..0b7e0c1eb65 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -94,7 +94,7 @@
@*android:color/accent_device_default_light
- ?androidprv:attr/materialColorSurfaceBright
+ @androidprv:color/materialColorSurfaceBright
#42a5f5
@@ -166,7 +166,7 @@
@*android:color/primary_text_default_material_light
- ?androidprv:attr/materialColorSurfaceContainer
+ @androidprv:color/materialColorSurfaceContainer
?android:attr/textColorPrimary
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 730c258601c..6fc9fb13af6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -771,6 +771,8 @@
+
+
Cancel
@@ -898,6 +900,8 @@
You and your child are in control
Keep in mind
+
+ Secure and helpful
Use your fingerprint to unlock your phone or approve purchases.\n\nNote: You can\u2019t use your fingerprint to unlock this device. For more information, contact your organization\u2019s admin.
@@ -928,6 +932,8 @@
For best results, use a screen protector that\u2019s Made for Google certified. With other screen protectors, your child\u2019s fingerprint may not work.
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5bcb805aeaf..c656e138b13 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -249,7 +249,7 @@
- center
- @*android:string/config_headlineFontFamily
- @dimen/search_bar_text_size
- - ?androidprv:attr/materialColorOnSurfaceVariant
+ - @androidprv:color/materialColorOnSurfaceVariant
- true
@@ -448,7 +448,7 @@
- @dimen/contextual_card_vertical_margin
- @dimen/contextual_card_side_margin
- @dimen/contextual_card_side_margin
- - ?androidprv:attr/materialColorSurfaceContainer
+ - @androidprv:color/materialColorSurfaceContainer
- @dimen/contextual_card_corner_radius
- 0dp
- ?android:attr/colorControlHighlight
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 4f20d8c9091..9d416f729fd 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -67,12 +67,12 @@
- @style/Widget.SliceView.Settings
- @android:color/transparent
- - ?androidprv:attr/materialColorOutlineVariant
- - ?androidprv:attr/materialColorOnSurfaceVariant
+ - @androidprv:color/materialColorOutlineVariant
+ - @androidprv:color/materialColorOnSurfaceVariant
- - ?androidprv:attr/materialColorSecondaryContainer
- - ?androidprv:attr/materialColorOnSecondaryContainer
- - ?androidprv:attr/materialColorOnSecondaryContainer
+ - @androidprv:color/materialColorSecondaryContainer
+ - @androidprv:color/materialColorOnSecondaryContainer
+ - @androidprv:color/materialColorOnSecondaryContainer
- ?android:attr/colorAccent
diff --git a/res/values/themes_expressive.xml b/res/values/themes_expressive.xml
index 8342fe0c9e0..0a8b45dafdc 100644
--- a/res/values/themes_expressive.xml
+++ b/res/values/themes_expressive.xml
@@ -59,12 +59,12 @@
- @style/Widget.SliceView.Settings
- @android:color/transparent
- - ?androidprv:attr/materialColorOutlineVariant
- - ?androidprv:attr/materialColorOnSurfaceVariant
+ - @androidprv:color/materialColorOutlineVariant
+ - @androidprv:color/materialColorOnSurfaceVariant
- - ?androidprv:attr/materialColorSecondaryContainer
- - ?androidprv:attr/materialColorOnSecondaryContainer
- - ?androidprv:attr/materialColorOnSecondaryContainer
+ - @androidprv:color/materialColorSecondaryContainer
+ - @androidprv:color/materialColorOnSecondaryContainer
+ - @androidprv:color/materialColorOnSecondaryContainer
- ?android:attr/colorAccent
diff --git a/res/xml/mobile_network_settings.xml b/res/xml/mobile_network_settings.xml
index 3c1317d15b5..a1a2276ee14 100644
--- a/res/xml/mobile_network_settings.xml
+++ b/res/xml/mobile_network_settings.xml
@@ -18,7 +18,7 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="mobile_network_pref_screen">
-
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index b3da71e226f..c8011ee0fb1 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1330,8 +1330,7 @@ public final class Utils extends com.android.settingslib.Utils {
*/
@ColorInt
public static int getHomepageIconColor(Context context) {
- return getColorAttrDefaultColor(
- context, com.android.internal.R.attr.materialColorOnSurface);
+ return context.getColor(com.android.internal.R.color.materialColorOnSurface);
}
/**
diff --git a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
index 9fc9e1044fc..a972a0dd5fa 100644
--- a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
@@ -66,7 +66,6 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
static final String RESET_KEY = "reset";
static final String PREVIEW_KEY = "preview";
private static final String NEED_RESET_SETTINGS = "need_reset_settings";
- private static final String LAST_PREVIEW_INDEX = "last_preview_index";
private static final int UNKNOWN_INDEX = -1;
private FontWeightAdjustmentPreferenceController mFontWeightAdjustmentController;
@@ -111,13 +110,6 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
if (savedInstanceState.getBoolean(NEED_RESET_SETTINGS)) {
mResetStateListeners.forEach(ResetStateListener::resetState);
}
-
- if (savedInstanceState.containsKey(LAST_PREVIEW_INDEX)) {
- final int lastPreviewIndex = savedInstanceState.getInt(LAST_PREVIEW_INDEX);
- if (lastPreviewIndex != UNKNOWN_INDEX) {
- mPreviewController.setCurrentItem(lastPreviewIndex);
- }
- }
}
}
@@ -252,8 +244,6 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
if (mNeedResetSettings) {
outState.putBoolean(NEED_RESET_SETTINGS, true);
}
-
- outState.putInt(LAST_PREVIEW_INDEX, mPreviewController.getCurrentItem());
}
@Override
diff --git a/src/com/android/settings/accessibility/TextReadingPreviewPreference.java b/src/com/android/settings/accessibility/TextReadingPreviewPreference.java
index a9e2dce4241..9161171914a 100644
--- a/src/com/android/settings/accessibility/TextReadingPreviewPreference.java
+++ b/src/com/android/settings/accessibility/TextReadingPreviewPreference.java
@@ -17,6 +17,8 @@
package com.android.settings.accessibility;
import android.content.Context;
+import android.os.Bundle;
+import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@@ -36,6 +38,7 @@ import com.android.settings.widget.DotsPageIndicator;
* A {@link Preference} that could show the preview related to the text and reading options.
*/
public class TextReadingPreviewPreference extends Preference {
+ private static final String KEY_LAST_INDEX = "last_preview_index";
private int mCurrentItem;
private int mLastLayerIndex;
private PreviewPagerAdapter mPreviewAdapter;
@@ -98,6 +101,22 @@ public class TextReadingPreviewPreference extends Preference {
updatePagerAndIndicator(viewPager, pageIndicator);
}
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ Bundle state = new Bundle();
+ state.putParcelable(null, super.onSaveInstanceState());
+ state.putInt(KEY_LAST_INDEX, getCurrentItem());
+ return state;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ Bundle bundle = (Bundle) state;
+ super.onRestoreInstanceState(bundle.getParcelable(null));
+ setCurrentItem(bundle.getInt(KEY_LAST_INDEX));
+ }
+
+
/**
* Set the minimum preview layout horizontal inner padding.
*/
diff --git a/src/com/android/settings/applications/manageapplications/ResetAppPrefPreferenceController.java b/src/com/android/settings/applications/manageapplications/ResetAppPrefPreferenceController.java
index 6ef45935d4a..e7bf62f1a6e 100644
--- a/src/com/android/settings/applications/manageapplications/ResetAppPrefPreferenceController.java
+++ b/src/com/android/settings/applications/manageapplications/ResetAppPrefPreferenceController.java
@@ -18,9 +18,11 @@ package com.android.settings.applications.manageapplications;
import android.content.Context;
import android.os.Bundle;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -70,4 +72,19 @@ public class ResetAppPrefPreferenceController extends AbstractPreferenceControll
public void onSaveInstanceState(Bundle outState) {
mResetAppsHelper.onSaveInstanceState(outState);
}
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ Preference preference = screen.findPreference(getPreferenceKey());
+ if (preference != null) {
+ preference.setEnabled(!isInCallState());
+ }
+ }
+
+ boolean isInCallState() {
+ TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+ return telephonyManager.getCallState(telephonyManager.getSubscriptionId())
+ != TelephonyManager.CALL_STATE_IDLE;
+ }
}
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index 1f7b3e512b2..77f11ff6f0f 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -37,6 +37,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
+import com.android.settings.flags.Flags;
import com.android.settings.password.ChooseLockGeneric;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.ConfirmDeviceCredentialActivity;
@@ -551,8 +552,11 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
@NonNull
protected PorterDuffColorFilter getIconColorFilter() {
if (mIconColorFilter == null) {
+ final int colorType = Flags.biometricsOnboardingEducation()
+ ? DynamicColorPalette.ColorType.PRIMARY_TEXT
+ : DynamicColorPalette.ColorType.ACCENT;
mIconColorFilter = new PorterDuffColorFilter(
- DynamicColorPalette.getColor(this, DynamicColorPalette.ColorType.ACCENT),
+ DynamicColorPalette.getColor(this, colorType),
PorterDuff.Mode.SRC_IN);
}
return mIconColorFilter;
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index d3f75195305..78e3770810a 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -53,6 +53,7 @@ import com.android.settings.biometrics.BiometricEnrollActivity;
import com.android.settings.biometrics.BiometricEnrollIntroduction;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.biometrics.MultiBiometricEnrollHelper;
+import com.android.settings.flags.Flags;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.SetupSkipDialog;
import com.android.settings.utils.SensorPrivacyManagerHelper;
@@ -144,6 +145,19 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
final ImageView iconLooking = findViewById(R.id.icon_looking);
iconGlasses.getBackground().setColorFilter(getIconColorFilter());
iconLooking.getBackground().setColorFilter(getIconColorFilter());
+ if (Flags.biometricsOnboardingEducation()) {
+ final ImageView iconSecurityPrivacySafe = findViewById(R.id.icon_security_privacy_safe);
+ final ImageView iconPrivacyTip = findViewById(R.id.icon_privacy_tip);
+ final ImageView iconFamiliarFaceAndZone =
+ findViewById(R.id.icon_familiar_face_and_zone);
+ final ImageView iconTrashCan = findViewById(R.id.icon_trash_can);
+ final ImageView iconLink = findViewById(R.id.icon_link);
+ iconSecurityPrivacySafe.getBackground().setColorFilter(getIconColorFilter());
+ iconPrivacyTip.getBackground().setColorFilter(getIconColorFilter());
+ iconFamiliarFaceAndZone.getBackground().setColorFilter(getIconColorFilter());
+ iconTrashCan.getBackground().setColorFilter(getIconColorFilter());
+ iconLink.getBackground().setColorFilter(getIconColorFilter());
+ }
// Set text for views with multiple variations.
final TextView infoMessageGlasses = findViewById(R.id.info_message_glasses);
@@ -156,9 +170,19 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
infoMessageLooking.setText(getInfoMessageLooking());
inControlTitle.setText(getInControlTitle());
howMessage.setText(getHowMessage());
- inControlMessage.setText(Html.fromHtml(getString(getInControlMessage()),
- Html.FROM_HTML_MODE_LEGACY));
- inControlMessage.setMovementMethod(LinkMovementMethod.getInstance());
+ if (Flags.biometricsOnboardingEducation()) {
+ inControlMessage.setText(
+ R.string.security_settings_face_enroll_introduction_control_message_2);
+ final TextView learnMore = findViewById(R.id.message_learn_more);
+ learnMore.setText(Html.fromHtml(getString(
+ R.string.security_settings_face_enroll_introduction_learn_more_message),
+ Html.FROM_HTML_MODE_LEGACY));
+ learnMore.setMovementMethod(LinkMovementMethod.getInstance());
+ } else {
+ inControlMessage.setText(Html.fromHtml(getString(getInControlMessage()),
+ Html.FROM_HTML_MODE_LEGACY));
+ inControlMessage.setMovementMethod(LinkMovementMethod.getInstance());
+ }
lessSecure.setText(getLessSecureMessage());
final ScrollView scrollView =
@@ -411,7 +435,11 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
@Override
protected int getLayoutResource() {
- return R.layout.face_enroll_introduction;
+ if (Flags.biometricsOnboardingEducation()) {
+ return R.layout.face_enroll_introduction_2;
+ } else {
+ return R.layout.face_enroll_introduction;
+ }
}
@Override
@@ -594,8 +622,13 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
setDescriptionText(getString(
R.string.private_space_face_enroll_introduction_message));
} else if (mIsFaceStrong) {
- setDescriptionText(getString(
- R.string.security_settings_face_enroll_introduction_message_class3));
+ final int messageRes;
+ if (Flags.biometricsOnboardingEducation()) {
+ messageRes = R.string.security_settings_face_enroll_introduction_message_class3_2;
+ } else {
+ messageRes = R.string.security_settings_face_enroll_introduction_message_class3;
+ }
+ setDescriptionText(getString(messageRes));
}
super.updateDescriptionText();
}
diff --git a/src/com/android/settings/dashboard/profileselector/UserAdapter.java b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
index 54887d7b732..b9f585faf2f 100644
--- a/src/com/android/settings/dashboard/profileselector/UserAdapter.java
+++ b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
@@ -39,7 +39,6 @@ import android.widget.TextView;
import com.android.internal.util.UserIcons;
import com.android.internal.widget.RecyclerView;
import com.android.settings.R;
-import com.android.settingslib.Utils;
import java.util.ArrayList;
import java.util.List;
@@ -62,8 +61,8 @@ public class UserAdapter extends BaseAdapter {
mUserHandle = userHandle;
mUserManager = um;
UserInfo userInfo = um.getUserInfo(mUserHandle.getIdentifier());
- int tintColor = Utils.getColorAttrDefaultColor(context,
- com.android.internal.R.attr.materialColorPrimary);
+ int tintColor = context.getColor(com.android.internal.R.color.materialColorPrimary);
+
if (userInfo.isManagedProfile()
|| (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
diff --git a/src/com/android/settings/datausage/DataSaverMainSwitchPreference.kt b/src/com/android/settings/datausage/DataSaverMainSwitchPreference.kt
index e4e38d42530..23cfadce3d0 100644
--- a/src/com/android/settings/datausage/DataSaverMainSwitchPreference.kt
+++ b/src/com/android/settings/datausage/DataSaverMainSwitchPreference.kt
@@ -19,18 +19,14 @@ package com.android.settings.datausage
import android.content.Context
import com.android.settings.R
import com.android.settings.widget.MainSwitchBarMetadata
+import com.android.settingslib.datastore.AbstractKeyedDataObservable
+import com.android.settingslib.datastore.DataChangeReason
import com.android.settingslib.datastore.KeyValueStore
-import com.android.settingslib.datastore.NoOpKeyedObservable
-import com.android.settingslib.metadata.PreferenceLifecycleContext
import com.android.settingslib.metadata.PreferenceLifecycleProvider
import com.android.settingslib.metadata.ReadWritePermit
import com.android.settingslib.metadata.SensitivityLevel
-class DataSaverMainSwitchPreference(context: Context) :
- MainSwitchBarMetadata, PreferenceLifecycleProvider {
-
- private val dataSaverBackend = DataSaverBackend(context)
- private var dataSaverBackendListener: DataSaverBackend.Listener? = null
+class DataSaverMainSwitchPreference : MainSwitchBarMetadata, PreferenceLifecycleProvider {
override val key
get() = KEY
@@ -38,7 +34,7 @@ class DataSaverMainSwitchPreference(context: Context) :
override val title
get() = R.string.data_saver_switch_title
- override fun storage(context: Context): KeyValueStore = DataSaverStore(dataSaverBackend)
+ override fun storage(context: Context) = createDataStore(context)
override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) =
ReadWritePermit.ALLOW
@@ -49,24 +45,11 @@ class DataSaverMainSwitchPreference(context: Context) :
override val sensitivityLevel
get() = SensitivityLevel.NO_SENSITIVITY
- override fun onStart(context: PreferenceLifecycleContext) {
- val listener = DataSaverBackend.Listener { context.notifyPreferenceChange(KEY) }
- dataSaverBackendListener = listener
- dataSaverBackend.addListener(listener)
- }
-
- override fun onStop(context: PreferenceLifecycleContext) {
- dataSaverBackendListener?.let {
- dataSaverBackend.remListener(it)
- dataSaverBackendListener = null
- }
- }
-
@Suppress("UNCHECKED_CAST")
private class DataSaverStore(private val dataSaverBackend: DataSaverBackend) :
- NoOpKeyedObservable(), KeyValueStore {
+ AbstractKeyedDataObservable(), KeyValueStore, DataSaverBackend.Listener {
- override fun contains(key: String) = true // just assume the datastore contains the value
+ override fun contains(key: String) = key == KEY
override fun getValue(key: String, valueType: Class): T? =
dataSaverBackend.isDataSaverEnabled as T?
@@ -74,9 +57,20 @@ class DataSaverMainSwitchPreference(context: Context) :
override fun setValue(key: String, valueType: Class, value: T?) {
dataSaverBackend.isDataSaverEnabled = value as Boolean
}
+
+ override fun onFirstObserverAdded() = dataSaverBackend.addListener(this)
+
+ override fun onLastObserverRemoved() = dataSaverBackend.remListener(this)
+
+ override fun onDataSaverChanged(isDataSaving: Boolean) =
+ notifyChange(KEY, DataChangeReason.UPDATE)
}
companion object {
const val KEY = "use_data_saver"
+
+ /** Creates [KeyValueStore] for data saver preference. */
+ fun createDataStore(context: Context): KeyValueStore =
+ DataSaverStore(DataSaverBackend(context))
}
}
diff --git a/src/com/android/settings/datausage/DataSaverScreen.kt b/src/com/android/settings/datausage/DataSaverScreen.kt
index 2e806432833..fd4441fbbe2 100644
--- a/src/com/android/settings/datausage/DataSaverScreen.kt
+++ b/src/com/android/settings/datausage/DataSaverScreen.kt
@@ -19,24 +19,30 @@ package com.android.settings.datausage
import android.content.Context
import android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID
import com.android.settings.R
+import com.android.settings.Settings.DataSaverSummaryActivity
import com.android.settings.flags.Flags
+import com.android.settings.utils.makeLaunchIntent
+import com.android.settingslib.datastore.HandlerExecutor
+import com.android.settingslib.datastore.KeyedObserver
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
import com.android.settingslib.metadata.PreferenceLifecycleContext
import com.android.settingslib.metadata.PreferenceLifecycleProvider
+import com.android.settingslib.metadata.PreferenceMetadata
import com.android.settingslib.metadata.PreferenceSummaryProvider
import com.android.settingslib.metadata.ProvidePreferenceScreen
import com.android.settingslib.metadata.preferenceHierarchy
import com.android.settingslib.preference.PreferenceScreenCreator
+import com.android.settings.datausage.DataSaverMainSwitchPreference.Companion.KEY as DATA_SAVER_KEY
@ProvidePreferenceScreen
-class DataSaverScreen :
+class DataSaverScreen(context: Context) :
PreferenceScreenCreator,
PreferenceAvailabilityProvider,
PreferenceSummaryProvider,
PreferenceLifecycleProvider {
- private var dataSaverBackend: DataSaverBackend? = null
- private var dataSaverBackendListener: DataSaverBackend.Listener? = null
+ private val dataSaverStore = DataSaverMainSwitchPreference.createDataStore(context)
+ private lateinit var keyedObserver: KeyedObserver
override val key
get() = KEY
@@ -53,7 +59,7 @@ class DataSaverScreen :
override fun getSummary(context: Context): CharSequence? =
when {
- DataSaverBackend(context).isDataSaverEnabled ->
+ dataSaverStore.getBoolean(DATA_SAVER_KEY) == true ->
context.getString(R.string.data_saver_on)
else -> context.getString(R.string.data_saver_off)
}
@@ -65,21 +71,21 @@ class DataSaverScreen :
override fun fragmentClass() = DataSaverSummary::class.java
+ override fun getLaunchIntent(context: Context, metadata: PreferenceMetadata?) =
+ makeLaunchIntent(context, DataSaverSummaryActivity::class.java, metadata?.key)
+
override fun getPreferenceHierarchy(context: Context) =
- preferenceHierarchy(this) { +DataSaverMainSwitchPreference(context) }
+ preferenceHierarchy(this) { +DataSaverMainSwitchPreference() }
override fun hasCompleteHierarchy() = false
- override fun onStart(context: PreferenceLifecycleContext) {
- val listener = DataSaverBackend.Listener { context.notifyPreferenceChange(KEY) }
- dataSaverBackendListener = listener
- dataSaverBackend = DataSaverBackend(context).apply { addListener(listener) }
+ override fun onCreate(context: PreferenceLifecycleContext) {
+ keyedObserver = KeyedObserver { _, _ -> context.notifyPreferenceChange(KEY) }
+ dataSaverStore.addObserver(DATA_SAVER_KEY, keyedObserver, HandlerExecutor.main)
}
- override fun onStop(context: PreferenceLifecycleContext) {
- dataSaverBackend?.remListener(dataSaverBackendListener)
- dataSaverBackend = null
- dataSaverBackendListener = null
+ override fun onDestroy(context: PreferenceLifecycleContext) {
+ dataSaverStore.removeObserver(DATA_SAVER_KEY, keyedObserver)
}
companion object {
diff --git a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
index fd6d199a29d..aa963c96a9a 100644
--- a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
@@ -90,11 +90,6 @@ public class NightDisplayActivationPreferenceController extends
}
}
- @Override
- public final void updateState(Preference preference) {
- updateStateInternal();
- }
-
/** FOR SLICES */
@Override
@@ -112,14 +107,4 @@ public class NightDisplayActivationPreferenceController extends
return mTimeFormatter.getAutoModeSummary(mContext, mColorDisplayManager);
}
- private void updateStateInternal() {
- final boolean isActivated = mColorDisplayManager.isNightDisplayActivated();
- final int autoMode = mColorDisplayManager.getNightDisplayAutoMode();
-
- if (autoMode == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME) {
- mTimeFormatter.getFormattedTimeString(isActivated
- ? mColorDisplayManager.getNightDisplayCustomStartTime()
- : mColorDisplayManager.getNightDisplayCustomEndTime());
- }
- }
}
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
index 4acaeeaf5bb..88f99c3beaf 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
@@ -332,9 +332,8 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
setBackgroundColor(Color.TRANSPARENT);
mTrapezoidSolidColor = Utils.getColorAccentDefaultColor(context);
mTrapezoidColor = Utils.getDisabled(context, mTrapezoidSolidColor);
- mTrapezoidHoverColor =
- Utils.getColorAttrDefaultColor(
- context, com.android.internal.R.attr.materialColorSecondaryContainer);
+ mTrapezoidHoverColor = context.getColor(
+ com.android.internal.R.color.materialColorSecondaryContainer);
// Initializes the divider line paint.
final Resources resources = getContext().getResources();
mDividerWidth = resources.getDimensionPixelSize(R.dimen.chartview_divider_width);
diff --git a/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java b/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
index fa7b372d709..9683b8787b9 100644
--- a/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
+++ b/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
@@ -316,7 +316,6 @@ public class ModifierKeysPickerDialogFragment extends DialogFragment {
}
private int getColorOfMaterialColorPrimary() {
- return Utils.getColorAttrDefaultColor(
- mActivity, com.android.internal.R.attr.materialColorPrimary);
+ return mActivity.getColor(com.android.internal.R.color.materialColorPrimary);
}
}
diff --git a/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java b/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
index 5a5b69e4a16..58e49bf2cd5 100644
--- a/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
+++ b/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
@@ -36,7 +36,6 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.Utils;
import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
@@ -202,8 +201,7 @@ public class ModifierKeysPreferenceController extends BasePreferenceController {
}
private int getColorOfMaterialColorPrimary() {
- return Utils.getColorAttrDefaultColor(
- mContext, com.android.internal.R.attr.materialColorPrimary);
+ return mContext.getColor(com.android.internal.R.color.materialColorPrimary);
}
private static boolean isCtrl(int keyCode) {
diff --git a/src/com/android/settings/inputmethod/ModifierKeysRestorePreferenceController.java b/src/com/android/settings/inputmethod/ModifierKeysRestorePreferenceController.java
index 4bb106915d4..20defa9a0cc 100644
--- a/src/com/android/settings/inputmethod/ModifierKeysRestorePreferenceController.java
+++ b/src/com/android/settings/inputmethod/ModifierKeysRestorePreferenceController.java
@@ -28,7 +28,6 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.Utils;
public class ModifierKeysRestorePreferenceController extends BasePreferenceController {
@@ -88,7 +87,6 @@ public class ModifierKeysRestorePreferenceController extends BasePreferenceContr
}
private int getColorOfMaterialColorPrimary() {
- return Utils.getColorAttrDefaultColor(
- mParent.getActivity(), com.android.internal.R.attr.materialColorPrimary);
+ return mParent.getActivity().getColor(com.android.internal.R.color.materialColorPrimary);
}
}
diff --git a/src/com/android/settings/network/AirplaneModePreference.kt b/src/com/android/settings/network/AirplaneModePreference.kt
index 164e3a9b513..758bcfbe487 100644
--- a/src/com/android/settings/network/AirplaneModePreference.kt
+++ b/src/com/android/settings/network/AirplaneModePreference.kt
@@ -152,7 +152,7 @@ class AirplaneModePreference :
data: Intent?,
): Boolean {
if (requestCode == REQUEST_CODE_EXIT_ECM && resultCode == Activity.RESULT_OK) {
- storage(context).setValue(KEY, Boolean::class.javaObjectType, true)
+ context.getKeyValueStore(KEY)?.setBoolean(KEY, true)
}
return true
}
diff --git a/src/com/android/settings/network/tether/TetherScreen.kt b/src/com/android/settings/network/tether/TetherScreen.kt
index c666683a902..5865c861f58 100644
--- a/src/com/android/settings/network/tether/TetherScreen.kt
+++ b/src/com/android/settings/network/tether/TetherScreen.kt
@@ -20,19 +20,27 @@ import android.net.TetheringManager
import android.os.UserManager
import com.android.settings.PreferenceRestrictionMixin
import com.android.settings.R
+import com.android.settings.Settings.TetherSettingsActivity
+import com.android.settings.datausage.DataSaverMainSwitchPreference
import com.android.settings.flags.Flags
import com.android.settings.network.TetherPreferenceController
+import com.android.settings.utils.makeLaunchIntent
import com.android.settings.wifi.tether.WifiHotspotSwitchPreference
import com.android.settingslib.TetherUtil
import com.android.settingslib.Utils
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
+import com.android.settingslib.metadata.PreferenceMetadata
+import com.android.settingslib.metadata.PreferenceTitleProvider
import com.android.settingslib.metadata.ProvidePreferenceScreen
import com.android.settingslib.metadata.preferenceHierarchy
import com.android.settingslib.preference.PreferenceScreenCreator
@ProvidePreferenceScreen
class TetherScreen :
- PreferenceScreenCreator, PreferenceAvailabilityProvider, PreferenceRestrictionMixin {
+ PreferenceScreenCreator,
+ PreferenceTitleProvider,
+ PreferenceAvailabilityProvider,
+ PreferenceRestrictionMixin {
override val key: String
get() = KEY
@@ -43,7 +51,7 @@ class TetherScreen :
override val keywords: Int
get() = R.string.keywords_hotspot_tethering
- override fun getPreferenceTitle(context: Context): CharSequence? =
+ override fun getTitle(context: Context): CharSequence? =
if (TetherPreferenceController.isTetherConfigDisallowed(context)) {
context.getText(R.string.tether_settings_title_all)
} else {
@@ -64,9 +72,14 @@ class TetherScreen :
override fun fragmentClass() = TetherSettings::class.java
- override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {
- +WifiHotspotSwitchPreference(context)
- }
+ override fun getLaunchIntent(context: Context, metadata: PreferenceMetadata?) =
+ makeLaunchIntent(context, TetherSettingsActivity::class.java, metadata?.key)
+
+ override fun getPreferenceHierarchy(context: Context) =
+ preferenceHierarchy(this) {
+ val dataSaverStore = DataSaverMainSwitchPreference.createDataStore(context)
+ +WifiHotspotSwitchPreference(context, dataSaverStore)
+ }
companion object {
const val KEY = "tether_settings"
diff --git a/src/com/android/settings/notification/modes/IconUtil.java b/src/com/android/settings/notification/modes/IconUtil.java
index 23817cbd5db..b589a0bef8e 100644
--- a/src/com/android/settings/notification/modes/IconUtil.java
+++ b/src/com/android/settings/notification/modes/IconUtil.java
@@ -23,6 +23,7 @@ import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
@@ -36,6 +37,7 @@ import android.util.StateSet;
import android.view.Gravity;
import androidx.annotation.AttrRes;
+import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -81,21 +83,19 @@ class IconUtil {
Drawable base = composeIcons(
context.getResources(),
background,
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorSecondaryContainer),
outerSizePx,
modeIcon,
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorOnSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorOnSecondaryContainer),
innerSizePx);
Drawable selected = composeIcons(
context.getResources(),
background,
- Utils.getColorAttr(context, com.android.internal.R.attr.materialColorPrimary),
+ context.getColor(com.android.internal.R.color.materialColorPrimary),
outerSizePx,
modeIcon,
- Utils.getColorAttr(context, com.android.internal.R.attr.materialColorOnPrimary),
+ context.getColor(com.android.internal.R.color.materialColorOnPrimary),
innerSizePx);
StateListDrawable result = new StateListDrawable();
@@ -114,13 +114,11 @@ class IconUtil {
static Drawable makeIconPickerHeader(@NonNull Context context, Drawable icon) {
return composeIconCircle(
context.getResources(),
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorSecondaryContainer),
context.getResources().getDimensionPixelSize(
R.dimen.zen_mode_icon_list_header_circle_diameter),
icon,
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorOnSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorOnSecondaryContainer),
context.getResources().getDimensionPixelSize(
R.dimen.zen_mode_icon_list_header_icon_size));
}
@@ -151,13 +149,11 @@ class IconUtil {
@DrawableRes int iconResId) {
return composeIconCircle(
context.getResources(),
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorSecondaryContainer),
context.getResources().getDimensionPixelSize(
R.dimen.zen_mode_circular_icon_diameter),
checkNotNull(context.getDrawable(iconResId)),
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorOnSecondaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorOnSecondaryContainer),
context.getResources().getDimensionPixelSize(
R.dimen.zen_mode_circular_icon_inner_icon_size));
}
@@ -172,12 +168,10 @@ class IconUtil {
if (Strings.isNullOrEmpty(displayName)) {
return composeIconCircle(
context.getResources(),
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorTertiaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorTertiaryContainer),
res.getDimensionPixelSize(R.dimen.zen_mode_circular_icon_diameter),
checkNotNull(context.getDrawable(R.drawable.ic_zen_mode_generic_contact)),
- Utils.getColorAttr(context,
- com.android.internal.R.attr.materialColorOnTertiaryContainer),
+ context.getColor(com.android.internal.R.color.materialColorOnTertiaryContainer),
res.getDimensionPixelSize(R.dimen.zen_mode_circular_icon_inner_icon_size));
}
@@ -187,14 +181,14 @@ class IconUtil {
Canvas canvas = new Canvas(bitmap);
Paint circlePaint = new Paint();
- circlePaint.setColor(Utils.getColorAttrDefaultColor(context,
- com.android.internal.R.attr.materialColorTertiaryContainer));
+ circlePaint.setColor(context.getColor(
+ com.android.internal.R.color.materialColorTertiaryContainer));
circlePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
canvas.drawCircle(diameter / 2f, diameter / 2f, diameter / 2f, circlePaint);
Paint textPaint = new Paint();
- textPaint.setColor(Utils.getColorAttrDefaultColor(context,
- com.android.internal.R.attr.materialColorOnTertiaryContainer));
+ textPaint.setColor(context.getColor(
+ com.android.internal.R.color.materialColorOnTertiaryContainer));
textPaint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));
textPaint.setTextAlign(Paint.Align.LEFT);
textPaint.setTextSize(res.getDimensionPixelSize(R.dimen.zen_mode_circular_icon_text_size));
@@ -210,12 +204,24 @@ class IconUtil {
return new BitmapDrawable(context.getResources(), bitmap);
}
+ private static Drawable composeIconCircle(Resources res, @ColorInt int circleColor,
+ @Px int circleDiameterPx, Drawable icon, @ColorInt int iconColor, @Px int iconSizePx) {
+ return composeIconCircle(res, ColorStateList.valueOf(circleColor), circleDiameterPx, icon,
+ ColorStateList.valueOf(iconColor), iconSizePx);
+ }
+
private static Drawable composeIconCircle(Resources res, ColorStateList circleColor,
@Px int circleDiameterPx, Drawable icon, ColorStateList iconColor, @Px int iconSizePx) {
return composeIcons(res, new ShapeDrawable(new OvalShape()), circleColor, circleDiameterPx,
icon, iconColor, iconSizePx);
}
+ private static Drawable composeIcons(Resources res, Drawable outer, @ColorInt int outerColor,
+ @Px int outerSizePx, Drawable icon, @ColorInt int iconColor, @Px int iconSizePx) {
+ return composeIcons(res, outer, ColorStateList.valueOf(outerColor), outerSizePx, icon,
+ ColorStateList.valueOf(iconColor), iconSizePx);
+ }
+
private static Drawable composeIcons(Resources res, Drawable outer, ColorStateList outerColor,
@Px int outerSizePx, Drawable icon, ColorStateList iconColor, @Px int iconSizePx) {
Drawable background = mutateDrawable(res, outer);
diff --git a/src/com/android/settings/spa/preference/ComposePreference.kt b/src/com/android/settings/spa/preference/ComposePreference.kt
index 55a469c492f..91b2d8ac81a 100644
--- a/src/com/android/settings/spa/preference/ComposePreference.kt
+++ b/src/com/android/settings/spa/preference/ComposePreference.kt
@@ -26,6 +26,14 @@ import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import com.android.settings.R
import com.android.settingslib.spa.framework.theme.SettingsTheme
+import com.android.settingslib.widget.GroupSectionDividerMixin
+
+open class ComposeMainSwitchPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0,
+ defStyleRes: Int = 0,
+) : ComposePreference(context, attrs, defStyleAttr, defStyleRes), GroupSectionDividerMixin
open class ComposePreference @JvmOverloads constructor(
context: Context,
diff --git a/src/com/android/settings/widget/LabeledSeekBarPreference.java b/src/com/android/settings/widget/LabeledSeekBarPreference.java
index 6300bd3b318..88ffa6b8f68 100644
--- a/src/com/android/settings/widget/LabeledSeekBarPreference.java
+++ b/src/com/android/settings/widget/LabeledSeekBarPreference.java
@@ -56,10 +56,10 @@ public class LabeledSeekBarPreference extends SeekBarPreference {
private final int mTextStartId;
private final int mTextEndId;
private final int mTickMarkId;
- private final int mIconStartId;
- private final int mIconEndId;
- private final int mIconStartContentDescriptionId;
- private final int mIconEndContentDescriptionId;
+ private int mIconStartId;
+ private int mIconEndId;
+ private int mIconStartContentDescriptionId;
+ private int mIconEndContentDescriptionId;
private OnPreferenceChangeListener mStopListener;
private SeekBar.OnSeekBarChangeListener mSeekBarChangeListener;
@@ -110,6 +110,38 @@ public class LabeledSeekBarPreference extends SeekBarPreference {
return mSeekBar;
}
+ /** Set the start icon of the Seekbar. */
+ public void setIconStart(int iconStartId) {
+ if (mIconStartId != iconStartId) {
+ mIconStartId = iconStartId;
+ notifyChanged();
+ }
+ }
+
+ /** Set the description resource id of the start icon. */
+ public void setIconStartContentDescription(int iconStartContentDescriptionId) {
+ if (mIconStartContentDescriptionId != iconStartContentDescriptionId) {
+ mIconStartContentDescriptionId = iconStartContentDescriptionId;
+ notifyChanged();
+ }
+ }
+
+ /** Set the end icon of the Seekbar. */
+ public void setIconEnd(int iconEndId) {
+ if (mIconEndId != iconEndId) {
+ mIconEndId = iconEndId;
+ notifyChanged();
+ }
+ }
+
+ /** Set the description resource id of the end icon. */
+ public void setIconEndContentDescription(int iconEndContentDescriptionId) {
+ if (mIconEndContentDescriptionId != iconEndContentDescriptionId) {
+ mIconEndContentDescriptionId = iconEndContentDescriptionId;
+ notifyChanged();
+ }
+ }
+
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
diff --git a/src/com/android/settings/wifi/details2/WifiPrivacyPageProvider.kt b/src/com/android/settings/wifi/details2/WifiPrivacyPageProvider.kt
index 8888f0dacf5..94a1168dbb7 100644
--- a/src/com/android/settings/wifi/details2/WifiPrivacyPageProvider.kt
+++ b/src/com/android/settings/wifi/details2/WifiPrivacyPageProvider.kt
@@ -25,8 +25,6 @@ import android.os.Looper
import android.os.Process
import android.os.SimpleClock
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
@@ -34,7 +32,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
-import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.stringArrayResource
@@ -44,14 +41,13 @@ import androidx.navigation.navArgument
import com.android.settings.R
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
import com.android.settingslib.spa.framework.common.SettingsPageProvider
-import com.android.settingslib.spa.framework.theme.SettingsDimension
import com.android.settingslib.spa.widget.preference.ListPreferenceModel
import com.android.settingslib.spa.widget.preference.ListPreferenceOption
import com.android.settingslib.spa.widget.preference.RadioPreferences
import com.android.settingslib.spa.widget.preference.SwitchPreference
import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel
import com.android.settingslib.spa.widget.scaffold.RegularScaffold
-import com.android.settingslib.spa.widget.ui.CategoryTitle
+import com.android.settingslib.spa.widget.ui.Category
import com.android.wifitrackerlib.WifiEntry
import java.time.Clock
import java.time.ZoneOffset
@@ -123,34 +119,34 @@ fun WifiPrivacyPage(wifiEntry: WifiEntry) {
@Composable
fun DeviceNameSwitchPreference(wifiEntry: WifiEntry) {
- Spacer(modifier = Modifier.width(SettingsDimension.itemDividerHeight))
- CategoryTitle(title = stringResource(R.string.wifi_privacy_device_name_settings))
- Spacer(modifier = Modifier.width(SettingsDimension.itemDividerHeight))
- var checked by remember {
- mutableStateOf(wifiEntry.wifiConfiguration?.isSendDhcpHostnameEnabled)
- }
- val context = LocalContext.current
- val wifiManager = context.getSystemService(WifiManager::class.java)!!
- SwitchPreference(object : SwitchPreferenceModel {
- override val title =
- context.resources.getString(
- R.string.wifi_privacy_send_device_name_toggle_title
- )
- override val summary =
- {
- context.resources.getString(
- R.string.wifi_privacy_send_device_name_toggle_summary
- )
- }
- override val checked = { checked }
- override val onCheckedChange: (Boolean) -> Unit = { newChecked ->
- wifiEntry.wifiConfiguration?.let {
- it.isSendDhcpHostnameEnabled = newChecked
- wifiManager.save(it, null /* listener */)
- checked = newChecked
- }
+ val title = stringResource(id = R.string.wifi_privacy_device_name_settings)
+ Category(title = title) {
+ var checked by remember {
+ mutableStateOf(wifiEntry.wifiConfiguration?.isSendDhcpHostnameEnabled)
}
- })
+ val context = LocalContext.current
+ val wifiManager = context.getSystemService(WifiManager::class.java)!!
+ SwitchPreference(object : SwitchPreferenceModel {
+ override val title =
+ context.resources.getString(
+ R.string.wifi_privacy_send_device_name_toggle_title
+ )
+ override val summary =
+ {
+ context.resources.getString(
+ R.string.wifi_privacy_send_device_name_toggle_summary
+ )
+ }
+ override val checked = { checked }
+ override val onCheckedChange: (Boolean) -> Unit = { newChecked ->
+ wifiEntry.wifiConfiguration?.let {
+ it.isSendDhcpHostnameEnabled = newChecked
+ wifiManager.save(it, null /* listener */)
+ checked = newChecked
+ }
+ }
+ })
+ }
}
fun onSelectedChange(wifiEntry: WifiEntry, privacy: Int) {
diff --git a/src/com/android/settings/wifi/tether/WifiHotspotSwitchPreference.kt b/src/com/android/settings/wifi/tether/WifiHotspotSwitchPreference.kt
index 4866d19ab17..c185e02c949 100644
--- a/src/com/android/settings/wifi/tether/WifiHotspotSwitchPreference.kt
+++ b/src/com/android/settings/wifi/tether/WifiHotspotSwitchPreference.kt
@@ -20,6 +20,7 @@ import android.app.settings.SettingsEnums
import android.content.Context
import android.content.Intent
import android.net.TetheringManager
+import android.net.TetheringManager.TETHERING_WIFI
import android.net.wifi.WifiClient
import android.net.wifi.WifiManager
import android.os.UserManager
@@ -30,7 +31,7 @@ import com.android.settings.PreferenceRestrictionMixin
import com.android.settings.R
import com.android.settings.Utils
import com.android.settings.core.SubSettingLauncher
-import com.android.settings.datausage.DataSaverBackend
+import com.android.settings.datausage.DataSaverMainSwitchPreference.Companion.KEY as DATA_SAVER_KEY
import com.android.settings.wifi.WifiUtils.canShowWifiHotspot
import com.android.settingslib.PrimarySwitchPreference
import com.android.settingslib.TetherUtil
@@ -38,9 +39,8 @@ import com.android.settingslib.datastore.AbstractKeyedDataObservable
import com.android.settingslib.datastore.DataChangeReason
import com.android.settingslib.datastore.HandlerExecutor
import com.android.settingslib.datastore.KeyValueStore
+import com.android.settingslib.datastore.KeyedObserver
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
-import com.android.settingslib.metadata.PreferenceLifecycleContext
-import com.android.settingslib.metadata.PreferenceLifecycleProvider
import com.android.settingslib.metadata.PreferenceMetadata
import com.android.settingslib.metadata.PreferenceSummaryProvider
import com.android.settingslib.metadata.ReadWritePermit
@@ -50,20 +50,15 @@ import com.android.settingslib.preference.PreferenceBinding
import com.android.settingslib.wifi.WifiUtils.Companion.getWifiTetherSummaryForConnectedDevices
// LINT.IfChange
-@Deprecated("Deprecated in Java")
@Suppress("MissingPermission", "NewApi", "UNCHECKED_CAST")
-class WifiHotspotSwitchPreference(context: Context) :
+class WifiHotspotSwitchPreference(context: Context, dataSaverStore: KeyValueStore) :
SwitchPreference(KEY, R.string.wifi_hotspot_checkbox_text),
PreferenceBinding,
PreferenceAvailabilityProvider,
PreferenceSummaryProvider,
- PreferenceLifecycleProvider,
PreferenceRestrictionMixin {
- private val wifiHotspotStore = WifiHotspotStore(context)
-
- private val dataSaverBackend = DataSaverBackend(context)
- private var dataSaverBackendListener: DataSaverBackend.Listener? = null
+ private val wifiHotspotStore = WifiHotspotStore(context, dataSaverStore)
override fun isAvailable(context: Context) =
canShowWifiHotspot(context) &&
@@ -71,22 +66,19 @@ class WifiHotspotSwitchPreference(context: Context) :
!Utils.isMonkeyRunning()
override fun getSummary(context: Context): CharSequence? =
- when (wifiHotspotStore.sapState) {
+ when (context.wifiManager?.wifiApState) {
WifiManager.WIFI_AP_STATE_ENABLING -> context.getString(R.string.wifi_tether_starting)
- WifiManager.WIFI_AP_STATE_ENABLED ->
- when (wifiHotspotStore.sapClientsSize) {
- null ->
- context.getString(
- R.string.wifi_tether_enabled_subtext,
- BidiFormatter.getInstance()
- .unicodeWrap(context.getSoftApConfiguration()?.ssid),
- )
- else ->
- getWifiTetherSummaryForConnectedDevices(
- context,
- wifiHotspotStore.sapClientsSize!!,
- )
+ WifiManager.WIFI_AP_STATE_ENABLED -> {
+ val sapClientsSize = wifiHotspotStore.sapClientsSize
+ if (sapClientsSize == null) {
+ context.getString(
+ R.string.wifi_tether_enabled_subtext,
+ BidiFormatter.getInstance().unicodeWrap(context.wifiSsid),
+ )
+ } else {
+ getWifiTetherSummaryForConnectedDevices(context, sapClientsSize)
}
+ }
WifiManager.WIFI_AP_STATE_DISABLING -> context.getString(R.string.wifi_tether_stopping)
WifiManager.WIFI_AP_STATE_DISABLED ->
context.getString(R.string.wifi_hotspot_off_subtext)
@@ -108,7 +100,8 @@ class WifiHotspotSwitchPreference(context: Context) :
.toIntent()
override fun isEnabled(context: Context) =
- !dataSaverBackend.isDataSaverEnabled && super.isEnabled(context)
+ wifiHotspotStore.dataSaverStore.getBoolean(DATA_SAVER_KEY) == true &&
+ super.isEnabled(context)
override val restrictionKeys
get() = arrayOf(UserManager.DISALLOW_WIFI_TETHERING)
@@ -117,10 +110,7 @@ class WifiHotspotSwitchPreference(context: Context) :
ReadWritePermit.ALLOW
override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) =
- when {
- dataSaverBackend.isDataSaverEnabled -> ReadWritePermit.DISALLOW
- else -> ReadWritePermit.ALLOW
- }
+ ReadWritePermit.ALLOW
override val sensitivityLevel
get() = SensitivityLevel.HIGH_SENSITIVITY
@@ -129,11 +119,17 @@ class WifiHotspotSwitchPreference(context: Context) :
override fun storage(context: Context): KeyValueStore = wifiHotspotStore
- private class WifiHotspotStore(private val context: Context) :
- AbstractKeyedDataObservable(), KeyValueStore {
+ private class WifiHotspotStore(
+ private val context: Context,
+ val dataSaverStore: KeyValueStore,
+ ) :
+ AbstractKeyedDataObservable(),
+ KeyValueStore,
+ WifiTetherSoftApManager.WifiTetherSoftApCallback,
+ TetheringManager.StartTetheringCallback,
+ KeyedObserver {
private var wifiTetherSoftApManager: WifiTetherSoftApManager? = null
- var sapState: Int = WifiManager.WIFI_AP_STATE_DISABLED
var sapFailureReason: Int? = null
var sapClientsSize: Int? = null
@@ -150,54 +146,47 @@ class WifiHotspotSwitchPreference(context: Context) :
override fun setValue(key: String, valueType: Class, value: T?) {
if (value !is Boolean) return
- context.tetheringManager?.let {
- if (value) {
- val startTetheringCallback =
- object : TetheringManager.StartTetheringCallback {
- override fun onTetheringStarted() {
- Log.d(TAG, "onTetheringStarted()")
- }
-
- override fun onTetheringFailed(error: Int) {
- Log.e(TAG, "onTetheringFailed(),error=$error")
- }
- }
- it.startTethering(
- TetheringManager.TETHERING_WIFI,
- HandlerExecutor.main,
- startTetheringCallback,
- )
- } else {
- it.stopTethering(TetheringManager.TETHERING_WIFI)
- }
+ val tetheringManager = context.tetheringManager ?: return
+ if (value) {
+ tetheringManager.startTethering(TETHERING_WIFI, HandlerExecutor.main, this)
+ } else {
+ tetheringManager.stopTethering(TETHERING_WIFI)
}
}
override fun onFirstObserverAdded() {
- val wifiSoftApCallback =
- object : WifiTetherSoftApManager.WifiTetherSoftApCallback {
- override fun onStateChanged(state: Int, failureReason: Int) {
- Log.d(TAG, "onStateChanged(),state=$state,failureReason=$failureReason")
- sapState = state
- sapFailureReason = failureReason
- if (state == WifiManager.WIFI_AP_STATE_DISABLED) sapClientsSize = null
- notifyChange(KEY, DataChangeReason.UPDATE)
- }
-
- override fun onConnectedClientsChanged(clients: List?) {
- sapClientsSize = clients?.size ?: 0
- Log.d(TAG, "onConnectedClientsChanged(),sapClientsSize=$sapClientsSize")
- notifyChange(KEY, DataChangeReason.UPDATE)
- }
- }
- wifiTetherSoftApManager =
- WifiTetherSoftApManager(context.wifiManager, wifiSoftApCallback)
- wifiTetherSoftApManager?.registerSoftApCallback()
+ val apManager = WifiTetherSoftApManager(context.wifiManager, this)
+ wifiTetherSoftApManager = apManager
+ apManager.registerSoftApCallback()
+ dataSaverStore.addObserver(DATA_SAVER_KEY, this, HandlerExecutor.main)
}
override fun onLastObserverRemoved() {
+ dataSaverStore.removeObserver(DATA_SAVER_KEY, this)
wifiTetherSoftApManager?.unRegisterSoftApCallback()
}
+
+ override fun onStateChanged(state: Int, failureReason: Int) {
+ Log.d(TAG, "onStateChanged(),state=$state,failureReason=$failureReason")
+ sapFailureReason = failureReason
+ if (state == WifiManager.WIFI_AP_STATE_DISABLED) sapClientsSize = null
+ notifyChange(KEY, DataChangeReason.UPDATE)
+ }
+
+ override fun onConnectedClientsChanged(clients: List?) {
+ sapClientsSize = clients?.size ?: 0
+ Log.d(TAG, "onConnectedClientsChanged(),sapClientsSize=$sapClientsSize")
+ notifyChange(KEY, DataChangeReason.UPDATE)
+ }
+
+ override fun onTetheringStarted() {}
+
+ override fun onTetheringFailed(error: Int) {
+ Log.e(TAG, "onTetheringFailed(),error=$error")
+ }
+
+ override fun onKeyChanged(key: String, reason: Int) =
+ notifyChange(KEY, DataChangeReason.UPDATE)
}
override fun bind(preference: Preference, metadata: PreferenceMetadata) {
@@ -207,24 +196,6 @@ class WifiHotspotSwitchPreference(context: Context) :
}
}
- override fun onStart(context: PreferenceLifecycleContext) {
- val listener =
- DataSaverBackend.Listener { isDataSaving: Boolean ->
- context.findPreference(KEY)?.isSwitchEnabled =
- !isDataSaving
- context.notifyPreferenceChange(KEY)
- }
- dataSaverBackendListener = listener
- dataSaverBackend.addListener(listener)
- }
-
- override fun onStop(context: PreferenceLifecycleContext) {
- dataSaverBackendListener?.let {
- dataSaverBackend.remListener(it)
- dataSaverBackendListener = null
- }
- }
-
companion object {
const val TAG = "WifiHotspotSwitchPreference"
const val KEY = "wifi_tether"
@@ -232,7 +203,9 @@ class WifiHotspotSwitchPreference(context: Context) :
private val Context.wifiManager: WifiManager?
get() = applicationContext.getSystemService(WifiManager::class.java)
- private fun Context.getSoftApConfiguration() = wifiManager?.softApConfiguration
+ @Suppress("DEPRECATION")
+ private val Context.wifiSsid
+ get() = wifiManager?.softApConfiguration?.ssid
private val Context.tetheringManager: TetheringManager?
get() = applicationContext.getSystemService(TetheringManager::class.java)
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceTest.kt b/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceTest.kt
index fd781bc33d5..17ba358aad9 100644
--- a/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceTest.kt
@@ -72,6 +72,6 @@ class VibrationMainSwitchPreferenceTest {
preference.createAndBindWidget(context)
private fun setVibrateOn(enabled: Boolean?) =
- preference.storage(context).setValue(VIBRATE_ON, Boolean::class.javaObjectType, enabled)
+ preference.storage(context).setBoolean(VIBRATE_ON, enabled)
}
// LINT.ThenChange(VibrationMainSwitchPreferenceControllerTest.java)
diff --git a/tests/robotests/src/com/android/settings/biometrics/face/FaceEnrollIntroductionTest.java b/tests/robotests/src/com/android/settings/biometrics/face/FaceEnrollIntroductionTest.java
index 81a72694592..3bfe8197b1f 100644
--- a/tests/robotests/src/com/android/settings/biometrics/face/FaceEnrollIntroductionTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/face/FaceEnrollIntroductionTest.java
@@ -64,6 +64,7 @@ import com.android.settings.R;
import com.android.settings.Settings;
import com.android.settings.biometrics.BiometricEnrollBase;
import com.android.settings.biometrics.BiometricUtils;
+import com.android.settings.flags.Flags;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.SettingsShadowResources;
@@ -402,7 +403,9 @@ public class FaceEnrollIntroductionTest {
assertThat(getGlifLayout(mActivity).getDescriptionText().toString()).isEqualTo(
mContext.getString(
- R.string.security_settings_face_enroll_introduction_message_class3));
+ Flags.biometricsOnboardingEducation()
+ ? R.string.security_settings_face_enroll_introduction_message_class3_2
+ : R.string.security_settings_face_enroll_introduction_message_class3));
assertThat(mActivity.findViewById(R.id.info_row_less_secure).getVisibility()).isEqualTo(
View.GONE);
}
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/BluetoothMainSwitchPreferenceTest.kt b/tests/robotests/src/com/android/settings/connecteddevice/BluetoothMainSwitchPreferenceTest.kt
index 03039ac8b4c..15db130795d 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/BluetoothMainSwitchPreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/connecteddevice/BluetoothMainSwitchPreferenceTest.kt
@@ -29,21 +29,17 @@ import org.junit.runner.RunWith
import org.mockito.kotlin.spy
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
-import org.robolectric.RuntimeEnvironment
@RunWith(AndroidJUnit4::class)
class BluetoothMainSwitchPreferenceTest {
- @get:Rule
- val setFlagsRule = SetFlagsRule()
+ @get:Rule val setFlagsRule = SetFlagsRule()
private val context: Context = ApplicationProvider.getApplicationContext()
private lateinit var bluetoothAdapter: BluetoothAdapter
private lateinit var bluetoothMainSwitchPreference: BluetoothMainSwitchPreference
@Before
fun setUp() {
- bluetoothAdapter = spy(
- BluetoothAdapter.getDefaultAdapter()
- )
+ bluetoothAdapter = spy(BluetoothAdapter.getDefaultAdapter())
whenever(bluetoothAdapter.state).thenReturn(BluetoothAdapter.STATE_ON)
bluetoothMainSwitchPreference = BluetoothMainSwitchPreference(bluetoothAdapter)
}
@@ -62,19 +58,19 @@ class BluetoothMainSwitchPreferenceTest {
@Test
fun storageSetOff_turnOff() {
- bluetoothMainSwitchPreference.storage(context).setValue(
- bluetoothMainSwitchPreference.key, Boolean::class.javaObjectType, false
- )
+ bluetoothMainSwitchPreference
+ .storage(context)
+ .setBoolean(bluetoothMainSwitchPreference.key, false)
verify(bluetoothAdapter).disable()
}
@Test
fun storageSetOn_turnOn() {
- bluetoothMainSwitchPreference.storage(context).setValue(
- bluetoothMainSwitchPreference.key, Boolean::class.javaObjectType, true
- )
+ bluetoothMainSwitchPreference
+ .storage(context)
+ .setBoolean(bluetoothMainSwitchPreference.key, true)
verify(bluetoothAdapter).enable()
}
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/datausage/DataSaverScreenTest.kt b/tests/robotests/src/com/android/settings/datausage/DataSaverScreenTest.kt
index 08af4c0e862..24e8213e566 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataSaverScreenTest.kt
+++ b/tests/robotests/src/com/android/settings/datausage/DataSaverScreenTest.kt
@@ -16,13 +16,16 @@
package com.android.settings.datausage
+import androidx.test.core.app.ApplicationProvider
import com.android.settings.flags.Flags
import com.android.settingslib.preference.CatalystScreenTestCase
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class DataSaverScreenTest : CatalystScreenTestCase() {
- override val preferenceScreenCreator = DataSaverScreen()
+ override val preferenceScreenCreator =
+ DataSaverScreen(ApplicationProvider.getApplicationContext())
+
override val flagName
get() = Flags.FLAG_CATALYST_RESTRICT_BACKGROUND_PARENT_ENTRY
diff --git a/tests/robotests/src/com/android/settings/display/BatteryPercentageSwitchPreferenceTest.kt b/tests/robotests/src/com/android/settings/display/BatteryPercentageSwitchPreferenceTest.kt
index f96b30f1cba..2a9a129f44b 100644
--- a/tests/robotests/src/com/android/settings/display/BatteryPercentageSwitchPreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/display/BatteryPercentageSwitchPreferenceTest.kt
@@ -117,11 +117,8 @@ class BatteryPercentageSwitchPreferenceTest {
batteryPercentageSwitchPreference.createAndBindWidget(context)
private fun showBatteryPercentage(on: Boolean) =
- batteryPercentageSwitchPreference
- .storage(context)
- .setValue(
+ batteryPercentageSwitchPreference.storage(context).setBoolean(
Settings.System.SHOW_BATTERY_PERCENT,
- Boolean::class.javaObjectType,
on,
)
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverPreferenceTest.kt b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverPreferenceTest.kt
index 052ba757dea..ef190a7cc9c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverPreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverPreferenceTest.kt
@@ -75,18 +75,14 @@ class BatterySaverPreferenceTest {
@Test
fun storeSetOn_setPowerSaveMode() {
- batterySaverPreference
- .storage(context)
- .setValue(batterySaverPreference.key, Boolean::class.javaObjectType, true)
+ batterySaverPreference.storage(context).setBoolean(batterySaverPreference.key, true)
verify(powerManager).setPowerSaveModeEnabled(true)
}
@Test
fun storeSetOff_unsetPowerSaveMode() {
- batterySaverPreference
- .storage(context)
- .setValue(batterySaverPreference.key, Boolean::class.javaObjectType, false)
+ batterySaverPreference.storage(context).setBoolean(batterySaverPreference.key, false)
verify(powerManager).setPowerSaveModeEnabled(false)
}
diff --git a/tests/robotests/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceTest.kt b/tests/robotests/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceTest.kt
index c0ad07eec3b..a06a1fe70d0 100644
--- a/tests/robotests/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceTest.kt
@@ -96,11 +96,11 @@ class AdaptiveConnectivityTogglePreferenceTest {
private fun setAdaptiveConnectivityEnabled(enabled: Boolean) =
adaptiveConnectivityTogglePreference
.storage(context)
- .setValue(ADAPTIVE_CONNECTIVITY_ENABLED, Boolean::class.javaObjectType, enabled)
+ .setBoolean(ADAPTIVE_CONNECTIVITY_ENABLED, enabled)
private fun getAdaptiveConnectivityEnabled() =
adaptiveConnectivityTogglePreference
.storage(context)
- .getValue(ADAPTIVE_CONNECTIVITY_ENABLED, Boolean::class.javaObjectType)
+ .getBoolean(ADAPTIVE_CONNECTIVITY_ENABLED)
}
// LINT.ThenChange(AdaptiveConnectivityTogglePreferenceControllerTest.java)
diff --git a/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceTest.kt b/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceTest.kt
index 640ded90132..a0f380fa5ec 100644
--- a/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceTest.kt
+++ b/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceTest.kt
@@ -88,9 +88,7 @@ class AirplaneModePreferenceTest {
SettingsGlobalStore.get(context).setInt(Settings.Global.AIRPLANE_MODE_ON, 1)
val getValue =
- airplaneModePreference
- .storage(context)
- .getValue(AirplaneModePreference.KEY, Boolean::class.javaObjectType)
+ airplaneModePreference.storage(context).getBoolean(AirplaneModePreference.KEY)
assertThat(getValue).isTrue()
}
@@ -100,9 +98,7 @@ class AirplaneModePreferenceTest {
SettingsGlobalStore.get(context).setInt(Settings.Global.AIRPLANE_MODE_ON, 0)
val getValue =
- airplaneModePreference
- .storage(context)
- .getValue(AirplaneModePreference.KEY, Boolean::class.javaObjectType)
+ airplaneModePreference.storage(context).getBoolean(AirplaneModePreference.KEY)
assertThat(getValue).isFalse()
}
diff --git a/tests/unit/src/com/android/settings/wifi/WifiSwitchPreferenceTest.kt b/tests/unit/src/com/android/settings/wifi/WifiSwitchPreferenceTest.kt
index 49d36a9020a..41de0901bd5 100644
--- a/tests/unit/src/com/android/settings/wifi/WifiSwitchPreferenceTest.kt
+++ b/tests/unit/src/com/android/settings/wifi/WifiSwitchPreferenceTest.kt
@@ -49,9 +49,7 @@ class WifiSwitchPreferenceTest {
fun getValue_defaultOn_returnOn() {
mockWifiManager.stub { on { isWifiEnabled } doReturn true }
- val getValue = wifiSwitchPreference
- .storage(context)
- .getValue(WifiSwitchPreference.KEY, Boolean::class.javaObjectType)
+ val getValue = wifiSwitchPreference.storage(context).getBoolean(WifiSwitchPreference.KEY)
assertThat(getValue).isTrue()
}
@@ -60,9 +58,7 @@ class WifiSwitchPreferenceTest {
fun getValue_defaultOff_returnOff() {
mockWifiManager.stub { on { isWifiEnabled } doReturn false }
- val getValue = wifiSwitchPreference
- .storage(context)
- .getValue(WifiSwitchPreference.KEY, Boolean::class.javaObjectType)
+ val getValue = wifiSwitchPreference.storage(context).getBoolean(WifiSwitchPreference.KEY)
assertThat(getValue).isFalse()
}
@@ -87,4 +83,4 @@ class WifiSwitchPreferenceTest {
private fun getSwitchPreference(): SwitchPreferenceCompat =
wifiSwitchPreference.createAndBindWidget(context)
-}
\ No newline at end of file
+}