From ecd09bb6b4ceaa6b77c4df860aa64487a46a3634 Mon Sep 17 00:00:00 2001 From: Jackal Guo Date: Wed, 20 Mar 2019 17:43:19 +0800 Subject: [PATCH] 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 --- .../view/AccessibilityInteractionController.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java index f37c9162d98a4..0051d01eec130 100644 --- a/core/java/android/view/AccessibilityInteractionController.java +++ b/core/java/android/view/AccessibilityInteractionController.java @@ -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) {