From 8335b9790a356b620ce776895291ef52af23ba73 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Thu, 5 Dec 2024 16:38:27 -0800 Subject: [PATCH] Modify the accessibility tree to move the searchbox to the top. This change fixes both quickstep and pixel launcher variants. Before A11y traversal order : https://paste.googleplex.com/4735370693181440 Video: http://recall/-/cYrER3oshUB9gisWlEhySV/fGSVr7vsAToApiYzywptQ6 After A11y traversal order : https://paste.googleplex.com/6464092613902336 Video: http://recall/-/cYrER3oshUB9gisWlEhySV/cEEPIPidHGP4tg9Hng7Ra6 Bug: 378610191 Test: Manual Flag: EXEMPT a11y Bugfix Change-Id: I95fbdc2db02f2957db461769e0d9a0556adbb760 --- .../allapps/ActivityAllAppsContainerView.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index c938482284..85d48a3ad2 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -762,6 +762,22 @@ public class ActivityAllAppsContainerView } } + @Override + public void addChildrenForAccessibility(ArrayList arrayList) { + super.addChildrenForAccessibility(arrayList); + if (!Flags.floatingSearchBar()) { + // Searchbox container is visually at the top of the all apps UI but it's present in + // end of the children list. + // We need to move the searchbox to the top in a11y tree for a11y services to read the + // all apps screen in same as visual order. + arrayList.stream().filter(v -> v.getId() == R.id.search_container_all_apps) + .findFirst().ifPresent(v -> { + arrayList.remove(v); + arrayList.add(0, v); + }); + } + } + protected void updateHeaderScroll(int scrolledOffset) { float prog1 = Utilities.boundToRange((float) scrolledOffset / mHeaderThreshold, 0f, 1f); int headerColor = getHeaderColor(prog1);