From 3c2233535259194304d9526603aa960b57ad7592 Mon Sep 17 00:00:00 2001 From: Bcan Date: Fri, 13 Sep 2024 14:21:26 +0800 Subject: [PATCH] Add debug message for missing OK key (2/3) --- services/inputflinger/reader/EventHub.cpp | 29 +++++++++++++++++++ services/inputflinger/reader/InputReader.cpp | 8 +++++ .../inputflinger/reader/include/EventHub.h | 3 ++ 3 files changed, 40 insertions(+) diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp index b19b4195d1..7ed2af598b 100644 --- a/services/inputflinger/reader/EventHub.cpp +++ b/services/inputflinger/reader/EventHub.cpp @@ -1547,6 +1547,7 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz // Grab the next input event. bool deviceChanged = false; + int32_t key_check = -1; while (mPendingEventIndex < mPendingEventCount) { const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++]; if (eventItem.data.fd == mINotifyFd) { @@ -1601,29 +1602,54 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz } continue; } + + ALOGI("===> traceKey D6, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); // This must be an input event if (eventItem.events & EPOLLIN) { int32_t readSize = read(device->fd, readBuffer, sizeof(struct input_event) * capacity); + ALOGI("===> traceKey D6-1, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); if (readSize == 0 || (readSize < 0 && errno == ENODEV)) { // Device was removed before INotify noticed. ALOGW("could not get event, removed? (fd: %d size: %" PRId32 " bufferSize: %zu capacity: %zu errno: %d)\n", device->fd, readSize, bufferSize, capacity, errno); + ALOGI("===> traceKey D6-1a, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); deviceChanged = true; closeDeviceLocked(*device); } else if (readSize < 0) { + ALOGI("===> traceKey D6-1b, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); if (errno != EAGAIN && errno != EINTR) { ALOGW("could not get event (errno=%d)", errno); } } else if ((readSize % sizeof(struct input_event)) != 0) { + ALOGI("===> traceKey D6-1c, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); ALOGE("could not get event (wrong size: %d)", readSize); } else { int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id; size_t count = size_t(readSize) / sizeof(struct input_event); + ALOGI("===> traceKey D6-1d 0, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); + for (size_t i = 0; i < count; i++) { struct input_event& iev = readBuffer[i]; + ALOGI("===> traceKey D6-1d 1, code=%d, in getEvents, in %s of %s line %d" ,iev.code,__func__ ,__FILE__ ,__LINE__); + if(iev.code==232) { + char tmps[11]={0}; + key_check = property_get_int32("sys.vasott.key_check", 0); + ALOGI("===> traceKey D6-1d 2, OK key detected, old_key_check=%d, key_check=%d", old_key_check, key_check); + if(old_key_check traceKey D6-1d 3, There might be a issue happened!"); + } + old_key_check=key_check; + //ALOGI("===> traceKey D6-1d 4, OK key detected, old_key_check=%d, key_check=%d", old_key_check, key_check); + key_check++; + sprintf(tmps,"%d",key_check); + //ALOGI("===> traceKey D6-1d 4a, OK key detected, key_check=%s", tmps); + property_set("sys.vasott.key_check",tmps); + } + event->when = processEventTimestamp(iev); event->readTime = systemTime(SYSTEM_TIME_MONOTONIC); event->deviceId = deviceId; @@ -1634,6 +1660,7 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz capacity -= 1; } if (capacity == 0) { + ALOGI("===> traceKey D6-1d 5, buffer full, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); // The result buffer is full. Reset the pending event index // so we will try to read the device again on the next iteration. mPendingEventIndex -= 1; @@ -1641,11 +1668,13 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz } } } else if (eventItem.events & EPOLLHUP) { + ALOGI("===> traceKey D6-2, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); ALOGI("Removing device %s due to epoll hang-up event.", device->identifier.name.c_str()); deviceChanged = true; closeDeviceLocked(*device); } else { + ALOGI("===> traceKey D6-3, in getEvents, in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); ALOGW("Received unexpected epoll event 0x%08x for device %s.", eventItem.events, device->identifier.name.c_str()); } diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp index 10c04f606c..0b6bf7b476 100644 --- a/services/inputflinger/reader/InputReader.cpp +++ b/services/inputflinger/reader/InputReader.cpp @@ -34,6 +34,8 @@ #include "InputDevice.h" +#define BLOGI(...) ALOG(LOG_INFO, "BFXBTF-484", __VA_ARGS__) + using android::base::StringPrintf; namespace android { @@ -112,6 +114,7 @@ void InputReader::loopOnce() { mReaderIsAliveCondition.notify_all(); if (count) { + ALOGI("===> traceKey C3 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); processEventsLocked(mEventBuffer, count); } @@ -144,6 +147,7 @@ void InputReader::loopOnce() { // resulting in a deadlock. This situation is actually quite plausible because the // listener is actually the input dispatcher, which calls into the window manager, // which occasionally calls into the input reader. + //ALOGI("===> traceKey C0 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); mQueuedListener->flush(); } @@ -163,6 +167,7 @@ void InputReader::processEventsLocked(const RawEvent* rawEvents, size_t count) { #if DEBUG_RAW_EVENTS ALOGD("BatchSize: %zu Count: %zu", batchSize, count); #endif + ALOGI("===> traceKey C2 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); processEventsForDeviceLocked(deviceId, rawEvent, batchSize); } else { switch (rawEvent->type) { @@ -298,15 +303,18 @@ void InputReader::processEventsForDeviceLocked(int32_t eventHubId, const RawEven auto deviceIt = mDevices.find(eventHubId); if (deviceIt == mDevices.end()) { ALOGW("Discarding event for unknown eventHubId %d.", eventHubId); + BLOGI("===> traceKey C1.2 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); return; } std::shared_ptr& device = deviceIt->second; if (device->isIgnored()) { // ALOGD("Discarding event for ignored deviceId %d.", deviceId); + BLOGI("===> traceKey C1.1 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); return; } + ALOGI("===> traceKey C1 in %s of %s line %d" ,__func__ ,__FILE__ ,__LINE__); device->process(rawEvents, count); } diff --git a/services/inputflinger/reader/include/EventHub.h b/services/inputflinger/reader/include/EventHub.h index 410a7063ea..bfd0c54d15 100644 --- a/services/inputflinger/reader/include/EventHub.h +++ b/services/inputflinger/reader/include/EventHub.h @@ -713,6 +713,9 @@ private: size_t mPendingEventCount; size_t mPendingEventIndex; bool mPendingINotify; + + + int32_t old_key_check=0; }; }; // namespace android -- 2.25.1