diff options
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_app_NativeActivity.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_view_InputEventReceiver.cpp | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 19bc154..074afa3 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -207,7 +207,7 @@ int32_t AInputQueue::getEvent(AInputEvent** outEvent) { uint32_t consumerSeq; InputEvent* myEvent = NULL; - status_t res = mConsumer.consume(&mPooledInputEventFactory, true /*consumeBatches*/, + status_t res = mConsumer.consume(&mPooledInputEventFactory, true /*consumeBatches*/, -1, &consumerSeq, &myEvent); if (res != android::OK) { if (res != android::WOULD_BLOCK) { diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp index 8f6f5f4..08e08b9 100644 --- a/core/jni/android_view_InputEventReceiver.cpp +++ b/core/jni/android_view_InputEventReceiver.cpp @@ -52,7 +52,7 @@ public: status_t initialize(); status_t finishInputEvent(uint32_t seq, bool handled); - status_t consumeEvents(JNIEnv* env, bool consumeBatches); + status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime); protected: virtual ~NativeInputEventReceiver(); @@ -130,15 +130,16 @@ int NativeInputEventReceiver::handleReceiveCallback(int receiveFd, int events, v } JNIEnv* env = AndroidRuntime::getJNIEnv(); - status_t status = r->consumeEvents(env, false /*consumeBatches*/); + status_t status = r->consumeEvents(env, false /*consumeBatches*/, -1); r->mMessageQueue->raiseAndClearException(env, "handleReceiveCallback"); return status == OK || status == NO_MEMORY ? 1 : 0; } -status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, bool consumeBatches) { +status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, + bool consumeBatches, nsecs_t frameTime) { #if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ Consuming input events, consumeBatches=%s.", getInputChannelName(), - consumeBatches ? "true" : "false"); + ALOGD("channel '%s' ~ Consuming input events, consumeBatches=%s, frameTime=%lld.", + getInputChannelName(), consumeBatches ? "true" : "false", frameTime); #endif if (consumeBatches) { @@ -150,7 +151,7 @@ status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, bool consumeBatche uint32_t seq; InputEvent* inputEvent; status_t status = mInputConsumer.consume(&mInputEventFactory, - consumeBatches, &seq, &inputEvent); + consumeBatches, frameTime, &seq, &inputEvent); if (status) { if (status == WOULD_BLOCK) { if (!skipCallbacks && !mBatchedInputEventPending @@ -270,10 +271,11 @@ static void nativeFinishInputEvent(JNIEnv* env, jclass clazz, jint receiverPtr, } } -static void nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jint receiverPtr) { +static void nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jint receiverPtr, + jlong frameTimeNanos) { sp<NativeInputEventReceiver> receiver = reinterpret_cast<NativeInputEventReceiver*>(receiverPtr); - status_t status = receiver->consumeEvents(env, true /*consumeBatches*/); + status_t status = receiver->consumeEvents(env, true /*consumeBatches*/, frameTimeNanos); if (status && status != DEAD_OBJECT && !env->ExceptionCheck()) { String8 message; message.appendFormat("Failed to consume batched input event. status=%d", status); @@ -291,7 +293,7 @@ static JNINativeMethod gMethods[] = { (void*)nativeDispose }, { "nativeFinishInputEvent", "(IIZ)V", (void*)nativeFinishInputEvent }, - { "nativeConsumeBatchedInputEvents", "(I)V", + { "nativeConsumeBatchedInputEvents", "(IJ)V", (void*)nativeConsumeBatchedInputEvents }, }; |