summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zixuan Qu <zixuanqu@google.com> 2022-09-12 22:52:35 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-09-12 22:52:35 +0000
commita335261b0b021030ea4fee314e400b3204bdb99d (patch)
tree5fc248c3334d4dc57945cf83d9f43e57ca223b4f
parente7eef125bfda2defdc02b4a147ce58dec7e7b7f0 (diff)
parent95c55fb30d2163817cbe0eeaa856070ca6bec409 (diff)
Merge "Add ABS_MT_SLOT config to virtual touch screen." into tm-qpr-dev am: 95c55fb30d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19908041 Change-Id: Idcd8b415e725ea05928e1d47732e3659a39d5c95 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/core/jni/com_android_server_companion_virtual_InputController.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/core/jni/com_android_server_companion_virtual_InputController.cpp b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
index 8197b67355d4..daca1531d41f 100644
--- a/services/core/jni/com_android_server_companion_virtual_InputController.cpp
+++ b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
@@ -21,6 +21,7 @@
#include <android/keycodes.h>
#include <errno.h>
#include <fcntl.h>
+#include <input/Input.h>
#include <linux/uinput.h>
#include <math.h>
#include <nativehelper/JNIHelp.h>
@@ -271,6 +272,14 @@ static int openUinput(const char* readableName, jint vendorId, jint productId, c
ALOGE("Error creating touchscreen uinput pressure axis: %s", strerror(errno));
return -errno;
}
+ uinput_abs_setup slotAbsSetup;
+ slotAbsSetup.code = ABS_MT_SLOT;
+ slotAbsSetup.absinfo.maximum = MAX_POINTERS;
+ slotAbsSetup.absinfo.minimum = 0;
+ if (ioctl(fd, UI_ABS_SETUP, &slotAbsSetup) != 0) {
+ ALOGE("Error creating touchscreen uinput slots: %s", strerror(errno));
+ return -errno;
+ }
}
if (ioctl(fd, UI_DEV_SETUP, &setup) != 0) {
ALOGE("Error creating uinput device: %s", strerror(errno));