Mark off-screen pages as unimportant for accessibility

ag/2458689 reduced page spacing, making it possible for
adjacent pages to overlap the current viewport. Though
you can't see this overlap due to paddings, this caused
items on the edges of adjacent pages to be focusable in
accessibility.

Bug: 63335071
Change-Id: I1296e7a711e2f0af8fc8bedda70a94a7693c7055
This commit is contained in:
Tony committed 2017-07-06 11:32:53 -07:00
1 parent 2ed276eb13
commit 6dea7cddf9
1 file changed
+9 -4
+9 -4
View File
@@ -1632,16 +1632,21 @@ public class Workspace extends PagedView
}
private void updatePageAlphaValues() {
if (mWorkspaceFadeInAdjacentScreens &&
!workspaceInModalState() &&
!mIsSwitchingState) {
if (!workspaceInModalState() && !mIsSwitchingState) {
int screenCenter = getScrollX() + getViewportWidth() / 2;
for (int i = numCustomPages(); i < getChildCount(); i++) {
CellLayout child = (CellLayout) getChildAt(i);
if (child != null) {
float scrollProgress = getScrollProgress(screenCenter, child, i);
float alpha = 1 - Math.abs(scrollProgress);
child.getShortcutsAndWidgets().setAlpha(alpha);
if (mWorkspaceFadeInAdjacentScreens) {
child.getShortcutsAndWidgets().setAlpha(alpha);
} else {
// Pages that are off-screen aren't important for accessibility.
child.getShortcutsAndWidgets().setImportantForAccessibility(
alpha > 0 ? IMPORTANT_FOR_ACCESSIBILITY_AUTO
: IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
}
}
}
}