Create Native getTouchpadHardwareProperties()
Create Native method to get the hardware properties of touchpad and
connected it to InputManagerService.java using JNI
Bug: 286551975
Test: Verified that the data flow works correctly and the method references are valid.
Flag: com.android.hardware.input.touchpad_visualizer
Change-Id: Ic6c32eabd3078ff2b50e3b3bb430abadd9dd752c
diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp
index f0e53b5..a5b1249 100644
--- a/services/inputflinger/reader/InputReader.cpp
+++ b/services/inputflinger/reader/InputReader.cpp
@@ -33,6 +33,7 @@
#include <utils/Thread.h>
#include "InputDevice.h"
+#include "include/gestures.h"
using android::base::StringPrintf;
@@ -817,6 +818,18 @@
return device->getDeviceInfo().getSensors();
}
+std::optional<HardwareProperties> InputReader::getTouchpadHardwareProperties(int32_t deviceId) {
+ std::scoped_lock _l(mLock);
+
+ InputDevice* device = findInputDeviceLocked(deviceId);
+
+ if (device == nullptr) {
+ return {};
+ }
+
+ return device->getTouchpadHardwareProperties();
+}
+
bool InputReader::setLightColor(int32_t deviceId, int32_t lightId, int32_t color) {
std::scoped_lock _l(mLock);