diff --git a/bundle.json b/bundle.json index dffb12a4..b9f0ba4b 100644 --- a/bundle.json +++ b/bundle.json @@ -28,7 +28,8 @@ "rom": "2000KB", "ram": "10000KB", "hisysevent_config": [ - "//foundation/barrierfree/accessibility/hisysevent.yaml" + "//foundation/barrierfree/accessibility/hisysevent.yaml", + "//foundation/barrierfree/accessibility/hisysevent_ue.yaml" ], "deps": { "components": [ diff --git a/hisysevent_ue.yaml b/hisysevent_ue.yaml new file mode 100644 index 00000000..010718c9 --- /dev/null +++ b/hisysevent_ue.yaml @@ -0,0 +1,50 @@ +# Copyright (c) 2024 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################################### +# below is the format of defining event # +##################################################### +#domain: domain name. [Only one domain name can be defined at the top] +# +#author: the author name who defined this event. +#date: the date when this event was defined, format is YYYY-MM-DD. +#logged: source file which refer to this event. +#usage: the usage of this event. +#//Define event name and event properties. +#@EVENT_NAME: the event definition part begin. +# // __BASE is used for defining the basic info of the event. +# // "type" optional values are: FAULT, STATISTICS, SECURITY, BEHAVIOR. +# // "level" optional values are: CRITICAL, MINOR. +# // "tag" set tags with may used by subscriber of this event, multiple tags divided by space. +# // "desc" full description of this event. +# @PARAMETER: {type: parameter type, arrsize: array length(optional), desc: parameter description}. +# // follow the __BASE block, each line defines a parameter of this event. +# // "type" optional values are: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, STRING. +# // "arrsize" of the parameter is an array, set a non-zero value. +# // "desc" full description of this parameter. + +##################################################### +# Example of some hiviewdfx events definition # +##################################################### + +domain: ACCESSIBILITY_UE + +ENABLE_SHORTKEY_ABILITY_SINGLE: + __BASE: {type: BEHAVIOR, level: CRITICAL, desc: enable single ability targets} + MSG_NAME: {type: STRING, desc: enable single targets name} + MSG_VALUE: {type: STRING, desc: enable single targets value} + +ZOOM_GESTURE_ACTION: + __BASE: {type: BEHAVIOR, level: CRITICAL, desc: on zoom gesture state} + MSG_NAME: {type: STRING, desc: on zoom gesture state name} + MSG_VALUE: {type: STRING, desc: on zoom gesture state value} \ No newline at end of file diff --git a/services/aams/include/utils.h b/services/aams/include/utils.h index b8fb777d..4594f689 100644 --- a/services/aams/include/utils.h +++ b/services/aams/include/utils.h @@ -61,6 +61,8 @@ public: static void VectorToString(const std::vector &vectorVal, std::string &stringOut); static void StringToVector(const std::string &stringIn, std::vector &vectorResult); static int32_t GetUserIdByCallingUid(); + static void RecordEnableShortkeyAbilityEvent(const std::string &name); + static void RecordOnZoomGestureEvent(const std::string &state); private: static std::string TransferUnavailableEventToString(A11yUnavailableEvent type); diff --git a/services/aams/src/accessibility_zoom_gesture.cpp b/services/aams/src/accessibility_zoom_gesture.cpp index 03eb4c78..f192fefd 100755 --- a/services/aams/src/accessibility_zoom_gesture.cpp +++ b/services/aams/src/accessibility_zoom_gesture.cpp @@ -785,6 +785,7 @@ void AccessibilityZoomGesture::OnZoom(int32_t anchorX, int32_t anchorY) float y = anchorPointY_ / screenHeight_; scaleRatio_ = DEFAULT_SCALE; AccessibilityDisplayManager &displayMgr = Singleton::GetInstance(); + Utils::RecordOnZoomGestureEvent("on"); displayMgr.SetDisplayScale(screenId_, scaleRatio_, scaleRatio_, x, y); #else HILOG_INFO("not support zoom"); @@ -798,6 +799,7 @@ void AccessibilityZoomGesture::OffZoom() #ifdef OHOS_BUILD_ENABLE_DISPLAY_MANAGER AccessibilityDisplayManager &displayMgr = Singleton::GetInstance(); uint64_t currentScreen = displayMgr.GetDefaultDisplayId(); + Utils::RecordOnZoomGestureEvent("off"); displayMgr.SetDisplayScale(currentScreen, NORMAL_SCALE, NORMAL_SCALE, DEFAULT_ANCHOR, DEFAULT_ANCHOR); #else HILOG_INFO("not support zoom"); diff --git a/services/aams/src/accessible_ability_manager_service.cpp b/services/aams/src/accessible_ability_manager_service.cpp index 6a79887a..e69ccdd8 100644 --- a/services/aams/src/accessible_ability_manager_service.cpp +++ b/services/aams/src/accessible_ability_manager_service.cpp @@ -2468,6 +2468,7 @@ void AccessibleAbilityManagerService::OnShortKeyProcess() if (shortkeyMultiTarget.size() == 0) { EnableShortKeyTargetAbility(); } else if (shortkeyMultiTarget.size() == 1) { + Utils::RecordEnableShortkeyAbilityEvent(shortkeyMultiTarget[0]); EnableShortKeyTargetAbility(shortkeyMultiTarget[0]); } else { // dialog diff --git a/services/aams/src/utils.cpp b/services/aams/src/utils.cpp index 5cf99e65..8bdfa456 100644 --- a/services/aams/src/utils.cpp +++ b/services/aams/src/utils.cpp @@ -365,6 +365,38 @@ void Utils::RecordStartingA11yEvent(const std::string &name) #endif //OHOS_BUILD_ENABLE_HISYSEVENT } +void Utils::RecordEnableShortkeyAbilityEvent(const std::string &name) +{ + std::string MSG_NAME = "enable single targets"; + HILOG_DEBUG("starting RecordEnableShortkeyAbilityEvent enable single targets: %{public}s", name.c_str()); +#ifdef OHOS_BUILD_ENABLE_HISYSEVENT + int32_t ret = HiSysEventWrite( + OHOS::HiviewDFX::HiSysEvent::Domain::ACCESSIBILITY_UE, + "ENABLE_SHORTKEY_ABILITY_SINGLE", + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, + "MSG_NAME", MSG_NAME, "MSG_VALUE", name); + if (ret != 0) { + HILOG_ERROR("Write HiSysEvent RecordEnableShortkeyAbilityEvent error, ret:%{public}d", ret); + } +#endif //OHOS_BUILD_ENABLE_HISYSEVENT +} + +void Utils::RecordOnZoomGestureEvent(const std::string &state) +{ + std::string MSG_NAME = "on zoom gesture state"; + HILOG_DEBUG("starting RecordOnZoomGestureEvent on zoom gesture state: %{public}s", state.c_str()); +#ifdef OHOS_BUILD_ENABLE_HISYSEVENT + int32_t ret = HiSysEventWrite( + OHOS::HiviewDFX::HiSysEvent::Domain::ACCESSIBILITY_UE, + "ZOOM_GESTURE_ACTION", + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, + "MSG_NAME", MSG_NAME, "MSG_VALUE", state); + if (ret != 0) { + HILOG_ERROR("Write HiSysEvent RecordOnZoomGestureEvent error, ret:%{public}d", ret); + } +#endif //OHOS_BUILD_ENABLE_HISYSEVENT +} + void Utils::VectorToString(const std::vector &vectorVal, std::string &stringOut) { HILOG_DEBUG();