Improve KQS accessibility

Adds accessible pane name, and content description for keyboard quick
switch view. Improves content description for task views, by having it
provide the task position in the task list. Also, sets a task content
description immediately when it gets associated with a task, even if the
task description is not available at the time. Accessibility focus for a
task may be requested as the KQS view is shown, so the task view should
have a meaningful content description from the start.

While here, update KQS to focus first task  by default when opened from
taskbar.

Bug: 399032757
Test: Manual, with Talkback enabled - open KQS via taskbar overflow view,
      and Alt+Tab, and verify Talkback announcements are informative
      (e.g. no "Pixel launcher" utterance).
      Also atest NexusLauncherTests:TaplTestsKeyboardQuickSwitch
Flag: EXEMPT bug fix

Change-Id: I3688954ab383035c1db35c5eb7a0ddf9a39a123f
This commit is contained in:
Toni Barzic committed 2025-03-10 17:35:04 +00:00
1 parent 8800f6d068
commit 394d5e0010
4 files changed
+73 -14

No files matched your search

@@ -300,6 +300,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
continue;
}
currentTaskView.setPositionInformation(i, tasksToDisplay);
currentTaskView.setThumbnailsForSplitTasks(
task1,
task2,
@@ -547,6 +548,9 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
ViewOutlineProvider outlineProvider = getOutlineProvider();
int defaultFocusedTaskIndex = Math.min(
getTaskCount() - 1,
currentFocusIndexOverride == -1 ? 1 : currentFocusIndexOverride);
mOpenAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
@@ -600,9 +604,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
});
}
animateFocusMove(-1, Math.min(
getTaskCount() - 1,
currentFocusIndexOverride == -1 ? 1 : currentFocusIndexOverride));
animateFocusMove(-1, defaultFocusedTaskIndex);
displayedContent.setVisibility(VISIBLE);
setVisibility(VISIBLE);
requestFocus();
@@ -622,6 +624,11 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
invalidateOutline();
mOpenAnimation = null;
InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_OPEN);
View focusedTask = getTaskAt(defaultFocusedTaskIndex);
if (focusedTask != null) {
focusedTask.requestAccessibilityFocus();
}
}
});