Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54559260 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Notify the policy when a stylus gesture starts

Bug: 243005009
Test: atest inputflinger_tests
Change-Id: Ie92cd2a991a50c33ef7e74b4690e6996cb357c58
parent 900dd54f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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.
+12 −0
Original line number Diff line number Diff line
@@ -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",