am 47c52a87: Merge "Some accessibility events not sent from touch explorer if apps misbehave." into jb-mr1-dev
* commit '47c52a873e78d78a73abe85bb5491701a7b39feb': Some accessibility events not sent from touch explorer if apps misbehave.
This commit is contained in:
BIN
core/res/res/drawable-hdpi/magnified_region_frame.9.png
Normal file
BIN
core/res/res/drawable-hdpi/magnified_region_frame.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
BIN
core/res/res/drawable-mdpi/magnified_region_frame.9.png
Normal file
BIN
core/res/res/drawable-mdpi/magnified_region_frame.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 B |
Binary file not shown.
|
Before Width: | Height: | Size: 741 B |
BIN
core/res/res/drawable-xhdpi/magnified_region_frame.9.png
Normal file
BIN
core/res/res/drawable-xhdpi/magnified_region_frame.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 205 B |
@@ -102,6 +102,10 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
// The timeout after which we are no longer trying to detect a gesture.
|
// The timeout after which we are no longer trying to detect a gesture.
|
||||||
private static final int EXIT_GESTURE_DETECTION_TIMEOUT = 2000;
|
private static final int EXIT_GESTURE_DETECTION_TIMEOUT = 2000;
|
||||||
|
|
||||||
|
// The timeout to send interaction end events in case we did not
|
||||||
|
// receive the expected hover exit event due to a misbehaving app.
|
||||||
|
private static final int SEND_INTERACTION_END_EVENTS_TIMEOUT = 200;
|
||||||
|
|
||||||
// Temporary array for storing pointer IDs.
|
// Temporary array for storing pointer IDs.
|
||||||
private final int[] mTempPointerIds = new int[MAX_POINTER_COUNT];
|
private final int[] mTempPointerIds = new int[MAX_POINTER_COUNT];
|
||||||
|
|
||||||
@@ -135,6 +139,9 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
// Command for delayed sending of a hover exit event.
|
// Command for delayed sending of a hover exit event.
|
||||||
private final SendHoverDelayed mSendHoverExitDelayed;
|
private final SendHoverDelayed mSendHoverExitDelayed;
|
||||||
|
|
||||||
|
// Command for delayed sending of interaction ending events.
|
||||||
|
private final SendInteractionEndEventsDelayed mSendInteractionEndEventsDelayed;
|
||||||
|
|
||||||
// Command for delayed sending of a long press.
|
// Command for delayed sending of a long press.
|
||||||
private final PerformLongPressDelayed mPerformLongPressDelayed;
|
private final PerformLongPressDelayed mPerformLongPressDelayed;
|
||||||
|
|
||||||
@@ -233,6 +240,7 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
mGestureLibrary.load();
|
mGestureLibrary.load();
|
||||||
mSendHoverEnterDelayed = new SendHoverDelayed(MotionEvent.ACTION_HOVER_ENTER, true);
|
mSendHoverEnterDelayed = new SendHoverDelayed(MotionEvent.ACTION_HOVER_ENTER, true);
|
||||||
mSendHoverExitDelayed = new SendHoverDelayed(MotionEvent.ACTION_HOVER_EXIT, false);
|
mSendHoverExitDelayed = new SendHoverDelayed(MotionEvent.ACTION_HOVER_EXIT, false);
|
||||||
|
mSendInteractionEndEventsDelayed = new SendInteractionEndEventsDelayed();
|
||||||
mDoubleTapDetector = new DoubleTapDetector();
|
mDoubleTapDetector = new DoubleTapDetector();
|
||||||
final float density = context.getResources().getDisplayMetrics().density;
|
final float density = context.getResources().getDisplayMetrics().density;
|
||||||
mScaledMinPointerDistanceToUseMiddleLocation =
|
mScaledMinPointerDistanceToUseMiddleLocation =
|
||||||
@@ -278,6 +286,7 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
mSendHoverExitDelayed.remove();
|
mSendHoverExitDelayed.remove();
|
||||||
mPerformLongPressDelayed.remove();
|
mPerformLongPressDelayed.remove();
|
||||||
mExitGestureDetectionModeDelayed.remove();
|
mExitGestureDetectionModeDelayed.remove();
|
||||||
|
mSendInteractionEndEventsDelayed.remove();
|
||||||
// Reset the pointer trackers.
|
// Reset the pointer trackers.
|
||||||
mReceivedPointerTracker.clear();
|
mReceivedPointerTracker.clear();
|
||||||
mInjectedPointerTracker.clear();
|
mInjectedPointerTracker.clear();
|
||||||
@@ -334,6 +343,7 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
// last hover exit event.
|
// last hover exit event.
|
||||||
if (mTouchExplorationGestureEnded
|
if (mTouchExplorationGestureEnded
|
||||||
&& eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
|
&& eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
|
||||||
|
mSendInteractionEndEventsDelayed.remove();
|
||||||
mTouchExplorationGestureEnded = false;
|
mTouchExplorationGestureEnded = false;
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END);
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END);
|
||||||
}
|
}
|
||||||
@@ -342,6 +352,7 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
// last hover exit and the touch exploration gesture end events.
|
// last hover exit and the touch exploration gesture end events.
|
||||||
if (mTouchInteractionEnded
|
if (mTouchInteractionEnded
|
||||||
&& eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
|
&& eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
|
||||||
|
mSendInteractionEndEventsDelayed.remove();
|
||||||
mTouchInteractionEnded = false;
|
mTouchInteractionEnded = false;
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
|
||||||
}
|
}
|
||||||
@@ -416,6 +427,10 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
mSendHoverExitDelayed.remove();
|
mSendHoverExitDelayed.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mSendInteractionEndEventsDelayed.isPending()) {
|
||||||
|
mSendInteractionEndEventsDelayed.forceSendAndRemove();
|
||||||
|
}
|
||||||
|
|
||||||
mPerformLongPressDelayed.remove();
|
mPerformLongPressDelayed.remove();
|
||||||
|
|
||||||
// If we have the first tap schedule a long press and break
|
// If we have the first tap schedule a long press and break
|
||||||
@@ -873,6 +888,9 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
final int pointerIdBits = event.getPointerIdBits();
|
final int pointerIdBits = event.getPointerIdBits();
|
||||||
mTouchExplorationGestureEnded = true;
|
mTouchExplorationGestureEnded = true;
|
||||||
mTouchInteractionEnded = true;
|
mTouchInteractionEnded = true;
|
||||||
|
if (!mSendInteractionEndEventsDelayed.isPending()) {
|
||||||
|
mSendInteractionEndEventsDelayed.post();
|
||||||
|
}
|
||||||
sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits, policyFlags);
|
sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits, policyFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1484,10 +1502,16 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
} else {
|
} else {
|
||||||
mTouchExplorationGestureEnded = true;
|
mTouchExplorationGestureEnded = true;
|
||||||
mTouchInteractionEnded = true;
|
mTouchInteractionEnded = true;
|
||||||
|
if (!mSendInteractionEndEventsDelayed.isPending()) {
|
||||||
|
mSendInteractionEndEventsDelayed.post();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!mGestureStarted) {
|
if (!mGestureStarted) {
|
||||||
mTouchInteractionEnded = true;
|
mTouchInteractionEnded = true;
|
||||||
|
if (!mSendInteractionEndEventsDelayed.isPending()) {
|
||||||
|
mSendInteractionEndEventsDelayed.post();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendMotionEvent(mPrototype, mHoverAction, mPointerIdBits, mPolicyFlags);
|
sendMotionEvent(mPrototype, mHoverAction, mPointerIdBits, mPolicyFlags);
|
||||||
@@ -1495,6 +1519,40 @@ class TouchExplorer implements EventStreamTransformation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SendInteractionEndEventsDelayed implements Runnable {
|
||||||
|
|
||||||
|
public void remove() {
|
||||||
|
mHandler.removeCallbacks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void post() {
|
||||||
|
mHandler.postDelayed(this, SEND_INTERACTION_END_EVENTS_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPending() {
|
||||||
|
return mHandler.hasCallbacks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceSendAndRemove() {
|
||||||
|
if (isPending()) {
|
||||||
|
run();
|
||||||
|
remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mTouchExplorationGestureEnded) {
|
||||||
|
mTouchExplorationGestureEnded = false;
|
||||||
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END);
|
||||||
|
}
|
||||||
|
if (mTouchInteractionEnded) {
|
||||||
|
mTouchInteractionEnded = false;
|
||||||
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return LOG_TAG;
|
return LOG_TAG;
|
||||||
|
|||||||
Reference in New Issue
Block a user