Refine adjustIsVisibleToUser

A11yInteractionController would adjust A11yNodeInfo's visible when it
is outside of interactive region. Therefore, the top row characters
in pop-up of IME additional characters may be invisible to users. It
causes a11y services can't select these A11yNodeInfo.

Check if window type of ViewRootImpl should be bypassed adjustment.

Bug: 113531901
Test: A11y CTS & unit test
Test: Check if the top row characters in pop-up of IME additional
      characters could be selected by Switch Access & Voice Access

Change-Id: If8d55720be69ea17090c26b12ce29ab64fdc5440
This commit is contained in:
Jackal Guo
2019-03-20 17:43:19 +08:00
parent 22640b9ac7
commit ecd09bb6b4

View File

@@ -16,6 +16,7 @@
package android.view;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_ACCESSIBLE_CLICKABLE_SPAN;
import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_REQUESTED_KEY;
import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY;
@@ -797,11 +798,19 @@ public final class AccessibilityInteractionController {
}
Rect boundsInScreen = mTempRect;
info.getBoundsInScreen(boundsInScreen);
if (interactiveRegion.quickReject(boundsInScreen)) {
if (interactiveRegion.quickReject(boundsInScreen) && !shouldBypassAdjustIsVisible()) {
info.setVisibleToUser(false);
}
}
private boolean shouldBypassAdjustIsVisible() {
final int windowType = mViewRootImpl.mOrigWindowType;
if (windowType == TYPE_INPUT_METHOD) {
return true;
}
return false;
}
private void applyAppScaleAndMagnificationSpecIfNeeded(AccessibilityNodeInfo info,
MagnificationSpec spec) {
if (info == null) {