diff --git a/frameworks/proxy/event_handler/src/client_msg_handler.cpp b/frameworks/proxy/event_handler/src/client_msg_handler.cpp index 97a74d5a9bd4e009800fcdd6cf3dc494ad398a54..39f605ba92bd8d01c3f6b7c1934dbb4866442264 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 ab27d0318fc115e4f85b8a9735b924e5e0bb06bc..ee5221ee503f3a8f486081b84fff8376f239c7d9 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); } }