• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #include "accessibility_element_operator_proxy.h"
17 #include "accessibility_ut_helper.h"
18 #include "hilog_wrapper.h"
19 
20 namespace OHOS {
21 namespace Accessibility {
AccessibilityElementOperatorProxy(const sptr<IRemoteObject> & impl)22 AccessibilityElementOperatorProxy::AccessibilityElementOperatorProxy(
23     const sptr<IRemoteObject> &impl) : IRemoteProxy<IAccessibilityElementOperator>(impl)
24 {}
25 
WriteInterfaceToken(MessageParcel & data)26 bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data)
27 {
28     (void)data;
29     return true;
30 }
31 
SendTransactCmd(AccessibilityInterfaceCode code,MessageParcel & data,MessageParcel & reply,MessageOption & option)32 bool AccessibilityElementOperatorProxy::SendTransactCmd(AccessibilityInterfaceCode code,
33     MessageParcel &data, MessageParcel &reply,  MessageOption &option)
34 {
35     (void)code;
36     (void)data;
37     (void)reply;
38     (void)option;
39     return true;
40 }
41 
SearchElementInfoByAccessibilityId(const int64_t elementId,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback,const int32_t mode,bool isFilter)42 RetError AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const int64_t elementId,
43     const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int32_t mode,
44     bool isFilter)
45 {
46     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
47     (void)requestId;
48     (void)callback;
49     (void)mode;
50     (void)isFilter;
51     return RET_OK;
52 }
53 
SearchDefaultFocusedByWindowId(const int32_t windowId,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback,const int32_t mode,bool isFilter)54 void AccessibilityElementOperatorProxy::SearchDefaultFocusedByWindowId(const int32_t windowId,
55     const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int32_t mode,
56     bool isFilter)
57 {
58     (void)windowId;
59     (void)requestId;
60     (void)callback;
61     (void)mode;
62     (void)isFilter;
63 }
64 
SearchElementInfosByText(const int64_t elementId,const std::string & text,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)65 void AccessibilityElementOperatorProxy::SearchElementInfosByText(const int64_t elementId,
66     const std::string &text,
67     const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
68 {
69     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
70     (void)text;
71     (void)requestId;
72     (void)callback;
73 }
74 
FindFocusedElementInfo(const int64_t elementId,const int32_t focusType,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)75 void AccessibilityElementOperatorProxy::FindFocusedElementInfo(const int64_t elementId,
76     const int32_t focusType, const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
77 {
78     (void)focusType;
79     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
80     if (callback) {
81         AccessibilityElementInfo info;
82         callback->SetFindFocusedElementInfoResult(info, requestId);
83     }
84 }
85 
FocusMoveSearch(const int64_t elementId,const int32_t direction,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)86 void AccessibilityElementOperatorProxy::FocusMoveSearch(const int64_t elementId,
87     const int32_t direction, const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
88 {
89     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
90     (void)direction;
91     (void)requestId;
92     (void)callback;
93 }
94 
ExecuteAction(const int64_t elementId,const int32_t action,const std::map<std::string,std::string> & arguments,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)95 void AccessibilityElementOperatorProxy::ExecuteAction(const int64_t elementId, const int32_t action,
96     const std::map<std::string, std::string> &arguments, const int32_t requestId,
97     const sptr<IAccessibilityElementOperatorCallback> &callback)
98 {
99     (void)arguments;
100     AccessibilityAbilityHelper::GetInstance().SetExecuteAction(action);
101     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
102     if (callback) {
103         callback->SetExecuteActionResult(true, requestId);
104     }
105 }
106 
GetCursorPosition(const int64_t elementId,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)107 void AccessibilityElementOperatorProxy::GetCursorPosition(const int64_t elementId, const int32_t requestId,
108     const sptr<IAccessibilityElementOperatorCallback> &callback)
109 {
110     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
111     if (callback) {
112         callback->SetCursorPositionResult(1, requestId);
113     }
114 }
115 
ClearFocus()116 void AccessibilityElementOperatorProxy::ClearFocus()
117 {
118 }
119 
OutsideTouch()120 void AccessibilityElementOperatorProxy::OutsideTouch()
121 {
122 }
123 
SetChildTreeIdAndWinId(const int64_t elementId,const int32_t treeId,const int32_t childWindowId)124 void AccessibilityElementOperatorProxy::SetChildTreeIdAndWinId(const int64_t elementId, const int32_t treeId,
125     const int32_t childWindowId)
126 {
127     (void)elementId;
128     (void)treeId;
129     (void)childWindowId;
130 }
131 
SetBelongTreeId(const int32_t treeId)132 void AccessibilityElementOperatorProxy::SetBelongTreeId(const int32_t treeId)
133 {
134     (void)treeId;
135 }
136 
SetParentWindowId(const int32_t parentWindowId)137 void AccessibilityElementOperatorProxy::SetParentWindowId(const int32_t parentWindowId)
138 {
139     (void)parentWindowId;
140 }
141 
SearchElementInfoBySpecificProperty(const int64_t elementId,const SpecificPropertyParam & param,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)142 void AccessibilityElementOperatorProxy::SearchElementInfoBySpecificProperty(const int64_t elementId,
143     const SpecificPropertyParam& param, const int32_t requestId,
144     const sptr<IAccessibilityElementOperatorCallback> &callback)
145 {
146     (void)elementId;
147     (void)param;
148     (void)requestId;
149     (void)callback;
150 }
151 } // namespace Accessibility
152 } // namespace OHOS