summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2022-09-26 17:13:50 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2022-10-26 20:31:25 +0000
commit545592604ba536896d597845e8db8049e451a135 (patch)
tree064fe78ced10d13a4e5062c0edd3a0e7cea282f8
parent900dd54f12e534e1ba7c85ffe402d4d3d1fd93ea (diff)
Notify the policy when a stylus gesture starts
Bug: 243005009 Test: atest inputflinger_tests Change-Id: Ie92cd2a991a50c33ef7e74b4690e6996cb357c58
-rw-r--r--services/core/java/com/android/server/input/InputManagerService.java5
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp12
2 files changed, 17 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 69b0e65e38da..3d990cc7c9c4 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -3052,6 +3052,11 @@ public class InputManagerService extends IInputManager.Stub
com.android.internal.R.bool.config_perDisplayFocusEnabled);
}
+ // Native callback.
+ @SuppressWarnings("unused")
+ private void notifyStylusGestureStarted(int deviceId, long eventTime) {
+ }
+
/**
* Flatten a map into a string list, with value positioned directly next to the
* key.
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index 3f380e7914d0..633b8d30163c 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -107,6 +107,7 @@ static struct {
jmethodID notifyFocusChanged;
jmethodID notifySensorEvent;
jmethodID notifySensorAccuracy;
+ jmethodID notifyStylusGestureStarted;
jmethodID notifyVibratorState;
jmethodID filterInputEvent;
jmethodID interceptKeyBeforeQueueing;
@@ -312,6 +313,7 @@ public:
int32_t surfaceRotation) override;
TouchAffineTransformation getTouchAffineTransformation(JNIEnv* env, jfloatArray matrixArr);
+ void notifyStylusGestureStarted(int32_t deviceId, nsecs_t eventTime) override;
/* --- InputDispatcherPolicyInterface implementation --- */
@@ -1177,6 +1179,13 @@ TouchAffineTransformation NativeInputManager::getTouchAffineTransformation(
return transform;
}
+void NativeInputManager::notifyStylusGestureStarted(int32_t deviceId, nsecs_t eventTime) {
+ JNIEnv* env = jniEnv();
+ env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyStylusGestureStarted, deviceId,
+ eventTime);
+ checkAndClearExceptionFromCallback(env, "notifyStylusGestureStarted");
+}
+
bool NativeInputManager::filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) {
ATRACE_CALL();
jobject inputEventObj;
@@ -2469,6 +2478,9 @@ int register_android_server_InputManager(JNIEnv* env) {
GET_METHOD_ID(gServiceClassInfo.notifySensorAccuracy, clazz, "notifySensorAccuracy", "(III)V");
+ GET_METHOD_ID(gServiceClassInfo.notifyStylusGestureStarted, clazz, "notifyStylusGestureStarted",
+ "(IJ)V");
+
GET_METHOD_ID(gServiceClassInfo.notifyVibratorState, clazz, "notifyVibratorState", "(IZ)V");
GET_METHOD_ID(gServiceClassInfo.notifyNoFocusedWindowAnr, clazz, "notifyNoFocusedWindowAnr",