• 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(IAccessibilityElementOperator::Message code,MessageParcel & data,MessageParcel & reply,MessageOption & option)32 bool AccessibilityElementOperatorProxy::SendTransactCmd(IAccessibilityElementOperator::Message 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 int32_t elementId,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback,const int32_t mode)42 void AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const int32_t elementId,
43     const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int32_t mode)
44 {
45     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
46     (void)requestId;
47     (void)callback;
48     (void)mode;
49 }
50 
SearchElementInfosByText(const int32_t elementId,const std::string & text,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)51 void AccessibilityElementOperatorProxy::SearchElementInfosByText(const int32_t elementId,
52     const std::string &text,
53     const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
54 {
55     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
56     (void)text;
57     (void)requestId;
58     (void)callback;
59 }
60 
FindFocusedElementInfo(const int32_t elementId,const int32_t focusType,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)61 void AccessibilityElementOperatorProxy::FindFocusedElementInfo(const int32_t elementId,
62     const int32_t focusType, const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
63 {
64     (void)focusType;
65     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
66     if (callback) {
67         AccessibilityElementInfo info;
68         callback->SetFindFocusedElementInfoResult(info, requestId);
69     }
70 }
71 
FocusMoveSearch(const int32_t elementId,const int32_t direction,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)72 void AccessibilityElementOperatorProxy::FocusMoveSearch(const int32_t elementId,
73     const int32_t direction, const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
74 {
75     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
76     (void)direction;
77     (void)requestId;
78     (void)callback;
79 }
80 
ExecuteAction(const int32_t elementId,const int32_t action,const std::map<std::string,std::string> & arguments,const int32_t requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)81 void AccessibilityElementOperatorProxy::ExecuteAction(const int32_t elementId, const int32_t action,
82     const std::map<std::string, std::string> &arguments, const int32_t requestId,
83     const sptr<IAccessibilityElementOperatorCallback> &callback)
84 {
85     (void)arguments;
86     AccessibilityAbilityHelper::GetInstance().SetExecuteAction(action);
87     AccessibilityAbilityHelper::GetInstance().SetTestChannelElementId(elementId);
88     if (callback) {
89         callback->SetExecuteActionResult(true, requestId);
90     }
91 }
92 
ClearFocus()93 void AccessibilityElementOperatorProxy::ClearFocus()
94 {
95 }
96 
OutsideTouch()97 void AccessibilityElementOperatorProxy::OutsideTouch()
98 {
99 }
100 } // namespace Accessibility
101 } // namespace OHOS