From bfeb1b814a684cd76063895f63a38fae09c1123b Mon Sep 17 00:00:00 2001 From: SUE Date: Wed, 23 Feb 2022 07:22:50 +0000 Subject: [PATCH 1/3] Signed-off-by:hellohyh001 --- utils/src/permission_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/src/permission_util.cpp b/utils/src/permission_util.cpp index 92a4bd45..3bdf81c6 100644 --- a/utils/src/permission_util.cpp +++ b/utils/src/permission_util.cpp @@ -50,7 +50,7 @@ bool PermissionUtil::CheckSensorPermission(AccessTokenID callerToken, int32_t se } std::string permissionName = sensorPermissions_[sensorTypeId]; int32_t result = AccessTokenKit::VerifyAccessToken(callerToken, permissionName); - if (result == PERMISSION_GRANTED) { + if (result != PERMISSION_GRANTED) { HiLog::Error(LABEL, "%{public}s sensorId: %{public}d grant failed, result: %{public}d", __func__, sensorTypeId, result); return false; -- Gitee From 142dcc5fd281b4b31afbc7e963404880f39d1287 Mon Sep 17 00:00:00 2001 From: SUE Date: Wed, 23 Feb 2022 07:29:08 +0000 Subject: [PATCH 2/3] Signed-off-by:hellohyh001 --- utils/include/permission_util.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils/include/permission_util.h b/utils/include/permission_util.h index 4a5721a2..a68658c6 100644 --- a/utils/include/permission_util.h +++ b/utils/include/permission_util.h @@ -16,11 +16,9 @@ #ifndef PERMISSION_UTIL_H #define PERMISSION_UTIL_H -#include #include #include #include "accesstoken_kit.h" -#include "refbase.h" #include "singleton.h" namespace OHOS { -- Gitee From 019aecec1109bd95270a97837d44d2dd9c52ec2c Mon Sep 17 00:00:00 2001 From: SUE Date: Wed, 23 Feb 2022 12:46:10 +0000 Subject: [PATCH 3/3] Signed-off-by:hellohyh001 --- frameworks/native/sensor/src/sensor_agent_proxy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/sensor/src/sensor_agent_proxy.cpp b/frameworks/native/sensor/src/sensor_agent_proxy.cpp index ce29e2f1..db6c8625 100755 --- a/frameworks/native/sensor/src/sensor_agent_proxy.cpp +++ b/frameworks/native/sensor/src/sensor_agent_proxy.cpp @@ -343,8 +343,8 @@ int32_t SensorAgentProxy::GetAllSensors(SensorInfo **sensorInfo, int32_t *count) HiLog::Error(LABEL, "%{public}s strcpy vendorName failed", __func__); return OHOS::Sensors::ERROR; } - const char *version = std::to_string(sensorList_[index].GetVersion()).c_str(); - ret = strcpy_s((*sensorInfo + index)->hardwareVersion, VERSION_MAX_LEN, version); + std::string version = std::to_string(sensorList_[index].GetVersion()); + ret = strcpy_s((*sensorInfo + index)->hardwareVersion, VERSION_MAX_LEN, version.c_str()); if (ret != EOK) { HiLog::Error(LABEL, "%{public}s strcpy hardwareVersion failed", __func__); return OHOS::Sensors::ERROR; -- Gitee