From b69dcc6f1c2f36adc9733691ed5ecf02e1d61894 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Mon, 26 Sep 2022 14:32:05 +0800 Subject: [PATCH] Modify sensor worning Signed-off-by: h00514358 Change-Id: Ia4bbe977fc6aba8a033ac9d91dc1bbdc79d807ea --- interfaces/plugin/src/sensor_js.cpp | 2 +- services/sensor/src/sensor_service.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index a706638b..7aea5a26 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -70,6 +70,7 @@ static bool copySensorData(sptr callbackInfo, SensorEvent *ev callbackInfo->data.sensorData.sensorTypeId = sensorTypeId; callbackInfo->data.sensorData.dataLength = event->dataLen; callbackInfo->data.sensorData.timestamp = event->timestamp; + CHKPF(event->data); auto data = reinterpret_cast(event->data); if (sensorTypeId == SENSOR_TYPE_ID_WEAR_DETECTION && callbackInfo->type == SUBSCRIBE_CALLBACK) { std::lock_guard onBodyLock(bodyMutex_); @@ -78,7 +79,6 @@ static bool copySensorData(sptr callbackInfo, SensorEvent *ev (fabs(g_bodyState - BODY_STATE_EXCEPT) < THREESHOLD) ? true : false; return true; } - CHKPF(data); if (memcpy_s(callbackInfo->data.sensorData.data, event->dataLen, data, event->dataLen) != EOK) { SEN_HILOGE("Copy data failed"); return false; diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index d9990954..563427c5 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -157,7 +157,6 @@ void SensorService::ReportSensorSysEvent(uint32_t sensorId, bool enable, int32_t sensorManager_.GetPackageName(tokenId, packageName); const int logLevel = 4; int32_t uid = clientInfo_.GetUidByPid(pid); - std::string message; if (enable) { HiSysEvent::Write(HiSysEvent::Domain::SENSOR, "ENABLE_SENSOR", HiSysEvent::EventType::STATISTIC, "LEVEL", logLevel, "UID", uid, "PKG_NAME", packageName, "TYPE", sensorId); -- Gitee