diff options
| author | Jackal Guo <jackalguo@google.com> | 2020-02-11 14:20:16 +0800 |
|---|---|---|
| committer | Jackal Guo <jackalguo@google.com> | 2020-02-19 16:12:10 +0800 |
| commit | a88ee6f588271b0ebc06284cc9a276ebc2ad214c (patch) | |
| tree | c3621e1497f694882ac8a534ed391809be65e3b5 /core/java/android/view/SurfaceView.java | |
| parent | 1c4cb8be3b8a1993cf04e28ca83b744c6c3a474f (diff) | |
Adjust the logic of isImportantForAccessibility
According to the logic in #isImportantForAccessibility, SurfaceView
wouldn't be important by default. This results in the A11yNodeInfo
generated by this SurfaceView isn't important. If this SurfaceView
hosts an embedded hierarchy, the accessibility services may ignore
it. Hence, it couldn't compose the complete node tree.
Bug: 149266686
Test: a11y CTS & unit tests
Change-Id: I90d9f043339d2ad72607e8ae8c8dfc2c1b0f004d
Diffstat (limited to 'core/java/android/view/SurfaceView.java')
| -rw-r--r-- | core/java/android/view/SurfaceView.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 5566e0e4292e..2b11889334d8 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -1596,6 +1596,19 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall info.addChild(wrapper.getLeashToken()); } + @Override + public int getImportantForAccessibility() { + final int mode = super.getImportantForAccessibility(); + // If developers explicitly set the important mode for it, don't change the mode. + // Only change the mode to important when this SurfaceView isn't explicitly set and has + // an embedded hierarchy. + if (mRemoteAccessibilityEmbeddedConnection == null + || mode != IMPORTANT_FOR_ACCESSIBILITY_AUTO) { + return mode; + } + return IMPORTANT_FOR_ACCESSIBILITY_YES; + } + private void initEmbeddedHierarchyForAccessibility(SurfaceControlViewHost.SurfacePackage p) { final IAccessibilityEmbeddedConnection connection = p.getAccessibilityEmbeddedConnection(); final RemoteAccessibilityEmbeddedConnection wrapper = |
