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
This commit is contained in:
Anushree Ganjam committed 2024-12-06 13:13:15 -08:00
1 parent 040aad2cb2
commit 8335b9790a
1 file changed
+16
@@ -762,6 +762,22 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
}
}
@Override
public void addChildrenForAccessibility(ArrayList<View> 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);