Merge "Settings strings for bubbles" into rvc-dev
diff --git a/res/drawable/accessibility_captions.png b/res/drawable/accessibility_captions.png
new file mode 100644
index 0000000..5467386
--- /dev/null
+++ b/res/drawable/accessibility_captions.png
Binary files differ
diff --git a/res/drawable/accessibility_color_inversion_preview.png b/res/drawable/accessibility_color_inversion_preview.png
deleted file mode 100644
index 5c9f3ea..0000000
--- a/res/drawable/accessibility_color_inversion_preview.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/accessibility_dwell.png b/res/drawable/accessibility_dwell.png
new file mode 100644
index 0000000..b4f5598
--- /dev/null
+++ b/res/drawable/accessibility_dwell.png
Binary files differ
diff --git a/res/layout/color_inversion_preview.xml b/res/layout/accessibility_autoclick_preview.xml
similarity index 87%
rename from res/layout/color_inversion_preview.xml
rename to res/layout/accessibility_autoclick_preview.xml
index 18a0bb8..4fa3f8f 100644
--- a/res/layout/color_inversion_preview.xml
+++ b/res/layout/accessibility_autoclick_preview.xml
@@ -22,8 +22,9 @@
<ImageView
android:layout_width="match_parent"
- android:layout_height="@dimen/color_mode_preview_height"
+ android:layout_height="@dimen/autoclick_preview_height"
android:contentDescription="@null"
android:scaleType="fitCenter"
- android:src="@drawable/accessibility_color_inversion_preview"/>
+ android:src="@drawable/accessibility_dwell"/>
+
</FrameLayout>
diff --git a/res/layout/accessibility_captions_preview.xml b/res/layout/accessibility_captions_preview.xml
new file mode 100644
index 0000000..f3c0316
--- /dev/null
+++ b/res/layout/accessibility_captions_preview.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/captioning_preview_height"
+ android:contentDescription="@null"
+ android:scaleType="fitCenter"
+ android:src="@drawable/accessibility_captions" />
+
+</FrameLayout>
diff --git a/res/raw/accessibility_color_inversion.mp4 b/res/raw/accessibility_color_inversion.mp4
new file mode 100644
index 0000000..d28b9b4
--- /dev/null
+++ b/res/raw/accessibility_color_inversion.mp4
Binary files differ
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ef6b818..4ca9798 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -56,6 +56,8 @@
<dimen name="captioning_preview_height">200dp</dimen>
+ <dimen name="autoclick_preview_height">200dp</dimen>
+
<dimen name="color_mode_preview_height">320dp</dimen>
<dimen name="ring_progress_bar_thickness">4dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 603711c..58e1975 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3812,6 +3812,12 @@
<!-- Bluetooth Tethering settings. Message for untethering from a bluetooth device [CHAR LIMIT=50]-->
<string name="bluetooth_untether_blank"><xliff:g id="device_name">%1$s</xliff:g> will be untethered.</string>
+ <!-- Ethernet Tethering settings-->
+ <!-- Label for ethernet tether checkbox [CHAR LIMIT=25]-->
+ <string name="ethernet_tether_checkbox_text">Ethernet tethering</string>
+ <!-- Ethernet Tethering subtext [CHAR LIMIT=70]-->
+ <string name="ethernet_tethering_subtext" product="default">Share phone\u2019s internet connection via USB Ethernet</string>
+
<!-- Tethering footer info [CHAR LIMIT=NONE]-->
<string name="tethering_footer_info">Use hotspot and tethering to provide internet to other devices through your mobile data connection. Apps can also create a hotspot to share content with nearby devices.</string>
<!-- Tethering footer info for the device which supports Wi-Fi and Wi-Fi tethering enabled at the same time [CHAR LIMIT=NONE]-->
@@ -4877,52 +4883,74 @@
<!-- Short summary for nav bar Magnification. Tells the user that this feature allows the user to magnify the screen using a button in the nav bar -->
<string name="accessibility_screen_magnification_navbar_short_summary">Tap a button to zoom</string>
<!-- Summary for the accessibility preference screen to enable screen magnification gestures. [CHAR LIMIT=none] -->
- <string name="accessibility_screen_magnification_summary"><![CDATA[Quickly zoom in on the screen to see content more clearly.<br/><br/><b>To zoom in:</b><br/>\t1. Use shortcut to start magnification<br/>\t2. Tap the screen<br/>\t3. Drag 2 fingers to move around screen<br/>\t4. Pinch with 2 fingers to adjust zoom<br/>\t5. Use shortcut to stop magnification<br/><br/><b>To zoom in temporarily:</b><br/>\t1. Use shortcut to start magnification<br/>\t2. Touch & hold anywhere on the screen<br/>\t3. Drag finger to move around screen<br/>\t4. Lift finger to stop magnification]]></string>
+ <string name="accessibility_screen_magnification_summary">
+ <![CDATA[Quickly zoom in on the screen to display content more clearly.<br/><br/>
+ <b>To zoom in:</b><br/>
+ 1. Use shortcut to start magnification<br/>
+ 2. Tap the screen<br/>
+ 3. Drag 2 fingers to move around screen<br/>
+ 4. Pinch with 2 fingers to adjust zoom<br/>
+ 5. Use shortcut to stop magnification<br/><br/>
+ <b>To zoom in temporarily:</b><br/>
+ 1. Use shortcut to start magnification<br/>
+ 2. Touch & hold anywhere on the screen<br/>
+ 3. Drag finger to move around screen<br/>
+ 4. Lift finger to stop magnification
+ ]]>
+ </string>
<!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
<string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch & hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
- <!-- Title for the Accessibility tutorial dialog in Accessibility service with button. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in accessibility service with button. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_button">Use accessibility button to open</string>
- <!-- Title for the Accessibility tutorial dialog in Accessibility service with gesture. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=50] -->
+ <string name="accessibility_tutorial_dialog_title_volume">Hold volume key to open</string>
+ <!-- Title for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_title_triple">Triple tap screen to open</string>
+ <!-- Title for the accessibility tutorial dialog in accessibility service with gesture. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_gesture">Use gesture to open</string>
- <!-- Title for the Accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_gesture_settings">Use new accessibility gesture</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
- <!-- Button for the Accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_button">To turn this app on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between apps, touch & hold the accessibility button.</string>
+ <!-- Instruction for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_message_volume">To turn this app on or off, press & hold both volume keys for 1 second.</string>
+ <!-- Instruction for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_message_triple">To start and stop magnification, triple-tap anywhere on your screen.</string>
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture">To turn this app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+ <!-- Button for the accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
<string name="accessibility_tutorial_dialog_button">Got it</string>
<!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
<string name="accessibility_shortcut_title"><xliff:g id="service" example="Select to Speak">%1$s</xliff:g> shortcut</string>
- <!-- Title for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_summary_software">Accessibility Button</string>
- <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software_gesture">Swipe up with 2 fingers</string>
- <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software_gesture_talkback">Swipe up with 3 fingers</string>
<!-- Summary for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software">Tap accessibility button</string>
- <!-- Summary for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen</string>
- <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers</string>
- <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers</string>
- <!-- Title for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
- <!-- Summary for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_hardware">Press & hold both volume keys for 1 second</string>
- <!-- Title for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_triple_tap">Triple-tap screen</string>
- <!-- Summary for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen 3 times. This shortcut may slow down your device.</string>
- <!-- Title for the Accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
+ <!-- Title for the accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
<string name="accessibility_shortcut_edit_dialog_title_advance">Advanced</string>
<!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
<string name="accessibility_screen_magnification_navbar_configuration_warning">The Accessibility button is set to <xliff:g id="service" example="Select to Speak">%1$s</xliff:g>. To use magnification, touch & hold the Accessibility button, then select magnification.</string>
@@ -4987,7 +5015,16 @@
<!-- Used in the accessibility service settings to control turning display color inversion on/off entirely. [CHAR LIMIT=NONE] -->
<string name="accessibility_display_inversion_switch_title">Use color inversion</string>
<!-- Subtitle for the accessibility preference to configure display color inversion. [CHAR LIMIT=NONE] -->
- <string name="accessibility_display_inversion_preference_subtitle"><![CDATA[Color inversion turns light screens dark. This feature may be helpful for people who are sensitive to bright light.<br/><br/>Color inversion also turns dark screens light. Colors will change in media and images.<br/><br/>Note: You can also use Dark theme to display a dark background. Dark theme works with supported apps. Color inversion works on all apps.]]></string>
+ <string name="accessibility_display_inversion_preference_subtitle">
+ <![CDATA[Color inversion turns light screens dark.<br/><br/>
+ Note:
+ <ol>
+ <li>\u00a0Color inversion also turns dark screens light.</li>
+ <li>\u00a0Colors will change in media and images.</li>
+ <li>\u00a0Dark theme can be used to display a dark background. Dark theme works with supported apps. Color inversion works on all apps.</li>
+ </ol>
+ ]]>
+ </string>
<!-- Title for accessibility preference for configuring feature that performs click action soon after mouse/trackpad pointer stops moving. [CHAR LIMIT=NONE] -->
<string name="accessibility_autoclick_preference_title">Autoclick (dwell timing)</string>
<!-- Footer text to explain what autoclick does -->
@@ -6134,13 +6171,13 @@
<!-- Title of Wi-Fi certificate [CHAR LIMIT=30] -->
<string name="wifi_certificate">Wi\u2011Fi certificate</string>
<!-- Title of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
- <string name="ca_certificate_warning_title">Your privacy is at risk</string>
+ <string name="ca_certificate_warning_title">Your data won\u2019t be private</string>
<!-- Description of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
- <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your information, such as passwords, messages, or credit card details, from websites you visit or apps you use - even if that information is encrypted.</string>
+ <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
<!-- Label for button to not install a certificate [CHAR_LIMIT=50] -->
<string name="certificate_warning_dont_install">Don\u2019t install</string>
<!-- Label for button to continue installing a certificate [CHAR_LIMIT=50] -->
- <string name="certificate_warning_install_anyway">Install anyways</string>
+ <string name="certificate_warning_install_anyway">Install anyway</string>
<!-- Toast message that a certificate was not installed -->
<string name="cert_not_installed">Certificate not installed</string>
@@ -6974,7 +7011,7 @@
<string name="apps_with_restrictions_settings_button">Expand settings for application</string>
<!-- NFC payment settings --><skip/>
- <string name="nfc_payment_settings_title">Tap & pay</string>
+ <string name="nfc_payment_settings_title">Contactless payments</string>
<!-- Caption for button linking to a page explaining how Tap and Pay works-->
<string name="nfc_payment_how_it_works">How it works</string>
<!-- String shown when there are no NFC payment applications installed -->
@@ -8533,54 +8570,70 @@
<!-- Apps > App Details > Picture-in-picture > Description. [CHAR LIMIT=NONE] -->
<string name="picture_in_picture_app_detail_summary">Allow this app to create a picture-in-picture window while the app is open or after you leave it (for example, to continue watching a video). This window displays on top of other apps you\'re using.</string>
- <!-- Special access > Title for managing the settings where users opt-in to connect a work app
- to its personal equivalent, allowing cross-profile communication. [CHAR LIMIT=50] -->
- <string name="interact_across_profiles_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings label. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=50] -->
+ <string name="interact_across_profiles_title">Connected work & personal apps</string>
- <!-- Special access > Connected personal and work apps > Text to display when the list is empty. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_empty_text" translatable="false">No connected apps</string>
+ <!-- Settings subtext. This text is shown when a user doesn't have any connected apps. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_empty_text">No connected apps</string>
- <!-- Special access > Connected personal and work apps > Additional keywords to search for. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_keywords" translatable="false">cross profile connected app apps work and personal</string>
+ <!-- Search keywords. If a user is searching for the "Connected work & personal apps" feature in Settings,
+ these keywords will surface that feature. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_keywords">cross profile connected app apps work and personal</string>
- <!-- Apps > App Details > Advanced section string title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_app_detail_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings header. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_app_detail_title">Connected work & personal apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_enabled" translatable="false">Connected</string>
+ <!-- Toggle label. This text is shown when a user's work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_enabled">Connected</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_disabled" translatable="false">Connect these apps</string>
+ <!-- Toggle label. This text is shown when a user can connect specific work and personal apps.
+ The apps they can connect are shown above this toggle. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_disabled">Connect these apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_1" translatable="false">Connected apps share permissions and can access each other\u2019s data.</string>
+ <!-- Settings text. This text lets a user know that if they connect work and personal apps,
+ they will share permissions and can access each other's data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_1">Connected apps share permissions and can access each other\u2019s data.</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_2" translatable="false">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
+ <!-- Settings text. This text lets a user know that they should only connect work and personal apps
+ if they trust the work app with their personal data. The work app could potentially show that data
+ to the user's IT admin. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_2">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_title" translatable="false">Trust work %1$s with your personal data?</string>
+ <!-- Dialog title. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_title">Trust work <xliff:g id="name" example="Calendar">%1$s</xliff:g> with your personal data?</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_summary" translatable="false">%1$s may expose your personal data to your IT admin.</string>
+ <!-- Dialog text. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data.
+ The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_summary"><xliff:g id="name" example="Calendar">%1$s</xliff:g> may expose your personal data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_title" translatable="false">App data</string>
+ <!-- Title of a section in a dialog. This section shows the app data that will be
+ accessible when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_title">App data</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_summary" translatable="false">It can access data in your personal %1$s app.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be
+ able to access data in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_summary">This app can access data in your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_title" translatable="false">Permissions</string>
+ <!-- Title of a section in a dialog. This section shows the permissions that will be accessible
+ when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_title">Permissions</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_summary" translatable="false">It can use your personal %1$s app\u2019s permissions, like access to location, storage, or contacts.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be able
+ to use permissions in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_summary">This app can use your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app\u2019s permissions, like access to location, storage, or contacts.</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user that currently no apps are connected -->
- <string name="interact_across_profiles_number_of_connected_apps_none" translatable="false">No apps connected</string>
+ <!-- Summary of preference to manage connected work and personal apps, informing the user that
+ currently no apps are connected [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_number_of_connected_apps_none">No apps connected</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user how many apps are connected -->
- <plurals name="interact_across_profiles_number_of_connected_apps" translatable="false">
+ <!-- Summary of preference to manage connected work and personal apps, informing the user how many apps are connected -->
+ <plurals name="interact_across_profiles_number_of_connected_apps">
<item quantity="one"><xliff:g id="count">%d</xliff:g> app connected</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps connected</item>
</plurals>
@@ -9743,7 +9796,7 @@
<!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
<string name="permit_draw_overlay">Allow display over other apps</string>
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
- <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
+ <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. This app will be able to see where you tap or change what\u2019s displayed on the screen.</string>
<!-- Manager External Storage settings title [CHAR LIMIT=40] -->
<string name="manage_external_storage_title">All files access</string>
@@ -10472,6 +10525,11 @@
<!-- [CHAR LIMIT=60] Name of dev option to enable extra quick settings tiles -->
<string name="quick_settings_developer_tiles">Quick settings developer tiles</string>
+ <!-- [CHAR LIMIT=50] Setting title to disable the adb authorization timeout feature. -->
+ <string name="adb_authorization_timeout_title">Disable adb authorization timeout</string>
+ <!-- [CHAR LIMIT=NONE] Setting summary explaining the disablement of the automatic adb authorization timeout. -->
+ <string name="adb_authorization_timeout_summary">Disable automatic revocation of adb authorizations for systems that have not reconnected within the default (7 days) or user-configured (minimum 1 day) amount of time.</string>
+
<!-- [CHAR LIMIT=25] Title of developer tile to toggle winscope trace -->
<string name="winscope_trace_quick_settings_title">Winscope Trace</string>
@@ -11793,4 +11851,9 @@
<!-- Button label to stop casting on media device. [CHAR LIMIT=40 -->
<string name="media_output_panel_stop_casting_button">Stop casting</string>
+
+ <!-- Title for the 5G limited VoLTE dialog. [CHAR LIMIT=50] -->
+ <string name="volte_5G_limited_title">Turn off VoLTE?</string>
+ <!-- Content description for the 5G limited VoLTE dialog. [CHAR LIMIT=NONE] -->
+ <string name="volte_5G_limited_text">This also turns off your 5G connection.\nDuring a voice call, you can\u2019t use the internet and some apps may not work.</string>
</resources>
diff --git a/res/xml/accessibility_autoclick_settings.xml b/res/xml/accessibility_autoclick_settings.xml
index f126113..d387b58 100644
--- a/res/xml/accessibility_autoclick_settings.xml
+++ b/res/xml/accessibility_autoclick_settings.xml
@@ -19,6 +19,15 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accessibility_autoclick_preference_title">
+ <com.android.settingslib.widget.LayoutPreference
+ android:key="accessibility_autoclick_preview"
+ android:layout="@layout/accessibility_autoclick_preview"
+ android:persistent="false"
+ android:selectable="false"
+ android:title="@string/summary_placeholder"
+ settings:allowDividerBelow="true"
+ settings:searchable="false" />
+
<com.android.settingslib.widget.RadioButtonPreference
android:key="accessibility_control_autoclick_default"
android:title="@string/accessibility_autoclick_default_title"
diff --git a/res/xml/accessibility_color_inversion_settings.xml b/res/xml/accessibility_color_inversion_settings.xml
index ba0d6fd..f44d41f 100644
--- a/res/xml/accessibility_color_inversion_settings.xml
+++ b/res/xml/accessibility_color_inversion_settings.xml
@@ -21,14 +21,14 @@
android:persistent="false"
android:title="@string/accessibility_display_inversion_preference_title">
- <com.android.settingslib.widget.LayoutPreference
+ <com.android.settings.widget.VideoPreference
android:key="color_inversion_preview"
- android:layout="@layout/color_inversion_preview"
android:persistent="false"
android:selectable="false"
android:title="@string/summary_placeholder"
- settings:allowDividerAbove="true"
settings:allowDividerBelow="true"
+ settings:animation="@raw/accessibility_color_inversion"
+ settings:controller="com.android.settings.widget.VideoPreferenceController"
settings:searchable="false" />
</PreferenceScreen>
diff --git a/res/xml/captioning_settings.xml b/res/xml/captioning_settings.xml
index 2a709f2..7ae93b9 100644
--- a/res/xml/captioning_settings.xml
+++ b/res/xml/captioning_settings.xml
@@ -21,11 +21,21 @@
android:persistent="false"
android:title="@string/accessibility_captioning_title">
+ <com.android.settingslib.widget.LayoutPreference
+ android:key="captions_preview"
+ android:layout="@layout/accessibility_captions_preview"
+ android:persistent="false"
+ android:selectable="false"
+ android:title="@string/summary_placeholder"
+ settings:allowDividerBelow="true"
+ settings:searchable="false" />
+
<SwitchPreference
android:key="captioning_preference_switch"
android:persistent="false"
android:summary="@string/accessibility_caption_master_switch_summary"
- android:title="@string/accessibility_caption_master_switch_title" />
+ android:title="@string/accessibility_caption_master_switch_title"
+ settings:allowDividerAbove="true" />
<Preference
android:fragment="com.android.settings.accessibility.CaptionAppearanceFragment"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index b4d0bba..48a0850 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -149,6 +149,11 @@
settings:keywords="@string/keywords_adb_wireless" />
<SwitchPreference
+ android:key="adb_authorization_timeout"
+ android:title="@string/adb_authorization_timeout_title"
+ android:summary="@string/adb_authorization_timeout_summary" />
+
+ <SwitchPreference
android:key="enable_terminal"
android:title="@string/enable_terminal_title"
android:summary="@string/enable_terminal_summary" />
diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml
index abc49cc..9367a9b 100644
--- a/res/xml/tether_prefs.xml
+++ b/res/xml/tether_prefs.xml
@@ -38,6 +38,12 @@
android:summary="@string/bluetooth_tethering_subtext"
settings:keywords="@string/keywords_hotspot_tethering" />
+ <SwitchPreference
+ android:key="enable_ethernet_tethering"
+ android:title="@string/ethernet_tether_checkbox_text"
+ android:summary="@string/ethernet_tethering_subtext"
+ settings:keywords="@string/keywords_hotspot_tethering" />
+
<Preference
android:key="disabled_on_data_saver"
android:summary="@string/tether_settings_disabled_on_data_saver"
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index 6bb75a5..a9b496a 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -28,6 +28,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -53,6 +55,7 @@
import com.android.settings.network.ProxySubscriptionManager;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -220,8 +223,30 @@
Bundle savedInstanceState) {
final int numSims = mProxySubscriptionMgr.getActiveSubscriptionInfoCountMax();
+ final List<SubscriptionInfo> subInfoList =
+ mProxySubscriptionMgr.getActiveSubscriptionsInfo();
mSlotId = 0;
- if (numSims > 1) {
+ final List<SubscriptionInfo> componenterList = new ArrayList<>();
+
+ for (int i = 0; i < numSims; ++i) {
+ final SubscriptionInfo subInfo =
+ getActiveSubscriptionInfoForSimSlotIndex(subInfoList, i);
+ final CarrierConfigManager carrierConfigManager = getContext().getSystemService(
+ CarrierConfigManager.class);
+ final PersistableBundle bundle = carrierConfigManager.getConfigForSubId(
+ subInfo.getSubscriptionId());
+ if (bundle != null
+ && !bundle.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ componenterList.add(subInfo);
+ }
+ }
+
+ if (componenterList.size() == 0) {
+ Log.e(TAG, "onCreateView: no sim info");
+ return null;
+ }
+
+ if (componenterList.size() > 1) {
final View view = inflater.inflate(R.layout.icc_lock_tabs, container, false);
final ViewGroup prefs_container = (ViewGroup) view.findViewById(R.id.prefs_container);
Utils.prepareCustomPreferencesList(container, view, prefs_container, false);
@@ -236,25 +261,22 @@
mTabHost.setOnTabChangedListener(mTabListener);
mTabHost.clearAllTabs();
- final List<SubscriptionInfo> subInfoList =
- mProxySubscriptionMgr.getActiveSubscriptionsInfo();
- for (int i = 0; i < numSims; ++i) {
- final SubscriptionInfo subInfo =
- getActiveSubscriptionInfoForSimSlotIndex(subInfoList, i);
- mTabHost.addTab(buildTabSpec(String.valueOf(i),
+ for (SubscriptionInfo subInfo : componenterList) {
+ int slot = subInfo.getSimSlotIndex();
+ mTabHost.addTab(buildTabSpec(String.valueOf(slot),
String.valueOf(subInfo == null
- ? getContext().getString(R.string.sim_editor_title, i + 1)
- : subInfo.getDisplayName())));
+ ? getContext().getString(R.string.sim_editor_title, slot + 1)
+ : subInfo.getDisplayName())));
}
- final SubscriptionInfo sir = getActiveSubscriptionInfoForSimSlotIndex(
- subInfoList, mSlotId);
- mSubId = sir.getSubscriptionId();
+
+ mSubId = componenterList.get(0).getSubscriptionId();
if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_TAB)) {
mTabHost.setCurrentTabByTag(savedInstanceState.getString(CURRENT_TAB));
}
return view;
} else {
+ mSlotId = componenterList.get(0).getSimSlotIndex();
return super.onCreateView(inflater, container, savedInstanceState);
}
}
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index cce2010..c61e573 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -18,6 +18,7 @@
import static android.net.ConnectivityManager.TETHERING_BLUETOOTH;
import static android.net.ConnectivityManager.TETHERING_USB;
+import static android.net.TetheringManager.TETHERING_ETHERNET;
import android.app.Activity;
import android.app.settings.SettingsEnums;
@@ -31,12 +32,16 @@
import android.content.pm.PackageManager;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
+import android.net.EthernetManager;
+import android.net.TetheringManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.HandlerExecutor;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
@@ -71,6 +76,7 @@
static final String KEY_USB_TETHER_SETTINGS = "usb_tether_settings";
@VisibleForTesting
static final String KEY_ENABLE_BLUETOOTH_TETHERING = "enable_bluetooth_tethering";
+ private static final String KEY_ENABLE_ETHERNET_TETHERING = "enable_ethernet_tethering";
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver";
@VisibleForTesting
static final String KEY_TETHER_PREFS_FOOTER = "tether_prefs_footer";
@@ -81,15 +87,22 @@
private SwitchPreference mBluetoothTether;
+ private SwitchPreference mEthernetTether;
+
private BroadcastReceiver mTetherChangeReceiver;
private String[] mUsbRegexs;
private String[] mBluetoothRegexs;
+ private String mEthernetRegex;
private AtomicReference<BluetoothPan> mBluetoothPan = new AtomicReference<>();
private Handler mHandler = new Handler();
private OnStartTetheringCallback mStartTetheringCallback;
private ConnectivityManager mCm;
+ private EthernetManager mEm;
+ private TetheringManager mTm;
+ private TetheringEventCallback mTetheringEventCallback;
+ private EthernetListener mEthernetListener;
private WifiTetherPreferenceController mWifiTetherPreferenceController;
@@ -144,17 +157,23 @@
mUsbTether = (SwitchPreference) findPreference(KEY_USB_TETHER_SETTINGS);
mBluetoothTether = (SwitchPreference) findPreference(KEY_ENABLE_BLUETOOTH_TETHERING);
+ mEthernetTether = (SwitchPreference) findPreference(KEY_ENABLE_ETHERNET_TETHERING);
setFooterPreferenceTitle();
mDataSaverBackend.addListener(this);
mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ mEm = (EthernetManager) getSystemService(Context.ETHERNET_SERVICE);
+ mTm = (TetheringManager) getSystemService(Context.TETHERING_SERVICE);
mUsbRegexs = mCm.getTetherableUsbRegexs();
mBluetoothRegexs = mCm.getTetherableBluetoothRegexs();
+ mEthernetRegex = getContext().getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex);
final boolean usbAvailable = mUsbRegexs.length != 0;
final boolean bluetoothAvailable = mBluetoothRegexs.length != 0;
+ final boolean ethernetAvailable = !TextUtils.isEmpty(mEthernetRegex);
if (!usbAvailable || Utils.isMonkeyRunning()) {
getPreferenceScreen().removePreference(mUsbTether);
@@ -172,6 +191,7 @@
mBluetoothTether.setChecked(false);
}
}
+ if (!ethernetAvailable) getPreferenceScreen().removePreference(mEthernetTether);
// Set initial state based on Data Saver mode.
onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled());
}
@@ -194,6 +214,7 @@
mDataSaverEnabled = isDataSaving;
mUsbTether.setEnabled(!mDataSaverEnabled);
mBluetoothTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
mDataSaverFooter.setVisible(mDataSaverEnabled);
}
@@ -221,6 +242,7 @@
@Override
public void onReceive(Context content, Intent intent) {
String action = intent.getAction();
+ // TODO: stop using ACTION_TETHER_STATE_CHANGED and use mTetheringEventCallback instead.
if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
// TODO - this should understand the interface types
ArrayList<String> available = intent.getStringArrayListExtra(
@@ -279,6 +301,8 @@
final Activity activity = getActivity();
mStartTetheringCallback = new OnStartTetheringCallback(this);
+ mTetheringEventCallback = new TetheringEventCallback();
+ mTm.registerTetheringEventCallback(new HandlerExecutor(mHandler), mTetheringEventCallback);
mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
mTetherChangeReceiver = new TetherChangeReceiver();
@@ -301,6 +325,9 @@
if (intent != null) mTetherChangeReceiver.onReceive(activity, intent);
+ mEthernetListener = new EthernetListener();
+ mEm.addListener(mEthernetListener);
+
updateState();
}
@@ -312,8 +339,12 @@
return;
}
getActivity().unregisterReceiver(mTetherChangeReceiver);
+ mTm.unregisterTetheringEventCallback(mTetheringEventCallback);
+ mEm.removeListener(mEthernetListener);
mTetherChangeReceiver = null;
mStartTetheringCallback = null;
+ mTetheringEventCallback = null;
+ mEthernetListener = null;
}
private void updateState() {
@@ -327,6 +358,7 @@
String[] errored) {
updateUsbState(available, tethered, errored);
updateBluetoothState();
+ updateEthernetState(available, tethered);
}
private void updateUsbState(String[] available, String[] tethered,
@@ -390,6 +422,31 @@
}
}
+ private void updateEthernetState(String[] available, String[] tethered) {
+
+ boolean isAvailable = false;
+ boolean isTethered = false;
+
+ for (String s : available) {
+ if (s.matches(mEthernetRegex)) isAvailable = true;
+ }
+
+ for (String s : tethered) {
+ if (s.matches(mEthernetRegex)) isTethered = true;
+ }
+
+ if (isTethered) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(true);
+ } else if (isAvailable || mEm.isAvailable()) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(false);
+ } else {
+ mEthernetTether.setEnabled(false);
+ mEthernetTether.setChecked(false);
+ }
+ }
+
public static boolean isProvisioningNeededButUnavailable(Context context) {
return (TetherUtil.isProvisioningNeeded(context)
&& !isIntentAvailable(context));
@@ -438,6 +495,12 @@
} else {
mCm.stopTethering(TETHERING_BLUETOOTH);
}
+ } else if (preference == mEthernetTether) {
+ if (mEthernetTether.isChecked()) {
+ startTethering(TETHERING_ETHERNET);
+ } else {
+ mCm.stopTethering(TETHERING_ETHERNET);
+ }
}
return super.onPreferenceTreeClick(preference);
@@ -495,6 +558,13 @@
if (!bluetoothAvailable) {
keys.add(KEY_ENABLE_BLUETOOTH_TETHERING);
}
+
+ final boolean ethernetAvailable = !TextUtils.isEmpty(
+ context.getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex));
+ if (!ethernetAvailable) {
+ keys.add(KEY_ENABLE_ETHERNET_TETHERING);
+ }
return keys;
}
};
@@ -524,4 +594,17 @@
}
}
}
+
+ private final class TetheringEventCallback implements TetheringManager.TetheringEventCallback {
+ @Override
+ public void onTetheredInterfacesChanged(List<String> interfaces) {
+ updateState();
+ }
+ }
+
+ private final class EthernetListener implements EthernetManager.Listener {
+ public void onAvailabilityChanged(String iface, boolean isAvailable) {
+ mHandler.post(TetherSettings.this::updateState);
+ }
+ }
}
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 08cfa70..c1ee545 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -336,7 +336,22 @@
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
: PREF_KEY_DELETE_FACE_DATA);
}
+
+ if (!isAttentionSupported(context)) {
+ keys.add(FaceSettingsAttentionPreferenceController.KEY);
+ }
+
return keys;
}
+
+ private boolean isAttentionSupported(Context context) {
+ FaceFeatureProvider featureProvider = FeatureFactory.getFactory(
+ context).getFaceFeatureProvider();
+ boolean isAttentionSupported = false;
+ if (featureProvider != null) {
+ isAttentionSupported = featureProvider.isAttentionSupported(context);
+ }
+ return isAttentionSupported;
+ }
};
}
diff --git a/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
new file mode 100644
index 0000000..79aa8e6
--- /dev/null
+++ b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+/**
+ * Preference controller for the developer option to disable the automatic revocation of adb
+ * authorizations.
+ */
+public class AdbAuthorizationTimeoutPreferenceController extends
+ DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener {
+ private static final String ADB_AUTHORIZATION_TIMEOUT_KEY = "adb_authorization_timeout";
+
+ private final Context mContext;
+
+ public AdbAuthorizationTimeoutPreferenceController(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return ADB_AUTHORIZATION_TIMEOUT_KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ final long authTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ // An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
+ // be automatically revoked.
+ ((SwitchPreference) mPreference).setChecked(authTimeout == 0);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ writeSetting((boolean) newValue);
+ return true;
+ }
+
+ @Override
+ public void onDeveloperOptionsSwitchDisabled() {
+ super.onDeveloperOptionsSwitchDisabled();
+ writeSetting(false);
+ ((SwitchPreference) mPreference).setChecked(false);
+ }
+
+ private void writeSetting(boolean isEnabled) {
+ long authTimeout = 0;
+ if (!isEnabled) {
+ authTimeout = Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME;
+ }
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ authTimeout);
+ }
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 8c79f2a..c349de9 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -444,6 +444,7 @@
controllers.add(new AdbPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new WirelessDebuggingPreferenceController(context, lifecycle));
+ controllers.add(new AdbAuthorizationTimeoutPreferenceController(context));
controllers.add(new LocalTerminalPreferenceController(context));
controllers.add(new BugReportInPowerPreferenceController(context));
controllers.add(new AutomaticSystemServerHeapDumpPreferenceController(context));
diff --git a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
index 2dbd7d1..dc65973 100644
--- a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
+++ b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
@@ -37,7 +37,7 @@
@VisibleForTesting
static final int ENHANCED_CONNECTIVITY_ON = 1;
- // default is enhanced connectivity disabled.
+ // default is enhanced connectivity enabled.
@VisibleForTesting
static final int ENHANCED_CONNECTIVITY_OFF = 0;
@@ -65,7 +65,7 @@
public void updateState(Preference preference) {
final int enhancedConnectivityEnabled = Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- ENHANCED_CONNECTIVITY_OFF);
+ ENHANCED_CONNECTIVITY_ON);
((SwitchPreference) mPreference).setChecked(
enhancedConnectivityEnabled == ENHANCED_CONNECTIVITY_ON);
}
@@ -75,7 +75,7 @@
super.onDeveloperOptionsSwitchDisabled();
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- ENHANCED_CONNECTIVITY_OFF);
- ((SwitchPreference) mPreference).setChecked(false);
+ ENHANCED_CONNECTIVITY_ON);
+ ((SwitchPreference) mPreference).setChecked(true);
}
}
diff --git a/src/com/android/settings/development/compat/PlatformCompatDashboard.java b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
index 7b79da7..2f2c750 100644
--- a/src/com/android/settings/development/compat/PlatformCompatDashboard.java
+++ b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
@@ -100,7 +100,7 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
try {
- mChanges = getPlatformCompat().listAllChanges();
+ mChanges = getPlatformCompat().listUIChanges();
} catch (RemoteException e) {
throw new RuntimeException("Could not list changes!", e);
}
diff --git a/src/com/android/settings/fuelgauge/BatterySaverReceiver.java b/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
index 300dc0f..bf5c51b 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
@@ -39,7 +39,7 @@
public void onReceive(Context context, Intent intent) {
if (DEBUG) Log.d(TAG, "Received " + intent.getAction());
String action = intent.getAction();
- if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGING.equals(action)) {
+ if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGED.equals(action)) {
if (mBatterySaverListener != null) {
mBatterySaverListener.onPowerSaveModeChanged();
}
@@ -55,7 +55,7 @@
public void setListening(boolean listening) {
if (listening && !mRegistered) {
final IntentFilter ifilter = new IntentFilter();
- ifilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGING);
+ ifilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
ifilter.addAction(Intent.ACTION_BATTERY_CHANGED);
mContext.registerReceiver(this, ifilter);
mRegistered = true;
diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
index 5ac407d..2716e4c 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
@@ -467,7 +467,7 @@
return true;
}
- return channel.isBlockableSystem()
+ return channel.isBlockable()
|| channel.getImportance() == IMPORTANCE_NONE;
}
diff --git a/src/com/android/settings/network/ims/ImsQueryController.java b/src/com/android/settings/network/ims/ImsQueryController.java
index 8fdad40..068a805 100644
--- a/src/com/android/settings/network/ims/ImsQueryController.java
+++ b/src/com/android/settings/network/ims/ImsQueryController.java
@@ -20,6 +20,7 @@
import android.telephony.SubscriptionManager;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsMmTelManager;
+import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
@@ -84,4 +85,20 @@
boolean isProvisionedOnDevice(int subId) {
return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query();
}
+
+ @VisibleForTesting
+ boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+ IllegalArgumentException {
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ return false;
+ }
+
+ final ImsMmTelManager imsMmTelManager = ImsMmTelManager.createForSubscriptionId(subId);
+ // TODO: have a shared thread pool instead of create ExecutorService
+ // everytime to improve performance.
+ final ExecutorService executor = Executors.newSingleThreadExecutor();
+ final IntegerConsumer intResult = new IntegerConsumer();
+ imsMmTelManager.getFeatureState(executor, intResult);
+ return (intResult.get(TIMEOUT_MILLIS) == ImsFeature.STATE_READY);
+ }
}
diff --git a/src/com/android/settings/network/ims/IntegerConsumer.java b/src/com/android/settings/network/ims/IntegerConsumer.java
new file mode 100644
index 0000000..02c8227
--- /dev/null
+++ b/src/com/android/settings/network/ims/IntegerConsumer.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 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.network.ims;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+
+class IntegerConsumer extends Semaphore implements Consumer<Integer> {
+
+ private static final String TAG = "IntegerConsumer";
+
+ IntegerConsumer() {
+ super(0);
+ mValue = new AtomicInteger();
+ }
+
+ private volatile AtomicInteger mValue;
+
+ /**
+ * Get boolean value reported from callback
+ *
+ * @param timeout callback waiting time in milliseconds
+ * @return int value reported
+ * @throws InterruptedException when thread get interrupted
+ */
+ int get(long timeout) throws InterruptedException {
+ tryAcquire(timeout, TimeUnit.MILLISECONDS);
+ return mValue.get();
+ }
+
+ /**
+ * Implementation of {@link Consumer#accept(Integer)}
+ *
+ * @param value int reported from {@link Consumer#accept(Integer)}
+ */
+ public void accept(Integer value) {
+ if (value != null) {
+ mValue.set(value.intValue());
+ }
+ release();
+ }
+}
diff --git a/src/com/android/settings/network/ims/VtQueryImsState.java b/src/com/android/settings/network/ims/VtQueryImsState.java
index 60bd729..c077603 100644
--- a/src/com/android/settings/network/ims/VtQueryImsState.java
+++ b/src/com/android/settings/network/ims/VtQueryImsState.java
@@ -20,20 +20,23 @@
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.SubscriptionManager;
+import android.telephony.ims.ImsException;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.ims.ImsManager;
import com.android.settings.network.SubscriptionUtil;
-import com.android.settings.network.telephony.MobileNetworkUtils;
/**
* Controller class for querying VT status
*/
public class VtQueryImsState extends ImsQueryController {
+ private static final String LOG_TAG = "VtQueryImsState";
+
private Context mContext;
private int mSubId;
@@ -71,14 +74,25 @@
* @return true when Video Call can be performed, otherwise false
*/
public boolean isReadyToVideoCall() {
+ if (!isProvisionedOnDevice(mSubId)) {
+ return false;
+ }
+
final ImsManager imsManager = getImsManager(mSubId);
if (imsManager == null) {
return false;
}
- return imsManager.isVtEnabledByPlatform()
- && isProvisionedOnDevice(mSubId)
- && MobileNetworkUtils.isImsServiceStateReady(imsManager);
+ if (!imsManager.isVtEnabledByPlatform()) {
+ return false;
+ }
+
+ try {
+ return isServiceStateReady(mSubId);
+ } catch (InterruptedException | IllegalArgumentException | ImsException exception) {
+ Log.w(LOG_TAG, "fail to get Vt service status. subId=" + mSubId, exception);
+ }
+ return false;
}
/**
diff --git a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
index f3fdcc9..21d49d9 100644
--- a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
+++ b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
@@ -42,7 +42,7 @@
implements LifecycleObserver {
private static final String TAG = "ContactDiscoveryPref";
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
private ImsManager mImsManager;
private CarrierConfigManager mCarrierConfigManager;
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index b505c2f..076a87b 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -26,6 +26,10 @@
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_TD_SCDMA;
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_UNKNOWN;
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
import android.content.ContentResolver;
import android.content.Context;
@@ -379,8 +383,10 @@
context.getContentResolver(),
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
- if (settingsNetworkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA
- || settingsNetworkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO) {
+ if (settingsNetworkMode == NETWORK_MODE_LTE_GSM_WCDMA
+ || settingsNetworkMode == NETWORK_MODE_LTE_CDMA_EVDO
+ || settingsNetworkMode == NETWORK_MODE_NR_LTE_GSM_WCDMA
+ || settingsNetworkMode == NETWORK_MODE_NR_LTE_CDMA_EVDO) {
return true;
}
@@ -407,8 +413,10 @@
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
if (isWorldMode(context, subId)) {
- if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO
- || networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) {
+ if (networkMode == NETWORK_MODE_LTE_CDMA_EVDO
+ || networkMode == NETWORK_MODE_LTE_GSM_WCDMA
+ || networkMode == NETWORK_MODE_NR_LTE_CDMA_EVDO
+ || networkMode == NETWORK_MODE_NR_LTE_GSM_WCDMA) {
return true;
} else if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
return true;
diff --git a/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java b/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
index e90a240..023f89e 100644
--- a/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
+++ b/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
@@ -16,6 +16,9 @@
package com.android.settings.network.telephony.cdma;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
+
import android.content.Context;
import android.provider.Settings;
import android.telephony.TelephonyManager;
@@ -53,8 +56,9 @@
mContext.getContentResolver(),
Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
- listPreference.setEnabled(
- settingsNetworkMode != TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ final boolean enableList = settingsNetworkMode != NETWORK_MODE_LTE_GSM_WCDMA
+ && settingsNetworkMode != NETWORK_MODE_NR_LTE_GSM_WCDMA;
+ listPreference.setEnabled(enableList);
}
@Override
diff --git a/src/com/android/settings/notification/app/NotificationPreferenceController.java b/src/com/android/settings/notification/app/NotificationPreferenceController.java
index be1ce1b..ecba95b 100644
--- a/src/com/android/settings/notification/app/NotificationPreferenceController.java
+++ b/src/com/android/settings/notification/app/NotificationPreferenceController.java
@@ -134,7 +134,7 @@
return channel.getImportance() == IMPORTANCE_NONE;
}
- return channel.isBlockableSystem() || !mAppRow.systemApp
+ return channel.isBlockable() || !mAppRow.systemApp
|| channel.getImportance() == IMPORTANCE_NONE;
}
return false;
diff --git a/src/com/android/settings/panel/MediaOutputGroupPanel.java b/src/com/android/settings/panel/MediaOutputGroupPanel.java
index 4a37c52..d98c0b1 100644
--- a/src/com/android/settings/panel/MediaOutputGroupPanel.java
+++ b/src/com/android/settings/panel/MediaOutputGroupPanel.java
@@ -148,7 +148,7 @@
@Override
public void onDeviceListUpdate(List<MediaDevice> devices) {
if (mCallback != null) {
- mCallback.onGroupChanged();
+ mCallback.onHeaderChanged();
}
}
diff --git a/src/com/android/settings/panel/MediaOutputPanel.java b/src/com/android/settings/panel/MediaOutputPanel.java
index 1145c42..998cfc8 100644
--- a/src/com/android/settings/panel/MediaOutputPanel.java
+++ b/src/com/android/settings/panel/MediaOutputPanel.java
@@ -33,6 +33,7 @@
import android.media.MediaMetadata;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@@ -66,12 +67,11 @@
private final Context mContext;
private final String mPackageName;
- private PanelContentCallback mCallback;
- private boolean mIsCustomizedButtonUsed = true;
-
@VisibleForTesting
LocalMediaManager mLocalMediaManager;
+ private PanelContentCallback mCallback;
+ private boolean mIsCustomizedButtonUsed = true;
private MediaSessionManager mMediaSessionManager;
private MediaController mMediaController;
@@ -82,20 +82,6 @@
private MediaOutputPanel(Context context, String packageName) {
mContext = context.getApplicationContext();
mPackageName = TextUtils.isEmpty(packageName) ? "" : packageName;
-
- if (!TextUtils.isEmpty(mPackageName)) {
- mMediaSessionManager = mContext.getSystemService(MediaSessionManager.class);
- for (MediaController controller : mMediaSessionManager.getActiveSessions(null)) {
- if (TextUtils.equals(controller.getPackageName(), mPackageName)) {
- mMediaController = controller;
- break;
- }
- }
- }
-
- if (mMediaController == null) {
- Log.e(TAG, "Unable to find " + mPackageName + " media controller");
- }
}
@Override
@@ -228,6 +214,19 @@
@OnLifecycleEvent(ON_START)
public void onStart() {
+ if (!TextUtils.isEmpty(mPackageName)) {
+ mMediaSessionManager = mContext.getSystemService(MediaSessionManager.class);
+ for (MediaController controller : mMediaSessionManager.getActiveSessions(null)) {
+ if (TextUtils.equals(controller.getPackageName(), mPackageName)) {
+ mMediaController = controller;
+ mMediaController.registerCallback(mCb);
+ break;
+ }
+ }
+ }
+ if (mMediaController == null) {
+ Log.d(TAG, "No media controller for " + mPackageName);
+ }
if (mLocalMediaManager == null) {
mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
}
@@ -237,6 +236,9 @@
@OnLifecycleEvent(ON_STOP)
public void onStop() {
+ if (mMediaController != null) {
+ mMediaController.unregisterCallback(mCb);
+ }
mLocalMediaManager.unregisterCallback(this);
mLocalMediaManager.stopScan();
}
@@ -245,4 +247,20 @@
public int getViewType() {
return PanelContent.VIEW_TYPE_SLIDER;
}
+
+ private final MediaController.Callback mCb = new MediaController.Callback() {
+ @Override
+ public void onMetadataChanged(MediaMetadata metadata) {
+ if (mCallback != null) {
+ mCallback.onHeaderChanged();
+ }
+ }
+
+ @Override
+ public void onPlaybackStateChanged(PlaybackState state) {
+ if (mCallback != null && state.getState() != PlaybackState.STATE_PLAYING) {
+ mCallback.forceClose();
+ }
+ }
+ };
}
diff --git a/src/com/android/settings/panel/PanelContentCallback.java b/src/com/android/settings/panel/PanelContentCallback.java
index ce8ea22..63c2c55 100644
--- a/src/com/android/settings/panel/PanelContentCallback.java
+++ b/src/com/android/settings/panel/PanelContentCallback.java
@@ -28,8 +28,13 @@
void onCustomizedButtonStateChanged();
/**
- * It will be called when group content is changed. For example, to add/remove a device into
+ * It will be called when header content is changed. For example, to add/remove a device into
* a group
*/
- void onGroupChanged();
+ void onHeaderChanged();
+
+ /**
+ * It will be called when panel requests to close itself.
+ */
+ void forceClose();
}
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
index 30cc2a8..28515fd 100644
--- a/src/com/android/settings/panel/PanelFragment.java
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -426,10 +426,23 @@
}
@Override
- public void onGroupChanged() {
+ public void onHeaderChanged() {
ThreadUtils.postOnMainThread(() -> {
+ mTitleIcon.setImageIcon(mPanel.getIcon().toIcon(getContext()));
+ mHeaderTitle.setText(mPanel.getTitle());
mHeaderSubtitle.setText(mPanel.getSubTitle());
});
}
+
+ @Override
+ public void forceClose() {
+ mPanelClosedKey = PanelClosedKeys.KEY_OTHERS;
+ getFragmentActivity().finish();
+ }
+
+ @VisibleForTesting
+ FragmentActivity getFragmentActivity() {
+ return getActivity();
+ }
}
}
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index bc0e5c7..7e78322 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -70,6 +70,13 @@
});
cleanup();
}
+
+ @Override
+ public void onAuthenticationFailed() {
+ mClientExecutor.execute(() -> {
+ mClientCallback.onAuthenticationFailed();
+ });
+ }
};
private final DialogInterface.OnClickListener mNegativeButtonListener =
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index 6809f35..755d158 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -42,6 +42,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
+import android.service.persistentdata.PersistentDataBlockManager;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
@@ -281,7 +282,11 @@
}
protected boolean canRunBeforeDeviceProvisioned() {
- return false;
+ PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
+ getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+
+ // Can only run during setup if factory reset protection has already been cleared
+ return (pdbm != null && pdbm.getDataBlockSize() == 0);
}
protected Class<? extends ChooseLockGeneric.InternalActivity> getInternalActivityClass() {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 83368f9..220b649 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -111,6 +111,7 @@
});
private AuthenticationCallback mAuthenticationCallback = new AuthenticationCallback() {
+ @Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
if (!mGoingToBackground) {
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
@@ -123,17 +124,24 @@
}
}
+ @Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
mTrustManager.setDeviceLockedForUser(mUserId, false);
-
+ final boolean isStrongAuth = result.getAuthenticationType()
+ == BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils, mUserManager,
- mUserId);
+ mDevicePolicyManager, mUserId, isStrongAuth);
ConfirmDeviceCredentialUtils.checkForPendingIntent(
ConfirmDeviceCredentialActivity.this);
setResult(Activity.RESULT_OK);
finish();
}
+
+ @Override
+ public void onAuthenticationFailed() {
+ mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
+ }
};
private String getStringForError(int errorCode) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
index 11d6924..a5febeb 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
@@ -20,6 +20,7 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.IActivityManager;
+import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.IntentSender;
import android.os.RemoteException;
@@ -54,8 +55,12 @@
}
public static void reportSuccessfulAttempt(LockPatternUtils utils, UserManager userManager,
- int userId) {
- utils.reportSuccessfulPasswordAttempt(userId);
+ DevicePolicyManager dpm, int userId, boolean isStrongAuth) {
+ if (isStrongAuth) {
+ utils.reportSuccessfulPasswordAttempt(userId);
+ } else {
+ dpm.reportSuccessfulBiometricAttempt(userId);
+ }
if (userManager.isManagedProfile(userId)) {
// Keyguard is responsible to disable StrongAuth for primary user. Disable StrongAuth
// for work challenge only here.
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index ce8813f..260919d 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -475,7 +475,8 @@
if (matched) {
if (newResult) {
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
- mUserManager, mEffectiveUserId);
+ mUserManager, mDevicePolicyManager, mEffectiveUserId,
+ /* isStrongAuth */ true);
}
startDisappearAnimation(intent);
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index b2afb22..06f3d93 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -509,7 +509,8 @@
if (matched) {
if (newResult) {
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
- mUserManager, mEffectiveUserId);
+ mUserManager, mDevicePolicyManager, mEffectiveUserId,
+ /* isStrongAuth */ true);
}
startDisappearAnimation(intent);
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/password/SetNewPasswordActivity.java b/src/com/android/settings/password/SetNewPasswordActivity.java
index 4bffbf5..19f2941 100644
--- a/src/com/android/settings/password/SetNewPasswordActivity.java
+++ b/src/com/android/settings/password/SetNewPasswordActivity.java
@@ -110,7 +110,7 @@
@Override
public void launchChooseLock(Bundle chooseLockFingerprintExtras) {
- final boolean isInSetupWizard = !WizardManagerHelper.isDeviceProvisioned(this);
+ final boolean isInSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
Intent intent = isInSetupWizard ? new Intent(this, SetupChooseLockGeneric.class)
: new Intent(this, ChooseLockGeneric.class);
intent.setAction(mNewPasswordAction);
diff --git a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
index 237e58f..bb3c762 100644
--- a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
+++ b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
@@ -61,12 +61,14 @@
import androidx.annotation.Nullable;
import androidx.slice.SliceViewManager;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.dashboard.DashboardFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.slices.SettingsSliceProvider;
import com.android.settingslib.drawer.ActivityTile;
+import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.search.Indexable;
@@ -379,9 +381,7 @@
final String currentPackageName = context.getPackageName();
for (DashboardCategory category : dashboardFeatureProvider.getAllCategories()) {
for (Tile tile : category.getTiles()) {
- if (currentPackageName.equals(tile.getPackageName())
- && tile instanceof ActivityTile) {
- // Skip Settings injected items because they should be indexed in the sub-pages.
+ if (!isEligibleForIndexing(currentPackageName, tile)) {
continue;
}
final SearchIndexableRaw raw = new SearchIndexableRaw(context);
@@ -402,6 +402,20 @@
return rawList;
}
+ @VisibleForTesting
+ boolean isEligibleForIndexing(String packageName, Tile tile) {
+ if (TextUtils.equals(packageName, tile.getPackageName())
+ && tile instanceof ActivityTile) {
+ // Skip Settings injected items because they should be indexed in the sub-pages.
+ return false;
+ }
+ if (TextUtils.equals(tile.getCategory(), CategoryKey.CATEGORY_HOMEPAGE)) {
+ // Skip homepage injected items since we would like to index their target activity.
+ return false;
+ }
+ return true;
+ }
+
private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) {
final Object[] ref = new Object[INDEXABLES_RAW_COLUMNS.length];
ref[COLUMN_INDEX_RAW_TITLE] = raw.title;
diff --git a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
index 8d093c0..bf807a1 100644
--- a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
+++ b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
@@ -17,6 +17,7 @@
package com.android.settings.security;
import android.app.KeyguardManager;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.Settings;
@@ -26,19 +27,23 @@
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.wifi.dpp.WifiDppUtils;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
/** Enable/disable user confirmation before deleting an eSim */
public class ConfirmSimDeletionPreferenceController extends BasePreferenceController implements
Preference.OnPreferenceChangeListener{
public static final String KEY_CONFIRM_SIM_DELETION = "confirm_sim_deletion";
private boolean mConfirmationDefaultOn;
+ private MetricsFeatureProvider mMetricsFeatureProvider;
public ConfirmSimDeletionPreferenceController(Context context, String key) {
super(context, key);
mConfirmationDefaultOn =
context.getResources()
.getBoolean(R.bool.config_sim_deletion_confirmation_default_on);
+ mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
@Override
@@ -72,11 +77,15 @@
return false;
}
if (!isChecked()) {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_CONFIRM_SIM_DELETION_ON);
setChecked(true);
return true;
} else {
// prevent disabling the feature until authorized
WifiDppUtils.showLockScreen(mContext, () -> {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_CONFIRM_SIM_DELETION_OFF);
// set data
setChecked(false);
// set UI
diff --git a/src/com/android/settings/security/SimLockPreferenceController.java b/src/com/android/settings/security/SimLockPreferenceController.java
index ffc1d6b..03983b5 100644
--- a/src/com/android/settings/security/SimLockPreferenceController.java
+++ b/src/com/android/settings/security/SimLockPreferenceController.java
@@ -52,13 +52,19 @@
@Override
public int getAvailabilityStatus() {
- final PersistableBundle b = mCarrierConfigManager.getConfig();
- final boolean IsAdmin = mUserManager.isAdminUser();
- if (!IsAdmin || !isSimIccReady() ||
- b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ final List<SubscriptionInfo> subInfoList =
+ mSubscriptionManager.getActiveSubscriptionInfoList();
+
+ if (subInfoList == null) {
return DISABLED_FOR_USER;
}
- return AVAILABLE;
+
+ final boolean isAdmin = mUserManager.isAdminUser();
+ if (isAdmin && (!isHideSimLockSetting(subInfoList))) {
+ return AVAILABLE;
+ }
+
+ return DISABLED_FOR_USER;
}
@Override
@@ -78,34 +84,37 @@
private boolean isSimReady() {
final List<SubscriptionInfo> subInfoList =
mSubscriptionManager.getActiveSubscriptionInfoList();
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- final int simState = mTelephonyManager.getSimState(subInfo.getSimSlotIndex());
- if ((simState != TelephonyManager.SIM_STATE_ABSENT) &&
- (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
- return true;
- }
+ if (subInfoList == null) {
+ return false;
+ }
+
+ for (SubscriptionInfo subInfo : subInfoList) {
+ final int simState = mTelephonyManager.getSimState(subInfo.getSimSlotIndex());
+ if ((simState != TelephonyManager.SIM_STATE_ABSENT)
+ && (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
+ return true;
}
}
return false;
}
- /**
- * Return true if a there is a Slot that has Icc
- */
- private boolean isSimIccReady() {
- final List<SubscriptionInfo> subInfoList =
- mSubscriptionManager.getActiveSubscriptionInfoList();
+ private boolean isHideSimLockSetting(List<SubscriptionInfo> subInfoList) {
+ if (subInfoList == null) {
+ return true;
+ }
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- mTelephonyManager = mTelephonyManager
- .createForSubscriptionId(subInfo.getSimSlotIndex());
- if (mTelephonyManager.hasIccCard()) {
- return true;
- }
+ for (SubscriptionInfo subInfo : subInfoList) {
+ final TelephonyManager telephonyManager = mTelephonyManager
+ .createForSubscriptionId(subInfo.getSubscriptionId());
+ final PersistableBundle bundle = mCarrierConfigManager.getConfigForSubId(
+ subInfo.getSubscriptionId());
+ if (telephonyManager.hasIccCard() && bundle != null
+ && !bundle.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ // one or more sims show sim lock setting UI.
+ return false;
}
}
- return false;
+
+ return true;
}
}
diff --git a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
index a28f990..23971e7 100644
--- a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
+++ b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
@@ -71,7 +71,8 @@
private Button mSubmitBtn;
private Button mCancelBtn;
private WifiEntry mWifiEntry;
- private NetworkDetailsTracker mNetworkDetailsTracker;
+ @VisibleForTesting
+ NetworkDetailsTracker mNetworkDetailsTracker;
private HandlerThread mWorkerThread;
@Override
diff --git a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
index 27cf1e2..44114e5 100644
--- a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
+++ b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
@@ -100,6 +100,10 @@
@Override
public int getAvailabilityStatus() {
+ // It is possible that mEnableUseWifiComponentName is no longer enabled by
+ // USE_OPEN_WIFI_PACKAGE. So update this component to reflect correct availability.
+ updateEnableUseWifiComponentName();
+ checkForFeatureSupportedScorers();
return mDoFeatureSupportedScorersExist ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
diff --git a/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
new file mode 100644
index 0000000..bc3544d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import static junit.framework.Assert.assertEquals;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class AdbAuthorizationTimeoutPreferenceControllerTest {
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+ @Mock
+ private DevelopmentSettingsDashboardFragment mFragment;
+
+ private Context mContext;
+ private ContentResolver mContentResolver;
+ private SwitchPreference mPreference;
+ private AdbAuthorizationTimeoutPreferenceController mPreferenceController;
+ private long mInitialAuthTimeout;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mContentResolver = mContext.getContentResolver();
+
+ mPreferenceController = new AdbAuthorizationTimeoutPreferenceController(mContext);
+ mPreference = spy(new SwitchPreference(mContext));
+ when(mPreferenceScreen.findPreference(mPreferenceController.getPreferenceKey())).thenReturn(
+ mPreference);
+ mPreferenceController.displayPreference(mPreferenceScreen);
+
+ mInitialAuthTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME, mInitialAuthTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableSetting_timeoutSetToZero() throws Exception {
+ // This developer option disables the automatic adb authorization revocation by setting
+ // the timeout value to 0 when enabled.
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(0, authTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableAndDisableSetting_timeoutSetToDefault()
+ throws Exception {
+ // A non-default setting value is not saved when this developer option is enabled and the
+ // setting value is set to 0. If the user subsequently disables the option the setting
+ // value is restored to the default value.
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 1);
+
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ mPreferenceController.onPreferenceChange(mPreference, false);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ }
+
+ @Test
+ public void updateState_timeoutSetToZero_preferenceDisplayedEnabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 0);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(true);
+ }
+
+ @Test
+ public void updateState_timeoutSetToDefault_preferenceDisplayedDisabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(false);
+ }
+
+ @Test
+ public void onDeveloperOptionsSwitchDisabled_preferenceAndTimeoutDisabled() throws Exception {
+ mPreferenceController.onDeveloperOptionsSwitchDisabled();
+
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ verify(mPreference).setChecked(false);
+ }
+}
+
diff --git a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
index 6fd6f55..171fc6b 100644
--- a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
@@ -88,20 +88,20 @@
}
@Test
- public void onDeveloperOptionsDisabled_shouldDisablePreference() {
- mController.onDeveloperOptionsDisabled();
+ public void onDeveloperOptionsDisabled_shouldEnablePreference() {
+ mController.onDeveloperOptionsSwitchDisabled();
verify(mPreference).setEnabled(false);
- verify(mPreference).setChecked(false);
+ verify(mPreference).setChecked(true);
- assertThat(isSettingEnabled()).isFalse();
+ assertThat(isSettingEnabled()).isTrue();
}
private boolean isSettingEnabled() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_OFF
- /* default off */)
+ EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON
+ /* default on */)
== EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON;
}
}
diff --git a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
index 1e59167..e59bd0b 100644
--- a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
+++ b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
@@ -93,7 +93,7 @@
mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_After_SDK_1_1", 1, false, false, "");
mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_After_SDK_1_2", 1, false, false, "");
mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_After_SDK_2", 2, false, false, "");
- when(mPlatformCompat.listAllChanges()).thenReturn(mChanges);
+ when(mPlatformCompat.listUIChanges()).thenReturn(mChanges);
when(mPlatformCompat.getOverrideValidator()).thenReturn(mOverrideValidator);
// By default, allow any change
when(mOverrideValidator.getOverrideAllowedState(anyLong(),anyString()))
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
index ec6436a..e411531 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
@@ -68,7 +68,7 @@
@Test
public void testOnReceive_powerSaveModeChanged_invokeCallback() {
- Intent intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGING);
+ Intent intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
mBatterySaverReceiver.onReceive(mContext, intent);
diff --git a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
index 4fd7d0c..3daf6cb 100644
--- a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
+++ b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
@@ -17,6 +17,7 @@
package com.android.settings.network.ims;
import android.content.Context;
+import android.telephony.ims.ImsException;
import com.android.ims.ImsManager;
@@ -29,6 +30,7 @@
private Boolean mIsTtyOnVolteEnabled;
private Boolean mIsProvisionedOnDevice;
private Boolean mIsEnabledByUser;
+ private Boolean mIsServiceStateReady;
/**
* Constructor
@@ -68,6 +70,19 @@
return super.isProvisionedOnDevice(subId);
}
+ public void setServiceStateReady(boolean isReady) {
+ mIsServiceStateReady = isReady;
+ }
+
+ @Override
+ boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+ IllegalArgumentException {
+ if (mIsServiceStateReady != null) {
+ return mIsServiceStateReady;
+ }
+ return super.isServiceStateReady(subId);
+ }
+
public void setIsEnabledByUser(boolean enabled) {
mIsEnabledByUser = enabled;
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
index 45a4563..0370bfa 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
@@ -64,7 +64,7 @@
private static final int TEST_SUB_ID = 2;
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
@Mock private ImsManager mImsManager;
@Mock private ImsRcsManager mImsRcsManager;
diff --git a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
index c766289..04fc4b9 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
@@ -27,7 +27,6 @@
import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.telephony.ims.ProvisioningManager;
-import android.telephony.ims.feature.ImsFeature;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
@@ -98,7 +97,7 @@
doReturn(true).when(mImsManager).isVtEnabledByPlatform();
mQueryImsState.setIsProvisionedOnDevice(true);
- doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState();
+ mQueryImsState.setServiceStateReady(true);
doReturn(true).when(mTelephonyManager).isDataEnabled();
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
diff --git a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
index b83ab77..d203c47 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
@@ -200,7 +200,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_DEFAULT);
- channel.setBlockableSystem(true);
+ channel.setBlockable(true);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
diff --git a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
index 170a5e0..259f40e 100644
--- a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
@@ -236,7 +236,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -247,7 +247,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
@@ -259,7 +259,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(true);
+ when(channel.isBlockable()).thenReturn(true);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -270,7 +270,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null, null, null);
diff --git a/tests/robotests/src/com/android/settings/panel/FakePanelContent.java b/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
index 4d91f52..bf2ac0d 100644
--- a/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
+++ b/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
@@ -42,6 +42,7 @@
public static final Intent INTENT = new Intent();
+ private CharSequence mTitle = TITLE;
private CharSequence mSubTitle;
private IconCompat mIcon;
private int mViewType;
@@ -51,22 +52,26 @@
return mIcon;
}
+ public void setIcon(IconCompat icon) {
+ mIcon = icon;
+ }
+
@Override
public CharSequence getSubTitle() {
return mSubTitle;
}
- public void setIcon(IconCompat icon) {
- mIcon = icon;
- }
-
public void setSubTitle(CharSequence subTitle) {
mSubTitle = subTitle;
}
@Override
public CharSequence getTitle() {
- return TITLE;
+ return mTitle;
+ }
+
+ public void setTitle(CharSequence title) {
+ mTitle = title;
}
@Override
diff --git a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
index b95c9d0..43cecfe 100644
--- a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
+++ b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
@@ -22,6 +22,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -30,6 +31,7 @@
import android.media.MediaMetadata;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
import android.net.Uri;
import com.android.settings.R;
@@ -41,6 +43,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
@@ -62,15 +65,18 @@
private MediaController mMediaController;
@Mock
private MediaMetadata mMediaMetadata;
-
@Mock
private LocalMediaManager mLocalMediaManager;
@Mock
private PanelContentCallback mCallback;
+ @Mock
+ private PlaybackState mPlaybackState;
private MediaOutputPanel mPanel;
private Context mContext;
private List<MediaController> mMediaControllers = new ArrayList<>();
+ private ArgumentCaptor<MediaController.Callback> mControllerCbs =
+ ArgumentCaptor.forClass(MediaController.Callback.class);
@Before
public void setUp() {
@@ -112,6 +118,7 @@
public void onStart_shouldRegisterCallback() {
mPanel.onStart();
+ verify(mMediaController).registerCallback(any());
verify(mLocalMediaManager).registerCallback(any());
verify(mLocalMediaManager).startScan();
}
@@ -167,6 +174,7 @@
@Test
public void getTitle_withMetadata_returnArtistName() {
+ mPanel.onStart();
when(mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ARTIST)).thenReturn(TEST_ARTIST);
when(mMediaController.getMetadata()).thenReturn(mMediaMetadata);
@@ -201,6 +209,7 @@
@Test
public void getSubTitle_withMetadata_returnAlbumName() {
+ mPanel.onStart();
when(mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ALBUM)).thenReturn(TEST_ALBUM);
when(mMediaController.getMetadata()).thenReturn(mMediaMetadata);
@@ -243,4 +252,30 @@
verify(mLocalMediaManager).releaseSession();
}
+
+ @Test
+ public void onMetadataChanged_verifyCallOnHeaderChanged() {
+ mPanel.onStart();
+ verify(mMediaController).registerCallback(mControllerCbs.capture());
+ final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
+
+ controllerCallbacks.onMetadataChanged(mMediaMetadata);
+
+ verify(mCallback).onHeaderChanged();
+ }
+
+ @Test
+ public void onPlaybackStateChanged_stateFromPlayingToStopped_verifyCallForceClose() {
+ mPanel.onStart();
+ verify(mMediaController).registerCallback(mControllerCbs.capture());
+ final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
+ when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PLAYING);
+ controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+ verify(mCallback, never()).forceClose();
+
+ when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_STOPPED);
+ controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+
+ verify(mCallback).forceClose();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
index 1976557..9df5af1 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
@@ -23,6 +23,7 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -41,6 +42,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@@ -51,7 +53,10 @@
@RunWith(RobolectricTestRunner.class)
public class PanelFragmentTest {
+ private static final String TITLE = "title";
+ private static final String TITLE2 = "title2";
private static final String SUBTITLE = "subtitle";
+ private static final String SUBTITLE2 = "subtitle2";
private Context mContext;
private PanelFragment mPanelFragment;
@@ -59,6 +64,8 @@
private FakeFeatureFactory mFakeFeatureFactory;
private PanelFeatureProvider mPanelFeatureProvider;
private FakePanelContent mFakePanelContent;
+ private ArgumentCaptor<PanelContentCallback> mPanelContentCbs = ArgumentCaptor.forClass(
+ PanelContentCallback.class);
private final String FAKE_EXTRA = "fake_extra";
@@ -69,9 +76,11 @@
mPanelFeatureProvider = spy(new PanelFeatureProviderImpl());
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mFakeFeatureFactory.panelFeatureProvider = mPanelFeatureProvider;
- mFakePanelContent = new FakePanelContent();
+ mFakePanelContent = spy(new FakePanelContent());
doReturn(mFakePanelContent).when(mPanelFeatureProvider).getPanel(any(), any());
+ }
+ private void initFakeActivity() {
mActivity = spy(Robolectric.buildActivity(FakeSettingsPanelActivity.class).setup().get());
mPanelFragment =
@@ -86,6 +95,7 @@
@Test
public void onCreateView_countdownLatch_setup() {
+ initFakeActivity();
mPanelFragment.onCreateView(LayoutInflater.from(mContext),
new LinearLayout(mContext), null);
PanelSlicesLoaderCountdownLatch countdownLatch =
@@ -99,6 +109,7 @@
@Test
public void onCreate_logsOpenEvent() {
+ initFakeActivity();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
SettingsEnums.PAGE_VISIBLE,
@@ -109,6 +120,7 @@
@Test
public void onDestroy_logCloseEvent() {
+ initFakeActivity();
mPanelFragment.onDestroyView();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
@@ -120,6 +132,7 @@
@Test
public void panelSeeMoreClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getSeeMoreListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -136,6 +149,7 @@
@Test
public void panelDoneClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getCloseListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -178,10 +192,62 @@
@Test
public void notSupportIcon_displayDefaultHeaderLayout() {
- final View titleView = mPanelFragment.mLayoutView.findViewById(R.id.panel_title);
- final View panelHeader = mPanelFragment.mLayoutView.findViewById(R.id.panel_header);
+ final ActivityController<FakeSettingsPanelActivity> activityController =
+ Robolectric.buildActivity(FakeSettingsPanelActivity.class);
+ activityController.setup();
+ final PanelFragment panelFragment = (PanelFragment)
+ Objects.requireNonNull(activityController
+ .get()
+ .getSupportFragmentManager()
+ .findFragmentById(R.id.main_content));
+
+ final View titleView = panelFragment.mLayoutView.findViewById(R.id.panel_title);
+ final View panelHeader = panelFragment.mLayoutView.findViewById(R.id.panel_header);
assertThat(panelHeader.getVisibility()).isEqualTo(View.GONE);
assertThat(titleView.getVisibility()).isEqualTo(View.VISIBLE);
}
+
+ @Test
+ public void onHeaderChanged_updateHeader_verifyTitle() {
+ mFakePanelContent.setIcon(IconCompat.createWithResource(mContext, R.drawable.ic_android));
+ mFakePanelContent.setTitle(TITLE);
+ mFakePanelContent.setSubTitle(SUBTITLE);
+ final ActivityController<FakeSettingsPanelActivity> activityController =
+ Robolectric.buildActivity(FakeSettingsPanelActivity.class);
+ activityController.setup();
+ final PanelFragment panelFragment = (PanelFragment)
+ Objects.requireNonNull(activityController
+ .get()
+ .getSupportFragmentManager()
+ .findFragmentById(R.id.main_content));
+ final TextView headerTitle = panelFragment.mLayoutView.findViewById(R.id.header_title);
+ final TextView headerSubtitle = panelFragment.mLayoutView.findViewById(
+ R.id.header_subtitle);
+
+ assertThat(headerTitle.getText()).isEqualTo(TITLE);
+ assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE);
+
+ mFakePanelContent.setTitle(TITLE2);
+ mFakePanelContent.setSubTitle(SUBTITLE2);
+ verify(mFakePanelContent).registerCallback(mPanelContentCbs.capture());
+ final PanelContentCallback panelContentCallbacks = mPanelContentCbs.getValue();
+ panelContentCallbacks.onHeaderChanged();
+
+ assertThat(headerTitle.getText()).isEqualTo(TITLE2);
+ assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE2);
+ }
+
+ @Test
+ public void forceClose_verifyFinish() {
+ initFakeActivity();
+ verify(mFakePanelContent).registerCallback(mPanelContentCbs.capture());
+ final PanelContentCallback panelContentCallbacks = spy(mPanelContentCbs.getValue());
+ when(((PanelFragment.LocalPanelCallback) panelContentCallbacks).getFragmentActivity())
+ .thenReturn(mActivity);
+
+ panelContentCallbacks.forceClose();
+
+ verify(mActivity).finish();
+ }
}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
index 1bdadb2..6b3fdf4 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
@@ -46,6 +46,7 @@
import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.search.SearchFeatureProvider;
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
+import com.android.settings.testutils.shadow.ShadowPersistentDataBlockManager;
import com.android.settings.testutils.shadow.ShadowStorageManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settings.testutils.shadow.ShadowUtils;
@@ -63,6 +64,7 @@
@Config(
shadows = {
ShadowLockPatternUtils.class,
+ ShadowPersistentDataBlockManager.class,
ShadowStorageManager.class,
ShadowUserManager.class,
ShadowUtils.class
@@ -82,11 +84,13 @@
public void tearDown() {
Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 1);
ShadowStorageManager.reset();
+ ShadowPersistentDataBlockManager.reset();
}
@Test
- public void onCreate_deviceNotProvisioned_shouldFinishActivity() {
+ public void onCreate_deviceNotProvisioned_persistentDataExists_shouldFinishActivity() {
Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 0);
+ ShadowPersistentDataBlockManager.setDataBlockSize(1000);
initActivity(null);
assertThat(mActivity.isFinishing()).isTrue();
@@ -191,7 +195,18 @@
}
@Test
- public void updatePreferencesOrFinish_callingAppIsAdmin_footerInvisible() {
+ public void updatePreferencesOrFinish_callingAppIsAdmin_deviceProvisioned_footerInvisible() {
+ initActivity(new Intent().putExtra(EXTRA_KEY_IS_CALLING_APP_ADMIN, true));
+
+ mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */ false);
+
+ FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
+ assertThat(footer.isVisible()).isFalse();
+ }
+
+ @Test
+ public void updatePreferencesOrFinish_callingAppIsAdmin_deviceNotProvisioned_footerInvisible() {
+ Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 0);
initActivity(new Intent().putExtra(EXTRA_KEY_IS_CALLING_APP_ADMIN, true));
mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */ false);
diff --git a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
index 04a2157..b36af98 100644
--- a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
@@ -45,6 +45,8 @@
import com.android.settings.testutils.shadow.ShadowPasswordUtils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.google.android.setupcompat.util.WizardManagerHelper;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -111,6 +113,7 @@
activity.launchChooseLock(new Bundle());
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
Intent intent = getLaunchChooseLockIntent(shadowActivity);
+ intent.putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, true);
assertThat(intent.getComponent())
.isEqualTo(new ComponentName(activity, SetupChooseLockGeneric.class));
diff --git a/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java b/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
index 0db684e..c9bff38 100644
--- a/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
+++ b/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
@@ -6,6 +6,7 @@
import static org.mockito.Mockito.spy;
import android.Manifest;
+import android.content.pm.ActivityInfo;
import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;
@@ -13,6 +14,8 @@
import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settingslib.drawer.ActivityTile;
+import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.search.SearchIndexableData;
import org.junit.After;
@@ -29,7 +32,8 @@
@RunWith(RobolectricTestRunner.class)
public class SettingsSearchIndexablesProviderTest {
- private static final String BASE_AUTHORITY = "com.android.settings";
+ private static final String PACKAGE_NAME = "com.android.settings";
+ private static final String BASE_AUTHORITY = "content://" + PACKAGE_NAME + "/";
private SettingsSearchIndexablesProvider mProvider;
private FakeFeatureFactory mFakeFeatureFactory;
@@ -40,7 +44,7 @@
ProviderInfo info = new ProviderInfo();
info.exported = true;
info.grantUriPermissions = true;
- info.authority = BASE_AUTHORITY;
+ info.authority = PACKAGE_NAME;
info.readPermission = Manifest.permission.READ_SEARCH_INDEXABLES;
mProvider.attachInfo(RuntimeEnvironment.application, info);
@@ -60,8 +64,7 @@
@Test
public void testRawColumnFetched() {
- Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.INDEXABLES_RAW_PATH);
+ Uri rawUri = Uri.parse(BASE_AUTHORITY + SearchIndexablesContract.INDEXABLES_RAW_PATH);
final Cursor cursor = mProvider.query(rawUri,
SearchIndexablesContract.INDEXABLES_RAW_COLUMNS, null, null, null);
@@ -83,8 +86,7 @@
@Test
public void testResourcesColumnFetched() {
- Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.INDEXABLES_XML_RES_PATH);
+ Uri rawUri = Uri.parse(BASE_AUTHORITY + SearchIndexablesContract.INDEXABLES_XML_RES_PATH);
final Cursor cursor = mProvider.query(rawUri,
SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS, null, null, null);
@@ -102,8 +104,8 @@
@Test
@Config(qualifiers = "mcc999")
public void testNonIndexablesColumnFetched() {
- final Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH);
+ final Uri rawUri = Uri.parse(
+ BASE_AUTHORITY + SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH);
final List<String> keys = new ArrayList<>();
@@ -117,4 +119,37 @@
assertThat(keys).hasSize(3);
assertThat(keys).containsAllOf("pref_key_1", "pref_key_3", "pref_key_5");
}
+
+ @Test
+ public void testIsEligibleForIndexing_isSettingsInjectedItem_ShouldBeFalse() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = PACKAGE_NAME;
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_SYSTEM);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
+ }
+
+ @Test
+ public void testIsEligibleForIndexing_isHomepageInjectedItem_ShouldBeFalse() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = "pkg";
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_HOMEPAGE);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
+ }
+
+ @Test
+ public void testIsEligibleForIndexing_normalInjectedItem_ShouldBeTrue() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = "pkg";
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_CONNECT);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isTrue();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
index 89be17a..0ab4256 100644
--- a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
@@ -103,7 +103,7 @@
setupMockIcc();
final PersistableBundle pb = new PersistableBundle();
pb.putBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, true);
- when(mCarrierManager.getConfig()).thenReturn(pb);
+ when(mCarrierManager.getConfigForSubId(anyInt())).thenReturn(pb);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.DISABLED_FOR_USER);
@@ -114,7 +114,7 @@
when(mUserManager.isAdminUser()).thenReturn(true);
setupMockIcc();
final PersistableBundle pb = new PersistableBundle();
- when(mCarrierManager.getConfig()).thenReturn(pb);
+ when(mCarrierManager.getConfigForSubId(anyInt())).thenReturn(pb);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java
new file mode 100644
index 0000000..dbbdd3d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.testutils.shadow;
+
+import android.service.persistentdata.PersistentDataBlockManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+@Implements(PersistentDataBlockManager.class)
+public class ShadowPersistentDataBlockManager {
+ private static int sDataBlockSize = 0;
+
+ @Resetter
+ public static void reset() {
+ sDataBlockSize = 0;
+ }
+
+ @Implementation
+ protected int getDataBlockSize() {
+ return sDataBlockSize;
+ }
+
+ public static void setDataBlockSize(int dataBlockSize) {
+ sDataBlockSize = dataBlockSize;
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
index 1f0c312..ce9d10c 100644
--- a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
@@ -24,21 +24,17 @@
import android.app.settings.SettingsEnums;
import android.os.Bundle;
-import com.android.settings.testutils.shadow.ShadowConnectivityManager;
+import com.android.wifitrackerlib.NetworkDetailsTracker;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
import org.robolectric.shadows.androidx.fragment.FragmentController;
-// TODO(b/70983952): Can't test because b/146802959, should remove @Ignore tag after it's fixed.
-@Ignore
@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowConnectivityManager.class)
public class ConfigureWifiEntryFragmentTest {
private static final String KEY_SSID = "key_ssid";
@@ -46,6 +42,9 @@
private ConfigureWifiEntryFragment mConfigureWifiEntryFragment;
+ @Mock
+ private NetworkDetailsTracker mNetworkDetailsTracker;
+
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
@@ -55,6 +54,8 @@
bundle.putInt(KEY_SECURITY, 1 /* WEP */);
mConfigureWifiEntryFragment = spy(new ConfigureWifiEntryFragment());
mConfigureWifiEntryFragment.setArguments(bundle);
+ mConfigureWifiEntryFragment.mNetworkDetailsTracker = mNetworkDetailsTracker;
+
FragmentController.setupFragment(mConfigureWifiEntryFragment);
}
diff --git a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
index beaa1a6..ca636a4 100644
--- a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
@@ -39,7 +39,6 @@
import android.provider.Settings;
import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import com.android.settings.R;
@@ -144,6 +143,19 @@
}
@Test
+ public void isAvailable_disableUseOpenWifiComponentBetweenCalls_returnsTrueThenReturnsFalse() {
+ setupScorers(Lists.newArrayList(sAppData));
+ createController();
+
+ assertThat(mController.isAvailable()).isTrue();
+
+ // Update NetworkScorerAppData so that it no longer has openWifiActivity.
+ setupScorers(Lists.newArrayList(sAppDataNoActivity));
+
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
public void setChecked_withTrue_enableShouldStartEnableActivity() {
setupScorers(Lists.newArrayList(sAppData, sAppDataNoActivity));
createController();