Merge "Do not reset incorrect password attempts after biometric authentication" 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 b86f624..98b9772 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2742,7 +2742,7 @@
<!-- Display settings screen, display white balance settings summary [CHAR LIMIT=NONE] -->
<string name="display_white_balance_summary"></string>
<!-- Display settings screen, setting option name to enable adaptive sleep [CHAR LIMIT=30] -->
- <string name="adaptive_sleep_title">Screen attention</string>
+ <string name="adaptive_sleep_title">Turn on screen attention</string>
<!-- Setting option summary when adaptive sleep is on [CHAR LIMIT=NONE] -->
<string name="adaptive_sleep_summary_on">On / Screen won\u2019t turn off if you\u2019re looking at it</string>
<!-- Setting option summary when adaptive sleep is off [CHAR LIMIT=NONE] -->
@@ -2756,7 +2756,7 @@
<!-- Description feature's privacy sensitive details to make sure users understand what feature users, what it saves/sends etc [CHAR LIMIT=NONE]-->
<string name="adaptive_sleep_privacy">Screen attention uses the front camera to see if someone is looking at the screen. It works on device, and images are never stored or sent to Google.</string>
<!-- Description about the contextual adaptive sleep card [CHAR LIMIT=NONE]-->
- <string name="adaptive_sleep_contextual_slice_summary">Keep screen on when viewing it</string>
+ <string name="adaptive_sleep_contextual_slice_summary">Keep screen on when looking at it</string>
<!-- Night display screen, setting option name to enable night display (renamed "Night Light" with title caps). [CHAR LIMIT=30] -->
<string name="night_display_title">Night Light</string>
@@ -4877,52 +4877,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 +5009,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 +6165,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>
@@ -8448,7 +8479,7 @@
<string name="notification_assistant_security_warning_summary">
<xliff:g id="notification_assistant_name" example="Notification Assistant">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive.
- It will also be able to modify or dismiss notifications or trigger action buttons they contain.
+ This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string>
@@ -8461,7 +8492,7 @@
<string name="notification_listener_security_warning_summary">
<xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive.
- It will also be able to dismiss notifications or trigger action buttons they contain.
+ This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string>
<string name="notification_listener_disable_warning_summary">
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/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/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index a0aa6db..4179ea3 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -68,11 +68,13 @@
final int result = bm.canAuthenticate(authenticators);
- if (result == BiometricManager.BIOMETRIC_SUCCESS
- || result == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE) {
- Log.e(TAG, "Unexpected result: " + result);
- finish();
- return;
+ if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
+ if (result == BiometricManager.BIOMETRIC_SUCCESS
+ || result == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE) {
+ Log.e(TAG, "Unexpected result: " + result);
+ finish();
+ return;
+ }
}
if (authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
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/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/media/MediaDeviceUpdateWorker.java b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
index 7557fd9..281d23e 100644
--- a/src/com/android/settings/media/MediaDeviceUpdateWorker.java
+++ b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
@@ -112,6 +112,11 @@
notifySliceChange();
}
+ @Override
+ public void onRequestFailed(int reason) {
+ notifySliceChange();
+ }
+
public Collection<MediaDevice> getMediaDevices() {
return mMediaDevices;
}
@@ -119,6 +124,9 @@
public void connectDevice(MediaDevice device) {
ThreadUtils.postOnBackgroundThread(() -> {
mLocalMediaManager.connectDevice(device);
+ ThreadUtils.postOnMainThread(() -> {
+ notifySliceChange();
+ });
});
}
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 318a50d..785d1df 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -42,6 +42,7 @@
import com.android.settings.slices.CustomSliceable;
import com.android.settings.slices.SliceBackgroundWorker;
import com.android.settings.slices.SliceBroadcastReceiver;
+import com.android.settingslib.media.LocalMediaManager;
import com.android.settingslib.media.MediaDevice;
import com.android.settingslib.media.MediaOutputSliceConstants;
@@ -246,6 +247,15 @@
rowBuilder.setTitle(deviceName);
rowBuilder.setPrimaryAction(SliceAction.create(broadcastAction, deviceIcon,
ListBuilder.ICON_IMAGE, deviceName));
+ switch (device.getState()) {
+ case LocalMediaManager.MediaDeviceState.STATE_CONNECTING:
+ rowBuilder.setSubtitle(mContext.getText(R.string.media_output_switching));
+ break;
+ case LocalMediaManager.MediaDeviceState.STATE_CONNECTING_FAILED:
+ rowBuilder.setSubtitle(mContext.getText(
+ R.string.media_output_switch_error_text));
+ break;
+ }
}
return rowBuilder;
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/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..2a9669a 100644
--- a/src/com/android/settings/panel/MediaOutputPanel.java
+++ b/src/com/android/settings/panel/MediaOutputPanel.java
@@ -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,13 @@
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();
+ }
+ }
+ };
}
diff --git a/src/com/android/settings/panel/PanelContentCallback.java b/src/com/android/settings/panel/PanelContentCallback.java
index ce8ea22..989082f 100644
--- a/src/com/android/settings/panel/PanelContentCallback.java
+++ b/src/com/android/settings/panel/PanelContentCallback.java
@@ -28,8 +28,8 @@
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();
}
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
index 30cc2a8..ed5c755 100644
--- a/src/com/android/settings/panel/PanelFragment.java
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -426,8 +426,10 @@
}
@Override
- public void onGroupChanged() {
+ public void onHeaderChanged() {
ThreadUtils.postOnMainThread(() -> {
+ mTitleIcon.setImageIcon(mPanel.getIcon().toIcon(getContext()));
+ mHeaderTitle.setText(mPanel.getTitle());
mHeaderSubtitle.setText(mPanel.getSubTitle());
});
}
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/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/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/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/media/MediaDeviceUpdateWorkerTest.java b/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
index f92b012..8014e56 100644
--- a/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
@@ -30,6 +30,7 @@
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
+import android.media.MediaRoute2ProviderService;
import android.net.Uri;
import com.android.settings.testutils.shadow.ShadowAudioManager;
@@ -95,7 +96,8 @@
@Test
public void onSelectedDeviceStateChanged_shouldNotifyChange() {
- mMediaDeviceUpdateWorker.onSelectedDeviceStateChanged(null, 0);
+ mMediaDeviceUpdateWorker.onSelectedDeviceStateChanged(mMediaDevice1,
+ LocalMediaManager.MediaDeviceState.STATE_CONNECTED);
verify(mResolver).notifyChange(URI, null);
}
@@ -156,6 +158,13 @@
}
@Test
+ public void onRequestFailed_shouldNotifyChange() {
+ mMediaDeviceUpdateWorker.onRequestFailed(MediaRoute2ProviderService.REASON_UNKNOWN_ERROR);
+
+ verify(mResolver).notifyChange(URI, null /* observer */);
+ }
+
+ @Test
public void onReceive_inCallState_shouldNotifyChange() {
mMediaDeviceUpdateWorker.mLocalMediaManager = mock(LocalMediaManager.class);
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
index 03d85b2..426eacc 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
@@ -336,6 +336,81 @@
}
@Test
+ public void getSlice_onTransferring_containTransferringSubtitle() {
+ final List<MediaDevice> mSelectedDevices = new ArrayList<>();
+ final List<MediaDevice> mSelectableDevices = new ArrayList<>();
+ mDevices.clear();
+ final MediaDevice device = mock(MediaDevice.class);
+ when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
+ when(device.getIcon()).thenReturn(mTestDrawable);
+ when(device.getMaxVolume()).thenReturn(100);
+ when(device.isConnected()).thenReturn(true);
+ when(device.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device.getId()).thenReturn(TEST_DEVICE_1_ID);
+ final MediaDevice device2 = mock(MediaDevice.class);
+ when(device2.getName()).thenReturn(TEST_DEVICE_2_NAME);
+ when(device2.getIcon()).thenReturn(mTestDrawable);
+ when(device2.getMaxVolume()).thenReturn(100);
+ when(device2.isConnected()).thenReturn(false);
+ when(device2.getState()).thenReturn(LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
+ when(device2.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device2.getId()).thenReturn(TEST_DEVICE_2_ID);
+ mSelectedDevices.add(device);
+ mSelectableDevices.add(device2);
+ when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(device);
+ mDevices.add(device);
+ mDevices.add(device2);
+ when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
+ when(mLocalMediaManager.getSelectableMediaDevice()).thenReturn(mSelectableDevices);
+ mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
+
+ final Slice mediaSlice = mMediaOutputSlice.getSlice();
+ final String sliceInfo = SliceQuery.findAll(mediaSlice, FORMAT_SLICE, HINT_LIST_ITEM,
+ null).toString();
+
+ assertThat(TextUtils.indexOf(sliceInfo, mContext.getText(R.string.media_output_switching)))
+ .isNotEqualTo(-1);
+ }
+
+ @Test
+ public void getSlice_onTransferringFailed_containFailedSubtitle() {
+ final List<MediaDevice> mSelectedDevices = new ArrayList<>();
+ final List<MediaDevice> mSelectableDevices = new ArrayList<>();
+ mDevices.clear();
+ final MediaDevice device = mock(MediaDevice.class);
+ when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
+ when(device.getIcon()).thenReturn(mTestDrawable);
+ when(device.getMaxVolume()).thenReturn(100);
+ when(device.isConnected()).thenReturn(true);
+ when(device.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device.getId()).thenReturn(TEST_DEVICE_1_ID);
+ final MediaDevice device2 = mock(MediaDevice.class);
+ when(device2.getName()).thenReturn(TEST_DEVICE_2_NAME);
+ when(device2.getIcon()).thenReturn(mTestDrawable);
+ when(device2.getMaxVolume()).thenReturn(100);
+ when(device2.isConnected()).thenReturn(false);
+ when(device2.getState()).thenReturn(LocalMediaManager.MediaDeviceState
+ .STATE_CONNECTING_FAILED);
+ when(device2.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device2.getId()).thenReturn(TEST_DEVICE_2_ID);
+ mSelectedDevices.add(device);
+ mSelectableDevices.add(device2);
+ when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(device);
+ mDevices.add(device);
+ mDevices.add(device2);
+ when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
+ when(mLocalMediaManager.getSelectableMediaDevice()).thenReturn(mSelectableDevices);
+ mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
+
+ final Slice mediaSlice = mMediaOutputSlice.getSlice();
+ final String sliceInfo = SliceQuery.findAll(mediaSlice, FORMAT_SLICE, HINT_LIST_ITEM,
+ null).toString();
+
+ assertThat(TextUtils.indexOf(sliceInfo, mContext.getText(
+ R.string.media_output_switch_error_text))).isNotEqualTo(-1);
+ }
+
+ @Test
public void onNotifyChange_foundMediaDevice_connect() {
mDevices.clear();
final MediaDevice device = mock(MediaDevice.class);
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..07f01fc 100644
--- a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
+++ b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
@@ -41,6 +41,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,7 +63,6 @@
private MediaController mMediaController;
@Mock
private MediaMetadata mMediaMetadata;
-
@Mock
private LocalMediaManager mLocalMediaManager;
@Mock
@@ -71,6 +71,8 @@
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 +114,7 @@
public void onStart_shouldRegisterCallback() {
mPanel.onStart();
+ verify(mMediaController).registerCallback(any());
verify(mLocalMediaManager).registerCallback(any());
verify(mLocalMediaManager).startScan();
}
@@ -167,6 +170,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 +205,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 +248,15 @@
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();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
index 1976557..07ca48b 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
@@ -41,6 +41,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 +52,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 +63,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 +75,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 +94,7 @@
@Test
public void onCreateView_countdownLatch_setup() {
+ initFakeActivity();
mPanelFragment.onCreateView(LayoutInflater.from(mContext),
new LinearLayout(mContext), null);
PanelSlicesLoaderCountdownLatch countdownLatch =
@@ -99,6 +108,7 @@
@Test
public void onCreate_logsOpenEvent() {
+ initFakeActivity();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
SettingsEnums.PAGE_VISIBLE,
@@ -109,6 +119,7 @@
@Test
public void onDestroy_logCloseEvent() {
+ initFakeActivity();
mPanelFragment.onDestroyView();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
@@ -120,6 +131,7 @@
@Test
public void panelSeeMoreClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getSeeMoreListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -136,6 +148,7 @@
@Test
public void panelDoneClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getCloseListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -178,10 +191,49 @@
@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);
+ }
}
\ 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);
}