summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Moskal <bartlomiej.moskal@siili.com>2020-11-13 11:31:37 +0100
committerBartlomiej Moskal <bartlomiej.moskal@siili.com>2020-11-14 08:14:13 +0000
commit82121b2fbf80fc39d8a7bab9e8e9a8c545f1ffd3 (patch)
tree3bd06356cf7f60b66a5e05ac0878d94c40e0b067
parentf8ad329f7ee01993c388f78851fc4ac88f5093b4 (diff)
Android: Treat ACTION_CANCEL as TouchPointReleased
If TouchPointPressed was previously send and there is no TouchPointReleased, we are exposed to uncorrectly handled touches by application. Some Android devices can recognize hand gestures. In some case the gesture may be handled by Android System. In this situation ACTION_CANCEL MotionEvent is delivered ACTION_CANCEL - from Android specification: -"Occurs when the parent takes possession of the motion, for example when the user has dragged enough across a list view that it will start scrolling instead of letting you press the buttons inside of it" -"The current gesture has been aborted. You will not receive any more points in it. You should treat this as an up event, but not perform any action that you normally would" If ACTION_CANCEL appears it means that ACTION_UP will not be delivered to application. That is why ACTION_CANCEL need to be treat as TouchPointReleased event. Fixes: QTBUG-72110 Change-Id: I8f32930cdb424b7530adc87b8334ac48a3bb9d57 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 64d62c53c1e92a1cc07449a0ea3c71501592c1e7) Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@siili.com>
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 13711f9d24..11504b8a2c 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -709,7 +709,7 @@ public class QtNative
}
if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN && index == event.getActionIndex()) {
return 0;
- } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP && index == event.getActionIndex()) {
+ } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_POINTER_UP && index == event.getActionIndex()) {
return 3;
}
return 2;