• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 
16 #ifndef FOUNDATION_ACE_ADAPTER_OHOS_OSAL_ACCESSIBILITY_ACCESSIBILITY_HIDUMPER_OSAL_H
17 #define FOUNDATION_ACE_ADAPTER_OHOS_OSAL_ACCESSIBILITY_ACCESSIBILITY_HIDUMPER_OSAL_H
18 
19 #include <string>
20 #include "accessibility_element_info.h"
21 
22 #include "core/accessibility/accessibility_utils.h"
23 
24 namespace OHOS::Accessibility {
25     class AccessibilityElementInfo;
26 }
27 
28 namespace OHOS::Ace::Framework {
29 struct ActionTable {
30     AceAction aceAction;
31     Accessibility::ActionType action;
32 };
33 
34 using ToInfoFunc = std::function<void(std::string& input)>;
35 
36 struct ActionStrTable {
37     Accessibility::ActionType action;
38     std::string actionStr;
39 };
40 
41 enum class ToInfoMode {
42     TO_STRING,
43     DUMPLOG_ADD,
44 };
45 
46 class AccessibilityElementInfoUtils {
47 public:
48     AccessibilityElementInfoUtils() = default;
49     ~AccessibilityElementInfoUtils() = default;
50 
51     static void ToKeyInfo(
52         const Accessibility::AccessibilityElementInfo& accessibilityElementInfo,
53         int32_t treeId);
54     static void ToCommonInfo(
55         const Accessibility::AccessibilityElementInfo& accessibilityElementInfo,
56         int32_t treeId);
57     static void ToDetailInfo(
58         const Accessibility::AccessibilityElementInfo& accessibilityElementInfo,
59         int32_t treeId);
60 };
61 
62 class AccessibilityManagerHidumper {
63 public:
64     AccessibilityManagerHidumper() = default;
65     ~AccessibilityManagerHidumper() = default;
66 
67     static AceAction ConvertAccessibilityAction(Accessibility::ActionType accessibilityAction);
68     static std::string ConvertActionTypeToString(Accessibility::ActionType action);
69 };
70 } // OHOS::Ace::Framework
71 #endif // FOUNDATION_ACE_ADAPTER_OHOS_OSAL_ACCESSIBILITY_ACCESSIBILITY_HIDUMPER_OSAL_H