From d1ddd8c29e150db8cd18c72bf3630f183509fd37 Mon Sep 17 00:00:00 2001 From: tu-xinxin Date: Tue, 20 Aug 2024 20:10:53 +0800 Subject: [PATCH 1/9] =?UTF-8?q?hisysevent=E9=83=A8=E4=BB=B6=E8=A7=A3?= =?UTF-8?q?=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tu-xinxin --- frameworks/native/BUILD.gn | 5 ++++- .../native/src/sensor_service_client.cpp | 4 ++++ .../native/src/sensor_service_proxy.cpp | 22 +++++++++++++++++++ sensor.gni | 8 +++++++ services/BUILD.gn | 10 +++++++-- .../adapter/src/hdi_connection.cpp | 18 +++++++++++++++ services/src/sensor_data_processer.cpp | 2 ++ services/src/sensor_service.cpp | 8 +++++++ services/src/sensor_service_stub.cpp | 6 +++++ utils/common/BUILD.gn | 5 ++++- .../common/src/sensor_basic_data_channel.cpp | 4 ++++ 11 files changed, 88 insertions(+), 4 deletions(-) diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index f7222ca6..1a496e58 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -56,12 +56,15 @@ ohos_shared_library("libsensor_client") { "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", - "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_single", "samgr:samgr_proxy", ] + if (hiviewdfx_hisysevent_enable) { + external_deps += [ "hisysevent:libhisysevent" ] + } + innerapi_tags = [ "platformsdk_indirect" ] part_name = "sensor" subsystem_name = "sensors" diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index 7d6ceeec..1f732e46 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -21,7 +21,9 @@ #include #include "death_recipient_template.h" +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "hitrace_meter.h" #include "ipc_skeleton.h" #include "sensor_errors.h" @@ -96,8 +98,10 @@ int32_t SensorServiceClient::InitServiceClient() std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_MS)); retry++; } +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "InitServiceClient", "ERROR_CODE", SENSOR_NATIVE_GET_SERVICE_ERR); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Get service failed"); return SENSOR_NATIVE_GET_SERVICE_ERR; } diff --git a/frameworks/native/src/sensor_service_proxy.cpp b/frameworks/native/src/sensor_service_proxy.cpp index 18790f4a..a69bf8d6 100644 --- a/frameworks/native/src/sensor_service_proxy.cpp +++ b/frameworks/native/src/sensor_service_proxy.cpp @@ -17,7 +17,9 @@ #include +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "message_parcel.h" #include "sensor_client_proxy.h" #include "sensor_errors.h" @@ -50,8 +52,10 @@ ErrCode SensorServiceProxy::EnableSensor(int32_t sensorId, int64_t samplingPerio int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::ENABLE_SENSOR), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableSensor", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -72,8 +76,10 @@ ErrCode SensorServiceProxy::DisableSensor(int32_t sensorId) int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::DISABLE_SENSOR), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableSensor", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -97,8 +103,10 @@ std::vector SensorServiceProxy::GetSensorList() int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::GET_SENSOR_LIST), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "GetSensorList", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); return sensors; } @@ -139,8 +147,10 @@ ErrCode SensorServiceProxy::TransferDataChannel(const sptrSendRequest(static_cast(SensorInterfaceCode::TRANSFER_DATA_CHANNEL), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "TransferDataChannel", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } sensorBasicDataChannel->CloseSendFd(); @@ -163,8 +173,10 @@ ErrCode SensorServiceProxy::DestroySensorChannel(sptr sensorClien int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::DESTROY_SENSOR_CHANNEL), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DestroySensorChannel", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -259,8 +271,10 @@ ErrCode SensorServiceProxy::CreateSocketChannel(sptr sensorClient int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::CREATE_SOCKET_CHANNEL), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "CreateSocketChannel", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); return ERROR; } @@ -288,8 +302,10 @@ ErrCode SensorServiceProxy::DestroySocketChannel(sptr sensorClien int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::DESTROY_SOCKET_CHANNEL), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DestroySocketChannel", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -309,8 +325,10 @@ ErrCode SensorServiceProxy::EnableActiveInfoCB() int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::ENABLE_ACTIVE_INFO_CB), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableActiveInfoCB", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -330,8 +348,10 @@ ErrCode SensorServiceProxy::DisableActiveInfoCB() int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::DISABLE_ACTIVE_INFO_CB), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableActiveInfoCB", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -351,8 +371,10 @@ ErrCode SensorServiceProxy::ResetSensors() int32_t ret = remote->SendRequest(static_cast(SensorInterfaceCode::RESET_SENSORS), data, reply, option); if (ret != NO_ERROR) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "ResetSensors", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); diff --git a/sensor.gni b/sensor.gni index 4306a824..29a2d8af 100644 --- a/sensor.gni +++ b/sensor.gni @@ -15,6 +15,7 @@ import("//build/ohos.gni") declare_args() { rust_socket_ipc = false + hiviewdfx_hisysevent_enable = true } SUBSYSTEM_DIR = "//base/sensors/sensor" @@ -48,3 +49,10 @@ if (build_variant == "root") { } else { sensor_build_eng = false } +if (!defined(global_parts_info) || + defined(global_parts_info.hiviewdfx_hisysevent)) { + hiviewdfx_hisysevent_enable = true + sensor_default_defines += [ "HIVIEWDFX_HISYSEVENT_ENABLE" ] +} else { + hiviewdfx_hisysevent_enable = false +} diff --git a/services/BUILD.gn b/services/BUILD.gn index f8b346c3..1d51f42b 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -59,7 +59,6 @@ ohos_shared_library("libsensor_service") { "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", - "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_single", "safwk:system_ability_fwk", @@ -69,6 +68,10 @@ ohos_shared_library("libsensor_service") { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } + + if (hiviewdfx_hisysevent_enable) { + external_deps += [ "hisysevent:libhisysevent" ] + } if (hdf_drivers_interface_sensor) { sources += [ @@ -147,7 +150,6 @@ ohos_static_library("libsensor_service_static") { "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", - "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_single", "safwk:system_ability_fwk", @@ -157,6 +159,10 @@ ohos_static_library("libsensor_service_static") { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } + + if (hiviewdfx_hisysevent_enable) { + external_deps += [ "hisysevent:libhisysevent" ] + } if (hdf_drivers_interface_sensor) { sources += [ diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index 977697dd..e0609517 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -18,7 +18,9 @@ #include #include +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "iproxy_broker.h" #include "v2_0/isensor_interface.h" @@ -65,8 +67,10 @@ int32_t HdiConnection::ConnectHdi() SEN_HILOGW("Connect hdi service failed, retry:%{public}d", retry); std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_MS)); } +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "ConnectHdi", "ERROR_CODE", CONNECT_SENSOR_HDF_ERR); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Connect V2_0 hdi failed"); return ERR_NO_INIT; } @@ -78,8 +82,10 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) std::vector sensorInfos; int32_t ret = g_sensorInterface->GetAllSensorInfo(sensorInfos); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "GetSensorList", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Get sensor list failed"); return ret; } @@ -114,8 +120,10 @@ int32_t HdiConnection::EnableSensor(int32_t sensorId) CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->Enable(sensorId); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableSensor", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Connect V2_0 hdi failed"); return ret; } @@ -128,8 +136,10 @@ int32_t HdiConnection::DisableSensor(int32_t sensorId) CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->Disable(sensorId); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableSensor", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Disable is failed"); return ret; } @@ -142,8 +152,10 @@ int32_t HdiConnection::SetBatch(int32_t sensorId, int64_t samplingInterval, int6 CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->SetBatch(sensorId, samplingInterval, reportInterval); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "SetBatch", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("SetBatch is failed"); return ret; } @@ -157,8 +169,10 @@ int32_t HdiConnection::SetMode(int32_t sensorId, int32_t mode) CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->SetMode(sensorId, mode); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "SetMode", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("SetMode is failed"); return ret; } @@ -172,8 +186,10 @@ int32_t HdiConnection::RegisterDataReport(ReportDataCb cb, sptrRegister(0, g_eventCallback); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "RegisterDataReport", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Register is failed"); return ret; } @@ -188,8 +204,10 @@ int32_t HdiConnection::DestroyHdiConnection() CHKPR(g_sensorInterface, ERR_NO_INIT); int32_t ret = g_sensorInterface->Unregister(0, g_eventCallback); if (ret != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DestroyHdiConnection", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Unregister is failed"); return ret; } diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index 86b6f58f..c35e57c6 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -20,7 +20,9 @@ #include #include +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "permission_util.h" #include "securec.h" #include "sensor_basic_data_channel.h" diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index eef9a2f3..623b10e6 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -20,7 +20,9 @@ #include #include +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "iservice_registry.h" #ifdef MEMMGR_ENABLE #include "mem_mgr_client.h" @@ -184,15 +186,21 @@ void SensorService::ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t std::string packageName(""); AccessTokenID tokenId = clientInfo_.GetTokenIdByPid(pid); sensorManager_.GetPackageName(tokenId, packageName); +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE const int logLevel = 4; int32_t uid = clientInfo_.GetUidByPid(pid); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE if (enable) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "ENABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGI("PackageName:%{public}s open the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); } else { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "DISABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGI("PackageName:%{public}s close the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); } } diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 8d07287a..44155399 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -22,7 +22,9 @@ #include #include "accesstoken_kit.h" +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "ipc_skeleton.h" #include "message_parcel.h" #include "permission_util.h" @@ -136,8 +138,10 @@ ErrCode SensorServiceStub::SensorEnableInner(MessageParcel &data, MessageParcel PermissionUtil &permissionUtil = PermissionUtil::GetInstance(); int32_t ret = permissionUtil.CheckSensorPermission(GetCallingTokenID(), sensorId); if (ret != PERMISSION_GRANTED) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "VERIFY_ACCESS_TOKEN_FAIL", HiSysEvent::EventType::SECURITY, "PKG_NAME", "SensorEnableInner", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("sensorId:%{public}d grant failed, result:%{public}d", sensorId, ret); return PERMISSION_DENIED; } @@ -160,8 +164,10 @@ ErrCode SensorServiceStub::SensorDisableInner(MessageParcel &data, MessageParcel PermissionUtil &permissionUtil = PermissionUtil::GetInstance(); int32_t ret = permissionUtil.CheckSensorPermission(GetCallingTokenID(), sensorId); if (ret != PERMISSION_GRANTED) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "VERIFY_ACCESS_TOKEN_FAIL", HiSysEvent::EventType::SECURITY, "PKG_NAME", "SensorDisableInner", "ERROR_CODE", ret); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("sensorId:%{public}d grant failed, result:%{public}d", sensorId, ret); return PERMISSION_DENIED; } diff --git a/utils/common/BUILD.gn b/utils/common/BUILD.gn index 48bce26e..0411e3a7 100644 --- a/utils/common/BUILD.gn +++ b/utils/common/BUILD.gn @@ -43,9 +43,12 @@ ohos_shared_library("libsensor_utils") { "access_token:libprivacy_sdk", "c_utils:utils", "hilog:libhilog", - "hisysevent:libhisysevent", "ipc:ipc_single", ] + + if (hiviewdfx_hisysevent_enable) { + external_deps += [ "hisysevent:libhisysevent" ] + } innerapi_tags = [ "platformsdk_indirect" ] part_name = "sensor" diff --git a/utils/common/src/sensor_basic_data_channel.cpp b/utils/common/src/sensor_basic_data_channel.cpp index 39c435ad..de2a2f16 100644 --- a/utils/common/src/sensor_basic_data_channel.cpp +++ b/utils/common/src/sensor_basic_data_channel.cpp @@ -19,7 +19,9 @@ #include #include +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" +#endif //HIVIEWDFX_HISYSEVENT_ENABLE #include "sensor_errors.h" #undef LOG_TAG @@ -49,8 +51,10 @@ int32_t SensorBasicDataChannel::CreateSensorBasicChannel() int32_t socketPair[SOCKET_PAIR_SIZE] = { 0 }; if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, socketPair) != 0) { +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "DATA_CHANNEL_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "CreateSensorBasicChannel", "ERROR_CODE", errno); +#endif //HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Create socketpair failed"); sendFd_ = -1; receiveFd_ = -1; -- Gitee From 33fd02e7e5a8d995d9969dadd39928dc4ff49816 Mon Sep 17 00:00:00 2001 From: tu-xinxin Date: Tue, 20 Aug 2024 20:13:49 +0800 Subject: [PATCH 2/9] =?UTF-8?q?hisysevent=E9=83=A8=E4=BB=B6=E8=A7=A3?= =?UTF-8?q?=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tu-xinxin --- .../native/src/sensor_service_client.cpp | 4 ++-- .../native/src/sensor_service_proxy.cpp | 22 +++++++++---------- .../adapter/src/hdi_connection.cpp | 18 +++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index 1f732e46..4afdbe6c 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -23,7 +23,7 @@ #include "death_recipient_template.h" #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "hitrace_meter.h" #include "ipc_skeleton.h" #include "sensor_errors.h" @@ -101,7 +101,7 @@ int32_t SensorServiceClient::InitServiceClient() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "InitServiceClient", "ERROR_CODE", SENSOR_NATIVE_GET_SERVICE_ERR); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Get service failed"); return SENSOR_NATIVE_GET_SERVICE_ERR; } diff --git a/frameworks/native/src/sensor_service_proxy.cpp b/frameworks/native/src/sensor_service_proxy.cpp index a69bf8d6..ea93b680 100644 --- a/frameworks/native/src/sensor_service_proxy.cpp +++ b/frameworks/native/src/sensor_service_proxy.cpp @@ -19,7 +19,7 @@ #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "message_parcel.h" #include "sensor_client_proxy.h" #include "sensor_errors.h" @@ -55,7 +55,7 @@ ErrCode SensorServiceProxy::EnableSensor(int32_t sensorId, int64_t samplingPerio #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableSensor", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -79,7 +79,7 @@ ErrCode SensorServiceProxy::DisableSensor(int32_t sensorId) #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableSensor", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -106,7 +106,7 @@ std::vector SensorServiceProxy::GetSensorList() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "GetSensorList", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); return sensors; } @@ -150,7 +150,7 @@ ErrCode SensorServiceProxy::TransferDataChannel(const sptrCloseSendFd(); @@ -176,7 +176,7 @@ ErrCode SensorServiceProxy::DestroySensorChannel(sptr sensorClien #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DestroySensorChannel", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -274,7 +274,7 @@ ErrCode SensorServiceProxy::CreateSocketChannel(sptr sensorClient #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "CreateSocketChannel", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); return ERROR; } @@ -305,7 +305,7 @@ ErrCode SensorServiceProxy::DestroySocketChannel(sptr sensorClien #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DestroySocketChannel", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -328,7 +328,7 @@ ErrCode SensorServiceProxy::EnableActiveInfoCB() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableActiveInfoCB", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -351,7 +351,7 @@ ErrCode SensorServiceProxy::DisableActiveInfoCB() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableActiveInfoCB", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); @@ -374,7 +374,7 @@ ErrCode SensorServiceProxy::ResetSensors() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "SERVICE_IPC_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "ResetSensors", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Failed, ret:%{public}d", ret); } return static_cast(ret); diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index e0609517..5cd089ab 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -20,7 +20,7 @@ #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "iproxy_broker.h" #include "v2_0/isensor_interface.h" @@ -70,7 +70,7 @@ int32_t HdiConnection::ConnectHdi() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "ConnectHdi", "ERROR_CODE", CONNECT_SENSOR_HDF_ERR); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Connect V2_0 hdi failed"); return ERR_NO_INIT; } @@ -85,7 +85,7 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "GetSensorList", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Get sensor list failed"); return ret; } @@ -123,7 +123,7 @@ int32_t HdiConnection::EnableSensor(int32_t sensorId) #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableSensor", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Connect V2_0 hdi failed"); return ret; } @@ -139,7 +139,7 @@ int32_t HdiConnection::DisableSensor(int32_t sensorId) #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "DisableSensor", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Disable is failed"); return ret; } @@ -155,7 +155,7 @@ int32_t HdiConnection::SetBatch(int32_t sensorId, int64_t samplingInterval, int6 #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "SetBatch", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("SetBatch is failed"); return ret; } @@ -172,7 +172,7 @@ int32_t HdiConnection::SetMode(int32_t sensorId, int32_t mode) #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "HDF_SERVICE_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "SetMode", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("SetMode is failed"); return ret; } @@ -189,7 +189,7 @@ int32_t HdiConnection::RegisterDataReport(ReportDataCb cb, sptr Date: Wed, 21 Aug 2024 02:39:56 +0000 Subject: [PATCH 3/9] update services/BUILD.gn. format check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- services/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/BUILD.gn b/services/BUILD.gn index 1d51f42b..235b2bfe 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -68,7 +68,7 @@ ohos_shared_library("libsensor_service") { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } - + if (hiviewdfx_hisysevent_enable) { external_deps += [ "hisysevent:libhisysevent" ] } @@ -159,7 +159,7 @@ ohos_static_library("libsensor_service_static") { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } - + if (hiviewdfx_hisysevent_enable) { external_deps += [ "hisysevent:libhisysevent" ] } -- Gitee From 862157b0eb66d9241a37cef7b77c58ebdb4a7329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 03:23:09 +0000 Subject: [PATCH 4/9] update utils/common/BUILD.gn. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- utils/common/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/common/BUILD.gn b/utils/common/BUILD.gn index 0411e3a7..64bb49c0 100644 --- a/utils/common/BUILD.gn +++ b/utils/common/BUILD.gn @@ -45,7 +45,7 @@ ohos_shared_library("libsensor_utils") { "hilog:libhilog", "ipc:ipc_single", ] - + if (hiviewdfx_hisysevent_enable) { external_deps += [ "hisysevent:libhisysevent" ] } -- Gitee From bd8a77d051d77b768e5e9da2f6f1055f1bf151c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 06:39:34 +0000 Subject: [PATCH 5/9] update services/src/sensor_data_processer.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- services/src/sensor_data_processer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index c35e57c6..8daa1907 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -22,7 +22,7 @@ #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "permission_util.h" #include "securec.h" #include "sensor_basic_data_channel.h" -- Gitee From 314995b0082053e2ceec74f5fe55c85582e3f58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 06:40:44 +0000 Subject: [PATCH 6/9] update services/src/sensor_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- services/src/sensor_service.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index 623b10e6..03c04e88 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -22,7 +22,7 @@ #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "iservice_registry.h" #ifdef MEMMGR_ENABLE #include "mem_mgr_client.h" @@ -189,18 +189,18 @@ void SensorService::ReportSensorSysEvent(int32_t sensorId, bool enable, int32_t #ifdef HIVIEWDFX_HISYSEVENT_ENABLE const int logLevel = 4; int32_t uid = clientInfo_.GetUidByPid(pid); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE if (enable) { #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "ENABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGI("PackageName:%{public}s open the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); } else { #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "DISABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGI("PackageName:%{public}s close the sensor, sensorId:%{public}d", packageName.c_str(), sensorId); } } -- Gitee From e83ab54501da076e2e41fd45d50c8d09a09f7e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 06:41:51 +0000 Subject: [PATCH 7/9] update services/src/sensor_service_stub.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- services/src/sensor_service_stub.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 44155399..3d08b091 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -24,7 +24,7 @@ #include "accesstoken_kit.h" #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "ipc_skeleton.h" #include "message_parcel.h" #include "permission_util.h" @@ -141,7 +141,7 @@ ErrCode SensorServiceStub::SensorEnableInner(MessageParcel &data, MessageParcel #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "VERIFY_ACCESS_TOKEN_FAIL", HiSysEvent::EventType::SECURITY, "PKG_NAME", "SensorEnableInner", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("sensorId:%{public}d grant failed, result:%{public}d", sensorId, ret); return PERMISSION_DENIED; } @@ -167,7 +167,7 @@ ErrCode SensorServiceStub::SensorDisableInner(MessageParcel &data, MessageParcel #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiSysEvent::Domain::SENSOR, "VERIFY_ACCESS_TOKEN_FAIL", HiSysEvent::EventType::SECURITY, "PKG_NAME", "SensorDisableInner", "ERROR_CODE", ret); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("sensorId:%{public}d grant failed, result:%{public}d", sensorId, ret); return PERMISSION_DENIED; } -- Gitee From 82a938a1b85ede0c2d7ccf60607c74e3bbf4d3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 06:42:35 +0000 Subject: [PATCH 8/9] update utils/common/src/sensor_basic_data_channel.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- utils/common/src/sensor_basic_data_channel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/common/src/sensor_basic_data_channel.cpp b/utils/common/src/sensor_basic_data_channel.cpp index de2a2f16..1851b6c6 100644 --- a/utils/common/src/sensor_basic_data_channel.cpp +++ b/utils/common/src/sensor_basic_data_channel.cpp @@ -21,7 +21,7 @@ #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "sensor_errors.h" #undef LOG_TAG @@ -54,7 +54,7 @@ int32_t SensorBasicDataChannel::CreateSensorBasicChannel() #ifdef HIVIEWDFX_HISYSEVENT_ENABLE HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SENSOR, "DATA_CHANNEL_EXCEPTION", HiSysEvent::EventType::FAULT, "PKG_NAME", "CreateSensorBasicChannel", "ERROR_CODE", errno); -#endif //HIVIEWDFX_HISYSEVENT_ENABLE +#endif // HIVIEWDFX_HISYSEVENT_ENABLE SEN_HILOGE("Create socketpair failed"); sendFd_ = -1; receiveFd_ = -1; -- Gitee From 5497150467be38e4b08afff315dace9ca10bdcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82xx?= Date: Wed, 21 Aug 2024 06:43:08 +0000 Subject: [PATCH 9/9] update sensor.gni. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 涂xx --- sensor.gni | 1 + 1 file changed, 1 insertion(+) diff --git a/sensor.gni b/sensor.gni index 29a2d8af..674b98ea 100644 --- a/sensor.gni +++ b/sensor.gni @@ -49,6 +49,7 @@ if (build_variant == "root") { } else { sensor_build_eng = false } + if (!defined(global_parts_info) || defined(global_parts_info.hiviewdfx_hisysevent)) { hiviewdfx_hisysevent_enable = true -- Gitee