add tread name and risk function and modify so Signed-off-by:mayunteng_1 <mayunteng@huawei.com>

Signed-off-by: mayunteng_1 <mayunteng@huawei.com>
Change-Id: I5852c4c9335d68db47016595ffd973cd306ff171
This commit is contained in:
mayunteng_1 2023-03-23 07:09:23 +00:00
parent f1f5ed8fe4
commit cb3ee4de58
16 changed files with 28 additions and 20 deletions

View File

@ -55,7 +55,7 @@ ohos_shared_library("stationary") {
external_deps = [
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
]

View File

@ -43,7 +43,7 @@ ohos_shared_library("deviceagent") {
external_deps = [
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
]

View File

@ -71,7 +71,7 @@ ohos_shared_library("devicestatus_client") {
"eventhandler:libeventhandler",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"samgr:samgr_proxy",
]

View File

@ -44,7 +44,10 @@ ohos_shared_library("devicestatus_mock") {
public_configs = [ ":devicestatus_srv_public_config" ]
deps = [ "//third_party/cJSON:cjson_static" ]
deps = [
"${device_status_utils_path}:devicestatus_util",
"//third_party/cJSON:cjson_static",
]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
@ -70,6 +73,7 @@ ohos_shared_library("devicestatus_algo") {
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"${device_status_utils_path}:devicestatus_util",
"//commonlibrary/c_utils/base:utils",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//foundation/multimodalinput/input/util:libmmi-util",
@ -81,7 +85,7 @@ ohos_shared_library("devicestatus_algo") {
"ability_base:base",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",

2
libs/src/datahub/sensor_data_callback.cpp Normal file → Executable file
View File

@ -19,6 +19,7 @@
#include <cstdio>
#include "devicestatus_common.h"
#include "util.h"
namespace OHOS {
namespace Msdp {
@ -208,6 +209,7 @@ bool SensorDataCallback::UnregisterCallbackSensor(int32_t sensorTypeId)
void SensorDataCallback::AlgorithmLoop()
{
SetThreadName(std::string("device_status_sensor"));
DEV_HILOGD(SERVICE, "enter");
while (alive_) {
sem_wait(&sem_);

View File

@ -25,6 +25,7 @@
#include "devicestatus_common.h"
#include "devicestatus_define.h"
#include "util.h"
namespace OHOS {
namespace Msdp {
@ -225,6 +226,7 @@ void DeviceStatusMsdpMock::StartThread()
void DeviceStatusMsdpMock::LoopingThreadEntry()
{
SetThreadName("device_status_mock");
if (callbacks_.empty()) {
DEV_HILOGD(SERVICE, "callbacks_ is empty");
return;

View File

@ -62,7 +62,7 @@ ohos_unittest("device_status_algorithm_test") {
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",
@ -98,7 +98,7 @@ ohos_unittest("device_status_datahub_test") {
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",
@ -134,7 +134,7 @@ ohos_unittest("device_status_mock_test") {
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"relational_store:native_rdb",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",

View File

@ -100,7 +100,7 @@ ohos_shared_library("devicestatus_service") {
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"safwk:system_ability_fwk",
]

View File

@ -26,6 +26,7 @@
#include <sys/ioctl.h>
#include <openssl/sha.h>
#include <securec.h>
#include "devicestatus_define.h"
#include "devicestatus_errors.h"
@ -118,8 +119,7 @@ void Device::Dispatch(const struct epoll_event &ev)
void Device::QueryDeviceInfo()
{
CALL_DEBUG_ENTER;
char buffer[PATH_MAX];
memset(buffer, 0, sizeof(buffer));
char buffer[PATH_MAX] = { 0 };
int32_t rc = ioctl(fd_, EVIOCGNAME(sizeof(buffer) - 1), &buffer);
if (rc < 0) {
FI_HILOGE("Could not get device name: %{public}s", strerror(errno));
@ -378,4 +378,4 @@ void Device::LoadDeviceConfig()
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS
} // namespace OHOS

View File

@ -63,7 +63,7 @@ ohos_source_set("coordination") {
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"window_manager:libdm",
]

View File

@ -53,7 +53,7 @@ ohos_shared_library("interaction_drag") {
"hiviewdfx_hilog_native:libhilog",
"init:libbegetutil",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"window_manager:libdm",
"window_manager:libwm",

View File

@ -53,7 +53,7 @@ ohos_moduletest("test_devicestatus_module") {
"common_event_service:cesfwk_innerkits",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",

View File

@ -58,7 +58,7 @@ ohos_unittest("test_devicestatus_service") {
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"relational_store:native_rdb",
"safwk:system_ability_fwk",
@ -84,7 +84,7 @@ ohos_unittest("DeviceStatusAgentTest") {
external_deps = [
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]

View File

@ -22,7 +22,7 @@ deps_ex = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"ipc:ipc_core",
"ipc:ipc_single",
"hiviewdfx_hilog_native:libhilog",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",

2
test/fuzztest/devicestatusclient_fuzzer/BUILD.gn Executable file → Normal file
View File

@ -22,7 +22,7 @@ deps_ex = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"ipc:ipc_core",
"ipc:ipc_single",
"hiviewdfx_hilog_native:libhilog",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",

View File

@ -54,7 +54,7 @@ ohos_systemtest("DeviceStatusClientTest") {
"common_event_service:cesfwk_innerkits",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"multimedia_image_framework:image_native",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",