Loading core/java/android/view/InputEventReceiver.java +3 −2 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public abstract class InputEventReceiver { long gpuCompletedTime, long presentTime); private static native boolean nativeConsumeBatchedInputEvents(long receiverPtr, long frameTimeNanos); private static native IBinder nativeGetToken(long receiverPtr); private static native String nativeDump(long receiverPtr, String prefix); /** Loading Loading @@ -268,10 +269,10 @@ public abstract class InputEventReceiver { * @return Returns a token to identify the input channel. */ public IBinder getToken() { if (mInputChannel == null) { if (mReceiverPtr == 0) { return null; } return mInputChannel.getToken(); return nativeGetToken(mReceiverPtr); } private String getShortDescription(InputEvent event) { Loading core/jni/android_view_InputEventReceiver.cpp +17 −4 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <vector> #include "android_os_MessageQueue.h" #include "android_util_Binder.h" #include "android_view_InputChannel.h" #include "android_view_KeyEvent.h" #include "android_view_MotionEvent.h" Loading Loading @@ -93,11 +94,12 @@ public: status_t initialize(); void dispose(); status_t finishInputEvent(uint32_t seq, bool handled); bool probablyHasInput(); bool probablyHasInput() const; status_t reportTimeline(int32_t inputEventId, nsecs_t gpuCompletedTime, nsecs_t presentTime); status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime, bool* outConsumedBatch); std::string dump(const char* prefix); sp<IBinder> getInputChannelToken() const; std::string dump(const char* prefix) const; protected: ~NativeInputEventReceiver() override; Loading Loading @@ -182,7 +184,7 @@ status_t NativeInputEventReceiver::finishInputEvent(uint32_t seq, bool handled) return processOutboundEvents(); } bool NativeInputEventReceiver::probablyHasInput() { bool NativeInputEventReceiver::probablyHasInput() const { if (mInputConsumer == nullptr) { return false; } Loading Loading @@ -512,7 +514,11 @@ status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, } } std::string NativeInputEventReceiver::dump(const char* prefix) { sp<IBinder> NativeInputEventReceiver::getInputChannelToken() const { return mInputConsumer->getChannel()->getConnectionToken(); } std::string NativeInputEventReceiver::dump(const char* prefix) const { std::string out; std::string consumerDump = addPrefix(mInputConsumer != nullptr ? mInputConsumer->dump() : "<null>", " "); Loading Loading @@ -636,6 +642,12 @@ static jboolean nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jlong return consumedBatch ? JNI_TRUE : JNI_FALSE; } static jobject nativeGetToken(JNIEnv* env, jclass clazz, jlong receiverPtr) { sp<NativeInputEventReceiver> receiver = reinterpret_cast<NativeInputEventReceiver*>(receiverPtr); return javaObjectForIBinder(env, receiver->getInputChannelToken()); } static jstring nativeDump(JNIEnv* env, jclass clazz, jlong receiverPtr, jstring prefix) { sp<NativeInputEventReceiver> receiver = reinterpret_cast<NativeInputEventReceiver*>(receiverPtr); Loading @@ -653,6 +665,7 @@ static const JNINativeMethod gMethods[] = { {"nativeProbablyHasInput", "(J)Z", (void*)nativeProbablyHasInput}, {"nativeReportTimeline", "(JIJJ)V", (void*)nativeReportTimeline}, {"nativeConsumeBatchedInputEvents", "(JJ)Z", (void*)nativeConsumeBatchedInputEvents}, {"nativeGetToken", "(J)Landroid/os/IBinder;", (void*)nativeGetToken}, {"nativeDump", "(JLjava/lang/String;)Ljava/lang/String;", (void*)nativeDump}, }; Loading Loading
core/java/android/view/InputEventReceiver.java +3 −2 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public abstract class InputEventReceiver { long gpuCompletedTime, long presentTime); private static native boolean nativeConsumeBatchedInputEvents(long receiverPtr, long frameTimeNanos); private static native IBinder nativeGetToken(long receiverPtr); private static native String nativeDump(long receiverPtr, String prefix); /** Loading Loading @@ -268,10 +269,10 @@ public abstract class InputEventReceiver { * @return Returns a token to identify the input channel. */ public IBinder getToken() { if (mInputChannel == null) { if (mReceiverPtr == 0) { return null; } return mInputChannel.getToken(); return nativeGetToken(mReceiverPtr); } private String getShortDescription(InputEvent event) { Loading
core/jni/android_view_InputEventReceiver.cpp +17 −4 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <vector> #include "android_os_MessageQueue.h" #include "android_util_Binder.h" #include "android_view_InputChannel.h" #include "android_view_KeyEvent.h" #include "android_view_MotionEvent.h" Loading Loading @@ -93,11 +94,12 @@ public: status_t initialize(); void dispose(); status_t finishInputEvent(uint32_t seq, bool handled); bool probablyHasInput(); bool probablyHasInput() const; status_t reportTimeline(int32_t inputEventId, nsecs_t gpuCompletedTime, nsecs_t presentTime); status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime, bool* outConsumedBatch); std::string dump(const char* prefix); sp<IBinder> getInputChannelToken() const; std::string dump(const char* prefix) const; protected: ~NativeInputEventReceiver() override; Loading Loading @@ -182,7 +184,7 @@ status_t NativeInputEventReceiver::finishInputEvent(uint32_t seq, bool handled) return processOutboundEvents(); } bool NativeInputEventReceiver::probablyHasInput() { bool NativeInputEventReceiver::probablyHasInput() const { if (mInputConsumer == nullptr) { return false; } Loading Loading @@ -512,7 +514,11 @@ status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, } } std::string NativeInputEventReceiver::dump(const char* prefix) { sp<IBinder> NativeInputEventReceiver::getInputChannelToken() const { return mInputConsumer->getChannel()->getConnectionToken(); } std::string NativeInputEventReceiver::dump(const char* prefix) const { std::string out; std::string consumerDump = addPrefix(mInputConsumer != nullptr ? mInputConsumer->dump() : "<null>", " "); Loading Loading @@ -636,6 +642,12 @@ static jboolean nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jlong return consumedBatch ? JNI_TRUE : JNI_FALSE; } static jobject nativeGetToken(JNIEnv* env, jclass clazz, jlong receiverPtr) { sp<NativeInputEventReceiver> receiver = reinterpret_cast<NativeInputEventReceiver*>(receiverPtr); return javaObjectForIBinder(env, receiver->getInputChannelToken()); } static jstring nativeDump(JNIEnv* env, jclass clazz, jlong receiverPtr, jstring prefix) { sp<NativeInputEventReceiver> receiver = reinterpret_cast<NativeInputEventReceiver*>(receiverPtr); Loading @@ -653,6 +665,7 @@ static const JNINativeMethod gMethods[] = { {"nativeProbablyHasInput", "(J)Z", (void*)nativeProbablyHasInput}, {"nativeReportTimeline", "(JIJJ)V", (void*)nativeReportTimeline}, {"nativeConsumeBatchedInputEvents", "(JJ)Z", (void*)nativeConsumeBatchedInputEvents}, {"nativeGetToken", "(J)Landroid/os/IBinder;", (void*)nativeGetToken}, {"nativeDump", "(JLjava/lang/String;)Ljava/lang/String;", (void*)nativeDump}, }; Loading