diff --git a/frameworks/capi/BUILD.gn b/frameworks/capi/BUILD.gn index dcb005b7cd366332e5892efd55e70eb2f693437f..3aa365bc34ac4704e87a2b6f4c28f9b9824b42b9 100644 --- a/frameworks/capi/BUILD.gn +++ b/frameworks/capi/BUILD.gn @@ -35,6 +35,7 @@ ohos_shared_library("ohvibrator") { external_deps = [ "hilog:libhilog" ] + cflags_cc = [ "-fstack-protector-strong" ] relative_install_dir = "ndk" part_name = "miscdevice" subsystem_name = "sensors" diff --git a/hisysevent.yaml b/hisysevent.yaml index 0ecb9ecbf9ee898c1241614b8d6c30851fd9a1c8..9e631304658b6d9f7dd4badd3d85a47d7ec02e11 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -36,4 +36,9 @@ VIBRATOR_HDF_SERVICE_EXCEPTION: MISC_SERVICE_EXCEPTION: __BASE: {type: FAULT, level: MINOR, desc: sensor service exception} PKG_NAME: {type: STRING, desc: package name} - ERROR_CODE: {type: INT32, desc: error code} \ No newline at end of file + ERROR_CODE: {type: INT32, desc: error code} + +SWITCHES_TOGGLE: + __BASE: {type: BEHAVIOR, level: CRITICAL, desc: Switching, preserve: true} + SWITCH_TYPE: {type: STRING, desc: Switch Type} + STATUS: {type: INT32, desc: Switch status} \ No newline at end of file diff --git a/services/miscdevice_service/src/vibration_priority_manager.cpp b/services/miscdevice_service/src/vibration_priority_manager.cpp index 5aa98dba114ea13a27d3da66c7d9ef3ecbaf34ab..c3914fd6b6686854626976efef8bc005bc91351f 100644 --- a/services/miscdevice_service/src/vibration_priority_manager.cpp +++ b/services/miscdevice_service/src/vibration_priority_manager.cpp @@ -19,6 +19,7 @@ #include "accesstoken_kit.h" #include "bundle_mgr_client.h" +#include "hisysevent.h" #include "ipc_skeleton.h" #include "iservice_registry.h" #include "os_account_manager.h" @@ -33,6 +34,7 @@ namespace OHOS { namespace Sensors { +using namespace OHOS::HiviewDFX; namespace { const std::string SETTING_COLUMN_KEYWORD = "KEYWORD"; const std::string SETTING_COLUMN_VALUE = "VALUE"; @@ -74,12 +76,16 @@ bool VibrationPriorityManager::Init() MISC_HILOGE("Get feedback failed"); } miscFeedback_ = feedback; + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "SWITCHES_TOGGLE", + HiSysEvent::EventType::BEHAVIOR, "SWITCH_TYPE", "feedback", "STATUS", feedback); MISC_HILOGI("feedback:%{public}d", feedback); int32_t ringerMode = miscAudioRingerMode_; if (GetIntValue(SETTING_RINGER_MODE_KEY, ringerMode) != ERR_OK) { MISC_HILOGE("Get ringerMode failed"); } miscAudioRingerMode_ = ringerMode; + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "SWITCHES_TOGGLE", + HiSysEvent::EventType::BEHAVIOR, "SWITCH_TYPE", "ringerMode", "STATUS", ringerMode); MISC_HILOGI("ringerMode:%{public}d", ringerMode); }; auto observer_ = CreateObserver(updateFunc);