Skip to content

Commit e45c0b2

Browse files
committed
Crash in the touch explorer.
1. The touch explorer was notified for accessibility events from a binder thread which was poking the internal state of the latter which by design is not tread safe. Since the touch explorer is expected to be running only on the main thread the accessibility manager service delivers the accessibility events to the explorer on that thread. bug:6635496 Change-Id: Ifdc5329e4be8e485d7f77f0fb472184494fa0d15
1 parent 4206ee2 commit e45c0b2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

services/java/com/android/server/accessibility/AccessibilityManagerService.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
113113

114114
private static final int MSG_TOGGLE_TOUCH_EXPLORATION = 2;
115115

116+
private static final int MSG_SEND_ACCESSIBILITY_EVENT_TO_INPUT_FILTER = 3;
117+
116118
private static int sIdCounter = 0;
117119

118120
private static int sNextWindowId;
@@ -402,7 +404,9 @@ public boolean sendAccessibilityEvent(AccessibilityEvent event) {
402404
notifyAccessibilityServicesDelayedLocked(event, true);
403405
}
404406
if (mHasInputFilter && mInputFilter != null) {
405-
mInputFilter.onAccessibilityEvent(event);
407+
mMainHandler.obtainMessage(MSG_SEND_ACCESSIBILITY_EVENT_TO_INPUT_FILTER,
408+
AccessibilityEvent.obtain(event)).sendToTarget();
409+
406410
}
407411
event.recycle();
408412
mHandledFeedbackTypes = 0;
@@ -1104,7 +1108,14 @@ public void onClick(DialogInterface dialog, int which) {
11041108
mEnableTouchExplorationDialog.setCanceledOnTouchOutside(true);
11051109
mEnableTouchExplorationDialog.show();
11061110
}
1107-
}
1111+
} break;
1112+
case MSG_SEND_ACCESSIBILITY_EVENT_TO_INPUT_FILTER: {
1113+
AccessibilityEvent event = (AccessibilityEvent) msg.obj;
1114+
if (mHasInputFilter && mInputFilter != null) {
1115+
mInputFilter.onAccessibilityEvent(event);
1116+
}
1117+
event.recycle();
1118+
} break;
11081119
}
11091120
}
11101121
}

0 commit comments

Comments
 (0)