From 326917f23294536f1383ada1fedd05d7378fc253 Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Wed, 2 Apr 2025 11:13:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=A4=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=89=93=E7=82=B9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- frameworks/native/light/src/light_client.cpp | 7 ++++++- frameworks/native/vibrator/vibrator_agent.cpp | 12 ++++++++++++ hisysevent.yaml | 10 ++++++++++ .../hdi_connection/adapter/src/hdi_connection.cpp | 4 ++++ .../adapter/src/hdi_light_connection.cpp | 12 ++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/frameworks/native/light/src/light_client.cpp b/frameworks/native/light/src/light_client.cpp index ca9c658..33d89a4 100644 --- a/frameworks/native/light/src/light_client.cpp +++ b/frameworks/native/light/src/light_client.cpp @@ -66,7 +66,8 @@ int32_t LightClient::InitLightClient() CHKPR(remoteObject, MISC_NATIVE_GET_SERVICE_ERR); remoteObject->AddDeathRecipient(serviceDeathObserver_); lightInfoList_.clear(); - miscdeviceProxy_->GetLightList(lightInfoList_); + int32_t ret = miscdeviceProxy_->GetLightList(lightInfoList_); + WriteHiSysIPCEvent(IMiscdeviceServiceIpcCode::COMMAND_GET_LIGHT_LIST, ret); return ERR_OK; } #ifdef HIVIEWDFX_HISYSEVENT_ENABLE @@ -107,6 +108,10 @@ void LightClient::WriteHiSysIPCEvent(IMiscdeviceServiceIpcCode code, int32_t ret HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::MISCDEVICE, "MISC_SERVICE_IPC_EXCEPTION", HiviewDFX::HiSysEvent::EventType::FAULT, "PKG_NAME", "TurnOff", "ERROR_CODE", ret); break; + case IMiscdeviceServiceIpcCode::COMMAND_GET_LIGHT_LIST: + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::MISCDEVICE, "MISC_SERVICE_IPC_EXCEPTION", + HiviewDFX::HiSysEvent::EventType::FAULT, "PKG_NAME", "GetLightList", "ERROR_CODE", ret); + break; default: MISC_HILOGW("Code does not exist, code:%{public}d", static_cast(code)); break; diff --git a/frameworks/native/vibrator/vibrator_agent.cpp b/frameworks/native/vibrator/vibrator_agent.cpp index af47f7b..551120b 100644 --- a/frameworks/native/vibrator/vibrator_agent.cpp +++ b/frameworks/native/vibrator/vibrator_agent.cpp @@ -198,6 +198,10 @@ int32_t PreProcess(const VibratorFileDescription &fd, VibratorPackage &package) auto &client = VibratorServiceClient::GetInstance(); int32_t ret = client.PreProcess(fd, package); if (ret != ERR_OK) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::MISCDEVICE, "PACKAGE_CONVERT_EXCEPTION", + HiviewDFX::HiSysEvent::EventType::FAULT, "PKG_NAME", "PreProcess", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGD("DecodeVibratorFile failed, ret:%{public}d", ret); return NormalizeErrCode(ret); } @@ -235,6 +239,10 @@ int32_t SeekTimeOnPackage(int32_t seekTime, const VibratorPackage &completePacka auto &client = VibratorServiceClient::GetInstance(); int32_t ret = client.SeekTimeOnPackage(seekTime, completePackage, seekPackage); if (ret != ERR_OK) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::MISCDEVICE, "PACKAGE_CONVERT_EXCEPTION", + HiviewDFX::HiSysEvent::EventType::FAULT, "PKG_NAME", "SeekTimeOnPackage", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGD("SeekTimeOnPackage failed, ret:%{public}d", ret); return NormalizeErrCode(ret); } @@ -246,6 +254,10 @@ int32_t FreeVibratorPackage(VibratorPackage &package) auto &client = VibratorServiceClient::GetInstance(); int32_t ret = client.FreeVibratorPackage(package); if (ret != ERR_OK) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::MISCDEVICE, "PACKAGE_FREE_EXCEPTION", + HiviewDFX::HiSysEvent::EventType::FAULT, "PKG_NAME", "FreeVibratorPackage", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGD("FreeVibratorPackage failed, ret:%{public}d", ret); return NormalizeErrCode(ret); } diff --git a/hisysevent.yaml b/hisysevent.yaml index 1e8b2c8..d49a3bb 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -56,4 +56,14 @@ WHITELIST_COUNT_EXCEPTION: USER_SWITCHED_EXCEPTION: __BASE: {type: FAULT, level: CRITICAL, desc: user switched exception, preserve: true} PKG_NAME: {type: STRING, desc: package name} + ERROR_CODE: {type: INT32, desc: error code} + +PACKAGE_CONVERT_EXCEPTION: + __BASE: {type: FAULT, level: CRITICAL, desc: package convert exception, preserve: true} + PKG_NAME: {type: STRING, desc: package name} + ERROR_CODE: {type: INT32, desc: error code} + +PACKAGE_FREE_EXCEPTION: + __BASE: {type: FAULT, level: CRITICAL, desc: package free exception, preserve: true} + PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} \ No newline at end of file diff --git a/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp index 6d22d80..08f71c5 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp @@ -307,6 +307,10 @@ int32_t HdiConnection::GetAllWaveInfo(std::vector &waveInfos int32_t vibratorId = 1; int32_t ret = vibratorInterface_->GetAllWaveInfo(vibratorId, waveInfos); if (ret != ERR_OK) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "VIBRATOR_HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, + "PKG_NAME", "GetAllWaveInfo", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGE("GetAllWaveInfo failed"); } return ret; diff --git a/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp index 12ba4b7..d41584f 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp @@ -53,6 +53,10 @@ int32_t HdiLightConnection::GetLightList(std::vector &lightList) CHKPR(lightInterface_, ERROR); int32_t ret = lightInterface_->GetLightInfo(lightInfos); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "VIBRATOR_HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, + "PKG_NAME", "GetLightList", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGE("Get light info failed"); return ret; } @@ -84,6 +88,10 @@ int32_t HdiLightConnection::TurnOn(int32_t lightId, const LightColor &color, con CHKPR(lightInterface_, ERROR); int32_t ret = lightInterface_->TurnOnLight(lightId, effect); if (ret < 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "VIBRATOR_HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, + "PKG_NAME", "TurnOn", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGE("TurnOn failed"); return ret; } @@ -96,6 +104,10 @@ int32_t HdiLightConnection::TurnOff(int32_t lightId) CHKPR(lightInterface_, ERROR); int32_t ret = lightInterface_->TurnOffLight(lightId); if (ret < 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "VIBRATOR_HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, + "PKG_NAME", "TurnOff", "ERROR_CODE", ret); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGE("TurnOff failed"); return ret; } -- Gitee