Fix should not let users adjust a11y button settings in SuW issue

Root Cause: Users should not be able to adjust any settings of the a11y
button in the setup wizard flow, but there will be a link button to
a11y button settings page on the a11y tutorial dialog where user can
modify the settings.

Solution: Hide the link button in a11y tutorial dialog if we know the
dialog is launched from any setup wizard page.

Bug: 256084341
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityGestureNavigationTutorialTest
Change-Id: I742f9b7ba311fcd7a5105463709dc104345b9f12
This commit is contained in:
Angela Wang
2022-10-28 09:16:25 +00:00
parent 812c7d7953
commit c4f3295491
4 changed files with 67 additions and 8 deletions

View File

@@ -160,6 +160,37 @@ public final class AccessibilityGestureNavigationTutorial {
return alertDialog;
}
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(Context context,
int shortcutTypes) {
return createAccessibilityTutorialDialogForSetupWizard(context, shortcutTypes,
mOnClickListener);
}
static AlertDialog createAccessibilityTutorialDialogForSetupWizard(Context context,
int shortcutTypes, @Nullable DialogInterface.OnClickListener actionButtonListener) {
final int category = SettingsEnums.SWITCH_SHORTCUT_DIALOG_ACCESSIBILITY_BUTTON_SETTINGS;
final DialogInterface.OnClickListener linkButtonListener =
(dialog, which) -> new SubSettingLauncher(context)
.setDestination(AccessibilityButtonFragment.class.getName())
.setSourceMetricsCategory(category)
.launch();
final AlertDialog alertDialog = new AlertDialog.Builder(context)
.setPositiveButton(R.string.accessibility_tutorial_dialog_button,
actionButtonListener)
.create();
final List<TutorialPage> tutorialPages =
createShortcutTutorialPages(context, shortcutTypes);
Preconditions.checkArgument(!tutorialPages.isEmpty(),
/* errorMessage= */ "Unexpected tutorial pages size");
alertDialog.setView(createShortcutNavigationContentView(context, tutorialPages, null));
return alertDialog;
}
/**
* Gets a content View for a dialog to confirm that they want to enable a service.
*