From b819cbb17d6b03b50301a90fc87e56b2142244d9 Mon Sep 17 00:00:00 2001 From: l30011477 Date: Mon, 18 Nov 2024 14:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E9=9A=9C=E7=A2=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=89=93=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30011477 --- bundle.json | 3 +- hisysevent_ue.yaml | 50 +++++++++++++++++++ services/aams/include/utils.h | 2 + .../aams/src/accessibility_zoom_gesture.cpp | 2 + .../accessible_ability_manager_service.cpp | 1 + services/aams/src/utils.cpp | 32 ++++++++++++ 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 hisysevent_ue.yaml 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();