1c29fa5a6Sopenharmony_ci/* 2c29fa5a6Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3c29fa5a6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c29fa5a6Sopenharmony_ci * you may not use this file except in compliance with the License. 5c29fa5a6Sopenharmony_ci * You may obtain a copy of the License at 6c29fa5a6Sopenharmony_ci * 7c29fa5a6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c29fa5a6Sopenharmony_ci * 9c29fa5a6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c29fa5a6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c29fa5a6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c29fa5a6Sopenharmony_ci * See the License for the specific language governing permissions and 13c29fa5a6Sopenharmony_ci * limitations under the License. 14c29fa5a6Sopenharmony_ci */ 15c29fa5a6Sopenharmony_ci 16c29fa5a6Sopenharmony_ci#include "dfx_hisysevent.h" 17c29fa5a6Sopenharmony_ci 18c29fa5a6Sopenharmony_ci#include <fstream> 19c29fa5a6Sopenharmony_ci 20c29fa5a6Sopenharmony_ci#include "i_input_windows_manager.h" 21c29fa5a6Sopenharmony_ci#include "parameters.h" 22c29fa5a6Sopenharmony_ci 23c29fa5a6Sopenharmony_ci#undef MMI_LOG_DOMAIN 24c29fa5a6Sopenharmony_ci#define MMI_LOG_DOMAIN MMI_LOG_SERVER 25c29fa5a6Sopenharmony_ci#undef MMI_LOG_TAG 26c29fa5a6Sopenharmony_ci#define MMI_LOG_TAG "DfxHisysevent" 27c29fa5a6Sopenharmony_ci 28c29fa5a6Sopenharmony_cinamespace OHOS { 29c29fa5a6Sopenharmony_cinamespace MMI { 30c29fa5a6Sopenharmony_cinamespace { 31c29fa5a6Sopenharmony_ciconstexpr int32_t INVALID_DEVICE_ID { -1 }; 32c29fa5a6Sopenharmony_ciconstexpr uint32_t REPORT_DISPATCH_TIMES { 100 }; 33c29fa5a6Sopenharmony_ciconstexpr uint32_t REPORT_COMBO_START_TIMES { 100 }; 34c29fa5a6Sopenharmony_ciconstexpr uint32_t POINTER_CLEAR_TIMES { 10 }; 35c29fa5a6Sopenharmony_ciconstexpr int32_t CONVERSION_US_TO_MS { 1000 }; 36c29fa5a6Sopenharmony_ciconstexpr int32_t TIMES_LEVEL1 { 10 }; 37c29fa5a6Sopenharmony_ciconstexpr int32_t TIMES_LEVEL2 { 25 }; 38c29fa5a6Sopenharmony_ciconstexpr int32_t TIMES_LEVEL3 { 30 }; 39c29fa5a6Sopenharmony_ciconstexpr int32_t TIMES_LEVEL4 { 50 }; 40c29fa5a6Sopenharmony_ciconstexpr int32_t FINGERSENSE_EVENT_TIMES { 1 }; 41c29fa5a6Sopenharmony_ciconstexpr size_t SINGLE_KNUCKLE_SIZE { 1 }; 42c29fa5a6Sopenharmony_ciconstexpr size_t DOUBLE_KNUCKLE_SIZE { 2 }; 43c29fa5a6Sopenharmony_ciconstexpr int32_t FAIL_SUCC_TIME_DIFF { 3 * 60 * 1000 }; 44c29fa5a6Sopenharmony_ciconstexpr int32_t MIN_GESTURE_TIMESTAMPS_SIZE { 2 }; 45c29fa5a6Sopenharmony_ciconstexpr int32_t DOWN_TO_PREV_UP_MAX_TIME_THRESHOLD { 1000 * 1000 }; 46c29fa5a6Sopenharmony_ciconstexpr int32_t FOLDABLE_DEVICE { 2 }; 47c29fa5a6Sopenharmony_ciconst int32_t ROTATE_POLICY = system::GetIntParameter("const.window.device.rotate_policy", 0); 48c29fa5a6Sopenharmony_ciconst std::string EMPTY_STRING { "" }; 49c29fa5a6Sopenharmony_ciconst std::string LCD_PATH { "/sys/class/graphics/fb0/lcd_model" }; 50c29fa5a6Sopenharmony_ciconst std::string ACC_PATH { "/sys/devices/platform/_sensor/acc_info" }; 51c29fa5a6Sopenharmony_ciconst std::string ACC0_PATH { "/sys/class/sensors/acc_sensor/info" }; 52c29fa5a6Sopenharmony_ciconst std::string TP_PATH { "/sys/touchscreen/touch_chip_info" }; 53c29fa5a6Sopenharmony_ciconst std::string TP0_PATH { "/sys/touchscreen0/touch_chip_info" }; 54c29fa5a6Sopenharmony_ciconst std::string TP1_PATH { "/sys/touchscreen1/touch_chip_info" }; 55c29fa5a6Sopenharmony_ci} // namespace 56c29fa5a6Sopenharmony_ci 57c29fa5a6Sopenharmony_cistatic std::string GetVendorInfo(const std::string &nodePath) 58c29fa5a6Sopenharmony_ci{ 59c29fa5a6Sopenharmony_ci char realPath[PATH_MAX] = {}; 60c29fa5a6Sopenharmony_ci if (realpath(nodePath.c_str(), realPath) == nullptr) { 61c29fa5a6Sopenharmony_ci MMI_HILOGE("The realpath return nullptr"); 62c29fa5a6Sopenharmony_ci return ""; 63c29fa5a6Sopenharmony_ci } 64c29fa5a6Sopenharmony_ci std::ifstream file(realPath); 65c29fa5a6Sopenharmony_ci if (!file.is_open()) { 66c29fa5a6Sopenharmony_ci MMI_HILOGE("Unable to open file:%{public}s, error:%{public}d", nodePath.c_str(), errno); 67c29fa5a6Sopenharmony_ci return ""; 68c29fa5a6Sopenharmony_ci } 69c29fa5a6Sopenharmony_ci std::string vendorInfo; 70c29fa5a6Sopenharmony_ci file >> vendorInfo; 71c29fa5a6Sopenharmony_ci file.close(); 72c29fa5a6Sopenharmony_ci return vendorInfo; 73c29fa5a6Sopenharmony_ci} 74c29fa5a6Sopenharmony_ci 75c29fa5a6Sopenharmony_civoid DfxHisysevent::OnDeviceConnect(int32_t id, OHOS::HiviewDFX::HiSysEvent::EventType type) 76c29fa5a6Sopenharmony_ci{ 77c29fa5a6Sopenharmony_ci std::shared_ptr<InputDevice> dev = INPUT_DEV_MGR->GetInputDevice(id); 78c29fa5a6Sopenharmony_ci CHKPV(dev); 79c29fa5a6Sopenharmony_ci std::string message; 80c29fa5a6Sopenharmony_ci std::string name; 81c29fa5a6Sopenharmony_ci if (type == OHOS::HiviewDFX::HiSysEvent::EventType::FAULT) { 82c29fa5a6Sopenharmony_ci message = "The input_device connection failed for already existing"; 83c29fa5a6Sopenharmony_ci name = "INPUT_DEV_CONNECTION_FAILURE"; 84c29fa5a6Sopenharmony_ci } else { 85c29fa5a6Sopenharmony_ci message = "The input_device connection succeed"; 86c29fa5a6Sopenharmony_ci name = "INPUT_DEV_CONNECTION_SUCCESS"; 87c29fa5a6Sopenharmony_ci } 88c29fa5a6Sopenharmony_ci if (id == INT32_MAX) { 89c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 90c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 91c29fa5a6Sopenharmony_ci name, 92c29fa5a6Sopenharmony_ci type, 93c29fa5a6Sopenharmony_ci "MSG", "The input_device connection failed because the nextId_ exceeded the upper limit"); 94c29fa5a6Sopenharmony_ci if (ret != 0) { 95c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 96c29fa5a6Sopenharmony_ci } 97c29fa5a6Sopenharmony_ci } else { 98c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 99c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 100c29fa5a6Sopenharmony_ci name, 101c29fa5a6Sopenharmony_ci type, 102c29fa5a6Sopenharmony_ci "DEVICE_ID", id, 103c29fa5a6Sopenharmony_ci "DEVICE_PHYS", dev->GetPhys(), 104c29fa5a6Sopenharmony_ci "DEVICE_NAME", dev->GetName(), 105c29fa5a6Sopenharmony_ci "DEVICE_TYPE", dev->GetType(), 106c29fa5a6Sopenharmony_ci "MSG", message); 107c29fa5a6Sopenharmony_ci if (ret != 0) { 108c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 109c29fa5a6Sopenharmony_ci } 110c29fa5a6Sopenharmony_ci } 111c29fa5a6Sopenharmony_ci} 112c29fa5a6Sopenharmony_ci 113c29fa5a6Sopenharmony_civoid DfxHisysevent::OnDeviceDisconnect(int32_t id, OHOS::HiviewDFX::HiSysEvent::EventType type) 114c29fa5a6Sopenharmony_ci{ 115c29fa5a6Sopenharmony_ci if (id == INVALID_DEVICE_ID) { 116c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 117c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 118c29fa5a6Sopenharmony_ci "INPUT_DEV_DISCONNECTION_FAILURE", 119c29fa5a6Sopenharmony_ci type, 120c29fa5a6Sopenharmony_ci "MSG", "The input device failed to disconnect to server"); 121c29fa5a6Sopenharmony_ci if (ret != 0) { 122c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 123c29fa5a6Sopenharmony_ci } 124c29fa5a6Sopenharmony_ci } else { 125c29fa5a6Sopenharmony_ci std::shared_ptr dev = INPUT_DEV_MGR->GetInputDevice(id); 126c29fa5a6Sopenharmony_ci CHKPV(dev); 127c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 128c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 129c29fa5a6Sopenharmony_ci "INPUT_DEV_DISCONNECTION_SUCCESS", 130c29fa5a6Sopenharmony_ci type, 131c29fa5a6Sopenharmony_ci "DEVICE_Id", id, 132c29fa5a6Sopenharmony_ci "DEVICE_PHYS", dev->GetPhys(), 133c29fa5a6Sopenharmony_ci "DEVICE_NAME", dev->GetName(), 134c29fa5a6Sopenharmony_ci "DEVICE_TYPE", dev->GetType(), 135c29fa5a6Sopenharmony_ci "MSG", "The input device successfully disconnect to server"); 136c29fa5a6Sopenharmony_ci if (ret != 0) { 137c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 138c29fa5a6Sopenharmony_ci } 139c29fa5a6Sopenharmony_ci } 140c29fa5a6Sopenharmony_ci} 141c29fa5a6Sopenharmony_ci 142c29fa5a6Sopenharmony_civoid DfxHisysevent::OnClientConnect(const ClientConnectData &data, OHOS::HiviewDFX::HiSysEvent::EventType type) 143c29fa5a6Sopenharmony_ci{ 144c29fa5a6Sopenharmony_ci if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { 145c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 146c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 147c29fa5a6Sopenharmony_ci "CLIENT_CONNECTION_SUCCESS", 148c29fa5a6Sopenharmony_ci type, 149c29fa5a6Sopenharmony_ci "PID", data.pid, 150c29fa5a6Sopenharmony_ci "UID", data.uid, 151c29fa5a6Sopenharmony_ci "MODULE_TYPE", data.moduleType, 152c29fa5a6Sopenharmony_ci "SERVER_FD", data.serverFd, 153c29fa5a6Sopenharmony_ci "PROGRAMNAME", data.programName, 154c29fa5a6Sopenharmony_ci "MSG", "The client successfully connected to the server"); 155c29fa5a6Sopenharmony_ci if (ret != 0) { 156c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 157c29fa5a6Sopenharmony_ci } 158c29fa5a6Sopenharmony_ci } else { 159c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 160c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 161c29fa5a6Sopenharmony_ci "CLIENT_CONNECTION_FAILURE", 162c29fa5a6Sopenharmony_ci type, 163c29fa5a6Sopenharmony_ci "PID", data.pid, 164c29fa5a6Sopenharmony_ci "UID", data.uid, 165c29fa5a6Sopenharmony_ci "MODULE_TYPE", data.moduleType, 166c29fa5a6Sopenharmony_ci "PROGRAMNAME", data.programName, 167c29fa5a6Sopenharmony_ci "MSG", "The client failed to connect to the server"); 168c29fa5a6Sopenharmony_ci if (ret != 0) { 169c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 170c29fa5a6Sopenharmony_ci } 171c29fa5a6Sopenharmony_ci } 172c29fa5a6Sopenharmony_ci} 173c29fa5a6Sopenharmony_ci 174c29fa5a6Sopenharmony_civoid DfxHisysevent::OnClientDisconnect(const SessionPtr& secPtr, int32_t fd, 175c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType type) 176c29fa5a6Sopenharmony_ci{ 177c29fa5a6Sopenharmony_ci CHKPV(secPtr); 178c29fa5a6Sopenharmony_ci if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { 179c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 180c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 181c29fa5a6Sopenharmony_ci "CLIENT_DISCONNECTION_SUCCESS", 182c29fa5a6Sopenharmony_ci type, 183c29fa5a6Sopenharmony_ci "PID", secPtr->GetPid(), 184c29fa5a6Sopenharmony_ci "UID", secPtr->GetUid(), 185c29fa5a6Sopenharmony_ci "MODULE_TYPE", secPtr->GetModuleType(), 186c29fa5a6Sopenharmony_ci "FD", fd, 187c29fa5a6Sopenharmony_ci "PROGRAMNAME", secPtr->GetProgramName(), 188c29fa5a6Sopenharmony_ci "MSG", "The client successfully disconnected to the server"); 189c29fa5a6Sopenharmony_ci if (ret != 0) { 190c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 191c29fa5a6Sopenharmony_ci } 192c29fa5a6Sopenharmony_ci } else { 193c29fa5a6Sopenharmony_ci if (secPtr == nullptr) { 194c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 195c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 196c29fa5a6Sopenharmony_ci "CLIENT_DISCONNECTION_FAILURE", 197c29fa5a6Sopenharmony_ci type, 198c29fa5a6Sopenharmony_ci "MSG", "The client failed to disconnect to the server because secPtr is nullptr"); 199c29fa5a6Sopenharmony_ci if (ret != 0) { 200c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 201c29fa5a6Sopenharmony_ci } 202c29fa5a6Sopenharmony_ci } else { 203c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 204c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 205c29fa5a6Sopenharmony_ci "CLIENT_DISCONNECTION_FAILURE", 206c29fa5a6Sopenharmony_ci type, 207c29fa5a6Sopenharmony_ci "MSG", "The client failed to disconnect to the server because close(fd) return error"); 208c29fa5a6Sopenharmony_ci if (ret != 0) { 209c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 210c29fa5a6Sopenharmony_ci } 211c29fa5a6Sopenharmony_ci } 212c29fa5a6Sopenharmony_ci } 213c29fa5a6Sopenharmony_ci} 214c29fa5a6Sopenharmony_ci 215c29fa5a6Sopenharmony_civoid DfxHisysevent::OnUpdateTargetPointer(std::shared_ptr<PointerEvent> pointer, int32_t fd, 216c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType type) 217c29fa5a6Sopenharmony_ci{ 218c29fa5a6Sopenharmony_ci CHKPV(pointer); 219c29fa5a6Sopenharmony_ci if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { 220c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 221c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 222c29fa5a6Sopenharmony_ci "TARGET_POINTER_EVENT_SUCCESS", 223c29fa5a6Sopenharmony_ci type, 224c29fa5a6Sopenharmony_ci "EVENTTYPE", pointer->GetEventType(), 225c29fa5a6Sopenharmony_ci "AGENT_WINDOWID", pointer->GetAgentWindowId(), 226c29fa5a6Sopenharmony_ci "TARGET_WINDOWID", pointer->GetTargetWindowId(), 227c29fa5a6Sopenharmony_ci "PID", WIN_MGR->GetWindowPid(pointer->GetTargetWindowId()), 228c29fa5a6Sopenharmony_ci "FD", fd, 229c29fa5a6Sopenharmony_ci "MSG", "The window manager successfully update target pointer"); 230c29fa5a6Sopenharmony_ci if (ret != 0) { 231c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 232c29fa5a6Sopenharmony_ci } 233c29fa5a6Sopenharmony_ci } else { 234c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 235c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 236c29fa5a6Sopenharmony_ci "TARGET_POINTER_EVENT_FAILURE", 237c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 238c29fa5a6Sopenharmony_ci "EVENTTYPE", pointer->GetEventType(), 239c29fa5a6Sopenharmony_ci "MSG", "The window manager failed to update target pointer"); 240c29fa5a6Sopenharmony_ci if (ret != 0) { 241c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 242c29fa5a6Sopenharmony_ci } 243c29fa5a6Sopenharmony_ci } 244c29fa5a6Sopenharmony_ci} 245c29fa5a6Sopenharmony_ci 246c29fa5a6Sopenharmony_civoid DfxHisysevent::OnUpdateTargetKey(std::shared_ptr<KeyEvent> key, int32_t fd, 247c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType type) 248c29fa5a6Sopenharmony_ci{ 249c29fa5a6Sopenharmony_ci CHKPV(key); 250c29fa5a6Sopenharmony_ci if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { 251c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 252c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 253c29fa5a6Sopenharmony_ci "TARGET_KEY_EVENT_SUCCESS", 254c29fa5a6Sopenharmony_ci type, 255c29fa5a6Sopenharmony_ci "EVENTTYPE", key->GetEventType(), 256c29fa5a6Sopenharmony_ci "KEYCODE", key->GetKeyCode(), 257c29fa5a6Sopenharmony_ci "ACTION", key->GetAction(), 258c29fa5a6Sopenharmony_ci "ACTION_TIME", key->GetActionTime(), 259c29fa5a6Sopenharmony_ci "ACTION_STARTTIME", key->GetActionStartTime(), 260c29fa5a6Sopenharmony_ci "FLAG", key->GetFlag(), 261c29fa5a6Sopenharmony_ci "KEYACTION", key->GetKeyAction(), 262c29fa5a6Sopenharmony_ci "FD", fd, 263c29fa5a6Sopenharmony_ci "AGENT_WINDOWID", key->GetAgentWindowId(), 264c29fa5a6Sopenharmony_ci "TARGET_WINDOWID", key->GetTargetWindowId(), 265c29fa5a6Sopenharmony_ci "PID", WIN_MGR->GetWindowPid(key->GetTargetWindowId()), 266c29fa5a6Sopenharmony_ci "MSG", "The window manager successfully update target key"); 267c29fa5a6Sopenharmony_ci if (ret != 0) { 268c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 269c29fa5a6Sopenharmony_ci } 270c29fa5a6Sopenharmony_ci } else { 271c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 272c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 273c29fa5a6Sopenharmony_ci "TARGET_KEY_EVENT_FAILURE", 274c29fa5a6Sopenharmony_ci type, 275c29fa5a6Sopenharmony_ci "EVENTTYPE", key->GetEventType(), 276c29fa5a6Sopenharmony_ci "KEYCODE", key->GetKeyCode(), 277c29fa5a6Sopenharmony_ci "ACTION", key->GetAction(), 278c29fa5a6Sopenharmony_ci "ACTION_TIME", key->GetActionTime(), 279c29fa5a6Sopenharmony_ci "ACTION_STARTTIME", key->GetActionStartTime(), 280c29fa5a6Sopenharmony_ci "FLAG", key->GetFlag(), 281c29fa5a6Sopenharmony_ci "KEYACTION", key->GetKeyAction(), 282c29fa5a6Sopenharmony_ci "MSG", "The window manager failed to update target key"); 283c29fa5a6Sopenharmony_ci if (ret != 0) { 284c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 285c29fa5a6Sopenharmony_ci } 286c29fa5a6Sopenharmony_ci } 287c29fa5a6Sopenharmony_ci} 288c29fa5a6Sopenharmony_ci 289c29fa5a6Sopenharmony_civoid DfxHisysevent::OnFocusWindowChanged(int32_t oldFocusWindowId, int32_t newFocusWindowId, 290c29fa5a6Sopenharmony_ci int32_t oldFocusWindowPid, int32_t newFocusWindowPid) 291c29fa5a6Sopenharmony_ci{ 292c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 293c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 294c29fa5a6Sopenharmony_ci "FOCUS_WINDOW_CHANGE", 295c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 296c29fa5a6Sopenharmony_ci "OLD_FOCUS_WINDOWID", oldFocusWindowId, 297c29fa5a6Sopenharmony_ci "NEW_FOCUS_WINDOWID", newFocusWindowId, 298c29fa5a6Sopenharmony_ci "OLD_FOCUS_WINDOWPID", oldFocusWindowPid, 299c29fa5a6Sopenharmony_ci "NEW_FOCUS_WINDOWPID", newFocusWindowPid, 300c29fa5a6Sopenharmony_ci "MSG", "The focusWindowId changing succeeded"); 301c29fa5a6Sopenharmony_ci if (ret != 0) { 302c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 303c29fa5a6Sopenharmony_ci } 304c29fa5a6Sopenharmony_ci} 305c29fa5a6Sopenharmony_ci 306c29fa5a6Sopenharmony_civoid DfxHisysevent::OnZorderWindowChanged(int32_t oldZorderFirstWindowId, int32_t newZorderFirstWindowId, 307c29fa5a6Sopenharmony_ci int32_t oldZorderFirstWindowPid, int32_t newZorderFirstWindowPid) 308c29fa5a6Sopenharmony_ci{ 309c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 310c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 311c29fa5a6Sopenharmony_ci "Z_ORDER_WINDOW_CHANGE", 312c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 313c29fa5a6Sopenharmony_ci "OLD_ZORDER_FIRST_WINDOWID", oldZorderFirstWindowId, 314c29fa5a6Sopenharmony_ci "NEW_ZORDER_FIRST_WINDOWID", newZorderFirstWindowId, 315c29fa5a6Sopenharmony_ci "OLD_ZORDER_FIRST_WINDOWPID", oldZorderFirstWindowPid, 316c29fa5a6Sopenharmony_ci "NEW_ZORDER_FIRST_WINDOWPID", newZorderFirstWindowPid, 317c29fa5a6Sopenharmony_ci "MSG", "The ZorderFirstWindow changing succeeded"); 318c29fa5a6Sopenharmony_ci if (ret != 0) { 319c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 320c29fa5a6Sopenharmony_ci } 321c29fa5a6Sopenharmony_ci} 322c29fa5a6Sopenharmony_ci 323c29fa5a6Sopenharmony_civoid DfxHisysevent::OnLidSwitchChanged(int32_t lidSwitch) 324c29fa5a6Sopenharmony_ci{ 325c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 326c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 327c29fa5a6Sopenharmony_ci "LID_SWITCH", 328c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 329c29fa5a6Sopenharmony_ci "SWITCH", lidSwitch); 330c29fa5a6Sopenharmony_ci if (ret != 0) { 331c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 332c29fa5a6Sopenharmony_ci } 333c29fa5a6Sopenharmony_ci} 334c29fa5a6Sopenharmony_ci 335c29fa5a6Sopenharmony_civoid DfxHisysevent::ApplicationBlockInput(const SessionPtr& sess) 336c29fa5a6Sopenharmony_ci{ 337c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 338c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 339c29fa5a6Sopenharmony_ci "APPLICATION_BLOCK_INPUT", 340c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 341c29fa5a6Sopenharmony_ci "PID", sess->GetPid(), 342c29fa5a6Sopenharmony_ci "UID", sess->GetUid(), 343c29fa5a6Sopenharmony_ci "PACKAGE_NAME", sess->GetProgramName(), 344c29fa5a6Sopenharmony_ci "PROCESS_NAME", sess->GetProgramName(), 345c29fa5a6Sopenharmony_ci "MSG", "User input does not respond"); 346c29fa5a6Sopenharmony_ci if (ret != 0) { 347c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 348c29fa5a6Sopenharmony_ci } 349c29fa5a6Sopenharmony_ci} 350c29fa5a6Sopenharmony_ci 351c29fa5a6Sopenharmony_civoid DfxHisysevent::CalcKeyDispTimes() 352c29fa5a6Sopenharmony_ci{ 353c29fa5a6Sopenharmony_ci int64_t endTime = GetSysClockTime(); 354c29fa5a6Sopenharmony_ci dispCastTime_.totalTimes++; 355c29fa5a6Sopenharmony_ci int64_t castTime = (endTime - dispatchStartTime_) / CONVERSION_US_TO_MS; 356c29fa5a6Sopenharmony_ci if (castTime <= TIMES_LEVEL1) { 357c29fa5a6Sopenharmony_ci dispCastTime_.below10msTimes++; 358c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL2) { 359c29fa5a6Sopenharmony_ci dispCastTime_.below25msTimes++; 360c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL4) { 361c29fa5a6Sopenharmony_ci dispCastTime_.below50msTimes++; 362c29fa5a6Sopenharmony_ci } else { 363c29fa5a6Sopenharmony_ci dispCastTime_.above50msTimes++; 364c29fa5a6Sopenharmony_ci } 365c29fa5a6Sopenharmony_ci} 366c29fa5a6Sopenharmony_ci 367c29fa5a6Sopenharmony_civoid DfxHisysevent::CalcPointerDispTimes() 368c29fa5a6Sopenharmony_ci{ 369c29fa5a6Sopenharmony_ci int64_t endTime = GetSysClockTime(); 370c29fa5a6Sopenharmony_ci dispCastTime_.sampleCount++; 371c29fa5a6Sopenharmony_ci int64_t castTime = (endTime - dispatchStartTime_) / CONVERSION_US_TO_MS; 372c29fa5a6Sopenharmony_ci if (dispCastTime_.sampleCount == POINTER_CLEAR_TIMES) { 373c29fa5a6Sopenharmony_ci dispCastTime_.sampleCount = 0; 374c29fa5a6Sopenharmony_ci dispCastTime_.totalTimes++; 375c29fa5a6Sopenharmony_ci if (castTime <= TIMES_LEVEL1) { 376c29fa5a6Sopenharmony_ci dispCastTime_.below10msTimes++; 377c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL2) { 378c29fa5a6Sopenharmony_ci dispCastTime_.below25msTimes++; 379c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL4) { 380c29fa5a6Sopenharmony_ci dispCastTime_.below50msTimes++; 381c29fa5a6Sopenharmony_ci } else { 382c29fa5a6Sopenharmony_ci dispCastTime_.above50msTimes++; 383c29fa5a6Sopenharmony_ci } 384c29fa5a6Sopenharmony_ci } 385c29fa5a6Sopenharmony_ci} 386c29fa5a6Sopenharmony_ci 387c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportDispTimes() 388c29fa5a6Sopenharmony_ci{ 389c29fa5a6Sopenharmony_ci if (dispCastTime_.totalTimes >= REPORT_DISPATCH_TIMES) { 390c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 391c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 392c29fa5a6Sopenharmony_ci "INPUT_DISPATCH_TIME", 393c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 394c29fa5a6Sopenharmony_ci "BELOW10MS", dispCastTime_.below10msTimes, 395c29fa5a6Sopenharmony_ci "BELOW25MS", dispCastTime_.below25msTimes, 396c29fa5a6Sopenharmony_ci "BELOW50MS", dispCastTime_.below50msTimes, 397c29fa5a6Sopenharmony_ci "ABOVE50MS", dispCastTime_.above50msTimes, 398c29fa5a6Sopenharmony_ci "MSG", "The costing time to dispatch event"); 399c29fa5a6Sopenharmony_ci if (ret != 0) { 400c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 401c29fa5a6Sopenharmony_ci } else { 402c29fa5a6Sopenharmony_ci dispCastTime_.sampleCount = 0; 403c29fa5a6Sopenharmony_ci dispCastTime_.totalTimes = 0; 404c29fa5a6Sopenharmony_ci dispCastTime_.below10msTimes = 0; 405c29fa5a6Sopenharmony_ci dispCastTime_.below25msTimes = 0; 406c29fa5a6Sopenharmony_ci dispCastTime_.below50msTimes = 0; 407c29fa5a6Sopenharmony_ci dispCastTime_.above50msTimes = 0; 408c29fa5a6Sopenharmony_ci } 409c29fa5a6Sopenharmony_ci } 410c29fa5a6Sopenharmony_ci} 411c29fa5a6Sopenharmony_ci 412c29fa5a6Sopenharmony_civoid DfxHisysevent::CalcComboStartTimes(const int32_t keyDownDuration) 413c29fa5a6Sopenharmony_ci{ 414c29fa5a6Sopenharmony_ci int64_t endTime = GetSysClockTime(); 415c29fa5a6Sopenharmony_ci comboStartCastTime_.totalTimes++; 416c29fa5a6Sopenharmony_ci int64_t castTime = (endTime - comboStartTime_) / CONVERSION_US_TO_MS - keyDownDuration; 417c29fa5a6Sopenharmony_ci if (castTime <= TIMES_LEVEL1) { 418c29fa5a6Sopenharmony_ci comboStartCastTime_.below10msTimes++; 419c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL3) { 420c29fa5a6Sopenharmony_ci comboStartCastTime_.below30msTimes++; 421c29fa5a6Sopenharmony_ci } else if (castTime <= TIMES_LEVEL4) { 422c29fa5a6Sopenharmony_ci comboStartCastTime_.below50msTimes++; 423c29fa5a6Sopenharmony_ci } else { 424c29fa5a6Sopenharmony_ci comboStartCastTime_.above50msTimes++; 425c29fa5a6Sopenharmony_ci } 426c29fa5a6Sopenharmony_ci} 427c29fa5a6Sopenharmony_ci 428c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportComboStartTimes() 429c29fa5a6Sopenharmony_ci{ 430c29fa5a6Sopenharmony_ci if (comboStartCastTime_.totalTimes >= REPORT_COMBO_START_TIMES) { 431c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 432c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 433c29fa5a6Sopenharmony_ci "COMBO_START_TIME", 434c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 435c29fa5a6Sopenharmony_ci "BELOW10MS", comboStartCastTime_.below10msTimes, 436c29fa5a6Sopenharmony_ci "BELOW30MS", comboStartCastTime_.below30msTimes, 437c29fa5a6Sopenharmony_ci "BELOW50MS", comboStartCastTime_.below50msTimes, 438c29fa5a6Sopenharmony_ci "ABOVE50MS", comboStartCastTime_.above50msTimes, 439c29fa5a6Sopenharmony_ci "MSG", "The costing time to launch application of combination"); 440c29fa5a6Sopenharmony_ci if (ret != 0) { 441c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 442c29fa5a6Sopenharmony_ci } else { 443c29fa5a6Sopenharmony_ci comboStartCastTime_.totalTimes = 0; 444c29fa5a6Sopenharmony_ci comboStartCastTime_.below10msTimes = 0; 445c29fa5a6Sopenharmony_ci comboStartCastTime_.below30msTimes = 0; 446c29fa5a6Sopenharmony_ci comboStartCastTime_.below50msTimes = 0; 447c29fa5a6Sopenharmony_ci comboStartCastTime_.above50msTimes = 0; 448c29fa5a6Sopenharmony_ci } 449c29fa5a6Sopenharmony_ci } 450c29fa5a6Sopenharmony_ci} 451c29fa5a6Sopenharmony_ci 452c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportPowerInfo(std::shared_ptr<KeyEvent> key, OHOS::HiviewDFX::HiSysEvent::EventType type) 453c29fa5a6Sopenharmony_ci{ 454c29fa5a6Sopenharmony_ci CHKPV(key); 455c29fa5a6Sopenharmony_ci if (key->GetKeyAction() == KeyEvent::KEY_ACTION_UP) { 456c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 457c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 458c29fa5a6Sopenharmony_ci "INPUT_POWER_UP", 459c29fa5a6Sopenharmony_ci type); 460c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 461c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 462c29fa5a6Sopenharmony_ci } 463c29fa5a6Sopenharmony_ci } else if (key->GetKeyAction() == KeyEvent::KEY_ACTION_DOWN) { 464c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 465c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 466c29fa5a6Sopenharmony_ci "INPUT_POWER_DOWN", 467c29fa5a6Sopenharmony_ci type); 468c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 469c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 470c29fa5a6Sopenharmony_ci } 471c29fa5a6Sopenharmony_ci } else { 472c29fa5a6Sopenharmony_ci MMI_HILOGW("Press power key is error"); 473c29fa5a6Sopenharmony_ci } 474c29fa5a6Sopenharmony_ci} 475c29fa5a6Sopenharmony_ci 476c29fa5a6Sopenharmony_civoid DfxHisysevent::StatisticTouchpadGesture(std::shared_ptr<PointerEvent> pointerEvent) 477c29fa5a6Sopenharmony_ci{ 478c29fa5a6Sopenharmony_ci CHKPV(pointerEvent); 479c29fa5a6Sopenharmony_ci int32_t pointerAction = pointerEvent->GetPointerAction(); 480c29fa5a6Sopenharmony_ci int32_t fingerCount = pointerEvent->GetFingerCount(); 481c29fa5a6Sopenharmony_ci 482c29fa5a6Sopenharmony_ci if (pointerAction == PointerEvent::POINTER_ACTION_AXIS_BEGIN) { 483c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 484c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 485c29fa5a6Sopenharmony_ci "TOUCHPAD_PINCH", 486c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 487c29fa5a6Sopenharmony_ci "FINGER_COUNT", fingerCount); 488c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 489c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 490c29fa5a6Sopenharmony_ci } 491c29fa5a6Sopenharmony_ci } else if (pointerAction == PointerEvent::POINTER_ACTION_SWIPE_BEGIN) { 492c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 493c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 494c29fa5a6Sopenharmony_ci "TOUCHPAD_SWIPE", 495c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 496c29fa5a6Sopenharmony_ci "FINGER_COUNT", fingerCount); 497c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 498c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 499c29fa5a6Sopenharmony_ci } 500c29fa5a6Sopenharmony_ci } else { 501c29fa5a6Sopenharmony_ci MMI_HILOGW("HiviewDFX Statistic touchpad gesture is error, pointer action is invalid"); 502c29fa5a6Sopenharmony_ci } 503c29fa5a6Sopenharmony_ci} 504c29fa5a6Sopenharmony_ci 505c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportTouchpadSettingState(TOUCHPAD_SETTING_CODE settingCode, bool flag) 506c29fa5a6Sopenharmony_ci{ 507c29fa5a6Sopenharmony_ci const std::map<uint32_t, std::string> mapSettingCodeToSettingType = { 508c29fa5a6Sopenharmony_ci { TOUCHPAD_SCROLL_SETTING, "TOUCHPAD_SCROLL_SETTING" }, 509c29fa5a6Sopenharmony_ci { TOUCHPAD_SCROLL_DIR_SETTING, "TOUCHPAD_SCROLL_DIR_SETTING" }, 510c29fa5a6Sopenharmony_ci { TOUCHPAD_TAP_SETTING, "TOUCHPAD_TAP_SETTING" }, 511c29fa5a6Sopenharmony_ci { TOUCHPAD_SWIPE_SETTING, "TOUCHPAD_SWIPE_SETTING" }, 512c29fa5a6Sopenharmony_ci { TOUCHPAD_PINCH_SETTING, "TOUCHPAD_PINCH_SETTING" }, 513c29fa5a6Sopenharmony_ci }; 514c29fa5a6Sopenharmony_ci 515c29fa5a6Sopenharmony_ci auto it = mapSettingCodeToSettingType.find(settingCode); 516c29fa5a6Sopenharmony_ci if (it == mapSettingCodeToSettingType.end()) { 517c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Report touchpad setting state is error, setting code is invalid"); 518c29fa5a6Sopenharmony_ci return; 519c29fa5a6Sopenharmony_ci } 520c29fa5a6Sopenharmony_ci std::string name = it->second; 521c29fa5a6Sopenharmony_ci 522c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 523c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 524c29fa5a6Sopenharmony_ci name, 525c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 526c29fa5a6Sopenharmony_ci "SWITCH_STATE", flag); 527c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 528c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 529c29fa5a6Sopenharmony_ci } 530c29fa5a6Sopenharmony_ci} 531c29fa5a6Sopenharmony_ci 532c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportTouchpadSettingState(TOUCHPAD_SETTING_CODE settingCode, int32_t value) 533c29fa5a6Sopenharmony_ci{ 534c29fa5a6Sopenharmony_ci const std::map<uint32_t, std::string> mapSettingCodeToSettingType = { 535c29fa5a6Sopenharmony_ci { TOUCHPAD_POINTER_SPEED_SETTING, "TOUCHPAD_POINTER_SPEED_SETTING" }, 536c29fa5a6Sopenharmony_ci { TOUCHPAD_RIGHT_CLICK_SETTING, "TOUCHPAD_RIGHT_CLICK_SETTING" }, 537c29fa5a6Sopenharmony_ci }; 538c29fa5a6Sopenharmony_ci 539c29fa5a6Sopenharmony_ci auto it = mapSettingCodeToSettingType.find(settingCode); 540c29fa5a6Sopenharmony_ci if (it == mapSettingCodeToSettingType.end()) { 541c29fa5a6Sopenharmony_ci MMI_HILOGW("HiviewDFX Report touchpad setting state is error, setting code is invalid"); 542c29fa5a6Sopenharmony_ci return; 543c29fa5a6Sopenharmony_ci } 544c29fa5a6Sopenharmony_ci std::string name = it->second; 545c29fa5a6Sopenharmony_ci 546c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 547c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 548c29fa5a6Sopenharmony_ci name, 549c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 550c29fa5a6Sopenharmony_ci "SWITCH_VALUE", value); 551c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 552c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 553c29fa5a6Sopenharmony_ci } 554c29fa5a6Sopenharmony_ci} 555c29fa5a6Sopenharmony_ci 556c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportSingleKnuckleDoubleClickEvent(int32_t intervalTime, int32_t distanceInterval) 557c29fa5a6Sopenharmony_ci{ 558c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 559c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 560c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 561c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 562c29fa5a6Sopenharmony_ci "SK_S_T", FINGERSENSE_EVENT_TIMES, 563c29fa5a6Sopenharmony_ci "SKS_T_I", intervalTime / CONVERSION_US_TO_MS, 564c29fa5a6Sopenharmony_ci "DKS_D_I", distanceInterval, 565c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 566c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 567c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 568c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 569c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 570c29fa5a6Sopenharmony_ci } 571c29fa5a6Sopenharmony_ci} 572c29fa5a6Sopenharmony_ci 573c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportFailIfInvalidTime(const std::shared_ptr<PointerEvent> touchEvent, int32_t intervalTime) 574c29fa5a6Sopenharmony_ci{ 575c29fa5a6Sopenharmony_ci if (intervalTime >= DOWN_TO_PREV_UP_MAX_TIME_THRESHOLD) { 576c29fa5a6Sopenharmony_ci return; 577c29fa5a6Sopenharmony_ci } 578c29fa5a6Sopenharmony_ci CHKPV(touchEvent); 579c29fa5a6Sopenharmony_ci size_t size = touchEvent->GetPointerIds().size(); 580c29fa5a6Sopenharmony_ci std::string knuckleFailCount; 581c29fa5a6Sopenharmony_ci std::string invalidTimeFailCount; 582c29fa5a6Sopenharmony_ci if (size == SINGLE_KNUCKLE_SIZE) { 583c29fa5a6Sopenharmony_ci knuckleFailCount = "SKF_T_I"; 584c29fa5a6Sopenharmony_ci invalidTimeFailCount = "SK_F_T"; 585c29fa5a6Sopenharmony_ci } else if (size == DOUBLE_KNUCKLE_SIZE) { 586c29fa5a6Sopenharmony_ci knuckleFailCount = "DKF_T_I"; 587c29fa5a6Sopenharmony_ci invalidTimeFailCount = "DK_F_T"; 588c29fa5a6Sopenharmony_ci } else { 589c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Report knuckle state error, knuckle size:%{public}zu", size); 590c29fa5a6Sopenharmony_ci return; 591c29fa5a6Sopenharmony_ci } 592c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 593c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 594c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 595c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 596c29fa5a6Sopenharmony_ci "FSF_T_C", FINGERSENSE_EVENT_TIMES, 597c29fa5a6Sopenharmony_ci knuckleFailCount, intervalTime / CONVERSION_US_TO_MS, 598c29fa5a6Sopenharmony_ci invalidTimeFailCount, FINGERSENSE_EVENT_TIMES, 599c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 600c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 601c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 602c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 603c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 604c29fa5a6Sopenharmony_ci } 605c29fa5a6Sopenharmony_ci} 606c29fa5a6Sopenharmony_ci 607c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportFailIfInvalidDistance(const std::shared_ptr<PointerEvent> touchEvent, float distance) 608c29fa5a6Sopenharmony_ci{ 609c29fa5a6Sopenharmony_ci CHKPV(touchEvent); 610c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 611c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 612c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 613c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 614c29fa5a6Sopenharmony_ci "SK_F_T", FINGERSENSE_EVENT_TIMES, 615c29fa5a6Sopenharmony_ci "DKF_D_I", distance, 616c29fa5a6Sopenharmony_ci "FSF_D_C", FINGERSENSE_EVENT_TIMES, 617c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 618c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 619c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 620c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 621c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 622c29fa5a6Sopenharmony_ci } 623c29fa5a6Sopenharmony_ci} 624c29fa5a6Sopenharmony_ci 625c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleClickEvent() 626c29fa5a6Sopenharmony_ci{ 627c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 628c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::INPUT_UE, 629c29fa5a6Sopenharmony_ci "KNUCKLE_CLICK", 630c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 631c29fa5a6Sopenharmony_ci "PNAMEID", EMPTY_STRING, 632c29fa5a6Sopenharmony_ci "PVERSIONID", EMPTY_STRING); 633c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 634c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 635c29fa5a6Sopenharmony_ci } 636c29fa5a6Sopenharmony_ci} 637c29fa5a6Sopenharmony_ci 638c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportScreenCaptureGesture() 639c29fa5a6Sopenharmony_ci{ 640c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 641c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::INPUT_UE, 642c29fa5a6Sopenharmony_ci "SINGLE_KNUCKLE_DOUBLE_CLICK", 643c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 644c29fa5a6Sopenharmony_ci "PNAMEID", EMPTY_STRING, 645c29fa5a6Sopenharmony_ci "PVERSIONID", EMPTY_STRING); 646c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 647c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 648c29fa5a6Sopenharmony_ci } 649c29fa5a6Sopenharmony_ci} 650c29fa5a6Sopenharmony_ci 651c29fa5a6Sopenharmony_ci#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR 652c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportMagicCursorColorChange(std::string fill_Color, std::string stroke_Color) 653c29fa5a6Sopenharmony_ci{ 654c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 655c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 656c29fa5a6Sopenharmony_ci "MAGIC_CURSOR_COLOR", 657c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 658c29fa5a6Sopenharmony_ci "FILL_COLOR", fill_Color, 659c29fa5a6Sopenharmony_ci "STROKE_COLOR", stroke_Color); 660c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 661c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 662c29fa5a6Sopenharmony_ci } 663c29fa5a6Sopenharmony_ci} 664c29fa5a6Sopenharmony_ci 665c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportMagicCursorShapeChange(std::string fill_Code, OHOS::MMI::MOUSE_ICON mouse_Style) 666c29fa5a6Sopenharmony_ci{ 667c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 668c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 669c29fa5a6Sopenharmony_ci "MAGIC_CURSOR_SHAPE", 670c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 671c29fa5a6Sopenharmony_ci "MOUSE_STYLE", mouse_Style, 672c29fa5a6Sopenharmony_ci "FILL_CODE", fill_Code); 673c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 674c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 675c29fa5a6Sopenharmony_ci } 676c29fa5a6Sopenharmony_ci} 677c29fa5a6Sopenharmony_ci 678c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportMagicCursorSizeChange(std::string fill_Code, std::string mouse_Size) 679c29fa5a6Sopenharmony_ci{ 680c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 681c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 682c29fa5a6Sopenharmony_ci "MAGIC_CURSOR_SIZE", 683c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 684c29fa5a6Sopenharmony_ci "MOUSE_SIZE", mouse_Size, 685c29fa5a6Sopenharmony_ci "FILL_CODE", fill_Code); 686c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 687c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 688c29fa5a6Sopenharmony_ci } 689c29fa5a6Sopenharmony_ci} 690c29fa5a6Sopenharmony_ci 691c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportMagicCursorFault(std::string error_Code, std::string error_Name) 692c29fa5a6Sopenharmony_ci{ 693c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 694c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 695c29fa5a6Sopenharmony_ci "FANTASY_CURSOR_FAILED", 696c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 697c29fa5a6Sopenharmony_ci "ERROR_CODE", error_Code, 698c29fa5a6Sopenharmony_ci "ERROR_NAME", error_Name); 699c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 700c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 701c29fa5a6Sopenharmony_ci } 702c29fa5a6Sopenharmony_ci} 703c29fa5a6Sopenharmony_ci#endif // OHOS_BUILD_ENABLE_MAGICCURSOR 704c29fa5a6Sopenharmony_ci 705c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportSmartShotSuccTimes() 706c29fa5a6Sopenharmony_ci{ 707c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 708c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 709c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 710c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 711c29fa5a6Sopenharmony_ci "RG_S_T", FINGERSENSE_EVENT_TIMES, 712c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 713c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 714c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 715c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 716c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 717c29fa5a6Sopenharmony_ci } 718c29fa5a6Sopenharmony_ci} 719c29fa5a6Sopenharmony_ci 720c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleGestureTrackLength(int32_t knuckleGestureTrackLength) 721c29fa5a6Sopenharmony_ci{ 722c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 723c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 724c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 725c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 726c29fa5a6Sopenharmony_ci "RG_TRACK_LENGTH", knuckleGestureTrackLength, 727c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 728c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 729c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 730c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 731c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 732c29fa5a6Sopenharmony_ci } 733c29fa5a6Sopenharmony_ci} 734c29fa5a6Sopenharmony_ci 735c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleGestureTrackTime(const std::vector<int64_t> &gestureTimeStamps) 736c29fa5a6Sopenharmony_ci{ 737c29fa5a6Sopenharmony_ci size_t size = gestureTimeStamps.size(); 738c29fa5a6Sopenharmony_ci if (size < MIN_GESTURE_TIMESTAMPS_SIZE) { 739c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Report knuckle gesture track time error, knuckle timestamps size:%{public}zu", size); 740c29fa5a6Sopenharmony_ci return; 741c29fa5a6Sopenharmony_ci } 742c29fa5a6Sopenharmony_ci int32_t knuckleGestureTrackTime = (gestureTimeStamps[size - 1] - gestureTimeStamps[0]) / CONVERSION_US_TO_MS; 743c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 744c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 745c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 746c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 747c29fa5a6Sopenharmony_ci "RG_TRACK_TIME", knuckleGestureTrackTime, 748c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 749c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 750c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 751c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 752c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 753c29fa5a6Sopenharmony_ci } 754c29fa5a6Sopenharmony_ci} 755c29fa5a6Sopenharmony_ci 756c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportScreenRecorderGesture(int32_t intervalTime) 757c29fa5a6Sopenharmony_ci{ 758c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 759c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 760c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 761c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 762c29fa5a6Sopenharmony_ci "DK_S_T", FINGERSENSE_EVENT_TIMES, 763c29fa5a6Sopenharmony_ci "DKS_T_I", intervalTime / CONVERSION_US_TO_MS, 764c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 765c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 766c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 767c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 768c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 769c29fa5a6Sopenharmony_ci } 770c29fa5a6Sopenharmony_ci} 771c29fa5a6Sopenharmony_ci 772c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleGestureFaildTimes() 773c29fa5a6Sopenharmony_ci{ 774c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 775c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 776c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 777c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 778c29fa5a6Sopenharmony_ci "LG_F_T", FINGERSENSE_EVENT_TIMES, 779c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 780c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 781c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 782c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 783c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 784c29fa5a6Sopenharmony_ci } 785c29fa5a6Sopenharmony_ci} 786c29fa5a6Sopenharmony_ci 787c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleDrawSSuccessTimes() 788c29fa5a6Sopenharmony_ci{ 789c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 790c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 791c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 792c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 793c29fa5a6Sopenharmony_ci "L_S_S_T", FINGERSENSE_EVENT_TIMES, 794c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 795c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 796c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 797c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 798c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 799c29fa5a6Sopenharmony_ci } 800c29fa5a6Sopenharmony_ci} 801c29fa5a6Sopenharmony_ci 802c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleGestureFromFailToSuccessTime(int32_t intervalTime) 803c29fa5a6Sopenharmony_ci{ 804c29fa5a6Sopenharmony_ci intervalTime /= CONVERSION_US_TO_MS; 805c29fa5a6Sopenharmony_ci if (intervalTime < 0 || intervalTime >= FAIL_SUCC_TIME_DIFF) { 806c29fa5a6Sopenharmony_ci return; 807c29fa5a6Sopenharmony_ci } 808c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 809c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 810c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 811c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 812c29fa5a6Sopenharmony_ci "RG_F_S_TIME_DIFF", intervalTime, 813c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 814c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 815c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 816c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 817c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 818c29fa5a6Sopenharmony_ci } 819c29fa5a6Sopenharmony_ci} 820c29fa5a6Sopenharmony_ci 821c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportKnuckleGestureFromSuccessToFailTime(int32_t intervalTime) 822c29fa5a6Sopenharmony_ci{ 823c29fa5a6Sopenharmony_ci intervalTime /= CONVERSION_US_TO_MS; 824c29fa5a6Sopenharmony_ci if (intervalTime < 0 || intervalTime >= FAIL_SUCC_TIME_DIFF) { 825c29fa5a6Sopenharmony_ci return; 826c29fa5a6Sopenharmony_ci } 827c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 828c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 829c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 830c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 831c29fa5a6Sopenharmony_ci "RG_S_F_TIME_DIFF", intervalTime, 832c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 833c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 834c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 835c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 836c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 837c29fa5a6Sopenharmony_ci } 838c29fa5a6Sopenharmony_ci} 839c29fa5a6Sopenharmony_ci 840c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportFailIfKnockTooFast() 841c29fa5a6Sopenharmony_ci{ 842c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 843c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 844c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 845c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 846c29fa5a6Sopenharmony_ci "SK_F_T", FINGERSENSE_EVENT_TIMES, 847c29fa5a6Sopenharmony_ci "FSF_C_C", FINGERSENSE_EVENT_TIMES, 848c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 849c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 850c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 851c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 852c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 853c29fa5a6Sopenharmony_ci } 854c29fa5a6Sopenharmony_ci} 855c29fa5a6Sopenharmony_ci 856c29fa5a6Sopenharmony_civoid DfxHisysevent::ReportFailIfOneSuccTwoFail(const std::shared_ptr<PointerEvent> touchEvent) 857c29fa5a6Sopenharmony_ci{ 858c29fa5a6Sopenharmony_ci CHKPV(touchEvent); 859c29fa5a6Sopenharmony_ci int32_t id = touchEvent->GetPointerId(); 860c29fa5a6Sopenharmony_ci PointerEvent::PointerItem item; 861c29fa5a6Sopenharmony_ci touchEvent->GetPointerItem(id, item); 862c29fa5a6Sopenharmony_ci if (item.GetToolType() == PointerEvent::TOOL_TYPE_KNUCKLE) { 863c29fa5a6Sopenharmony_ci return; 864c29fa5a6Sopenharmony_ci } 865c29fa5a6Sopenharmony_ci int32_t ret = HiSysEventWrite( 866c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT, 867c29fa5a6Sopenharmony_ci "FINGERSENSE_KNOCK_EVENT_INFO", 868c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, 869c29fa5a6Sopenharmony_ci "SK_F_T", FINGERSENSE_EVENT_TIMES, 870c29fa5a6Sopenharmony_ci "FSF_1S_2F_C", FINGERSENSE_EVENT_TIMES, 871c29fa5a6Sopenharmony_ci "TP_INFO", GetTpVendorName(), 872c29fa5a6Sopenharmony_ci "S_INFO", GetAccVendorName(), 873c29fa5a6Sopenharmony_ci "LCD_INFO", GetLcdInfo()); 874c29fa5a6Sopenharmony_ci if (ret != RET_OK) { 875c29fa5a6Sopenharmony_ci MMI_HILOGE("HiviewDFX Write failed, ret:%{public}d", ret); 876c29fa5a6Sopenharmony_ci } 877c29fa5a6Sopenharmony_ci} 878c29fa5a6Sopenharmony_ci 879c29fa5a6Sopenharmony_cistd::string DfxHisysevent::GetTpVendorName() 880c29fa5a6Sopenharmony_ci{ 881c29fa5a6Sopenharmony_ci if (ROTATE_POLICY != FOLDABLE_DEVICE) { 882c29fa5a6Sopenharmony_ci return GetVendorInfo(TP_PATH); 883c29fa5a6Sopenharmony_ci } 884c29fa5a6Sopenharmony_ci auto displayMode = WIN_MGR->GetDisplayMode(); 885c29fa5a6Sopenharmony_ci if (displayMode == DisplayMode::FULL) { 886c29fa5a6Sopenharmony_ci return GetVendorInfo(TP0_PATH); 887c29fa5a6Sopenharmony_ci } else if (displayMode == DisplayMode::MAIN) { 888c29fa5a6Sopenharmony_ci return GetVendorInfo(TP1_PATH); 889c29fa5a6Sopenharmony_ci } 890c29fa5a6Sopenharmony_ci return "NA"; 891c29fa5a6Sopenharmony_ci} 892c29fa5a6Sopenharmony_ci 893c29fa5a6Sopenharmony_cistd::string DfxHisysevent::GetAccVendorName() 894c29fa5a6Sopenharmony_ci{ 895c29fa5a6Sopenharmony_ci if (ROTATE_POLICY != FOLDABLE_DEVICE) { 896c29fa5a6Sopenharmony_ci return GetVendorInfo(ACC_PATH); 897c29fa5a6Sopenharmony_ci } 898c29fa5a6Sopenharmony_ci return GetVendorInfo(ACC0_PATH); 899c29fa5a6Sopenharmony_ci} 900c29fa5a6Sopenharmony_ci 901c29fa5a6Sopenharmony_cistd::string DfxHisysevent::GetLcdInfo() 902c29fa5a6Sopenharmony_ci{ 903c29fa5a6Sopenharmony_ci return GetVendorInfo(LCD_PATH); 904c29fa5a6Sopenharmony_ci} 905c29fa5a6Sopenharmony_ci} // namespace MMI 906c29fa5a6Sopenharmony_ci} // namespace OHOS