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 25989ca6998e46bb1062543c2e608e5f0ff543c8..4625e42997250d9e4cd61f4ec464fb27bc24c374 100644 --- a/services/miscdevice_service/src/vibration_priority_manager.cpp +++ b/services/miscdevice_service/src/vibration_priority_manager.cpp @@ -18,6 +18,9 @@ #include #include "accesstoken_kit.h" +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE +#include "hisysevent.h" +#endif // HIVIEWDFX_HISYSEVENT_ENABLE #include "ipc_skeleton.h" #include "iservice_registry.h" #include "system_ability_definition.h" @@ -36,6 +39,7 @@ namespace OHOS { namespace Sensors { +using namespace OHOS::HiviewDFX; namespace { const std::string SETTING_COLUMN_KEYWORD = "KEYWORD"; const std::string SETTING_COLUMN_VALUE = "VALUE"; @@ -78,11 +82,19 @@ bool VibrationPriorityManager::Init() } miscFeedback_ = feedback; MISC_HILOGI("feedback:%{public}d", feedback); +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "SWITCHES_TOGGLE", + HiSysEvent::EventType::BEHAVIOR, "SWITCH_TYPE", "feedback", "STATUS", feedback); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE int32_t ringerMode = miscAudioRingerMode_; if (GetIntValue(SETTING_RINGER_MODE_KEY, ringerMode) != ERR_OK) { MISC_HILOGE("Get ringerMode failed"); } miscAudioRingerMode_ = ringerMode; +#ifdef HIVIEWDFX_HISYSEVENT_ENABLE + HiSysEventWrite(HiSysEvent::Domain::MISCDEVICE, "SWITCHES_TOGGLE", + HiSysEvent::EventType::BEHAVIOR, "SWITCH_TYPE", "ringerMode", "STATUS", ringerMode); +#endif // HIVIEWDFX_HISYSEVENT_ENABLE MISC_HILOGI("ringerMode:%{public}d", ringerMode); }; auto observer_ = CreateObserver(updateFunc);