!1540 无障碍服务新增行为打点

Merge pull request !1540 from 李浔/master
This commit is contained in:
openharmony_ci 2024-11-19 02:40:44 +00:00 committed by Gitee
commit 4bfe70776f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 93 additions and 1 deletions

View File

@ -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": [

54
hisysevent_ue.yaml Normal file
View File

@ -0,0 +1,54 @@
# 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}
PNAMEID: {type: STRING, desc: package name}
PVERSIONID: {type: STRING, desc: application version}
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}
PNAMEID: {type: STRING, desc: package name}
PVERSIONID: {type: STRING, desc: application version}
MSG_NAME: {type: STRING, desc: on zoom gesture state name}
MSG_VALUE: {type: STRING, desc: on zoom gesture state value}

View File

@ -61,6 +61,8 @@ public:
static void VectorToString(const std::vector<std::string> &vectorVal, std::string &stringOut);
static void StringToVector(const std::string &stringIn, std::vector<std::string> &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);

View File

@ -785,6 +785,7 @@ void AccessibilityZoomGesture::OnZoom(int32_t anchorX, int32_t anchorY)
float y = anchorPointY_ / screenHeight_;
scaleRatio_ = DEFAULT_SCALE;
AccessibilityDisplayManager &displayMgr = Singleton<AccessibilityDisplayManager>::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<AccessibilityDisplayManager>::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");

View File

@ -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

View File

@ -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<std::string> &vectorVal, std::string &stringOut)
{
HILOG_DEBUG();