From dcdce4bc55622be8ca43e521d542fd263c680fac Mon Sep 17 00:00:00 2001 From: xinying-yuan Date: Wed, 8 Feb 2023 22:54:29 +0800 Subject: [PATCH] fixed 8f77010 from https://gitee.com/yuanxinying/multimodalinput_input/pulls/2295 add maintain log for power key in rom Signed-off-by: yuanxinying --- .../proxy/event_handler/src/client_msg_handler.cpp | 11 ++++++++++- frameworks/proxy/events/include/event_log_helper.h | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/frameworks/proxy/event_handler/src/client_msg_handler.cpp b/frameworks/proxy/event_handler/src/client_msg_handler.cpp index 97a74d5a9b..39f605ba92 100644 --- a/frameworks/proxy/event_handler/src/client_msg_handler.cpp +++ b/frameworks/proxy/event_handler/src/client_msg_handler.cpp @@ -182,12 +182,21 @@ int32_t ClientMsgHandler::OnSubscribeKeyEventCallback(const UDSClient &client, N MMI_HILOGE("Packet read fd failed"); return PACKET_READ_FAIL; } - MMI_HILOGD("Subscribe:%{public}d,Fd:%{public}d,KeyEvent:%{public}d," + if (keyEvent->GetKeyCode() == KEYCODE_POWER) { + MMI_HILOGI("Subscribe:%{public}d,Fd:%{public}d,KeyEvent:%{public}d," "KeyCode:%{public}d,ActionTime:%{public}" PRId64 ",ActionStartTime:%{public}" PRId64 "," "Action:%{public}d,KeyAction:%{public}d,EventType:%{public}d,Flag:%{public}u", subscribeId, fd, keyEvent->GetId(), keyEvent->GetKeyCode(), keyEvent->GetActionTime(), keyEvent->GetActionStartTime(), keyEvent->GetAction(), keyEvent->GetKeyAction(), keyEvent->GetEventType(), keyEvent->GetFlag()); + } else { + MMI_HILOGD("Subscribe:%{public}d,Fd:%{public}d,KeyEvent:%{public}d," + "KeyCode:%{public}d,ActionTime:%{public}" PRId64 ",ActionStartTime:%{public}" PRId64 "," + "Action:%{public}d,KeyAction:%{public}d,EventType:%{public}d,Flag:%{public}u", + subscribeId, fd, keyEvent->GetId(), keyEvent->GetKeyCode(), keyEvent->GetActionTime(), + keyEvent->GetActionStartTime(), keyEvent->GetAction(), keyEvent->GetKeyAction(), + keyEvent->GetEventType(), keyEvent->GetFlag()); + } BytraceAdapter::StartBytrace(keyEvent, BytraceAdapter::TRACE_START, BytraceAdapter::KEY_SUBSCRIBE_EVENT); return KeyEventInputSubscribeMgr.OnSubscribeKeyEventCallback(keyEvent, subscribeId); } diff --git a/frameworks/proxy/events/include/event_log_helper.h b/frameworks/proxy/events/include/event_log_helper.h index ab27d0318f..ee5221ee50 100644 --- a/frameworks/proxy/events/include/event_log_helper.h +++ b/frameworks/proxy/events/include/event_log_helper.h @@ -38,7 +38,7 @@ private: static void Print(const std::shared_ptr event) { std::vector eventItems { event->GetKeyItems() }; - MMI_HILOGD("KeyCode:%{public}d,KeyIntention:%{public}d,ActionTime:%{public}" PRId64 ",ActionStartTime:%{public}" PRId64 + MMI_HILOGI("KeyCode:%{public}d,KeyIntention:%{public}d,ActionTime:%{public}" PRId64 ",ActionStartTime:%{public}" PRId64 ",EventType:%{public}s,Flag:%{public}d,KeyAction:%{public}s,NumLock:%{public}d," "CapsLock:%{public}d,ScrollLock:%{public}d,EventNumber:%{public}d,keyItemsCount:%{public}zu", event->GetKeyCode(), event->GetKeyIntention(), event->GetActionTime(), event->GetActionStartTime(), @@ -48,7 +48,7 @@ private: event->GetFunctionKey(KeyEvent::SCROLL_LOCK_FUNCTION_KEY), event->GetId(), eventItems.size()); for (const auto &item : eventItems) { - MMI_HILOGD("DeviceNumber:%{public}d,KeyCode:%{public}d,DownTime:%{public}" PRId64 ",IsPressed:%{public}d," + MMI_HILOGI("DeviceNumber:%{public}d,KeyCode:%{public}d,DownTime:%{public}" PRId64 ",IsPressed:%{public}d," "GetUnicode:%{public}d", item.GetDeviceId(), item.GetKeyCode(), item.GetDownTime(), item.IsPressed(), item.GetUnicode()); } @@ -59,7 +59,7 @@ private: for (; cItr != pressedKeys.cend(); ++cItr) { tmpStr += ("," + std::to_string(*cItr)); } - MMI_HILOGD("%{public}s]", tmpStr.c_str()); + MMI_HILOGI("%{public}s]", tmpStr.c_str()); } } @@ -153,7 +153,8 @@ template void EventLogHelper::PrintEventData(std::shared_ptr event) { CHKPV(event); - if (HiLogIsLoggable(OHOS::MMI::MMI_LOG_DOMAIN, LABEL.tag, LOG_DEBUG)) { + if (HiLogIsLoggable(OHOS::MMI::MMI_LOG_DOMAIN, LABEL.tag, LOG_DEBUG) || + (event->GetAction() == EVENT_TYPE_KEY && event->GetKeyCode() == KEYCODE_POWER)){ EventLogHelper::Print(event); } } -- Gitee