Update a11y edit shortcut screen's text and tutorial text
Bug: 323792194 Test: manual Test: atest com.android.settings.accessibility Test: atest com.android.settings.accessibility.shortcuts Flag: N/A simple string changes NO_IFTTT=Introduce new IfThisThenThat lint Change-Id: I7ba4096d669453c33257880407e85ffe76d358f8
This commit is contained in:
@@ -4865,33 +4865,45 @@
|
|||||||
<!-- Accessibility label for paging indicator in accessibility tutorial page. [CHAR LIMIT=NONE] -->
|
<!-- Accessibility label for paging indicator in accessibility tutorial page. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_pager">Page <xliff:g id="current_page" example="2">%1$d</xliff:g> of <xliff:g id="num_pages" example="3">%2$d</xliff:g></string>
|
<string name="accessibility_tutorial_pager">Page <xliff:g id="current_page" example="2">%1$d</xliff:g> of <xliff:g id="num_pages" example="3">%2$d</xliff:g></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>
|
<string name="accessibility_tutorial_dialog_title_button">Accessibility button shortcut</string>
|
||||||
<!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
|
<!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_title_volume">Hold volume keys to open</string>
|
<string name="accessibility_tutorial_dialog_title_volume">Volume keys shortcut</string>
|
||||||
<!-- Title for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
|
<!-- 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>
|
<string name="accessibility_tutorial_dialog_title_triple">Triple tap shortcut</string>
|
||||||
<!-- Title for the accessibility tutorial dialog in accessibility service with two finger double tap. [CHAR LIMIT=100] -->
|
<!-- Title for the accessibility tutorial dialog in accessibility service with two finger double tap. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_title_two_finger_double">Two finger double tap screen to open</string>
|
<string name="accessibility_tutorial_dialog_title_two_finger_double">%1$d-finger double tap shortcut</string>
|
||||||
<!-- Title for the accessibility tutorial dialog in accessibility service with quick setting shortcut. [CHAR LIMIT=100] -->
|
<!-- Title for the accessibility tutorial dialog in accessibility service with quick setting shortcut. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_title_quick_setting">Quick Settings shortcut</string>
|
<string name="accessibility_tutorial_dialog_title_quick_setting">Quick Settings shortcut</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 gesture. [CHAR LIMIT=50] -->
|
||||||
<string name="accessibility_tutorial_dialog_title_gesture">Use gesture to open</string>
|
<string name="accessibility_tutorial_dialog_title_gesture">Accessibility gesture shortcut</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 accessibility gesture</string>
|
<string name="accessibility_tutorial_dialog_title_gesture_settings">Use 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] -->
|
<!-- 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 use this feature, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between features, touch & hold the accessibility button.</string>
|
<string name="accessibility_tutorial_dialog_message_button">To use this feature, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen.\n\nTo switch between features, touch & hold the accessibility button.</string>
|
||||||
<!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using the accessibility floating button. [CHAR LIMIT=100] -->
|
<!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using the accessibility floating button. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_floating_button">To use this feature, tap the accessibility button on your screen.</string>
|
<string name="accessibility_tutorial_dialog_message_floating_button">To use this feature, tap the accessibility button on your screen</string>
|
||||||
<!-- Instruction for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
|
<!-- Instruction for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_volume">To use this feature, press & hold both volume keys.</string>
|
<string name="accessibility_tutorial_dialog_message_volume">To use this feature, press & hold both volume keys</string>
|
||||||
<!-- Instruction for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
|
<!-- Instruction for the accessibility tutorial dialog for the screen magnification feature 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>
|
<string name="accessibility_tutorial_dialog_message_triple">To start and stop magnification, triple-tap anywhere on your screen.</string>
|
||||||
<!-- Instruction for the accessibility tutorial dialog in accessibility service with two finger double tap. [CHAR LIMIT=100] -->
|
<!-- Instruction for the accessibility tutorial dialog for the screen magnification feature with triple tap shortcut. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_two_finger_triple">To start and stop magnification, double-tap anywhere on your screen with two fingers.</string>
|
<string name="accessibility_tutorial_dialog_tripletap_instruction">To start and stop magnification, quickly tap the screen %1$d times</string>
|
||||||
<!-- Instruction for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=NONE]-->
|
<!-- Instruction for the accessibility tutorial dialog for the screen magnification feature with two finger double tap. [CHAR LIMIT=100] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_quick_setting">To use this feature, swipe down from the top of your screen.</string>
|
<string name="accessibility_tutorial_dialog_twofinger_doubletap_instruction">To start and stop magnification, quickly tap the screen twice with %1$d fingers</string>
|
||||||
|
<!-- Instruction for the accessibility tutorial dialog in accessibility service with quick settings shortcut. [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="accessibility_tutorial_dialog_message_quick_setting">{count, plural,
|
||||||
|
=1 {To use this feature, swipe down from the top of your screen. Then, find the {featureName} tile.}
|
||||||
|
other {To use this feature, swipe down from the top of your screen with # fingers. Then, find the {featureName} tile.}
|
||||||
|
}</string>
|
||||||
|
<!-- Warning for the accessibility shortcut type that is not available immediately during device setup when chosen, but will be available after setup. [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="accessibility_tutorial_dialog_shortcut_unavailable_in_suw">This shortcut will be available after you finish device setup.</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] -->
|
<!-- 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 use this feature, swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture">To use this feature, swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
||||||
|
<!-- Instruction for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_tutorial_dialog_gesture_shortcut_instruction">{count, plural,
|
||||||
|
=1 {To use this feature, swipe up from the bottom of your screen}
|
||||||
|
other {To use this feature, swipe up with # fingers from the bottom of your screen}
|
||||||
|
}</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] -->
|
<!-- 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 use this feature, swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture_talkback">To use this feature, swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 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] -->
|
<!-- 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] -->
|
||||||
@@ -4901,7 +4913,9 @@
|
|||||||
<!-- Button for the accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
|
<!-- 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>
|
<string name="accessibility_tutorial_dialog_button">Got it</string>
|
||||||
<!-- Button for the accessibility tutorial dialog to open the Accessibility button settings page. [CHAR LIMIT=30] -->
|
<!-- Button for the accessibility tutorial dialog to open the Accessibility button settings page. [CHAR LIMIT=30] -->
|
||||||
<string name="accessibility_tutorial_dialog_link_button">Button settings</string>
|
<string name="accessibility_tutorial_dialog_link_button">Customize button</string>
|
||||||
|
<!-- Button for the accessibility tutorial dialog to open a page to select the different software shortcut type. [CHAR LIMIT=30] -->
|
||||||
|
<string name="accessibility_tutorial_dialog_configure_software_shortcut_type">More options</string>
|
||||||
<!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
|
<!-- 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>
|
<string name="accessibility_shortcut_title"><xliff:g id="service" example="Select to Speak">%1$s</xliff:g> shortcut</string>
|
||||||
<!-- Shown as one of the item in the chosen accessibility shortcut types list presented as a label next to the shortcut toggle. [CHAR LIMIT=NONE] -->
|
<!-- Shown as one of the item in the chosen accessibility shortcut types list presented as a label next to the shortcut toggle. [CHAR LIMIT=NONE] -->
|
||||||
@@ -4912,16 +4926,23 @@
|
|||||||
<string name="accessibility_shortcut_edit_dialog_title_software_gesture">Swipe up with 2 fingers</string>
|
<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>
|
<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] -->
|
<!-- Title for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_software">Tap accessibility button</string>
|
<string name="accessibility_shortcut_edit_dialog_title_software">Accessibility button</string>
|
||||||
<!-- Summary for accessibility shortcut preference for software shortcut gesture type. [CHAR LIMIT=NONE] -->
|
<!-- Summary for accessibility shortcut preference for floating button shortcut type. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_software_by_gesture">Use accessibility gesture</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_floating_button">Tap the floating button</string>
|
||||||
|
<!-- Title for accessibility shortcut preference for software shortcut gesture type. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_dialog_title_software_by_gesture">Accessibility gesture</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.\n\nTo switch between features, touch & hold the accessibility button.</string>
|
<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. To switch between features, touch & hold the accessibility button.</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.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</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.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
||||||
|
<!-- Summary for gesture shortcut option -->
|
||||||
|
<string name="accessibility_shortcut_edit_dialog_summary_gesture">{count, plural,
|
||||||
|
=1 {Swipe up from the bottom of your screen. To switch between features, swipe up and hold.}
|
||||||
|
other {Swipe up with # fingers from the bottom of your screen. To switch between features, swipe up with # fingers and hold.}
|
||||||
|
}</string>
|
||||||
<!-- Summary for software shortcut in accessibility edit shortcut dialog when user had enabled the accessibility floating button mode (Floating over other apps). [CHAR LIMIT=NONE] -->
|
<!-- Summary for software shortcut in accessibility edit shortcut dialog when user had enabled the accessibility floating button mode (Floating over other apps). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_summary_software_floating"><annotation id="link">More options</annotation></string>
|
<string name="accessibility_shortcut_edit_dialog_summary_software_floating"><annotation id="link">More options</annotation></string>
|
||||||
<!-- Footer to show help link content description. [CHAR LIMIT=NONE] -->
|
<!-- Footer to show help link content description. [CHAR LIMIT=NONE] -->
|
||||||
@@ -4929,25 +4950,41 @@
|
|||||||
<!-- Title for quick settings shortcut option in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for quick settings shortcut option in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_quick_settings">Quick Settings</string>
|
<string name="accessibility_shortcut_edit_dialog_title_quick_settings">Quick Settings</string>
|
||||||
<!-- Summary for quick settings shortcut option in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Summary for quick settings shortcut option in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_summary_quick_settings">Swipe down from the top of your screen</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_quick_settings">{count, plural,
|
||||||
|
=1 {Swipe down from the top of your screen}
|
||||||
|
other {Swipe down with # fingers from the top of your screen}
|
||||||
|
}</string>
|
||||||
|
<!-- Summary for quick settings shortcut option in accessibility edit shortcut dialog in Setup Wizard. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_dialog_summary_quick_settings_suw">{count, plural,
|
||||||
|
=1 {Swipe down from the top of your screen. This shortcut will be available after you finish device setup.}
|
||||||
|
other {Swipe down with # fingers from the top of your screen. This shortcut will be available after you finish device setup.}
|
||||||
|
}</string>
|
||||||
<!-- Shown as one of the item in the chosen accessibility shortcut types list presented as a label next to the shortcut toggle. [CHAR LIMIT=NONE] -->
|
<!-- Shown as one of the item in the chosen accessibility shortcut types list presented as a label next to the shortcut toggle. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_feature_shortcut_setting_summary_quick_settings">Quick Settings</string>
|
<string name="accessibility_feature_shortcut_setting_summary_quick_settings">Quick Settings</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>
|
<string name="accessibility_shortcut_edit_dialog_title_hardware">Volume keys</string>
|
||||||
<!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
<!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_hardware_keyword">hold volume keys</string>
|
<string name="accessibility_shortcut_hardware_keyword">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</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_hardware">Press & hold both volume keys</string>
|
||||||
<!-- Title for two finger double tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for two finger double tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_two_finger_double_tap">Two-finger double-tap screen</string>
|
<string name="accessibility_shortcut_edit_dialog_title_two_finger_double_tap">Two-finger double-tap screen</string>
|
||||||
<!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
<!-- Title for 2-finger double tap shortcut in accessibility edit shortcut screen. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_two_finger_double_tap_keyword">two-finger double-tap screen</string>
|
<string name="accessibility_shortcut_edit_screen_title_two_finger_double_tap">%1$d-finger double tap</string>
|
||||||
|
<!-- Summary for 2-finger double tap shortcut in accessibility edit shortcut screen. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_screen_summary_two_finger_double_tap">Quickly tap the screen twice with %1$d fingers</string>
|
||||||
|
<!-- Title for triple tap shortcut in accessibility edit shortcut screen. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_screen_title_triple_tap">Triple tap</string>
|
||||||
|
<!-- Summary for triple tap shortcut in accessibility edit shortcut screen. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_screen_summary_triple_tap">Quickly tap the screen %1$d times. This may slow down your device.</string>
|
||||||
|
<!-- 2-finger double tap is shown as part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_two_finger_double_tap_keyword">%1$d-finger double tap</string>
|
||||||
<!-- Summary for two finger double tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Summary for two finger double tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_summary_two_finger_double_tap">Quickly tap screen {0,number,integer} times with two fingers</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_two_finger_double_tap">Quickly tap screen {0,number,integer} times with two fingers</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>
|
<string name="accessibility_shortcut_edit_dialog_title_triple_tap">Triple-tap screen</string>
|
||||||
<!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
<!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_triple_tap_keyword">triple-tap screen</string>
|
<string name="accessibility_shortcut_triple_tap_keyword">triple tap</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 {0,number,integer} times. This shortcut may slow down your device</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen {0,number,integer} 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=20] -->
|
<!-- Title for the accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=20] -->
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
settings:allowDividerAbove="false"
|
settings:allowDividerAbove="false"
|
||||||
settings:allowDividerBelow="false"/>
|
settings:allowDividerBelow="false"/>
|
||||||
|
<!-- LINT.IfChange(shortcut_type_ui_order) -->
|
||||||
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
|
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
|
||||||
android:key="@string/accessibility_shortcut_quick_settings_pref"
|
android:key="@string/accessibility_shortcut_quick_settings_pref"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
@@ -90,4 +90,11 @@
|
|||||||
settings:allowDividerAbove="false"
|
settings:allowDividerAbove="false"
|
||||||
settings:allowDividerBelow="false"
|
settings:allowDividerBelow="false"
|
||||||
settings:controller="com.android.settings.accessibility.shortcuts.TripleTapShortcutOptionController" />
|
settings:controller="com.android.settings.accessibility.shortcuts.TripleTapShortcutOptionController" />
|
||||||
|
<!--
|
||||||
|
LINT.ThenChange(
|
||||||
|
/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java:shortcut_type_ui_order,
|
||||||
|
/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java:shortcut_type_ui_order,
|
||||||
|
/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java:shortcut_type_ui_order
|
||||||
|
)
|
||||||
|
-->
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -29,12 +29,14 @@ import android.text.Spannable;
|
|||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.style.ImageSpan;
|
import android.text.style.ImageSpan;
|
||||||
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -57,6 +59,7 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
import com.android.server.accessibility.Flags;
|
import com.android.server.accessibility.Flags;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
import com.android.settingslib.widget.LottieColorUtils;
|
import com.android.settingslib.widget.LottieColorUtils;
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView;
|
import com.airbnb.lottie.LottieAnimationView;
|
||||||
@@ -66,6 +69,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for creating the dialog that guides users for gesture navigation for
|
* Utility class for creating the dialog that guides users for gesture navigation for
|
||||||
@@ -117,12 +121,17 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
return createDialog(context, DialogType.LAUNCH_SERVICE_BY_ACCESSIBILITY_GESTURE);
|
return createDialog(context, DialogType.LAUNCH_SERVICE_BY_ACCESSIBILITY_GESTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AlertDialog createAccessibilityTutorialDialog(Context context, int shortcutTypes) {
|
static AlertDialog createAccessibilityTutorialDialog(
|
||||||
return createAccessibilityTutorialDialog(context, shortcutTypes, mOnClickListener);
|
@NonNull Context context, int shortcutTypes, @NonNull CharSequence featureName) {
|
||||||
|
return createAccessibilityTutorialDialog(
|
||||||
|
context, shortcutTypes, mOnClickListener, featureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AlertDialog createAccessibilityTutorialDialog(Context context, int shortcutTypes,
|
static AlertDialog createAccessibilityTutorialDialog(
|
||||||
@Nullable DialogInterface.OnClickListener actionButtonListener) {
|
@NonNull Context context,
|
||||||
|
int shortcutTypes,
|
||||||
|
@Nullable DialogInterface.OnClickListener actionButtonListener,
|
||||||
|
@NonNull CharSequence featureName) {
|
||||||
|
|
||||||
final int category = SettingsEnums.SWITCH_SHORTCUT_DIALOG_ACCESSIBILITY_BUTTON_SETTINGS;
|
final int category = SettingsEnums.SWITCH_SHORTCUT_DIALOG_ACCESSIBILITY_BUTTON_SETTINGS;
|
||||||
final DialogInterface.OnClickListener linkButtonListener =
|
final DialogInterface.OnClickListener linkButtonListener =
|
||||||
@@ -138,46 +147,59 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
linkButtonListener)
|
linkButtonListener)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
final List<TutorialPage> tutorialPages =
|
final List<TutorialPage> tutorialPages = createShortcutTutorialPages(
|
||||||
createShortcutTutorialPages(context, shortcutTypes);
|
context, shortcutTypes, featureName, /* isInSetupWizard= */ false);
|
||||||
Preconditions.checkArgument(!tutorialPages.isEmpty(),
|
Preconditions.checkArgument(!tutorialPages.isEmpty(),
|
||||||
/* errorMessage= */ "Unexpected tutorial pages size");
|
/* errorMessage= */ "Unexpected tutorial pages size");
|
||||||
|
|
||||||
final TutorialPageChangeListener.OnPageSelectedCallback callback = index -> {
|
final TutorialPageChangeListener.OnPageSelectedCallback callback =
|
||||||
final int pageType = tutorialPages.get(index).getType();
|
index -> updateTutorialNegativeButtonTextAndVisibility(
|
||||||
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setVisibility(
|
alertDialog, tutorialPages, index);
|
||||||
pageType == UserShortcutType.SOFTWARE ? VISIBLE : GONE);
|
|
||||||
};
|
|
||||||
|
|
||||||
alertDialog.setView(createShortcutNavigationContentView(context, tutorialPages, callback));
|
alertDialog.setView(createShortcutNavigationContentView(context, tutorialPages, callback));
|
||||||
|
|
||||||
// Showing first page won't invoke onPageSelectedCallback. Need to check the first tutorial
|
// Showing first page won't invoke onPageSelectedCallback. Need to check the first tutorial
|
||||||
// page type manually to set correct visibility of the link button.
|
// page type manually to set correct visibility of the link button.
|
||||||
alertDialog.setOnShowListener(dialog -> {
|
alertDialog.setOnShowListener(
|
||||||
final int firstPageType = tutorialPages.get(0).getType();
|
dialog -> updateTutorialNegativeButtonTextAndVisibility(
|
||||||
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setVisibility(
|
alertDialog, tutorialPages, /* selectedPageIndex= */ 0));
|
||||||
firstPageType == UserShortcutType.SOFTWARE ? VISIBLE : GONE);
|
|
||||||
});
|
|
||||||
|
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(Context context,
|
private static void updateTutorialNegativeButtonTextAndVisibility(
|
||||||
int shortcutTypes) {
|
AlertDialog dialog, List<TutorialPage> pages, int selectedPageIndex) {
|
||||||
return createAccessibilityTutorialDialogForSetupWizard(context, shortcutTypes,
|
final Button button = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||||
mOnClickListener);
|
final int pageType = pages.get(selectedPageIndex).getType();
|
||||||
|
final int buttonVisibility = pageType == UserShortcutType.SOFTWARE ? VISIBLE : GONE;
|
||||||
|
button.setVisibility(buttonVisibility);
|
||||||
|
if (buttonVisibility == VISIBLE) {
|
||||||
|
final int textResId = AccessibilityUtil.isFloatingMenuEnabled(dialog.getContext())
|
||||||
|
? R.string.accessibility_tutorial_dialog_link_button
|
||||||
|
: R.string.accessibility_tutorial_dialog_configure_software_shortcut_type;
|
||||||
|
button.setText(textResId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(Context context,
|
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(Context context,
|
||||||
int shortcutTypes, @Nullable DialogInterface.OnClickListener actionButtonListener) {
|
int shortcutTypes, CharSequence featureName) {
|
||||||
|
return createAccessibilityTutorialDialogForSetupWizard(context, shortcutTypes,
|
||||||
|
mOnClickListener, featureName);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(
|
||||||
|
@NonNull Context context,
|
||||||
|
int shortcutTypes,
|
||||||
|
@Nullable DialogInterface.OnClickListener actionButtonListener,
|
||||||
|
@NonNull CharSequence featureName) {
|
||||||
|
|
||||||
final AlertDialog alertDialog = new AlertDialog.Builder(context)
|
final AlertDialog alertDialog = new AlertDialog.Builder(context)
|
||||||
.setPositiveButton(R.string.accessibility_tutorial_dialog_button,
|
.setPositiveButton(R.string.accessibility_tutorial_dialog_button,
|
||||||
actionButtonListener)
|
actionButtonListener)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
final List<TutorialPage> tutorialPages =
|
final List<TutorialPage> tutorialPages = createShortcutTutorialPages(
|
||||||
createShortcutTutorialPages(context, shortcutTypes);
|
context, shortcutTypes, featureName, /* inSetupWizard= */ true);
|
||||||
Preconditions.checkArgument(!tutorialPages.isEmpty(),
|
Preconditions.checkArgument(!tutorialPages.isEmpty(),
|
||||||
/* errorMessage= */ "Unexpected tutorial pages size");
|
/* errorMessage= */ "Unexpected tutorial pages size");
|
||||||
|
|
||||||
@@ -403,8 +425,8 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
final View image =
|
final View image =
|
||||||
createIllustrationViewWithImageRawResource(context,
|
createIllustrationViewWithImageRawResource(context,
|
||||||
R.raw.a11y_shortcut_type_triple_tap);
|
R.raw.a11y_shortcut_type_triple_tap);
|
||||||
final CharSequence instruction =
|
final CharSequence instruction = context.getString(
|
||||||
context.getText(R.string.accessibility_tutorial_dialog_message_triple);
|
R.string.accessibility_tutorial_dialog_tripletap_instruction, 3);
|
||||||
final ImageView indicatorIcon =
|
final ImageView indicatorIcon =
|
||||||
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
||||||
indicatorIcon.setEnabled(false);
|
indicatorIcon.setEnabled(false);
|
||||||
@@ -413,15 +435,16 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static TutorialPage createTwoFingerTripleTapTutorialPage(@NonNull Context context) {
|
private static TutorialPage createTwoFingerTripleTapTutorialPage(@NonNull Context context) {
|
||||||
// TODO(b/308088945): Update tutorial string and image when UX provides them
|
|
||||||
final int type = UserShortcutType.TWOFINGER_DOUBLETAP;
|
final int type = UserShortcutType.TWOFINGER_DOUBLETAP;
|
||||||
final CharSequence title =
|
final int numFingers = 2;
|
||||||
context.getText(R.string.accessibility_tutorial_dialog_title_two_finger_double);
|
final CharSequence title = context.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_two_finger_double, numFingers);
|
||||||
|
// TODO(b/308088945): Update tutorial image when UX provides them
|
||||||
final View image =
|
final View image =
|
||||||
createIllustrationViewWithImageRawResource(context,
|
createIllustrationViewWithImageRawResource(context,
|
||||||
R.raw.a11y_shortcut_type_triple_tap);
|
R.raw.a11y_shortcut_type_triple_tap);
|
||||||
final CharSequence instruction =
|
final CharSequence instruction = context.getString(
|
||||||
context.getText(R.string.accessibility_tutorial_dialog_message_two_finger_triple);
|
R.string.accessibility_tutorial_dialog_twofinger_doubletap_instruction, numFingers);
|
||||||
final ImageView indicatorIcon =
|
final ImageView indicatorIcon =
|
||||||
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
||||||
indicatorIcon.setEnabled(false);
|
indicatorIcon.setEnabled(false);
|
||||||
@@ -429,30 +452,50 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
return new TutorialPage(type, title, image, indicatorIcon, instruction);
|
return new TutorialPage(type, title, image, indicatorIcon, instruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TutorialPage createQuickSettingTutorialPage(@NonNull Context context) {
|
private static TutorialPage createQuickSettingsTutorialPage(
|
||||||
|
@NonNull Context context, @NonNull CharSequence featureName, boolean inSetupWizard) {
|
||||||
final int type = UserShortcutType.QUICK_SETTINGS;
|
final int type = UserShortcutType.QUICK_SETTINGS;
|
||||||
final CharSequence title =
|
final CharSequence title =
|
||||||
context.getText(R.string.accessibility_tutorial_dialog_title_quick_setting);
|
context.getText(R.string.accessibility_tutorial_dialog_title_quick_setting);
|
||||||
final View image =
|
final View image =
|
||||||
createIllustrationView(context,
|
createIllustrationView(context,
|
||||||
R.drawable.a11y_shortcut_type_quick_settings);
|
R.drawable.a11y_shortcut_type_quick_settings);
|
||||||
final CharSequence instruction =
|
final int numFingers = AccessibilityUtil.isTouchExploreEnabled(context) ? 2 : 1;
|
||||||
context.getText(R.string.accessibility_tutorial_dialog_message_quick_setting);
|
Map<String, Object> arguments = new ArrayMap<>();
|
||||||
|
arguments.put("count", numFingers);
|
||||||
|
arguments.put("featureName", featureName);
|
||||||
|
final CharSequence instruction = StringUtil.getIcuPluralsString(context,
|
||||||
|
arguments,
|
||||||
|
R.string.accessibility_tutorial_dialog_message_quick_setting);
|
||||||
|
final SpannableStringBuilder tutorialText = new SpannableStringBuilder();
|
||||||
|
if (inSetupWizard) {
|
||||||
|
tutorialText.append(context.getText(
|
||||||
|
R.string.accessibility_tutorial_dialog_shortcut_unavailable_in_suw))
|
||||||
|
.append("\n\n");
|
||||||
|
}
|
||||||
|
tutorialText.append(instruction);
|
||||||
final ImageView indicatorIcon =
|
final ImageView indicatorIcon =
|
||||||
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
createImageView(context, R.drawable.ic_accessibility_page_indicator);
|
||||||
indicatorIcon.setEnabled(false);
|
indicatorIcon.setEnabled(false);
|
||||||
|
|
||||||
return new TutorialPage(type, title, image, indicatorIcon, instruction);
|
return new TutorialPage(type, title, image, indicatorIcon, tutorialText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the tutorial pages for selected shortcut types in the same order as shown in the
|
||||||
|
* edit shortcut screen.
|
||||||
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static List<TutorialPage> createShortcutTutorialPages(@NonNull Context context,
|
static List<TutorialPage> createShortcutTutorialPages(
|
||||||
int shortcutTypes) {
|
@NonNull Context context, int shortcutTypes, @NonNull CharSequence featureName,
|
||||||
|
boolean inSetupWizard) {
|
||||||
|
// LINT.IfChange(shortcut_type_ui_order)
|
||||||
final List<TutorialPage> tutorialPages = new ArrayList<>();
|
final List<TutorialPage> tutorialPages = new ArrayList<>();
|
||||||
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
||||||
if ((shortcutTypes & UserShortcutType.QUICK_SETTINGS)
|
if ((shortcutTypes & UserShortcutType.QUICK_SETTINGS)
|
||||||
== UserShortcutType.QUICK_SETTINGS) {
|
== UserShortcutType.QUICK_SETTINGS) {
|
||||||
tutorialPages.add(createQuickSettingTutorialPage(context));
|
tutorialPages.add(
|
||||||
|
createQuickSettingsTutorialPage(context, featureName, inSetupWizard));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((shortcutTypes & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
if ((shortcutTypes & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
||||||
@@ -463,10 +506,6 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
tutorialPages.add(createHardwareTutorialPage(context));
|
tutorialPages.add(createHardwareTutorialPage(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((shortcutTypes & UserShortcutType.TRIPLETAP) == UserShortcutType.TRIPLETAP) {
|
|
||||||
tutorialPages.add(createTripleTapTutorialPage(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) {
|
if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) {
|
||||||
if ((shortcutTypes & UserShortcutType.TWOFINGER_DOUBLETAP)
|
if ((shortcutTypes & UserShortcutType.TWOFINGER_DOUBLETAP)
|
||||||
== UserShortcutType.TWOFINGER_DOUBLETAP) {
|
== UserShortcutType.TWOFINGER_DOUBLETAP) {
|
||||||
@@ -474,6 +513,11 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((shortcutTypes & UserShortcutType.TRIPLETAP) == UserShortcutType.TRIPLETAP) {
|
||||||
|
tutorialPages.add(createTripleTapTutorialPage(context));
|
||||||
|
}
|
||||||
|
// LINT.ThenChange(/res/xml/accessibility_edit_shortcuts.xml:shortcut_type_ui_order)
|
||||||
|
|
||||||
return tutorialPages;
|
return tutorialPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,10 +553,11 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
final int resId = R.string.accessibility_tutorial_dialog_message_floating_button;
|
final int resId = R.string.accessibility_tutorial_dialog_message_floating_button;
|
||||||
sb.append(context.getText(resId));
|
sb.append(context.getText(resId));
|
||||||
} else if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
} else if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
final int resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
final int numFingers = AccessibilityUtil.isTouchExploreEnabled(context) ? 3 : 2;
|
||||||
? R.string.accessibility_tutorial_dialog_message_gesture_talkback
|
sb.append(StringUtil.getIcuPluralsString(
|
||||||
: R.string.accessibility_tutorial_dialog_message_gesture;
|
context,
|
||||||
sb.append(context.getText(resId));
|
numFingers,
|
||||||
|
R.string.accessibility_tutorial_dialog_gesture_shortcut_instruction));
|
||||||
} else {
|
} else {
|
||||||
final int resId = R.string.accessibility_tutorial_dialog_message_button;
|
final int resId = R.string.accessibility_tutorial_dialog_message_button;
|
||||||
sb.append(getSoftwareInstructionWithIcon(context, context.getText(resId)));
|
sb.append(getSoftwareInstructionWithIcon(context, context.getText(resId)));
|
||||||
|
@@ -223,12 +223,12 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
mDialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialogForSetupWizard(
|
.createAccessibilityTutorialDialogForSetupWizard(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked, getLabelName());
|
||||||
} else {
|
} else {
|
||||||
mDialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialog(
|
.createAccessibilityTutorialDialog(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked, getLabelName());
|
||||||
}
|
}
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
return mDialog;
|
return mDialog;
|
||||||
@@ -454,6 +454,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(context,
|
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(context,
|
||||||
getComponentName().flattenToString());
|
getComponentName().flattenToString());
|
||||||
|
|
||||||
|
// LINT.IfChange(shortcut_type_ui_order)
|
||||||
final List<CharSequence> list = new ArrayList<>();
|
final List<CharSequence> list = new ArrayList<>();
|
||||||
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
||||||
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.QUICK_SETTINGS)) {
|
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.QUICK_SETTINGS)) {
|
||||||
@@ -470,6 +471,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
R.string.accessibility_shortcut_hardware_keyword);
|
R.string.accessibility_shortcut_hardware_keyword);
|
||||||
list.add(hardwareTitle);
|
list.add(hardwareTitle);
|
||||||
}
|
}
|
||||||
|
// LINT.ThenChange(/res/xml/accessibility_edit_shortcuts.xml:shortcut_type_ui_order)
|
||||||
|
|
||||||
// Show software shortcut if first time to use.
|
// Show software shortcut if first time to use.
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
@@ -228,12 +228,12 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
|||||||
mDialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialogForSetupWizard(
|
.createAccessibilityTutorialDialogForSetupWizard(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked, mPackageName);
|
||||||
} else {
|
} else {
|
||||||
mDialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialog(
|
.createAccessibilityTutorialDialog(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked, mPackageName);
|
||||||
}
|
}
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
return mDialog;
|
return mDialog;
|
||||||
@@ -711,6 +711,7 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
|||||||
return context.getText(R.string.accessibility_shortcut_state_off);
|
return context.getText(R.string.accessibility_shortcut_state_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LINT.IfChange(shortcut_type_ui_order)
|
||||||
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(
|
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(
|
||||||
context, mComponentName.flattenToString(), getDefaultShortcutTypes());
|
context, mComponentName.flattenToString(), getDefaultShortcutTypes());
|
||||||
|
|
||||||
@@ -730,6 +731,7 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
|||||||
R.string.accessibility_shortcut_hardware_keyword);
|
R.string.accessibility_shortcut_hardware_keyword);
|
||||||
list.add(hardwareTitle);
|
list.add(hardwareTitle);
|
||||||
}
|
}
|
||||||
|
// LINT.ThenChange(/res/xml/accessibility_edit_shortcuts.xml:shortcut_type_ui_order)
|
||||||
|
|
||||||
// Show software shortcut if first time to use.
|
// Show software shortcut if first time to use.
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
@@ -484,6 +484,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(context,
|
final int shortcutTypes = PreferredShortcuts.retrieveUserShortcutType(context,
|
||||||
MAGNIFICATION_CONTROLLER_NAME);
|
MAGNIFICATION_CONTROLLER_NAME);
|
||||||
|
|
||||||
|
// LINT.IfChange(shortcut_type_ui_order)
|
||||||
final List<CharSequence> list = new ArrayList<>();
|
final List<CharSequence> list = new ArrayList<>();
|
||||||
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
if (android.view.accessibility.Flags.a11yQsShortcut()) {
|
||||||
if (hasShortcutType(shortcutTypes, UserShortcutType.QUICK_SETTINGS)) {
|
if (hasShortcutType(shortcutTypes, UserShortcutType.QUICK_SETTINGS)) {
|
||||||
@@ -500,18 +501,19 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
R.string.accessibility_shortcut_hardware_keyword);
|
R.string.accessibility_shortcut_hardware_keyword);
|
||||||
list.add(hardwareTitle);
|
list.add(hardwareTitle);
|
||||||
}
|
}
|
||||||
|
if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) {
|
||||||
|
if (hasShortcutType(shortcutTypes, UserShortcutType.TWOFINGER_DOUBLETAP)) {
|
||||||
|
final CharSequence twoFingerDoubleTapTitle = context.getString(
|
||||||
|
R.string.accessibility_shortcut_two_finger_double_tap_keyword, 2);
|
||||||
|
list.add(twoFingerDoubleTapTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (hasShortcutType(shortcutTypes, UserShortcutType.TRIPLETAP)) {
|
if (hasShortcutType(shortcutTypes, UserShortcutType.TRIPLETAP)) {
|
||||||
final CharSequence tripleTapTitle = context.getText(
|
final CharSequence tripleTapTitle = context.getText(
|
||||||
R.string.accessibility_shortcut_triple_tap_keyword);
|
R.string.accessibility_shortcut_triple_tap_keyword);
|
||||||
list.add(tripleTapTitle);
|
list.add(tripleTapTitle);
|
||||||
}
|
}
|
||||||
if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) {
|
// LINT.ThenChange(/res/xml/accessibility_edit_shortcuts.xml:shortcut_type_ui_order)
|
||||||
if (hasShortcutType(shortcutTypes, UserShortcutType.TWOFINGER_DOUBLETAP)) {
|
|
||||||
final CharSequence twoFingerTripleTapTitle = context.getText(
|
|
||||||
R.string.accessibility_shortcut_two_finger_double_tap_keyword);
|
|
||||||
list.add(twoFingerTripleTapTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show software shortcut if first time to use.
|
// Show software shortcut if first time to use.
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
@@ -258,8 +258,10 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mTouchExplorationStateChangeListener = isTouchExplorationEnabled ->
|
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||||
|
refreshPreferenceController(QuickSettingsShortcutOptionController.class);
|
||||||
refreshPreferenceController(GestureShortcutOptionController.class);
|
refreshPreferenceController(GestureShortcutOptionController.class);
|
||||||
|
};
|
||||||
|
|
||||||
final AccessibilityManager am = getSystemService(
|
final AccessibilityManager am = getSystemService(
|
||||||
AccessibilityManager.class);
|
AccessibilityManager.class);
|
||||||
|
@@ -57,9 +57,12 @@ public class FloatingButtonShortcutOptionController
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getSummary() {
|
public CharSequence getSummary() {
|
||||||
if (isInSetupWizard()) {
|
final SpannableStringBuilder sb = new SpannableStringBuilder();
|
||||||
return null;
|
sb.append(mContext.getText(
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_floating_button));
|
||||||
|
if (!isInSetupWizard()) {
|
||||||
|
sb.append("\n\n").append(getCustomizeAccessibilityButtonLink());
|
||||||
}
|
}
|
||||||
return new SpannableStringBuilder().append(getCustomizeAccessibilityButtonLink());
|
return sb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.accessibility.AccessibilityUtil;
|
import com.android.settings.accessibility.AccessibilityUtil;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A controller handles displaying the gesture shortcut option preference and
|
* A controller handles displaying the gesture shortcut option preference and
|
||||||
@@ -59,13 +60,18 @@ public class GestureShortcutOptionController extends SoftwareShortcutOptionPrefe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getSummary() {
|
public CharSequence getSummary() {
|
||||||
|
int numFingers = AccessibilityUtil.isTouchExploreEnabled(mContext) ? 3 : 2;
|
||||||
|
String instruction = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
numFingers,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture);
|
||||||
|
|
||||||
final SpannableStringBuilder sb = new SpannableStringBuilder();
|
final SpannableStringBuilder sb = new SpannableStringBuilder();
|
||||||
final int resId = AccessibilityUtil.isTouchExploreEnabled(mContext)
|
sb.append(instruction);
|
||||||
? R.string.accessibility_shortcut_edit_dialog_summary_software_gesture_talkback
|
if (!isInSetupWizard()) {
|
||||||
: R.string.accessibility_shortcut_edit_dialog_summary_software_gesture;
|
|
||||||
sb.append(mContext.getText(resId));
|
|
||||||
sb.append("\n\n");
|
sb.append("\n\n");
|
||||||
sb.append(getCustomizeAccessibilityButtonLink());
|
sb.append(getCustomizeAccessibilityButtonLink());
|
||||||
|
}
|
||||||
|
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,8 @@ import androidx.preference.PreferenceScreen;
|
|||||||
import com.android.internal.accessibility.common.ShortcutConstants;
|
import com.android.internal.accessibility.common.ShortcutConstants;
|
||||||
import com.android.internal.accessibility.util.AccessibilityUtils;
|
import com.android.internal.accessibility.util.AccessibilityUtils;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -62,13 +64,22 @@ public class QuickSettingsShortcutOptionController extends ShortcutOptionPrefere
|
|||||||
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
||||||
shortcutOptionPreference.setTitle(
|
shortcutOptionPreference.setTitle(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_quick_settings);
|
R.string.accessibility_shortcut_edit_dialog_title_quick_settings);
|
||||||
shortcutOptionPreference.setSummary(
|
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
|
||||||
shortcutOptionPreference.setIntroImageResId(
|
shortcutOptionPreference.setIntroImageResId(
|
||||||
R.drawable.a11y_shortcut_type_quick_settings);
|
R.drawable.a11y_shortcut_type_quick_settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
int numFingers = AccessibilityUtil.isTouchExploreEnabled(mContext) ? 2 : 1;
|
||||||
|
return StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
numFingers,
|
||||||
|
isInSetupWizard()
|
||||||
|
? R.string.accessibility_shortcut_edit_dialog_summary_quick_settings_suw
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isShortcutAvailable() {
|
protected boolean isShortcutAvailable() {
|
||||||
return Flags.a11yQsShortcut()
|
return Flags.a11yQsShortcut()
|
||||||
@@ -91,7 +102,8 @@ public class QuickSettingsShortcutOptionController extends ShortcutOptionPrefere
|
|||||||
}
|
}
|
||||||
for (String target : getShortcutTargets()) {
|
for (String target : getShortcutTargets()) {
|
||||||
ComponentName targetComponentName = ComponentName.unflattenFromString(target);
|
ComponentName targetComponentName = ComponentName.unflattenFromString(target);
|
||||||
if (!a11yFeatureToTileMap.containsKey(targetComponentName)) {
|
if (targetComponentName == null
|
||||||
|
|| !a11yFeatureToTileMap.containsKey(targetComponentName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@ package com.android.settings.accessibility.shortcuts;
|
|||||||
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.icu.text.MessageFormat;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.accessibility.Flags;
|
import android.view.accessibility.Flags;
|
||||||
|
|
||||||
@@ -52,12 +51,9 @@ public class TripleTapShortcutOptionController extends ShortcutOptionPreferenceC
|
|||||||
final Preference preference = screen.findPreference(getPreferenceKey());
|
final Preference preference = screen.findPreference(getPreferenceKey());
|
||||||
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
||||||
shortcutOptionPreference.setTitle(
|
shortcutOptionPreference.setTitle(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_triple_tap);
|
R.string.accessibility_shortcut_edit_screen_title_triple_tap);
|
||||||
String summary = mContext.getString(
|
String summary = mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_triple_tap);
|
R.string.accessibility_shortcut_edit_screen_summary_triple_tap, 3);
|
||||||
// Format the number '3' in the summary.
|
|
||||||
final Object[] arguments = {3};
|
|
||||||
summary = MessageFormat.format(summary, arguments);
|
|
||||||
|
|
||||||
shortcutOptionPreference.setSummary(summary);
|
shortcutOptionPreference.setSummary(summary);
|
||||||
shortcutOptionPreference.setIntroImageRawResId(
|
shortcutOptionPreference.setIntroImageRawResId(
|
||||||
|
@@ -19,7 +19,6 @@ package com.android.settings.accessibility.shortcuts;
|
|||||||
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.icu.text.MessageFormat;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
@@ -54,16 +53,17 @@ public class TwoFingerDoubleTapShortcutOptionController
|
|||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
final Preference preference = screen.findPreference(getPreferenceKey());
|
final Preference preference = screen.findPreference(getPreferenceKey());
|
||||||
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
if (preference instanceof ShortcutOptionPreference shortcutOptionPreference) {
|
||||||
// TODO (b/306153204): Update shortcut string and image when UX provides them
|
int numFingers = 2;
|
||||||
shortcutOptionPreference.setTitle(
|
String title = mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_two_finger_double_tap);
|
R.string.accessibility_shortcut_edit_screen_title_two_finger_double_tap,
|
||||||
|
numFingers);
|
||||||
|
shortcutOptionPreference.setTitle(title);
|
||||||
String summary = mContext.getString(
|
String summary = mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_two_finger_double_tap);
|
R.string.accessibility_shortcut_edit_screen_summary_two_finger_double_tap,
|
||||||
// Format the number '2' in the summary.
|
numFingers);
|
||||||
final Object[] arguments = {2};
|
|
||||||
summary = MessageFormat.format(summary, arguments);
|
|
||||||
|
|
||||||
shortcutOptionPreference.setSummary(summary);
|
shortcutOptionPreference.setSummary(summary);
|
||||||
|
// TODO (b/306153204): Update shortcut image when UX provides them
|
||||||
shortcutOptionPreference.setIntroImageRawResId(
|
shortcutOptionPreference.setIntroImageRawResId(
|
||||||
R.raw.a11y_shortcut_type_triple_tap);
|
R.raw.a11y_shortcut_type_triple_tap);
|
||||||
}
|
}
|
||||||
|
@@ -32,18 +32,27 @@ import android.app.settings.SettingsEnums;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.platform.test.annotations.RequiresFlagsEnabled;
|
import android.platform.test.annotations.EnableFlags;
|
||||||
import android.platform.test.flag.junit.CheckFlagsRule;
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.util.ArrayMap;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextSwitcher;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import com.android.server.accessibility.Flags;
|
import com.android.server.accessibility.Flags;
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.SubSettings;
|
import com.android.settings.SubSettings;
|
||||||
|
import com.android.settings.testutils.AccessibilityTestUtils;
|
||||||
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -54,16 +63,22 @@ import org.mockito.junit.MockitoJUnit;
|
|||||||
import org.mockito.junit.MockitoRule;
|
import org.mockito.junit.MockitoRule;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
import org.robolectric.shadows.ShadowAccessibilityManager;
|
||||||
import org.robolectric.shadows.ShadowLooper;
|
import org.robolectric.shadows.ShadowLooper;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/** Tests for {@link AccessibilityGestureNavigationTutorial}. */
|
/** Tests for {@link AccessibilityGestureNavigationTutorial}. */
|
||||||
|
@Config(shadows = SettingsShadowResources.class)
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public final class AccessibilityGestureNavigationTutorialTest {
|
public final class AccessibilityGestureNavigationTutorialTest {
|
||||||
|
private static final String FAKE_FEATURE_NAME = "Fake Feature Name";
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
|
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
|
||||||
@Rule
|
@Rule
|
||||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||||
@Mock
|
@Mock
|
||||||
private DialogInterface.OnClickListener mOnClickListener;
|
private DialogInterface.OnClickListener mOnClickListener;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -79,7 +94,7 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void createTutorialPages_shortcutListIsEmpty_throwsException() {
|
public void createTutorialPages_shortcutListIsEmpty_throwsException() {
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -87,36 +102,42 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
mShortcutTypes |= UserShortcutType.TRIPLETAP;
|
mShortcutTypes |= UserShortcutType.TRIPLETAP;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
|
||||||
assertThat(createShortcutTutorialPages(mContext,
|
assertThat(
|
||||||
mShortcutTypes)).hasSize(/* expectedSize= */ 1);
|
createShortcutTutorialPages(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME, /* inSetupWizard= */ false)
|
||||||
|
).hasSize(/* expectedSize= */ 1);
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_MAGNIFICATION_MULTIPLE_FINGER_MULTIPLE_TAP_GESTURE)
|
@EnableFlags(Flags.FLAG_ENABLE_MAGNIFICATION_MULTIPLE_FINGER_MULTIPLE_TAP_GESTURE)
|
||||||
public void createTutorialPages_turnOnTwoFingerTripleTapShortcut_hasOnePage() {
|
public void createTutorialPages_turnOnTwoFingerTripleTapShortcut_hasOnePage() {
|
||||||
mShortcutTypes |= UserShortcutType.TWOFINGER_DOUBLETAP;
|
mShortcutTypes |= UserShortcutType.TWOFINGER_DOUBLETAP;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
|
||||||
assertThat(createShortcutTutorialPages(mContext,
|
assertThat(
|
||||||
mShortcutTypes)).hasSize(/* expectedSize= */ 1);
|
createShortcutTutorialPages(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME, /* inSetupWizard= */ false)
|
||||||
|
).hasSize(/* expectedSize= */ 1);
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@RequiresFlagsEnabled(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
@EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
public void createTutorialPages_turnOnQuickSettingShortcut_hasOnePage() {
|
public void createTutorialPages_turnOnQuickSettingShortcut_hasOnePage() {
|
||||||
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
|
||||||
assertThat(createShortcutTutorialPages(mContext,
|
assertThat(
|
||||||
mShortcutTypes)).hasSize(/* expectedSize= */ 1);
|
createShortcutTutorialPages(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME, /* inSetupWizard= */ false)
|
||||||
|
).hasSize(/* expectedSize= */ 1);
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,10 +146,12 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
|
||||||
assertThat(createShortcutTutorialPages(mContext,
|
assertThat(
|
||||||
mShortcutTypes)).hasSize(/* expectedSize= */ 1);
|
createShortcutTutorialPages(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME, /* inSetupWizard= */ false)
|
||||||
|
).hasSize(/* expectedSize= */ 1);
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,36 +161,69 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
mShortcutTypes |= UserShortcutType.HARDWARE;
|
mShortcutTypes |= UserShortcutType.HARDWARE;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
|
||||||
assertThat(createShortcutTutorialPages(mContext,
|
assertThat(
|
||||||
mShortcutTypes)).hasSize(/* expectedSize= */ 2);
|
createShortcutTutorialPages(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME, /* inSetupWizard= */ false)
|
||||||
|
).hasSize(/* expectedSize= */ 2);
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createTutorialPages_turnOnSoftwareShortcut_linkButtonVisible() {
|
public void createTutorialPages_turnOnA11yGestureShortcut_linkButtonShownWithText() {
|
||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ true, /* floatingButtonEnabled= */ false);
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
assertThat(alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).getVisibility())
|
Button btn = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||||
.isEqualTo(View.VISIBLE);
|
assertThat(btn).isNotNull();
|
||||||
|
assertThat(btn.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
assertThat(btn.getText().toString()).isEqualTo(
|
||||||
|
mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_configure_software_shortcut_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createTutorialPages_turnOnSoftwareAndHardwareShortcut_linkButtonVisible() {
|
public void createTutorialPages_turnOnA11yNavButtonShortcut_linkButtonShownWithText() {
|
||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
mShortcutTypes |= UserShortcutType.HARDWARE;
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ false, /* floatingButtonEnabled= */ false);
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
assertThat(alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).getVisibility())
|
Button btn = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||||
.isEqualTo(View.VISIBLE);
|
assertThat(btn).isNotNull();
|
||||||
|
assertThat(btn.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
assertThat(btn.getText().toString()).isEqualTo(
|
||||||
|
mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_configure_software_shortcut_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createTutorialPages_turnOnFloatingButtonShortcut_linkButtonShownWithText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ false, /* floatingButtonEnabled= */ true);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
Button btn = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||||
|
assertThat(btn).isNotNull();
|
||||||
|
assertThat(btn.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
assertThat(btn.getText().toString()).isEqualTo(
|
||||||
|
mContext.getString(R.string.accessibility_tutorial_dialog_link_button));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -175,7 +231,7 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
mShortcutTypes |= UserShortcutType.HARDWARE;
|
mShortcutTypes |= UserShortcutType.HARDWARE;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
ShadowLooper.idleMainLooper();
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
@@ -188,20 +244,293 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialogForSetupWizard(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialogForSetupWizard(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
assertThat(alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).getVisibility())
|
assertThat(alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).getVisibility())
|
||||||
.isEqualTo(View.GONE);
|
.isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void createAccessibilityTutorialDialog_qsShortcut_inSuwTalkbackOn_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
||||||
|
setTouchExplorationEnabled(true);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_quick_setting);
|
||||||
|
Map<String, Object> arguments = new ArrayMap<>();
|
||||||
|
arguments.put("count", 2);
|
||||||
|
arguments.put("featureName", FAKE_FEATURE_NAME);
|
||||||
|
final CharSequence instruction = StringUtil.getIcuPluralsString(mContext,
|
||||||
|
arguments,
|
||||||
|
R.string.accessibility_tutorial_dialog_message_quick_setting);
|
||||||
|
final SpannableStringBuilder expectedInstruction = new SpannableStringBuilder();
|
||||||
|
expectedInstruction
|
||||||
|
.append(mContext.getText(
|
||||||
|
R.string.accessibility_tutorial_dialog_shortcut_unavailable_in_suw))
|
||||||
|
.append("\n\n");
|
||||||
|
expectedInstruction.append(instruction);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialogForSetupWizard(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void createAccessibilityTutorialDialog_qsShortcut_notInSuwTalkbackOn_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
||||||
|
setTouchExplorationEnabled(true);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_quick_setting);
|
||||||
|
Map<String, Object> arguments = new ArrayMap<>();
|
||||||
|
arguments.put("count", 2);
|
||||||
|
arguments.put("featureName", FAKE_FEATURE_NAME);
|
||||||
|
final CharSequence expectedInstruction = StringUtil.getIcuPluralsString(mContext,
|
||||||
|
arguments,
|
||||||
|
R.string.accessibility_tutorial_dialog_message_quick_setting);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void createAccessibilityTutorialDialog_qsShortcut_inSuwTalkbackOff_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
||||||
|
setTouchExplorationEnabled(false);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_quick_setting);
|
||||||
|
Map<String, Object> arguments = new ArrayMap<>();
|
||||||
|
arguments.put("count", 1);
|
||||||
|
arguments.put("featureName", FAKE_FEATURE_NAME);
|
||||||
|
final CharSequence instruction = StringUtil.getIcuPluralsString(mContext,
|
||||||
|
arguments,
|
||||||
|
R.string.accessibility_tutorial_dialog_message_quick_setting);
|
||||||
|
final SpannableStringBuilder expectedInstruction = new SpannableStringBuilder();
|
||||||
|
expectedInstruction.append(mContext.getText(
|
||||||
|
R.string.accessibility_tutorial_dialog_shortcut_unavailable_in_suw))
|
||||||
|
.append("\n\n");
|
||||||
|
expectedInstruction.append(instruction);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialogForSetupWizard(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void createAccessibilityTutorialDialog_qsShortcut_notInSuwTalkbackOff_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.QUICK_SETTINGS;
|
||||||
|
setTouchExplorationEnabled(false);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_quick_setting);
|
||||||
|
Map<String, Object> arguments = new ArrayMap<>();
|
||||||
|
arguments.put("count", 1);
|
||||||
|
arguments.put("featureName", FAKE_FEATURE_NAME);
|
||||||
|
final CharSequence expectedInstruction = StringUtil.getIcuPluralsString(mContext,
|
||||||
|
arguments,
|
||||||
|
R.string.accessibility_tutorial_dialog_message_quick_setting);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_volumeKeysShortcut_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.HARDWARE;
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_volume);
|
||||||
|
final CharSequence expectedInstruction = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_message_volume);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_tripleTapShortcut_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.TRIPLETAP;
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_triple);
|
||||||
|
final CharSequence expectedInstruction = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_tripletap_instruction, 3);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(Flags.FLAG_ENABLE_MAGNIFICATION_MULTIPLE_FINGER_MULTIPLE_TAP_GESTURE)
|
||||||
|
public void createAccessibilityTutorialDialog_twoFingerDoubleTapShortcut_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.TWOFINGER_DOUBLETAP;
|
||||||
|
final int numFingers = 2;
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_two_finger_double, numFingers);
|
||||||
|
final String expectedInstruction = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_twofinger_doubletap_instruction, numFingers);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_floatingButtonShortcut_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ false, /* floatingButtonEnabled= */ true);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_button);
|
||||||
|
final String expectedInstruction = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_message_floating_button);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_navA11yButtonShortcut_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ false, /* floatingButtonEnabled= */ false);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_button);
|
||||||
|
final String expectedInstruction = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_message_button);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_gestureShortcut_talkbackOn_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
setTouchExplorationEnabled(true);
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ true, /* floatingButtonEnabled= */ false);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_gesture);
|
||||||
|
final String expectedInstruction = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 3,
|
||||||
|
R.string.accessibility_tutorial_dialog_gesture_shortcut_instruction);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createAccessibilityTutorialDialog_gestureShortcut_talkbackOff_verifyText() {
|
||||||
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
|
setTouchExplorationEnabled(false);
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(
|
||||||
|
mContext, /* gestureNavEnabled= */ true, /* floatingButtonEnabled= */ false);
|
||||||
|
final String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_tutorial_dialog_title_gesture);
|
||||||
|
final String expectedInstruction = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 2,
|
||||||
|
R.string.accessibility_tutorial_dialog_gesture_shortcut_instruction);
|
||||||
|
|
||||||
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
|
verifyTutorialTitleAndInstruction(
|
||||||
|
alertDialog,
|
||||||
|
expectedTitle,
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void performClickOnPositiveButton_turnOnSoftwareShortcut_dismiss() {
|
public void performClickOnPositiveButton_turnOnSoftwareShortcut_dismiss() {
|
||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes);
|
createAccessibilityTutorialDialog(mContext, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
||||||
ShadowLooper.idleMainLooper();
|
ShadowLooper.idleMainLooper();
|
||||||
@@ -213,8 +542,10 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
public void performClickOnPositiveButton_turnOnSoftwareShortcut_callOnClickListener() {
|
public void performClickOnPositiveButton_turnOnSoftwareShortcut_callOnClickListener() {
|
||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
final AlertDialog alertDialog =
|
final AlertDialog alertDialog =
|
||||||
createAccessibilityTutorialDialog(mContext, mShortcutTypes, mOnClickListener);
|
createAccessibilityTutorialDialog(
|
||||||
|
mContext, mShortcutTypes, mOnClickListener, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
ShadowLooper.idleMainLooper();
|
||||||
|
|
||||||
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
||||||
ShadowLooper.idleMainLooper();
|
ShadowLooper.idleMainLooper();
|
||||||
@@ -226,7 +557,8 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
public void performClickOnNegativeButton_turnOnSoftwareShortcut_directToSettingsPage() {
|
public void performClickOnNegativeButton_turnOnSoftwareShortcut_directToSettingsPage() {
|
||||||
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
mShortcutTypes |= UserShortcutType.SOFTWARE;
|
||||||
Activity activity = Robolectric.buildActivity(Activity.class).create().get();
|
Activity activity = Robolectric.buildActivity(Activity.class).create().get();
|
||||||
final AlertDialog alertDialog = createAccessibilityTutorialDialog(activity, mShortcutTypes);
|
final AlertDialog alertDialog =
|
||||||
|
createAccessibilityTutorialDialog(activity, mShortcutTypes, FAKE_FEATURE_NAME);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
|
||||||
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
|
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
|
||||||
@@ -251,4 +583,22 @@ public final class AccessibilityGestureNavigationTutorialTest {
|
|||||||
assertThat(alertDialog.isShowing()).isFalse();
|
assertThat(alertDialog.isShowing()).isFalse();
|
||||||
verify(mOnDismissListener).onDismiss(alertDialog);
|
verify(mOnDismissListener).onDismiss(alertDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setTouchExplorationEnabled(boolean enable) {
|
||||||
|
ShadowAccessibilityManager am = shadowOf(
|
||||||
|
mContext.getSystemService(AccessibilityManager.class));
|
||||||
|
am.setTouchExplorationEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verifyTutorialTitleAndInstruction(AlertDialog alertDialog, String expectedTitle,
|
||||||
|
String expectedInstruction) {
|
||||||
|
TextSwitcher titleView = alertDialog.findViewById(R.id.title);
|
||||||
|
assertThat(titleView).isNotNull();
|
||||||
|
assertThat(((TextView) titleView.getCurrentView()).getText().toString()).isEqualTo(
|
||||||
|
expectedTitle);
|
||||||
|
TextSwitcher instructionView = alertDialog.findViewById(R.id.instruction);
|
||||||
|
assertThat(instructionView).isNotNull();
|
||||||
|
assertThat(((TextView) instructionView.getCurrentView()).getText().toString()).isEqualTo(
|
||||||
|
expectedInstruction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.accessibility.shortcuts;
|
package com.android.settings.accessibility.shortcuts;
|
||||||
|
|
||||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
|
|
||||||
|
|
||||||
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_COMPONENT_NAME;
|
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_COMPONENT_NAME;
|
||||||
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
||||||
import static com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment.SHORTCUT_SETTINGS;
|
import static com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment.SHORTCUT_SETTINGS;
|
||||||
@@ -38,10 +36,12 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.platform.test.annotations.EnableFlags;
|
||||||
import android.platform.test.flag.junit.SetFlagsRule;
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.view.accessibility.Flags;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.testing.FragmentScenario;
|
import androidx.fragment.app.testing.FragmentScenario;
|
||||||
@@ -58,9 +58,11 @@ import com.android.settings.SettingsActivity;
|
|||||||
import com.android.settings.SubSettings;
|
import com.android.settings.SubSettings;
|
||||||
import com.android.settings.accessibility.AccessibilityUtil;
|
import com.android.settings.accessibility.AccessibilityUtil;
|
||||||
import com.android.settings.accessibility.PreferredShortcuts;
|
import com.android.settings.accessibility.PreferredShortcuts;
|
||||||
|
import com.android.settings.testutils.AccessibilityTestUtils;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ import org.junit.runner.RunWith;
|
|||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
import org.robolectric.shadow.api.Shadow;
|
||||||
import org.robolectric.shadows.ShadowAccessibilityManager;
|
import org.robolectric.shadows.ShadowAccessibilityManager;
|
||||||
import org.robolectric.shadows.ShadowContentResolver;
|
import org.robolectric.shadows.ShadowContentResolver;
|
||||||
import org.robolectric.shadows.ShadowLooper;
|
import org.robolectric.shadows.ShadowLooper;
|
||||||
@@ -81,6 +84,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +100,8 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
private static final CharSequence SCREEN_TITLE = "Fake shortcut title";
|
private static final CharSequence SCREEN_TITLE = "Fake shortcut title";
|
||||||
private static final ComponentName TARGET_FAKE_COMPONENT =
|
private static final ComponentName TARGET_FAKE_COMPONENT =
|
||||||
new ComponentName("FakePackage", "FakeClass");
|
new ComponentName("FakePackage", "FakeClass");
|
||||||
|
private static final ComponentName TARGET_FAKE_COMPONENT_TILE =
|
||||||
|
new ComponentName("FakePackage", "FakeTile");
|
||||||
private static final String TARGET = MAGNIFICATION_CONTROLLER_NAME;
|
private static final String TARGET = MAGNIFICATION_CONTROLLER_NAME;
|
||||||
private static final Set<String> TARGETS = Set.of(TARGET);
|
private static final Set<String> TARGETS = Set.of(TARGET);
|
||||||
|
|
||||||
@@ -109,12 +115,14 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
AccessibilityTestUtils.setSoftwareShortcutMode(mContext, /* gestureNavEnabled= */
|
||||||
|
true, /* floatingButtonEnabled= */ false);
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.integer.config_navBarInteractionMode,
|
com.android.internal.R.bool.config_quickSettingsSupported, true);
|
||||||
NAV_BAR_MODE_GESTURAL);
|
com.android.settings.testutils.shadow.ShadowAccessibilityManager a11yManager =
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Shadow.extract(mContext.getSystemService(AccessibilityManager.class));
|
||||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
|
a11yManager.setA11yFeatureToTileMap(
|
||||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE);
|
Map.of(TARGET_FAKE_COMPONENT, TARGET_FAKE_COMPONENT_TILE));
|
||||||
|
|
||||||
mActivity = Robolectric.buildActivity(FragmentActivity.class).get();
|
mActivity = Robolectric.buildActivity(FragmentActivity.class).get();
|
||||||
}
|
}
|
||||||
@@ -158,7 +166,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentCreated_inSuw_controllersTargetsSet() {
|
public void fragmentCreated_inSuw_controllersTargetsSet() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ true);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ true, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
mFragmentScenario.onFragment(fragment -> {
|
mFragmentScenario.onFragment(fragment -> {
|
||||||
@@ -174,7 +182,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentCreated_notInSuw_controllersTargetsSet() {
|
public void fragmentCreated_notInSuw_controllersTargetsSet() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
mFragmentScenario.onFragment(fragment -> {
|
mFragmentScenario.onFragment(fragment -> {
|
||||||
@@ -195,7 +203,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
assertThat(contentResolver.getContentObservers(uri)).isEmpty();
|
assertThat(contentResolver.getContentObservers(uri)).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
for (Uri uri : SHORTCUT_SETTINGS) {
|
for (Uri uri : SHORTCUT_SETTINGS) {
|
||||||
@@ -207,7 +215,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
public void fragmentDestroyed_unregisterSettingsObserver() {
|
public void fragmentDestroyed_unregisterSettingsObserver() {
|
||||||
ShadowContentResolver contentResolver = shadowOf(mContext.getContentResolver());
|
ShadowContentResolver contentResolver = shadowOf(mContext.getContentResolver());
|
||||||
|
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false)
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET)
|
||||||
.moveToState(Lifecycle.State.CREATED);
|
.moveToState(Lifecycle.State.CREATED);
|
||||||
mFragmentScenario.onFragment(EditShortcutsPreferenceFragment::onDestroy);
|
mFragmentScenario.onFragment(EditShortcutsPreferenceFragment::onDestroy);
|
||||||
|
|
||||||
@@ -218,7 +226,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onVolumeKeysShortcutSettingChanged_volumeKeyControllerUpdated() {
|
public void onVolumeKeysShortcutSettingChanged_volumeKeyControllerUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
ShortcutUtils.optInValueToSettings(
|
ShortcutUtils.optInValueToSettings(
|
||||||
@@ -233,7 +241,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSoftwareShortcutSettingChanged_softwareControllersUpdated() {
|
public void onSoftwareShortcutSettingChanged_softwareControllersUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
ShortcutUtils.optInValueToSettings(
|
ShortcutUtils.optInValueToSettings(
|
||||||
@@ -249,7 +257,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSoftwareShortcutModeChanged_softwareControllersUpdated() {
|
public void onSoftwareShortcutModeChanged_softwareControllersUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
ShortcutUtils.optInValueToSettings(
|
ShortcutUtils.optInValueToSettings(
|
||||||
@@ -265,7 +273,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onTripleTapShortcutSettingChanged_tripleTapShortcutControllerUpdated() {
|
public void onTripleTapShortcutSettingChanged_tripleTapShortcutControllerUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
@@ -283,7 +291,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onTwoFingersShortcutSettingChanged_twoFingersDoubleTapShortcutControllerUpdated() {
|
public void onTwoFingersShortcutSettingChanged_twoFingersDoubleTapShortcutControllerUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
|
|
||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
@@ -302,12 +310,12 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentResumed_enableTouchExploration_gestureShortcutOptionSummaryUpdated() {
|
public void fragmentResumed_enableTouchExploration_gestureShortcutOptionSummaryUpdated() {
|
||||||
String expectedSummary = mContext.getString(
|
String expectedSummary = StringUtil.getIcuPluralsString(mContext, 3,
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_gesture_talkback)
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture)
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ mContext.getString(
|
+ mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
||||||
|
|
||||||
ShadowAccessibilityManager am = shadowOf(
|
ShadowAccessibilityManager am = shadowOf(
|
||||||
@@ -323,12 +331,12 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentPaused_enableTouchExploration_gestureShortcutOptionSummaryNotUpdated() {
|
public void fragmentPaused_enableTouchExploration_gestureShortcutOptionSummaryNotUpdated() {
|
||||||
String expectedSummary = mContext.getString(
|
String expectedSummary = StringUtil.getIcuPluralsString(mContext, 2,
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_gesture)
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture)
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ mContext.getString(
|
+ mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.RESUMED).moveToState(Lifecycle.State.STARTED);
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED).moveToState(Lifecycle.State.STARTED);
|
||||||
|
|
||||||
ShadowAccessibilityManager am = shadowOf(
|
ShadowAccessibilityManager am = shadowOf(
|
||||||
@@ -342,9 +350,49 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void fragmentResumed_enableTouchExploration_qsShortcutOptionSummaryUpdated() {
|
||||||
|
String expectedSummary = StringUtil.getIcuPluralsString(mContext, 2,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
||||||
|
mFragmentScenario = createFragScenario(
|
||||||
|
/* isInSuw= */ false, TARGET_FAKE_COMPONENT.flattenToString());
|
||||||
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
||||||
|
|
||||||
|
ShadowAccessibilityManager am = shadowOf(
|
||||||
|
mContext.getSystemService(AccessibilityManager.class));
|
||||||
|
am.setTouchExplorationEnabled(true);
|
||||||
|
|
||||||
|
mFragmentScenario.onFragment(fragment -> {
|
||||||
|
Preference preference = fragment.findPreference(
|
||||||
|
mContext.getString(R.string.accessibility_shortcut_quick_settings_pref));
|
||||||
|
assertThat(preference.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
|
public void fragmentPaused_enableTouchExploration_qsShortcutOptionSummaryNotUpdated() {
|
||||||
|
String expectedSummary = StringUtil.getIcuPluralsString(mContext, 1,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
||||||
|
mFragmentScenario = createFragScenario(
|
||||||
|
/* isInSuw= */ false, TARGET_FAKE_COMPONENT.flattenToString());
|
||||||
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED).moveToState(Lifecycle.State.STARTED);
|
||||||
|
|
||||||
|
ShadowAccessibilityManager am = shadowOf(
|
||||||
|
mContext.getSystemService(AccessibilityManager.class));
|
||||||
|
am.setTouchExplorationEnabled(true);
|
||||||
|
|
||||||
|
mFragmentScenario.onFragment(fragment -> {
|
||||||
|
Preference preference = fragment.findPreference(
|
||||||
|
mContext.getString(R.string.accessibility_shortcut_quick_settings_pref));
|
||||||
|
assertThat(preference.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onAdvancedPreferenceClicked_advancedShouldBecomeInvisible() {
|
public void onAdvancedPreferenceClicked_advancedShouldBecomeInvisible() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
||||||
mFragmentScenario.onFragment(fragment -> {
|
mFragmentScenario.onFragment(fragment -> {
|
||||||
Preference advanced = fragment.findPreference(
|
Preference advanced = fragment.findPreference(
|
||||||
@@ -372,7 +420,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentRecreated_collapsed_advancedRemainVisible() {
|
public void fragmentRecreated_collapsed_advancedRemainVisible() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
||||||
|
|
||||||
mFragmentScenario.recreate();
|
mFragmentScenario.recreate();
|
||||||
@@ -386,7 +434,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fragmentResumed_preferredShortcutsUpdated() {
|
public void fragmentResumed_preferredShortcutsUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
mFragmentScenario.moveToState(Lifecycle.State.RESUMED);
|
||||||
// Move the fragment to the background
|
// Move the fragment to the background
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
@@ -408,7 +456,7 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onVolumeKeysShortcutSettingChanged_preferredShortcutsUpdated() {
|
public void onVolumeKeysShortcutSettingChanged_preferredShortcutsUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
assertThat(
|
assertThat(
|
||||||
PreferredShortcuts.retrieveUserShortcutType(
|
PreferredShortcuts.retrieveUserShortcutType(
|
||||||
@@ -481,22 +529,25 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
|
||||||
public void onQuickSettingsShortcutSettingChanged_preferredShortcutsUpdated() {
|
public void onQuickSettingsShortcutSettingChanged_preferredShortcutsUpdated() {
|
||||||
mFragmentScenario = createFragScenario(/* isInSuw= */ false);
|
final String target = TARGET_FAKE_COMPONENT.flattenToString();
|
||||||
|
mFragmentScenario = createFragScenario(
|
||||||
|
/* isInSuw= */ false, TARGET_FAKE_COMPONENT.flattenToString());
|
||||||
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
mFragmentScenario.moveToState(Lifecycle.State.CREATED);
|
||||||
int currentPreferredShortcut =
|
int currentPreferredShortcut =
|
||||||
PreferredShortcuts.retrieveUserShortcutType(mContext, TARGET);
|
PreferredShortcuts.retrieveUserShortcutType(mContext, target);
|
||||||
assertThat(currentPreferredShortcut
|
assertThat(currentPreferredShortcut
|
||||||
& ShortcutConstants.UserShortcutType.QUICK_SETTINGS).isEqualTo(0);
|
& ShortcutConstants.UserShortcutType.QUICK_SETTINGS).isEqualTo(0);
|
||||||
|
|
||||||
ShortcutUtils.optInValueToSettings(
|
ShortcutUtils.optInValueToSettings(
|
||||||
mContext, ShortcutConstants.UserShortcutType.QUICK_SETTINGS, TARGET);
|
mContext, ShortcutConstants.UserShortcutType.QUICK_SETTINGS, target);
|
||||||
|
|
||||||
// Calls onFragment so that the change to Setting is notified to its observer
|
// Calls onFragment so that the change to Setting is notified to its observer
|
||||||
mFragmentScenario.onFragment(fragment ->
|
mFragmentScenario.onFragment(fragment ->
|
||||||
assertThat(
|
assertThat(
|
||||||
PreferredShortcuts.retrieveUserShortcutType(
|
PreferredShortcuts.retrieveUserShortcutType(
|
||||||
mContext, TARGET)
|
mContext, target)
|
||||||
).isEqualTo(ShortcutConstants.UserShortcutType.QUICK_SETTINGS)
|
).isEqualTo(ShortcutConstants.UserShortcutType.QUICK_SETTINGS)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -537,10 +588,11 @@ public class EditShortcutsPreferenceFragmentTest {
|
|||||||
return retControllers;
|
return retControllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FragmentScenario<EditShortcutsPreferenceFragment> createFragScenario(boolean isInSuw) {
|
private FragmentScenario<EditShortcutsPreferenceFragment> createFragScenario(
|
||||||
|
boolean isInSuw, String target) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putStringArray(
|
args.putStringArray(
|
||||||
EditShortcutsPreferenceFragment.ARG_KEY_SHORTCUT_TARGETS, new String[]{TARGET});
|
EditShortcutsPreferenceFragment.ARG_KEY_SHORTCUT_TARGETS, new String[]{target});
|
||||||
FragmentScenario<EditShortcutsPreferenceFragment> scenario =
|
FragmentScenario<EditShortcutsPreferenceFragment> scenario =
|
||||||
FragmentScenario.launch(
|
FragmentScenario.launch(
|
||||||
EditShortcutsPreferenceFragment.class, args,
|
EditShortcutsPreferenceFragment.class, args,
|
||||||
|
@@ -24,7 +24,6 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
@@ -74,19 +73,24 @@ public class FloatingButtonShortcutOptionControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSummary_inSuw_verifySummaryEmpty() {
|
public void getSummary_inSuw_verifySummary() {
|
||||||
|
String expectedSummary = mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_floating_button);
|
||||||
mController.setInSetupWizard(true);
|
mController.setInSetupWizard(true);
|
||||||
|
|
||||||
assertThat(TextUtils.isEmpty(mController.getSummary())).isTrue();
|
assertThat(mController.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSummary_notInSuw_verifySummary() {
|
public void getSummary_notInSuw_verifySummary() {
|
||||||
|
String expectedSummary = mContext.getText(
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_floating_button)
|
||||||
|
+ "\n\n"
|
||||||
|
+ mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
||||||
mController.setInSetupWizard(false);
|
mController.setInSetupWizard(false);
|
||||||
|
|
||||||
assertThat(mController.getSummary().toString()).isEqualTo(
|
assertThat(mController.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
mContext.getString(
|
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_floating));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -34,6 +34,7 @@ import androidx.test.core.app.ApplicationProvider;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.AccessibilityTestUtils;
|
import com.android.settings.testutils.AccessibilityTestUtils;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -82,10 +83,13 @@ public class GestureShortcutOptionControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSummary_touchExplorationDisabled_verifySummary() {
|
public void getSummary_touchExplorationDisabled_notInSuw_verifySummary() {
|
||||||
enableTouchExploration(false);
|
enableTouchExploration(false);
|
||||||
String expected = mContext.getString(
|
mController.setInSetupWizard(false);
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_gesture)
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 2,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture)
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ mContext.getString(
|
+ mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
||||||
@@ -94,10 +98,25 @@ public class GestureShortcutOptionControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSummary_touchExplorationEnabled_verifySummary() {
|
public void getSummary_touchExplorationDisabled_inSuw_verifySummary() {
|
||||||
|
enableTouchExploration(false);
|
||||||
|
mController.setInSetupWizard(true);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 2,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_touchExplorationEnabled_notInSuw_verifySummary() {
|
||||||
enableTouchExploration(true);
|
enableTouchExploration(true);
|
||||||
String expected = mContext.getString(
|
mController.setInSetupWizard(false);
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_gesture_talkback)
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 3,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture)
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ mContext.getString(
|
+ mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
R.string.accessibility_shortcut_edit_dialog_summary_software_floating);
|
||||||
@@ -105,6 +124,18 @@ public class GestureShortcutOptionControllerTest {
|
|||||||
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_touchExplorationEnabled_inSuw_verifySummary() {
|
||||||
|
enableTouchExploration(true);
|
||||||
|
mController.setInSetupWizard(true);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 3,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_gesture);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isShortcutAvailable_inSuw_returnFalse() {
|
public void isShortcutAvailable_inSuw_returnFalse() {
|
||||||
mController.setInSetupWizard(true);
|
mController.setInSetupWizard(true);
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.accessibility.shortcuts;
|
package com.android.settings.accessibility.shortcuts;
|
||||||
|
|
||||||
|
import static com.android.settings.testutils.AccessibilityTestUtils.setupMockAccessibilityManager;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
@@ -40,12 +42,14 @@ import com.android.internal.accessibility.util.ShortcutUtils;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.AccessibilityTestUtils;
|
import com.android.settings.testutils.AccessibilityTestUtils;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
|
import com.android.settingslib.utils.StringUtil;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,6 +59,7 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Tests for {@link QuickSettingsShortcutOptionController}
|
* Tests for {@link QuickSettingsShortcutOptionController}
|
||||||
*/
|
*/
|
||||||
|
@Config(shadows = SettingsShadowResources.class)
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class QuickSettingsShortcutOptionControllerTest {
|
public class QuickSettingsShortcutOptionControllerTest {
|
||||||
private static final String PREF_KEY = "prefKey";
|
private static final String PREF_KEY = "prefKey";
|
||||||
@@ -87,15 +92,60 @@ public class QuickSettingsShortcutOptionControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_verifyScreenTextSet() {
|
public void displayPreference_verifyScreenTitleSet() {
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
|
||||||
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(
|
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(
|
||||||
mContext.getString(
|
mContext.getString(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_quick_settings));
|
R.string.accessibility_shortcut_edit_dialog_title_quick_settings));
|
||||||
assertThat(mShortcutOptionPreference.getSummary().toString()).isEqualTo(
|
}
|
||||||
mContext.getString(
|
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings));
|
@Test
|
||||||
|
public void getSummary_touchExplorationDisabled_inSuw_verifySummary() {
|
||||||
|
enableTouchExploration(false);
|
||||||
|
mController.setInSetupWizard(true);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 1,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings_suw);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_touchExplorationDisabled_notInSuw_verifySummary() {
|
||||||
|
enableTouchExploration(false);
|
||||||
|
mController.setInSetupWizard(false);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 1,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_touchExplorationEnabled_inSuw_verifySummary() {
|
||||||
|
enableTouchExploration(true);
|
||||||
|
mController.setInSetupWizard(true);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 2,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings_suw);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_touchExplorationEnabled_notInSuw_verifySummary() {
|
||||||
|
enableTouchExploration(true);
|
||||||
|
mController.setInSetupWizard(false);
|
||||||
|
String expected = StringUtil.getIcuPluralsString(
|
||||||
|
mContext,
|
||||||
|
/* count= */ 2,
|
||||||
|
R.string.accessibility_shortcut_edit_dialog_summary_quick_settings);
|
||||||
|
|
||||||
|
assertThat(mController.getSummary().toString()).isEqualTo(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -177,4 +227,9 @@ public class QuickSettingsShortcutOptionControllerTest {
|
|||||||
|
|
||||||
assertThat(mController.isChecked()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enableTouchExploration(boolean enable) {
|
||||||
|
AccessibilityManager am = setupMockAccessibilityManager(mContext);
|
||||||
|
when(am.isTouchExplorationEnabled()).thenReturn(enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.icu.text.MessageFormat;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.platform.test.annotations.DisableFlags;
|
import android.platform.test.annotations.DisableFlags;
|
||||||
import android.platform.test.annotations.EnableFlags;
|
import android.platform.test.annotations.EnableFlags;
|
||||||
@@ -83,16 +82,16 @@ public class TripleTapShortcutOptionControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_verifyScreenTestSet() {
|
public void displayPreference_verifyTitleSummaryText() {
|
||||||
|
String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_screen_title_triple_tap);
|
||||||
|
String expectedSummary = mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_screen_summary_triple_tap, 3);
|
||||||
|
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
|
||||||
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(
|
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(expectedTitle);
|
||||||
mContext.getString(R.string.accessibility_shortcut_edit_dialog_title_triple_tap));
|
assertThat(mShortcutOptionPreference.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
assertThat(mShortcutOptionPreference.getSummary().toString()).isEqualTo(
|
|
||||||
MessageFormat.format(
|
|
||||||
mContext.getString(
|
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_triple_tap),
|
|
||||||
3));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.icu.text.MessageFormat;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.platform.test.annotations.DisableFlags;
|
import android.platform.test.annotations.DisableFlags;
|
||||||
import android.platform.test.annotations.EnableFlags;
|
import android.platform.test.annotations.EnableFlags;
|
||||||
@@ -82,15 +81,15 @@ public class TwoFingerDoubleTapShortcutOptionControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_verifyScreenTextSet() {
|
public void displayPreference_verifyScreenTextSet() {
|
||||||
|
String expectedTitle = mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_screen_title_two_finger_double_tap, 2);
|
||||||
|
String expectedSummary = mContext.getString(
|
||||||
|
R.string.accessibility_shortcut_edit_screen_summary_two_finger_double_tap, 2);
|
||||||
|
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
|
||||||
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(
|
assertThat(mShortcutOptionPreference.getTitle().toString()).isEqualTo(expectedTitle);
|
||||||
mContext.getString(
|
assertThat(mShortcutOptionPreference.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_two_finger_double_tap));
|
|
||||||
assertThat(mShortcutOptionPreference.getSummary().toString()).isEqualTo(
|
|
||||||
MessageFormat.format(mContext.getString(
|
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_two_finger_double_tap),
|
|
||||||
2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -16,14 +16,15 @@
|
|||||||
|
|
||||||
package com.android.settings.testutils.shadow;
|
package com.android.settings.testutils.shadow;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.util.ArrayMap;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
import org.robolectric.annotation.Implementation;
|
||||||
import org.robolectric.annotation.Implements;
|
import org.robolectric.annotation.Implements;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,12 +32,21 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Implements(AccessibilityManager.class)
|
@Implements(AccessibilityManager.class)
|
||||||
public class ShadowAccessibilityManager extends org.robolectric.shadows.ShadowAccessibilityManager {
|
public class ShadowAccessibilityManager extends org.robolectric.shadows.ShadowAccessibilityManager {
|
||||||
|
private Map<ComponentName, ComponentName> mA11yFeatureToTileMap = new ArrayMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a hidden method {@link AccessibilityManager.getA11yFeatureToTileMap} and returns
|
* Implements a hidden method {@link AccessibilityManager.getA11yFeatureToTileMap}
|
||||||
* an empty map.
|
|
||||||
*/
|
*/
|
||||||
@Implementation
|
@Implementation
|
||||||
public Map<ComponentName, ComponentName> getA11yFeatureToTileMap(@UserIdInt int userId) {
|
public Map<ComponentName, ComponentName> getA11yFeatureToTileMap(@UserIdInt int userId) {
|
||||||
return Collections.emptyMap();
|
return mA11yFeatureToTileMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set fake a11y feature to tile mapping
|
||||||
|
*/
|
||||||
|
public void setA11yFeatureToTileMap(
|
||||||
|
@NonNull Map<ComponentName, ComponentName> a11yFeatureToTileMap) {
|
||||||
|
mA11yFeatureToTileMap = a11yFeatureToTileMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user