From 54ed198cb0605cbccb6cba68e6513ed02c764679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 25 Jan 2020 17:44:28 +0000 Subject: [PATCH] app: don't discard android touch events of unknown tool type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the kind of event one gets when using 'adb shell input tap x y', which I am trying to use for the end-to-end tests. Right now, we only have two pointer source types: mouse and touch. On Android, emulated touch events tend to simulate the touchscreen, not a mouse, so let's go with that as a fallback. Perhaps in the future we will have another special pointer source for this kind of event, such as "unknown" or "virtual". Signed-off-by: Daniel Martí --- app/internal/window/os_android.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/internal/window/os_android.go b/app/internal/window/os_android.go index 3a7d52c4..a23fb178 100644 --- a/app/internal/window/os_android.go +++ b/app/internal/window/os_android.go @@ -419,6 +419,10 @@ func onTouchEvent(env *C.JNIEnv, class C.jclass, handle C.jlong, action, pointer src = pointer.Touch case C.AMOTION_EVENT_TOOL_TYPE_MOUSE: src = pointer.Mouse + case C.AMOTION_EVENT_TOOL_TYPE_UNKNOWN: + // For example, triggered via 'adb shell input tap'. + // Instead of discarding it, treat it as a touch event. + src = pointer.Touch default: return }