Skip to content

Commit 07b726c

Browse files
committed
Enabling accessibility focus only if explore by touch is on.
1. Now we will enable the accessibility focus only if Explore by Touch is enabled. Enabling this feature allows a blind user to touch the screen and set the accessibility focus at this location as well as get spoken feedback. Also an accessibility service can move the accessibility as a result of user gestures detected only if Explore by Touch is enabled. Since we will handle some gestures by default if not accessibility service does so to provide reasonable built-in navigation of the UI by "objects" we need the accessibility focus functionality. bug:6383361 Change-Id: I13ce6072a90f5838c7656379788144c99a772bf0
1 parent 427db9b commit 07b726c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/java/android/view/View.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5942,7 +5942,8 @@ boolean isAccessibilityFocused() {
59425942
* @hide
59435943
*/
59445944
public boolean requestAccessibilityFocus() {
5945-
if (!AccessibilityManager.getInstance(mContext).isEnabled()) {
5945+
AccessibilityManager manager = AccessibilityManager.getInstance(mContext);
5946+
if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
59465947
return false;
59475948
}
59485949
if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) {

core/java/android/view/ViewRootImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,8 @@ private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff,
23162316
* @param canvas The canvas on which to draw.
23172317
*/
23182318
private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
2319-
if (!AccessibilityManager.getInstance(mView.mContext).isEnabled()) {
2319+
AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
2320+
if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
23202321
return;
23212322
}
23222323
if (mAccessibilityFocusedHost == null || mAccessibilityFocusedHost.mAttachInfo == null) {

0 commit comments

Comments
 (0)