Add ABS_MT_SLOT config to virtual touch screen.

Cherry-picked-from: ag/19908041

Bug: 244744917
Bug: 233960835
Bug: 233327669

Test: atest VirtualDeviceManagerServiceTest

Change-Id: I58f0302e4df3415cff74646d7424c699d98cbca7
This commit is contained in:
Zixuan Qu
2022-09-27 19:17:57 +00:00
parent 39a6ea0a60
commit 1f6323ddfb

View File

@@ -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));