Merge "Tweak UI of profile tab layout" into sc-dev
diff --git a/res/drawable/ic_lock_pin.xml b/res/drawable/ic_lock_pin.xml
index e1821f6..587f49c 100644
--- a/res/drawable/ic_lock_pin.xml
+++ b/res/drawable/ic_lock_pin.xml
@@ -21,5 +21,5 @@
android:viewportHeight="24">
<path
android:pathData="M6,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM16,6c0,1.1 0.9,2 2,2s2,-0.9 2,-2 -0.9,-2 -2,-2 -2,0.9 -2,2zM12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z"
- android:fillColor="?attr/sudListItemIconColor"/>
+ android:fillColor="?android:attr/colorAccent"/>
</vector>
diff --git a/res/layout/face_enroll_accessibility_toggle.xml b/res/layout/face_enroll_accessibility_toggle.xml
index bb3a7ff..a56655d 100644
--- a/res/layout/face_enroll_accessibility_toggle.xml
+++ b/res/layout/face_enroll_accessibility_toggle.xml
@@ -30,15 +30,18 @@
<!-- Title -->
<com.google.android.setupdesign.view.RichTextView
- style="@style/SudDescription.Glif"
android:id="@+id/title"
android:paddingHorizontal="8dp"
android:paddingTop="8dp"
+ android:paddingBottom="4dp"
android:gravity="start"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/toggle"
android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="@dimen/sud_description_text_size"
+ />
<!-- Subtitle -->
<TextView
@@ -50,7 +53,8 @@
android:layout_below="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"/>
+ android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"
+ android:textColor="?android:attr/textColorSecondary"/>
<!-- Vertical divider -->
<View
diff --git a/res/layout/face_enroll_education.xml b/res/layout/face_enroll_education.xml
index 53a584e..f98380d 100644
--- a/res/layout/face_enroll_education.xml
+++ b/res/layout/face_enroll_education.xml
@@ -21,7 +21,8 @@
style="?attr/face_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ app:sucHeaderText="@string/security_settings_face_enroll_education_title">
<LinearLayout
style="@style/SudContentFrame"
@@ -38,7 +39,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="-32dp">
+ android:layout_marginTop="-24dp">
<com.google.android.setupdesign.view.IllustrationVideoView
android:id="@+id/illustration_default"
@@ -97,7 +98,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
- app:messageText="@string/security_settings_face_enroll_introduction_accessibility_diversity"/>
+ app:messageText="@string/security_settings_face_enroll_introduction_accessibility"/>
</FrameLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c19c8dc..8bc44be 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1088,77 +1088,77 @@
<!-- Content of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=NONE] -->
<string name="setup_fingerprint_enroll_enrolling_skip_message">You\u2019ve chosen to use your fingerprint as one way to unlock your phone. If you skip now, you\u2019ll need to set this up later. Setup takes only a minute or so.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="tablet">A PIN protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="tablet">A PIN protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="tablet">A pattern protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="tablet">A pattern protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="tablet">A password protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="tablet">A password protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="device">A PIN protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="device">A PIN protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="device">A pattern protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="device">A pattern protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="device">A password protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="device">A password protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="default">A PIN protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="default">A PIN protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="default">A pattern protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="default">A pattern protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="default">A password protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="default">A password protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="tablet">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="tablet">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="tablet">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="tablet">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="tablet">A password is required to set up Fingerprint Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="tablet">A password is required to set up Fingerprint Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="device">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="device">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="device">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="device">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="device">A password is required to set up Fingerprint Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="device">A password is required to set up Fingerprint Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="default">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="default">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="default">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="default">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="default">A password is required to set up Fingerprint Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="default">A password is required to set up Fingerprint Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="tablet">A PIN is required to set up Face Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="tablet">A PIN is required to set up Face Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="tablet">A pattern is required to set up Face Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="tablet">A pattern is required to set up Face Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="tablet">A password is required to set up Face Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="tablet">A password is required to set up Face Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="device">A PIN is required to set up Face Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="device">A PIN is required to set up Face Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="device">A pattern is required to set up Face Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="device">A pattern is required to set up Face Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="device">A password is required to set up Face Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="device">A password is required to set up Face Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="default">A PIN is required to set up Face Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="default">A PIN is required to set up Face Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="default">A pattern is required to set up Face Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="default">A pattern is required to set up Face Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="default">A password is required to set up Face Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="default">A password is required to set up Face Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="tablet">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="tablet">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="tablet">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="tablet">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="tablet">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="tablet">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="device">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="device">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="device">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="device">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="device">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="device">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="default">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="default">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="default">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="default">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="default">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="default">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
<string name="lock_screen_pin_skip_title">Skip PIN setup?</string>
<!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=90]-->
@@ -5403,8 +5403,8 @@
<string name="accessibility_button_intro">Using the accessibility button. The gesture isn\u2019t available with 3-button navigation.</string>
<!-- Summary text for the accessibility button preference. [CHAR LIMIT=50] -->
<string name="accessibility_button_summary">Quickly access accessibility features</string>
- <!-- Description for the accessibility button & gesture page. Explain how this page works. [CHAR LIMIT=NONE] -->
- <string name="accessibility_button_gesture_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button or gesture.</string>
+ <!-- Description for the accessibility button in gesture navigation. Explain how this page works. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_button_gesture_description">Quickly access accessibility features from any screen.\n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button.\n\nTo use the accessibility button in the navigation bar instead, switch to 2-button navigation or 3-button navigation.</string>
<!-- Description for the accessibility button page. Explain how this page works. [CHAR LIMIT=NONE] -->
<string name="accessibility_button_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button.</string>
<!-- Title for the button or gesture of the accessibility button. [CHAR LIMIT=35] -->
@@ -8204,7 +8204,7 @@
<string name="keywords_wifi_calling">wifi, wi-fi, call, calling</string>
<string name="keywords_display">screen, touchscreen</string>
<string name="keywords_display_brightness_level">dim screen, touchscreen, battery, bright</string>
- <string name="keywords_display_night_display">dim screen, night, tint, night shift, brightness, screen color, colour, color, light sensitivity, photophobia, make darker, darken, dark mode, migraine</string>
+ <string name="keywords_display_night_display">dim screen, night, tint, night shift, brightness, screen color, colour, color</string>
<string name="keywords_display_wallpaper">background, personalize, customize display</string>
<string name="keywords_display_font_size">text size</string>
<!-- Search keyword for "Cast" settings [CHAR_LIMIT=NONE]-->
@@ -8252,7 +8252,7 @@
<string name="keywords_model_and_hardware">serial number, hardware version</string>
<string name="keywords_android_version">android security patch level, baseband version, kernel version</string>
<!-- Search keywords for dark mode settings [CHAR LIMIT=NONE] -->
- <string name="keywords_dark_ui_mode">theme, light, dark, mode</string>
+ <string name="keywords_dark_ui_mode">theme, light, dark, mode, light sensitivity, photophobia, make darker, darken, dark mode, migraine</string>
<!-- Search keyword for Device Theme Settings [CHAR LIMIT=NONE] -->
<string name="keywords_systemui_theme">dark theme</string>
@@ -12353,6 +12353,15 @@
<!-- Title for preference showing the name of the device. [CHAR LIMIT=60]-->
<string name="my_device_info_device_name_preference_title">Device name</string>
+ <!-- Title for preference category showing the name of basic info. [CHAR LIMIT=60]-->
+ <string name="my_device_info_basic_info_category_title">Basic info</string>
+ <!-- Title for preference category showing the name of legal & regulatory. [CHAR LIMIT=60]-->
+ <string name="my_device_info_legal_category_title">Legal & regulatory</string>
+ <!-- Title for preference category showing the name of device details. [CHAR LIMIT=60]-->
+ <string name="my_device_info_device_details_category_title">Device details</string>
+ <!-- Title for preference category showing the name of device identifiers. [CHAR LIMIT=60]-->
+ <string name="my_device_info_device_identifiers_category_title">Device identifiers</string>
+
<!-- Title for Wifi Access settings [CHAR LIMIT=35] -->
<string name="change_wifi_state_title">Wi-Fi control</string>
diff --git a/res/xml/accessibility_button_settings.xml b/res/xml/accessibility_button_settings.xml
index 02b1c7d..78d13ab 100644
--- a/res/xml/accessibility_button_settings.xml
+++ b/res/xml/accessibility_button_settings.xml
@@ -61,7 +61,6 @@
<com.android.settings.accessibility.AccessibilityFooterPreference
android:key="accessibility_button_footer"
- android:title="@string/accessibility_button_description"
android:persistent="false"
android:selectable="false"
settings:searchable="false"
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 5077f77..a415abf 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -28,173 +28,185 @@
android:selectable="false"
settings:isPreferenceVisible="false"/>
- <!-- Device name -->
- <com.android.settings.widget.ValidatedEditTextPreference
- android:key="device_name"
- android:order="1"
- android:title="@string/my_device_info_device_name_preference_title"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.deviceinfo.DeviceNamePreferenceController"
- settings:enableCopying="true"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_basic_info_category_title">
- <!-- Account name -->
- <Preference
- android:key="branded_account"
- android:order="2"
- android:title="@string/my_device_info_account_preference_title"
- android:summary="@string/summary_placeholder"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
+ <!-- Device name -->
+ <com.android.settings.widget.ValidatedEditTextPreference
+ android:key="device_name"
+ android:order="1"
+ android:title="@string/my_device_info_device_name_preference_title"
+ android:summary="@string/summary_placeholder"
+ settings:controller="com.android.settings.deviceinfo.DeviceNamePreferenceController"
+ settings:enableCopying="true"/>
- <!-- Phone number -->
- <Preference
- android:key="phone_number"
- android:order="3"
- android:title="@string/status_number"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:controller="com.android.settings.deviceinfo.PhoneNumberPreferenceController"
- settings:enableCopying="true"/>
+ <!-- Account name -->
+ <Preference
+ android:key="branded_account"
+ android:order="2"
+ android:title="@string/my_device_info_account_preference_title"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
- <!-- Legal information -->
- <Preference
- android:key="legal_container"
- android:order="15"
- android:title="@string/legal_information"
- android:fragment="com.android.settings.LegalSettings"
- settings:allowDividerAbove="true"/>
+ <!-- Phone number -->
+ <Preference
+ android:key="phone_number"
+ android:order="3"
+ android:title="@string/status_number"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:controller="com.android.settings.deviceinfo.PhoneNumberPreferenceController"
+ settings:enableCopying="true"/>
+ </PreferenceCategory>
- <!-- Regulatory labels -->
- <Preference
- android:key="regulatory_info"
- android:order="16"
- android:title="@string/regulatory_labels">
- <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
- </Preference>
+ <PreferenceCategory
+ android:title="@string/my_device_info_legal_category_title">
- <!-- Safety & regulatory manual -->
- <Preference
- android:key="safety_info"
- android:order="17"
- android:title="@string/safety_and_regulatory_info">
- <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO"/>
- </Preference>
+ <!-- Legal information -->
+ <Preference
+ android:key="legal_container"
+ android:order="15"
+ android:title="@string/legal_information"
+ android:fragment="com.android.settings.LegalSettings"/>
- <!-- SIM status -->
- <Preference
- android:key="sim_status"
- android:order="18"
- android:title="@string/sim_status_title"
- settings:keywords="@string/keywords_sim_status"
- android:summary="@string/summary_placeholder"
- settings:enableCopying="true"
- settings:allowDividerAbove="true"/>
+ <!-- Regulatory labels -->
+ <Preference
+ android:key="regulatory_info"
+ android:order="16"
+ android:title="@string/regulatory_labels">
+ <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
+ </Preference>
- <!-- Model & hardware -->
- <Preference
- android:key="device_model"
- android:order="31"
- android:title="@string/model_info"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.deviceinfo.hardwareinfo.HardwareInfoFragment"
- settings:enableCopying="true"
- settings:keywords="@string/keywords_model_and_hardware"
- settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
+ <!-- Safety & regulatory manual -->
+ <Preference
+ android:key="safety_info"
+ android:order="17"
+ android:title="@string/safety_and_regulatory_info">
+ <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO"/>
+ </Preference>
+ </PreferenceCategory>
- <!-- IMEI -->
- <Preference
- android:key="imei_info"
- android:order="32"
- android:title="@string/status_imei"
- android:summary="@string/summary_placeholder"
- settings:keywords="@string/keywords_imei_info"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_device_details_category_title">
- <!-- Android version -->
- <Preference
- android:key="firmware_version"
- android:order="42"
- android:title="@string/firmware_version"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings"
- settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
+ <!-- SIM status -->
+ <Preference
+ android:key="sim_status"
+ android:order="18"
+ android:title="@string/sim_status_title"
+ settings:keywords="@string/keywords_sim_status"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"/>
- <!--IP address -->
- <Preference
- android:key="wifi_ip_address"
- android:order="44"
- android:title="@string/wifi_ip_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:allowDividerAbove="true"
- settings:enableCopying="true"/>
+ <!-- Model & hardware -->
+ <Preference
+ android:key="device_model"
+ android:order="31"
+ android:title="@string/model_info"
+ android:summary="@string/summary_placeholder"
+ android:fragment="com.android.settings.deviceinfo.hardwareinfo.HardwareInfoFragment"
+ settings:enableCopying="true"
+ settings:keywords="@string/keywords_model_and_hardware"
+ settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
- <!-- Wi-Fi MAC address -->
- <Preference
- android:key="saved_accesspoints_wifi_mac_address"
- android:order="45"
- android:title="@string/status_wifi_mac_address"
- android:summary="@string/view_saved_network"
- android:fragment="com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2"
- settings:enableCopying="false"/>
+ <!-- IMEI -->
+ <Preference
+ android:key="imei_info"
+ android:order="32"
+ android:title="@string/status_imei"
+ android:summary="@string/summary_placeholder"
+ settings:keywords="@string/keywords_imei_info"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController"/>
- <!-- Factory Wi-Fi MAC address -->
- <Preference
- android:key="wifi_mac_address"
- android:order="46"
- android:title="@string/status_device_wifi_mac_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:enableCopying="true"/>
+ <!-- Android version -->
+ <Preference
+ android:key="firmware_version"
+ android:order="42"
+ android:title="@string/firmware_version"
+ android:summary="@string/summary_placeholder"
+ android:fragment="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings"
+ settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
+ </PreferenceCategory>
- <!-- Bluetooth address -->
- <Preference
- android:key="bt_address"
- android:order="47"
- android:title="@string/status_bt_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:enableCopying="true"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_device_identifiers_category_title">
- <!-- Device up time -->
- <Preference
- android:key="up_time"
- android:order="48"
- android:title="@string/status_up_time"
- android:summary="@string/summary_placeholder"
- android:selectable="false"/>
+ <!--IP address -->
+ <Preference
+ android:key="wifi_ip_address"
+ android:order="44"
+ android:title="@string/wifi_ip_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Manual -->
- <Preference
- android:key="manual"
- android:order="50"
- android:title="@string/manual">
- <intent android:action="android.settings.SHOW_MANUAL"/>
- </Preference>
+ <!-- Wi-Fi MAC address -->
+ <Preference
+ android:key="saved_accesspoints_wifi_mac_address"
+ android:order="45"
+ android:title="@string/status_wifi_mac_address"
+ android:summary="@string/view_saved_network"
+ android:fragment="com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2"
+ settings:enableCopying="false"/>
- <!-- Feedback on the device -->
- <Preference
- android:key="device_feedback"
- android:order="51"
- android:title="@string/device_feedback"
- settings:keywords="@string/keywords_device_feedback"/>
+ <!-- Factory Wi-Fi MAC address -->
+ <Preference
+ android:key="wifi_mac_address"
+ android:order="46"
+ android:title="@string/status_device_wifi_mac_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Device FCC equipment id -->
- <Preference
- android:key="fcc_equipment_id"
- android:order="52"
- android:title="@string/fcc_equipment_id"
- android:summary="@string/summary_placeholder"/>
+ <!-- Bluetooth address -->
+ <Preference
+ android:key="bt_address"
+ android:order="47"
+ android:title="@string/status_bt_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Build number -->
- <Preference
- android:key="build_number"
- android:order="53"
- android:title="@string/build_number"
- android:summary="@string/summary_placeholder"
- settings:allowDividerAbove="true"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.BuildNumberPreferenceController"/>
+ <!-- Device up time -->
+ <Preference
+ android:key="up_time"
+ android:order="48"
+ android:title="@string/status_up_time"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"/>
+
+ <!-- Manual -->
+ <Preference
+ android:key="manual"
+ android:order="50"
+ android:title="@string/manual">
+ <intent android:action="android.settings.SHOW_MANUAL"/>
+ </Preference>
+
+ <!-- Feedback on the device -->
+ <Preference
+ android:key="device_feedback"
+ android:order="51"
+ android:title="@string/device_feedback"
+ settings:keywords="@string/keywords_device_feedback"/>
+
+ <!-- Device FCC equipment id -->
+ <Preference
+ android:key="fcc_equipment_id"
+ android:order="52"
+ android:title="@string/fcc_equipment_id"
+ android:summary="@string/summary_placeholder"/>
+
+ <!-- Build number -->
+ <Preference
+ android:key="build_number"
+ android:order="53"
+ android:title="@string/build_number"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.BuildNumberPreferenceController"/>
+ </PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index 82cb860..0e802f6 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -46,6 +46,12 @@
android:summary="@string/owner_info_settings_summary" />
<SwitchPreference
+ android:key="security_setting_lockdown_enabled"
+ android:title="@string/lockdown_settings_title"
+ android:summary="@string/lockdown_settings_summary"
+ settings:controller="com.android.settings.security.LockdownButtonPreferenceController" />
+
+ <SwitchPreference
android:key="lockscreen_privacy_wallet_switch"
android:title="@string/lockscreen_privacy_wallet_setting_toggle"
android:summary="@string/lockscreen_privacy_wallet_summary"
diff --git a/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
index 744a292..8b4a364 100644
--- a/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
@@ -34,4 +34,11 @@
protected String getLabelName() {
return mContext.getString(R.string.accessibility_button_title);
}
+
+ @Override
+ public CharSequence getSummary() {
+ return AccessibilityUtil.isGestureNavigateEnabled(mContext)
+ ? mContext.getString(R.string.accessibility_button_gesture_description)
+ : mContext.getString(R.string.accessibility_button_description);
+ }
}
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index d095e37..91eeace 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -368,7 +368,12 @@
}
ActivityManager am = (ActivityManager)
getActivity().getSystemService(Context.ACTIVITY_SERVICE);
- boolean res = am.clearApplicationUserData(packageName, mClearDataObserver);
+ boolean res = false;
+ try {
+ res = am.clearApplicationUserData(packageName, mClearDataObserver);
+ } catch (SecurityException e) {
+ Log.i(TAG, "Failed to clear application user data: " + e);
+ }
if (!res) {
// Clearing data failed for some obscure reason. Just log error for now
Log.i(TAG, "Couldn't clear application user data for package:" + packageName);
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 8e2d3f4..65ab2e7 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -16,20 +16,17 @@
package com.android.settings.biometrics.face;
-import android.annotation.StringRes;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Intent;
import android.hardware.face.FaceManager;
import android.os.Bundle;
-import android.os.Handler;
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.CompoundButton;
-import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -41,14 +38,10 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
-import com.google.android.setupdesign.GlifLayout;
import com.google.android.setupdesign.view.IllustrationVideoView;
public class FaceEnrollEducation extends BiometricEnrollBase {
-
private static final String TAG = "FaceEducation";
- private static final int ON = 1;
- private static final int OFF = 0;
private FaceManager mFaceManager;
private FaceEnrollAccessibilityToggle mSwitchDiversity;
@@ -57,28 +50,18 @@
private IllustrationVideoView mIllustrationDefault;
private LottieAnimationView mIllustrationLottie;
private View mIllustrationAccessibility;
- private Handler mHandler;
private Intent mResultIntent;
- private TextView mDescriptionText;
private boolean mNextClicked;
private boolean mAccessibilityEnabled;
- private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
+ private final CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- final int headerRes;
- final int descriptionRes;
- if (isChecked) {
- headerRes = R.string
- .security_settings_face_enroll_education_title_accessibility;
- descriptionRes = R.string
- .security_settings_face_enroll_education_message_accessibility;
- } else {
- headerRes = R.string.security_settings_face_enroll_education_title;
- descriptionRes = R.string.security_settings_face_enroll_education_message;
- }
- updateHeaders(headerRes, descriptionRes);
+ final int descriptionRes = isChecked
+ ? R.string.security_settings_face_enroll_education_message_accessibility
+ : R.string.security_settings_face_enroll_education_message;
+ setDescriptionText(descriptionRes);
if (isChecked) {
hideDefaultIllustration();
@@ -95,18 +78,14 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.face_enroll_education);
- final int headerRes = R.string.security_settings_face_enroll_education_title;
- final int descriptionRes = R.string.security_settings_face_enroll_education_message;
- updateHeaders(headerRes, descriptionRes);
-
- mHandler = new Handler();
+ setTitle(R.string.security_settings_face_enroll_education_title);
+ setDescriptionText(R.string.security_settings_face_enroll_education_message);
mFaceManager = Utils.getFaceManagerOrNull(this);
mIllustrationDefault = findViewById(R.id.illustration_default);
mIllustrationLottie = findViewById(R.id.illustration_lottie);
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
- mDescriptionText = findViewById(R.id.sud_layout_description);
mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
if (mIsUsingLottie) {
@@ -259,15 +238,6 @@
return SettingsEnums.FACE_ENROLL_INTRO;
}
- private void updateHeaders(@StringRes int headerRes, @StringRes int descriptionRes) {
- final CharSequence headerText = getText(headerRes);
- setTitle(headerText);
-
- final GlifLayout layout = getLayout();
- layout.setHeaderText(headerText);
- layout.setDescriptionText(descriptionRes);
- }
-
private void hideDefaultIllustration() {
if (mIsUsingLottie) {
mIllustrationLottie.cancelAnimation();
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index 1e25179..95f74fa 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -38,7 +38,6 @@
import android.telephony.CellBroadcastService;
import android.telephony.CellSignalStrength;
import android.telephony.ICellBroadcastService;
-import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
@@ -245,6 +244,8 @@
private void updateSubscriptionStatus() {
updateNetworkProvider();
+ // getServiceState() may return null when the subscription is inactive
+ // or when there was an error communicating with the phone process.
final ServiceState serviceState = mTelephonyManager.getServiceState();
final SignalStrength signalStrength = mTelephonyManager.getSignalStrength();
@@ -577,7 +578,10 @@
}
private void updateRoamingStatus(ServiceState serviceState) {
- if (serviceState.getRoaming()) {
+ // If the serviceState is null, we assume that roaming is disabled.
+ if (serviceState == null) {
+ mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_unknown));
+ } else if (serviceState.getRoaming()) {
mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_roaming_in));
} else {
mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_roaming_not));
diff --git a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
index 35f9c72..b21c6ac 100644
--- a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
+++ b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
@@ -139,13 +139,17 @@
}
public static int isControllerAvailable(Context context) {
- return context.getResources().getBoolean(
- com.android.internal.R.bool.config_adaptive_sleep_available)
- && isAttentionServiceAvailable(context)
+ return isAdaptiveSleepSupported(context)
? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}
+ static boolean isAdaptiveSleepSupported(Context context) {
+ return context.getResources().getBoolean(
+ com.android.internal.R.bool.config_adaptive_sleep_available)
+ && isAttentionServiceAvailable(context);
+ }
+
private static boolean isAttentionServiceAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
final String resolvePackage = packageManager.getAttentionServicePackageName();
diff --git a/src/com/android/settings/display/ScreenTimeoutSettings.java b/src/com/android/settings/display/ScreenTimeoutSettings.java
index 66f5ed3..18d1049 100644
--- a/src/com/android/settings/display/ScreenTimeoutSettings.java
+++ b/src/com/android/settings/display/ScreenTimeoutSettings.java
@@ -314,8 +314,7 @@
}
private static boolean isScreenAttentionAvailable(Context context) {
- return context.getResources().getBoolean(
- com.android.internal.R.bool.config_adaptive_sleep_available);
+ return AdaptiveSleepPreferenceController.isAdaptiveSleepSupported(context);
}
private static class TimeoutCandidateInfo extends CandidateInfo {
diff --git a/src/com/android/settings/network/AirplaneModePreferenceController.java b/src/com/android/settings/network/AirplaneModePreferenceController.java
index 122b975..6839037 100644
--- a/src/com/android/settings/network/AirplaneModePreferenceController.java
+++ b/src/com/android/settings/network/AirplaneModePreferenceController.java
@@ -35,11 +35,12 @@
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnDestroy;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
public class AirplaneModePreferenceController extends TogglePreferenceController
- implements LifecycleObserver, OnStart, OnStop,
+ implements LifecycleObserver, OnStart, OnStop, OnDestroy,
AirplaneModeEnabler.OnAirplaneModeChangedListener {
public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -133,6 +134,12 @@
}
}
+ @Override
+ public void onDestroy() {
+ mAirplaneModeEnabler.close();
+ }
+
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_EXIT_ECM) {
final boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
diff --git a/src/com/android/settings/network/InternetUpdater.java b/src/com/android/settings/network/InternetUpdater.java
index cb8d32c..3d97e95 100644
--- a/src/com/android/settings/network/InternetUpdater.java
+++ b/src/com/android/settings/network/InternetUpdater.java
@@ -33,6 +33,7 @@
import android.net.ConnectivityManager.NetworkCallback;
import android.net.Network;
import android.net.NetworkCapabilities;
+import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.util.Log;
@@ -249,6 +250,9 @@
@InternetType int internetType = INTERNET_NETWORKS_AVAILABLE;
if (mInternetAvailable) {
internetType = sTransportMap.get(mTransport);
+ if (internetType == INTERNET_WIFI && isCarrierWifiActive()) {
+ internetType = INTERNET_CELLULAR;
+ }
} else if (mAirplaneModeEnabler.isAirplaneModeOn()
&& mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
internetType = INTERNET_OFF;
@@ -260,6 +264,15 @@
}
}
+ protected boolean isCarrierWifiActive() {
+ final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
+ if (wifiInfo == null || !wifiInfo.isCarrierMerged()) {
+ return false;
+ }
+ Log.i(TAG, "Detect a merged carrier Wi-Fi connected.");
+ return true;
+ }
+
/**
* Get the internet type.
*/
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index 25cf4ce..88e732a 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -116,6 +116,7 @@
static final int MENU_ID_FORGET = Menu.FIRST + 3;
static final int MENU_ID_MODIFY = Menu.FIRST + 4;
static final int MENU_FIX_CONNECTIVITY = Menu.FIRST + 5;
+ static final int MENU_ID_SHARE = Menu.FIRST + 6;
@VisibleForTesting
static final int ADD_NETWORK_REQUEST = 2;
@@ -200,7 +201,7 @@
* ensure that behavior is consistent if {@link #isUiRestricted()} changes. It could be changed
* by the Test DPC tool in AFW mode.
*/
- private boolean mIsRestricted;
+ protected boolean mIsRestricted;
@VisibleForTesting
AirplaneModeEnabler mAirplaneModeEnabler;
@@ -218,7 +219,8 @@
PreferenceCategory mConnectedWifiEntryPreferenceCategory;
@VisibleForTesting
PreferenceCategory mFirstWifiEntryPreferenceCategory;
- private PreferenceCategory mWifiEntryPreferenceCategory;
+ @VisibleForTesting
+ PreferenceCategory mWifiEntryPreferenceCategory;
@VisibleForTesting
AddWifiNetworkPreference mAddWifiNetworkPreference;
private WifiSwitchPreferenceController mWifiSwitchPreferenceController;
@@ -459,6 +461,12 @@
}
@Override
+ public void onDestroy() {
+ mAirplaneModeEnabler.close();
+ super.onDestroy();
+ }
+
+ @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@@ -535,7 +543,8 @@
}
if (mSelectedWifiEntry.canDisconnect()) {
- menu.add(Menu.NONE, MENU_ID_DISCONNECT, 0 /* order */,
+ menu.add(Menu.NONE, MENU_ID_SHARE, 0 /* order */, R.string.share);
+ menu.add(Menu.NONE, MENU_ID_DISCONNECT, 1 /* order */,
R.string.wifi_disconnect_button_text);
}
@@ -574,6 +583,10 @@
case MENU_ID_FORGET:
forget(mSelectedWifiEntry);
return true;
+ case MENU_ID_SHARE:
+ WifiDppUtils.showLockScreen(getContext(),
+ () -> launchWifiDppConfiguratorActivity(mSelectedWifiEntry));
+ return true;
case MENU_ID_MODIFY:
showDialog(mSelectedWifiEntry, WifiConfigUiBase2.MODE_MODIFY);
return true;
@@ -608,6 +621,23 @@
return true;
}
+ private void launchWifiDppConfiguratorActivity(WifiEntry wifiEntry) {
+ final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(getContext(),
+ mWifiManager, wifiEntry);
+
+ if (intent == null) {
+ Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
+ } else {
+ mMetricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
+ SettingsEnums.ACTION_SETTINGS_SHARE_WIFI_QR_CODE,
+ SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR,
+ /* key */ null,
+ /* value */ Integer.MIN_VALUE);
+
+ startActivity(intent);
+ }
+ }
+
private void showDialog(WifiEntry wifiEntry, int dialogMode) {
if (WifiUtils.isNetworkLockedDown(getActivity(), wifiEntry.getWifiConfiguration())
&& wifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED) {
@@ -771,7 +801,11 @@
}
}
- private void updateWifiEntryPreferences() {
+ protected void updateWifiEntryPreferences() {
+ // bypass the update if the activity and the view are not ready, or it's restricted UI.
+ if (getActivity() == null || getView() == null || mIsRestricted) {
+ return;
+ }
// in case state has changed
if (mWifiPickerTracker.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
return;
diff --git a/src/com/android/settings/network/ProviderModelSlice.java b/src/com/android/settings/network/ProviderModelSlice.java
index aafe715..df705cd 100644
--- a/src/com/android/settings/network/ProviderModelSlice.java
+++ b/src/com/android/settings/network/ProviderModelSlice.java
@@ -16,10 +16,10 @@
package com.android.settings.network;
-
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
import static com.android.settings.slices.CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI;
+import static com.android.settings.slices.CustomSliceRegistry.WIFI_SLICE_URI;
import android.annotation.ColorInt;
import android.app.AlertDialog;
@@ -96,78 +96,77 @@
@Override
public Slice getSlice() {
// The provider model slice step:
- // First section: Add a Wi-Fi item which state is connected.
- // Second section: Add a carrier item.
- // Third section: Add the Wi-Fi items which are not connected.
- // Fourth section: If device has connection problem, this row show the message for user.
- @InternetUpdater.InternetType int internetType = getInternetType();
+ // First section: Add the Ethernet item.
+ // Second section: Add the carrier item.
+ // Third section: Add the Wi-Fi toggle item.
+ // Fourth section: Add the connected Wi-Fi item.
+ // Fifth section: Add the Wi-Fi items which are not connected.
+ // Sixth section: Add the See All item.
final ListBuilder listBuilder = mHelper.createListBuilder(getUri());
- if (mHelper.isAirplaneModeEnabled() && !mWifiManager.isWifiEnabled()
- && internetType != InternetUpdater.INTERNET_ETHERNET) {
- log("Airplane mode is enabled.");
- return listBuilder.build();
- }
-
int maxListSize = 0;
- List<WifiSliceItem> wifiList = null;
final NetworkProviderWorker worker = getWorker();
if (worker != null) {
- // get Wi-Fi list.
- wifiList = worker.getResults();
maxListSize = worker.getApRowCount();
} else {
log("network provider worker is null.");
}
- final boolean hasCarrier = mHelper.hasCarrier();
- log("hasCarrier: " + hasCarrier);
-
- // First section: Add a Ethernet or Wi-Fi item which state is connected.
- boolean isConnectedWifiAddedTop = false;
- final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
- if (internetType == InternetUpdater.INTERNET_ETHERNET) {
+ // First section: Add the Ethernet item.
+ if (getInternetType() == InternetUpdater.INTERNET_ETHERNET) {
log("get Ethernet item which is connected");
listBuilder.addRow(createEthernetRow());
maxListSize--;
- } else {
- if (connectedWifiItem != null && internetType == InternetUpdater.INTERNET_WIFI) {
- log("get Wi-Fi item which is connected to internet");
- listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
- isConnectedWifiAddedTop = true;
+ }
+
+ // Second section: Add the carrier item.
+ if (!mHelper.isAirplaneModeEnabled()) {
+ final boolean hasCarrier = mHelper.hasCarrier();
+ log("hasCarrier: " + hasCarrier);
+ if (hasCarrier) {
+ mHelper.updateTelephony();
+ listBuilder.addRow(
+ mHelper.createCarrierRow(
+ worker != null ? worker.getNetworkTypeDescription() : ""));
maxListSize--;
}
}
- // Second section: Add a carrier item.
- if (hasCarrier) {
- mHelper.updateTelephony();
- listBuilder.addRow(
- mHelper.createCarrierRow(
- worker != null ? worker.getNetworkTypeDescription() : ""));
- maxListSize--;
+ // Third section: Add the Wi-Fi toggle item.
+ final boolean isWifiEnabled = mWifiManager.isWifiEnabled();
+ listBuilder.addRow(createWifiToggleRow(mContext, isWifiEnabled));
+ maxListSize--;
+ if (!isWifiEnabled) {
+ log("Wi-Fi is disabled");
+ return listBuilder.build();
+ }
+ List<WifiSliceItem> wifiList = (worker != null) ? worker.getResults() : null;
+ if (wifiList == null || wifiList.size() <= 0) {
+ log("Wi-Fi list is empty");
+ return listBuilder.build();
}
- // Third section: Add the connected Wi-Fi item to Wi-Fi list if the Ethernet is connected.
- if (connectedWifiItem != null && !isConnectedWifiAddedTop) {
+ // Fourth section: Add the connected Wi-Fi item.
+ final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
+ if (connectedWifiItem != null) {
log("get Wi-Fi item which is connected");
listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
maxListSize--;
}
- // Fourth section: Add the Wi-Fi items which are not connected.
- if (wifiList != null && wifiList.size() > 0) {
- log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
-
- final List<WifiSliceItem> disconnectedWifiList = wifiList.stream()
- .filter(wifiSliceItem -> wifiSliceItem.getConnectedState()
- != WifiEntry.CONNECTED_STATE_CONNECTED)
- .limit(maxListSize - 1)
- .collect(Collectors.toList());
- for (WifiSliceItem item : disconnectedWifiList) {
- listBuilder.addRow(getWifiSliceItemRow(item));
- }
- listBuilder.addRow(getSeeAllRow());
+ // Fifth section: Add the Wi-Fi items which are not connected.
+ log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
+ final List<WifiSliceItem> disconnectedWifiList = wifiList.stream()
+ .filter(item -> item.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED)
+ .limit(maxListSize - 1)
+ .collect(Collectors.toList());
+ for (WifiSliceItem item : disconnectedWifiList) {
+ listBuilder.addRow(getWifiSliceItemRow(item));
}
+
+ // Sixth section: Add the See All item.
+ log("add See-All");
+ listBuilder.addRow(getSeeAllRow());
+
return listBuilder.build();
}
@@ -324,6 +323,26 @@
.setSubtitle(mContext.getText(R.string.to_switch_networks_disconnect_ethernet));
}
+ /**
+ * @return a {@link ListBuilder.RowBuilder} of the Wi-Fi toggle.
+ */
+ protected ListBuilder.RowBuilder createWifiToggleRow(Context context, boolean isWifiEnabled) {
+ final Intent intent = new Intent(WIFI_SLICE_URI.toString())
+ .setData(WIFI_SLICE_URI)
+ .setClass(context, SliceBroadcastReceiver.class)
+ .putExtra(EXTRA_TOGGLE_STATE, !isWifiEnabled)
+ // The FLAG_RECEIVER_FOREGROUND flag is necessary to avoid the intent delay of
+ // the first sending after the device restarts
+ .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent,
+ PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+ final SliceAction toggleSliceAction = SliceAction.createToggle(pendingIntent,
+ null /* actionTitle */, isWifiEnabled);
+ return new ListBuilder.RowBuilder()
+ .setTitle(context.getString(R.string.wifi_settings))
+ .setPrimaryAction(toggleSliceAction);
+ }
+
protected ListBuilder.RowBuilder getSeeAllRow() {
final CharSequence title = mContext.getText(R.string.previous_connected_see_all);
final IconCompat icon = getSeeAllIcon();
diff --git a/src/com/android/settings/network/telephony/NetworkProviderWorker.java b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
index 675d60f..a6b438a 100644
--- a/src/com/android/settings/network/telephony/NetworkProviderWorker.java
+++ b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
@@ -54,7 +54,7 @@
DataConnectivityListener.Client, InternetUpdater.InternetChangeListener,
SubscriptionsChangeListener.SubscriptionsChangeListenerClient {
private static final String TAG = "NetworkProviderWorker";
- private static final int PROVIDER_MODEL_DEFAULT_EXPANDED_ROW_COUNT = 5;
+ private static final int PROVIDER_MODEL_DEFAULT_EXPANDED_ROW_COUNT = 6;
private DataContentObserver mMobileDataObserver;
private SignalStrengthListener mSignalStrengthListener;
private SubscriptionsChangeListener mSubscriptionsListener;
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
index 53c0f20..ae6f2e0 100644
--- a/src/com/android/settings/panel/InternetConnectivityPanel.java
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -39,7 +39,6 @@
import android.util.Log;
import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
@@ -236,6 +235,11 @@
@Override
public Intent getSeeMoreIntent() {
+ // Disable the see more button for provider model design.
+ if (mIsProviderModelEnabled) {
+ return null;
+ }
+
// Don't remove the see more intent for non-provider model design. This intent will be
// used when isCustomizedButtonUsed() returns false.
return new Intent(Settings.ACTION_WIRELESS_SETTINGS)
@@ -243,23 +247,6 @@
}
@Override
- public boolean isCustomizedButtonUsed() {
- return mIsProviderModelEnabled;
- }
-
- @Override
- public CharSequence getCustomizedButtonTitle() {
- return mContext.getText(
- mInternetUpdater.isWifiEnabled() ? R.string.turn_off_wifi : R.string.turn_on_wifi);
- }
-
- @Override
- public void onClickCustomizedButton(FragmentActivity panelActivity) {
- // Don't finish the panel activity
- mWifiManager.setWifiEnabled(!mInternetUpdater.isWifiEnabled());
- }
-
- @Override
public boolean isProgressBarVisible() {
return mIsProgressBarVisible;
}
@@ -320,7 +307,6 @@
}
updateSubtitleText();
mCallback.onHeaderChanged();
- mCallback.onCustomizedButtonStateChanged();
}
@VisibleForTesting
diff --git a/src/com/android/settings/password/SetupChooseLockGeneric.java b/src/com/android/settings/password/SetupChooseLockGeneric.java
index 15a90e3..3261b81 100644
--- a/src/com/android/settings/password/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/password/SetupChooseLockGeneric.java
@@ -23,7 +23,6 @@
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
import android.os.Bundle;
import android.os.IBinder;
import android.os.UserHandle;
@@ -43,6 +42,7 @@
import com.android.settings.utils.SettingsDividerItemDecoration;
import com.google.android.setupdesign.GlifPreferenceLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
/**
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
@@ -67,13 +67,9 @@
}
@Override
- protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
- @Override
protected void onCreate(Bundle savedInstance) {
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstance);
if(getIntent().hasExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY)) {
@@ -92,6 +88,12 @@
findViewById(R.id.content_parent).setFitsSystemWindows(false);
}
+ @Override
+ protected boolean isToolbarEnabled() {
+ // Hide the action bar from this page.
+ return false;
+ }
+
public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment {
public static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
new file mode 100644
index 0000000..33c5762
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2021 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.accessibility;
+
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.res.Resources;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link AccessibilityButtonFooterPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class AccessibilityButtonFooterPreferenceControllerTest {
+
+ @Rule
+ public final MockitoRule mockito = MockitoJUnit.rule();
+
+ @Spy
+ private final Context mContext = ApplicationProvider.getApplicationContext();
+ @Spy
+ private final Resources mResources = mContext.getResources();
+ private AccessibilityButtonFooterPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mController = new AccessibilityButtonFooterPreferenceController(mContext,
+ "test_key");
+ when(mContext.getResources()).thenReturn(mResources);
+ }
+
+ @Test
+ public void getSummary_navigationGestureEnabled_shouldReturnButtonAndGestureSummary() {
+ when(mResources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode))
+ .thenReturn(NAV_BAR_MODE_GESTURAL);
+
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getText(R.string.accessibility_button_gesture_description));
+ }
+
+ @Test
+ public void getSummary_navigationGestureDisabled_shouldReturnButtonSummary() {
+ when(mResources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode))
+ .thenReturn(NAV_BAR_MODE_2BUTTON);
+
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getText(R.string.accessibility_button_description));
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
index 4bce0bb..c7e5b13 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
@@ -32,8 +32,7 @@
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri;
-import android.view.LayoutInflater;
-import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.preference.PreferenceViewHolder;
@@ -45,6 +44,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.robolectric.RobolectricTestRunner;
@@ -57,10 +57,12 @@
public class AnimatedImagePreferenceTest {
private final Context mContext = RuntimeEnvironment.application;
private Uri mImageUri;
- private View mRootView;
private PreferenceViewHolder mViewHolder;
private AnimatedImagePreference mAnimatedImagePreference;
+ @Mock
+ private ViewGroup mRootView;
+
@Spy
private ImageView mImageView;
@@ -68,9 +70,8 @@
public void init() {
MockitoAnnotations.initMocks(this);
- final LayoutInflater inflater = LayoutInflater.from(mContext);
- mRootView = spy(inflater.inflate(R.layout.preference_animated_image, /* root= */ null));
mViewHolder = spy(PreferenceViewHolder.createInstanceForTests(mRootView));
+ doReturn(new LottieAnimationView(mContext)).when(mRootView).findViewById(R.id.lottie_view);
mImageView = spy(new ImageView(mContext));
mAnimatedImagePreference = new AnimatedImagePreference(mContext);
diff --git a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
index abb616a..41e4429 100644
--- a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
@@ -22,16 +22,24 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
@@ -80,6 +88,9 @@
@Mock
Preference mDisableOptionsPreference;
+ @Mock
+ private PackageManager mPackageManager;
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -90,6 +101,15 @@
mContentResolver = mContext.getContentResolver();
mResources = spy(mContext.getResources());
+ doReturn(mPackageManager).when(mContext).getPackageManager();
+ when(mPackageManager.getAttentionServicePackageName()).thenReturn("some.package");
+ when(mPackageManager.checkPermission(any(), any())).thenReturn(
+ PackageManager.PERMISSION_GRANTED);
+ final ResolveInfo attentionServiceResolveInfo = new ResolveInfo();
+ attentionServiceResolveInfo.serviceInfo = new ServiceInfo();
+ when(mPackageManager.resolveService(isA(Intent.class), anyInt())).thenReturn(
+ attentionServiceResolveInfo);
+
doReturn(TIMEOUT_ENTRIES).when(mResources).getStringArray(R.array.screen_timeout_entries);
doReturn(TIMEOUT_VALUES).when(mResources).getStringArray(R.array.screen_timeout_entries);
doReturn(true).when(mResources).getBoolean(
@@ -148,6 +168,13 @@
}
@Test
+ public void updateCandidates_AttentionServiceNotInstalled_doNoShowAdaptiveSleepPreference() {
+ when(mPackageManager.resolveService(isA(Intent.class), anyInt())).thenReturn(null);
+
+ verify(mSettings.mAdaptiveSleepController, never()).addToScreen(mPreferenceScreen);
+ }
+
+ @Test
public void updateCandidates_enforcedAdmin_showDisabledByAdminPreference() {
mSettings.mAdmin = new RestrictedLockUtils.EnforcedAdmin();
mSettings.mDisableOptionsPreference = mDisableOptionsPreference;
diff --git a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index 7affe68..9951449 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -535,4 +535,32 @@
assertThat(p instanceof NetworkProviderSettings.FirstWifiEntryPreference).isTrue();
}
+
+ @Test
+ public void updateWifiEntryPreferences_activityIsNull_ShouldNotCrash() {
+ when(mNetworkProviderSettings.getActivity()).thenReturn(null);
+
+ // should not crash
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+ }
+
+ @Test
+ public void updateWifiEntryPreferences_viewIsNull_ShouldNotCrash() {
+ final FragmentActivity activity = mock(FragmentActivity.class);
+ when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
+ when(mNetworkProviderSettings.getView()).thenReturn(null);
+
+ // should not crash
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+ }
+
+ @Test
+ public void updateWifiEntryPreferences_isRestricted_bypassUpdate() {
+ mNetworkProviderSettings.mIsRestricted = true;
+ mNetworkProviderSettings.mWifiEntryPreferenceCategory = mock(PreferenceCategory.class);
+
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+
+ verify(mNetworkProviderSettings.mWifiEntryPreferenceCategory, never()).setVisible(true);
+ }
}
diff --git a/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java b/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
index 5ab2ce0..c54c3ee 100644
--- a/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
+++ b/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
@@ -39,6 +39,7 @@
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
+import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import androidx.lifecycle.Lifecycle;
@@ -194,4 +195,17 @@
assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_ETHERNET);
}
+
+ @Test
+ public void updateInternetType_carrierWifiConnected_getInternetCellular() {
+ final WifiInfo wifiInfo = mock(WifiInfo.class);
+ doReturn(wifiInfo).when(mWifiManager).getConnectionInfo();
+ doReturn(true).when(wifiInfo).isCarrierMerged();
+ mInternetUpdater.mInternetAvailable = true;
+ mInternetUpdater.mTransport = TRANSPORT_WIFI;
+
+ mInternetUpdater.updateInternetType();
+
+ assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_CELLULAR);
+ }
}
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
index 722e305..66247d3 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
@@ -46,6 +46,8 @@
import android.telephony.TelephonyManager;
import androidx.slice.Slice;
+import androidx.slice.SliceItem;
+import androidx.slice.SliceMetadata;
import androidx.slice.SliceProvider;
import androidx.slice.builders.ListBuilder;
import androidx.slice.builders.SliceAction;
@@ -104,8 +106,6 @@
ListBuilder.RowBuilder mMockCarrierRowBuild;
@Mock
WifiPickerTracker mWifiPickerTracker;
- @Mock
- WifiSliceItem mWifiSliceItem;
AlertDialog mMockAlertDialog;
private FakeFeatureFactory mFeatureFactory;
@@ -127,7 +127,7 @@
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
-
+ when(mWifiManager.isWifiEnabled()).thenReturn(true);
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
@@ -192,7 +192,24 @@
@Test
@UiThreadTest
- public void getSlice_haveTwoWifiAndOneCarrier_getCarrierAndTwoWiFiAndSeeAll() {
+ public void getSlice_airplaneModeIsOn_oneWifiToggle() {
+ mWifiList.clear();
+ mMockNetworkProviderWorker.updateSelfResults(null);
+ mockHelperCondition(true, false, false, null);
+
+ final Slice slice = mMockProviderModelSlice.getSlice();
+
+ assertThat(slice).isNotNull();
+ verify(mListBuilder, times(1)).addRow(any(ListBuilder.RowBuilder.class));
+ final SliceItem sliceTitle =
+ SliceMetadata.from(mContext, slice).getListContent().getHeader().getTitleItem();
+ assertThat(sliceTitle.getText()).isEqualTo(
+ ResourcesUtils.getResourcesString(mContext, "wifi_settings"));
+ }
+
+ @Test
+ @UiThreadTest
+ public void getSlice_haveTwoWifiAndOneCarrier_getFiveRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -207,13 +224,13 @@
assertThat(slice).isNotNull();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveOneConnectedWifiAndTwoDisconnectedWifiAndNoCarrier_getFourRow() {
+ public void getSlice_haveOneConnectedWifiAndTwoDisconnectedWifiAndNoCarrier_getFiveRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -230,13 +247,13 @@
final Slice slice = mMockProviderModelSlice.getSlice();
assertThat(slice).isNotNull();
- verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveTwoDisconnectedWifiAndNoCarrier_getThreeRow() {
+ public void getSlice_haveTwoDisconnectedWifiAndNoCarrier_getFourRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi1_key", true);
@@ -250,13 +267,13 @@
final Slice slice = mMockProviderModelSlice.getSlice();
assertThat(slice).isNotNull();
- verify(mListBuilder, times(3)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveEthernetAndCarrierAndTwoDisconnectedWifi_getFiveRow() {
+ public void getSlice_haveEthernetAndCarrierAndTwoDisconnectedWifi_getSixRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi1_key", true);
@@ -274,13 +291,13 @@
assertThat(slice).isNotNull();
assertThat(mMockProviderModelSlice.hasCreateEthernetRow()).isTrue();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(6)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveEthernetAndCarrierAndConnectedWifiAndDisconnectedWifi_getFiveRow() {
+ public void getSlice_haveEthernetAndCarrierAndConnectedWifiAndDisconnectedWifi_getSixRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -298,7 +315,7 @@
assertThat(slice).isNotNull();
assertThat(mMockProviderModelSlice.hasCreateEthernetRow()).isTrue();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(6)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@@ -396,6 +413,11 @@
return super.getSeeAllRow();
}
+ @Override
+ public ListBuilder.RowBuilder getWifiSliceItemRow(WifiSliceItem wifiSliceItem) {
+ return super.getWifiSliceItemRow(wifiSliceItem);
+ }
+
public boolean hasCreateEthernetRow() {
return mHasCreateEthernetRow;
}
diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
index c13d368..30a2729 100644
--- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -21,7 +21,6 @@
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -32,7 +31,6 @@
import android.net.wifi.WifiManager;
import android.os.Handler;
-import androidx.fragment.app.FragmentActivity;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -89,8 +87,6 @@
private WifiManager mWifiManager;
@Mock
private ProviderModelSliceHelper mProviderModelSliceHelper;
- @Mock
- private FragmentActivity mPanelActivity;
private Context mContext;
private FakeHandlerInjector mFakeHandlerInjector;
@@ -223,20 +219,6 @@
}
@Test
- public void getCustomizedButtonTitle_wifiOff_turnOnWifi() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
-
- assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_TURN_ON_WIFI);
- }
-
- @Test
- public void getCustomizedButtonTitle_wifiOn_turnOffWifi() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
-
- assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_TURN_OFF_WIFI);
- }
-
- @Test
public void getSlices_providerModelDisabled_containsNecessarySlices() {
mPanel.mIsProviderModelEnabled = false;
List<Uri> uris = mPanel.getSlices();
@@ -255,33 +237,17 @@
}
@Test
- public void getSeeMoreIntent_shouldNotNull() {
+ public void getSeeMoreIntent_providerModelDisabled_shouldNotNull() {
+ mPanel.mIsProviderModelEnabled = false;
+
assertThat(mPanel.getSeeMoreIntent()).isNotNull();
}
@Test
- public void onClickCustomizedButton_wifiOn_setWifiOff() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
+ public void getSeeMoreIntent_providerModelEnabled_shouldBeNull() {
+ mPanel.mIsProviderModelEnabled = true;
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mWifiManager).setWifiEnabled(false);
- }
-
- @Test
- public void onClickCustomizedButton_wifiOff_setWifiOn() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
-
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mWifiManager).setWifiEnabled(true);
- }
-
- @Test
- public void onClickCustomizedButton_shouldNotFinishActivity() {
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mPanelActivity, never()).finish();
+ assertThat(mPanel.getSeeMoreIntent()).isNull();
}
@Test
@@ -294,26 +260,6 @@
}
@Test
- public void onWifiEnabledChanged_wifiOff_onCustomizedButtonStateChanged() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
- clearInvocations(mPanelContentCallback);
-
- mPanel.onWifiEnabledChanged(false);
-
- verify(mPanelContentCallback).onCustomizedButtonStateChanged();
- }
-
- @Test
- public void onWifiEnabledChanged_wifiOn_onCustomizedButtonStateChanged() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
- clearInvocations(mPanelContentCallback);
-
- mPanel.onWifiEnabledChanged(true);
-
- verify(mPanelContentCallback).onCustomizedButtonStateChanged();
- }
-
- @Test
public void updateProgressBar_wifiDisabled_hideProgress() {
mPanel.mIsProgressBarVisible = true;
doReturn(false).when(mInternetUpdater).isWifiEnabled();