• 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 "accessible_ability_manager_service_proxy.h"
17 #include "accessibility_ability_info_parcel.h"
18 #include "accessibility_caption_parcel.h"
19 #include "accessibility_event_info_parcel.h"
20 #include "accessibility_ipc_interface_code.h"
21 #include "hilog_wrapper.h"
22 
23 namespace OHOS {
24 namespace Accessibility {
25 
26 const int32_t ABILITY_SIZE_MAX = 10000;
27 const int32_t TREE_ID_MAX = 0x00001FFF;
28 
AccessibleAbilityManagerServiceProxy(const sptr<IRemoteObject> & impl)29 AccessibleAbilityManagerServiceProxy::AccessibleAbilityManagerServiceProxy(const sptr<IRemoteObject> &impl)
30     : IRemoteProxy<IAccessibleAbilityManagerService>(impl)
31 {
32     HILOG_INFO("AccessibleAbilityManagerServiceProxy construct.");
33 }
34 
~AccessibleAbilityManagerServiceProxy()35 AccessibleAbilityManagerServiceProxy::~AccessibleAbilityManagerServiceProxy()
36 {
37     HILOG_INFO("AccessibleAbilityManagerServiceProxy destruct.");
38 }
39 
WriteInterfaceToken(MessageParcel & data)40 bool AccessibleAbilityManagerServiceProxy::WriteInterfaceToken(MessageParcel &data)
41 {
42     HILOG_DEBUG();
43     if (!data.WriteInterfaceToken(AccessibleAbilityManagerServiceProxy::GetDescriptor())) {
44         HILOG_ERROR("write interface token failed");
45         return false;
46     }
47     return true;
48 }
49 
SendTransactCmd(AccessibilityInterfaceCode code,MessageParcel & data,MessageParcel & reply,MessageOption & option)50 bool AccessibleAbilityManagerServiceProxy::SendTransactCmd(AccessibilityInterfaceCode code,
51     MessageParcel &data, MessageParcel &reply,  MessageOption &option)
52 {
53     HILOG_DEBUG();
54 
55     sptr<IRemoteObject> remoteServiceProxy= Remote();
56     if (remoteServiceProxy == nullptr) {
57         HILOG_ERROR("fail to send transact cmd %{public}d due to remote object", code);
58         return false;
59     }
60     int32_t resultServiceProxy =
61         remoteServiceProxy->SendRequest(static_cast<uint32_t>(code), data, reply, option);
62     if (resultServiceProxy != NO_ERROR) {
63         HILOG_ERROR("receive error transact code %{public}d in transact cmd %{public}d", resultServiceProxy, code);
64         return false;
65     }
66     return true;
67 }
68 
SendEvent(const AccessibilityEventInfo & uiEvent,const int32_t flag)69 RetError AccessibleAbilityManagerServiceProxy::SendEvent(const AccessibilityEventInfo &uiEvent, const int32_t flag)
70 {
71     HILOG_DEBUG();
72     MessageParcel data;
73     MessageParcel reply;
74     MessageOption option(MessageOption::TF_ASYNC);
75     AccessibilityEventInfoParcel eventInfoParcel(uiEvent);
76 
77     if (!WriteInterfaceToken(data)) {
78         HILOG_ERROR("fail, connection write Token");
79         return RET_ERR_IPC_FAILED;
80     }
81 
82     if (!data.WriteParcelable(&eventInfoParcel)) {
83         HILOG_ERROR("fail, connection write parcelable AccessibilityEventInfo error");
84         return RET_ERR_IPC_FAILED;
85     }
86 
87     if (!SendTransactCmd(AccessibilityInterfaceCode::SEND_EVENT, data, reply, option)) {
88         HILOG_ERROR("SendEvent fail");
89         return RET_ERR_IPC_FAILED;
90     }
91     return RET_OK;
92 }
93 
SetCaptionProperty(const AccessibilityConfig::CaptionProperty & caption)94 RetError AccessibleAbilityManagerServiceProxy::SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption)
95 {
96     HILOG_DEBUG();
97     MessageParcel data;
98     MessageParcel reply;
99     MessageOption option;
100     CaptionPropertyParcel captionParcel(caption);
101 
102     if (!WriteInterfaceToken(data)) {
103         HILOG_ERROR("fail, connection write Token");
104         return RET_ERR_IPC_FAILED;
105     }
106 
107     if (!data.WriteParcelable(&captionParcel)) {
108         HILOG_ERROR("fail, connection write parcelable Caption Property ");
109         return RET_ERR_IPC_FAILED;
110     }
111 
112     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_CAPTION_PROPERTY, data, reply, option)) {
113         HILOG_ERROR("SetCaptionProperty fail");
114         return RET_ERR_IPC_FAILED;
115     }
116     return static_cast<RetError>(reply.ReadInt32());
117 }
118 
SetCaptionState(const bool state)119 RetError AccessibleAbilityManagerServiceProxy::SetCaptionState(const bool state)
120 {
121     HILOG_DEBUG();
122     MessageParcel data;
123     MessageParcel reply;
124     MessageOption option;
125 
126     if (!WriteInterfaceToken(data)) {
127         HILOG_ERROR("SetCaptionState fail, connection write Token");
128         return RET_ERR_IPC_FAILED;
129     }
130 
131     if (!data.WriteBool(state)) {
132         HILOG_ERROR("SetCaptionState fail, connection write parcelable Caption State ");
133         return RET_ERR_IPC_FAILED;
134     }
135 
136     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_CAPTION_STATE, data, reply, option)) {
137         HILOG_ERROR("SetCaptionState fail");
138         return RET_ERR_IPC_FAILED;
139     }
140     return static_cast<RetError>(reply.ReadInt32());
141 }
142 
RegisterStateObserver(const sptr<IAccessibleAbilityManagerStateObserver> & client)143 uint32_t AccessibleAbilityManagerServiceProxy::RegisterStateObserver(
144     const sptr<IAccessibleAbilityManagerStateObserver> &client)
145 {
146     HILOG_DEBUG();
147     MessageParcel data;
148     MessageParcel reply;
149     MessageOption option;
150 
151     if (client == nullptr) {
152         HILOG_ERROR("RegisterStateObserver fail, Input client is null");
153         return TRANSACTION_ERR;
154     }
155 
156     if (!WriteInterfaceToken(data)) {
157         HILOG_ERROR("RegisterStateObserver fail, connection write Token error");
158         return TRANSACTION_ERR;
159     }
160 
161     if (!data.WriteRemoteObject(client->AsObject())) {
162         HILOG_ERROR("RegisterStateObserver fail, connection write client error");
163         return TRANSACTION_ERR;
164     }
165 
166     if (!SendTransactCmd(AccessibilityInterfaceCode::REGISTER_STATE_CALLBACK,
167         data, reply, option)) {
168         HILOG_ERROR("RegisterStateCallback fail");
169         return TRANSACTION_ERR;
170     }
171 
172     return reply.ReadUint32();
173 }
174 
GetAbilityList(const uint32_t abilityTypes,const int32_t stateType,std::vector<AccessibilityAbilityInfo> & infos)175 RetError AccessibleAbilityManagerServiceProxy::GetAbilityList(const uint32_t abilityTypes, const int32_t stateType,
176     std::vector<AccessibilityAbilityInfo> &infos)
177 {
178     HILOG_DEBUG();
179     MessageParcel data;
180     MessageParcel reply;
181     MessageOption option;
182 
183     if (!WriteInterfaceToken(data)) {
184         HILOG_ERROR("fail, connection write Token error");
185         return RET_ERR_IPC_FAILED;
186     }
187 
188     if (!data.WriteUint32(abilityTypes)) {
189         HILOG_ERROR("fail, connection write abilityTypes error");
190         return RET_ERR_IPC_FAILED;
191     }
192 
193     if (!data.WriteInt32(stateType)) {
194         HILOG_ERROR("fail, connection write stateType error");
195         return RET_ERR_IPC_FAILED;
196     }
197 
198     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ABILITYLIST,
199         data, reply, option)) {
200         HILOG_ERROR("GetAbilityList fail");
201         return RET_ERR_IPC_FAILED;
202     }
203     // read result
204     int32_t abilityInfoSize = reply.ReadInt32();
205     if (abilityInfoSize < 0 || abilityInfoSize > ABILITY_SIZE_MAX) {
206         HILOG_ERROR("abilityInfoSize is invalid");
207         return RET_ERR_INVALID_PARAM;
208     }
209 
210     for (int32_t i = 0; i < abilityInfoSize; i++) {
211         sptr<AccessibilityAbilityInfoParcel> info = reply.ReadStrongParcelable<AccessibilityAbilityInfoParcel>();
212         if (info == nullptr) {
213             HILOG_ERROR("ReadStrongParcelable<AccessibilityAbilityInfoParcel> failed");
214             return RET_ERR_IPC_FAILED;
215         }
216         infos.emplace_back(*info);
217     }
218     return static_cast<RetError>(reply.ReadInt32());
219 }
220 
RegisterElementOperator(int32_t windowId,const sptr<IAccessibilityElementOperator> & operation,bool isApp)221 RetError AccessibleAbilityManagerServiceProxy::RegisterElementOperator(
222     int32_t windowId, const sptr<IAccessibilityElementOperator> &operation, bool isApp)
223 {
224     HILOG_DEBUG();
225     MessageParcel data;
226     MessageParcel reply;
227     MessageOption option(MessageOption::TF_ASYNC);
228 
229     if (operation == nullptr) {
230         HILOG_ERROR("fail, Input operation is null");
231         return RET_ERR_INVALID_PARAM;
232     }
233 
234     if (!WriteInterfaceToken(data)) {
235         HILOG_ERROR("fail, connection write Token");
236         return RET_ERR_IPC_FAILED;
237     }
238 
239     if (!data.WriteInt32(windowId)) {
240         HILOG_ERROR("fail, connection write windowId error");
241         return RET_ERR_IPC_FAILED;
242     }
243 
244     if (!data.WriteRemoteObject(operation->AsObject())) {
245         HILOG_ERROR("fail, connection write parcelable operation error");
246         return RET_ERR_IPC_FAILED;
247     }
248 
249     if (!SendTransactCmd(AccessibilityInterfaceCode::REGISTER_INTERACTION_CONNECTION,
250         data, reply, option)) {
251         HILOG_ERROR("RegisterElementOperator fail");
252         return RET_ERR_IPC_FAILED;
253     }
254     return RET_OK;
255 }
256 
RegisterElementOperator(Registration parameter,const sptr<IAccessibilityElementOperator> & operation,bool isApp)257 RetError AccessibleAbilityManagerServiceProxy::RegisterElementOperator(Registration parameter,
258     const sptr<IAccessibilityElementOperator> &operation, bool isApp)
259 {
260     HILOG_DEBUG();
261     MessageParcel data;
262     MessageParcel reply;
263     MessageOption option(MessageOption::TF_ASYNC);
264 
265     if (operation == nullptr) {
266         HILOG_ERROR("fail, Input operation is null");
267         return RET_ERR_INVALID_PARAM;
268     }
269 
270     if (!WriteInterfaceToken(data)) {
271         HILOG_ERROR("fail, connection write Token");
272         return RET_ERR_IPC_FAILED;
273     }
274 
275     if (!data.WriteInt32(parameter.windowId)) {
276         HILOG_ERROR("fail, connection write windowId error");
277         return RET_ERR_IPC_FAILED;
278     }
279 
280     if (!data.WriteInt32(parameter.parentWindowId)) {
281         HILOG_ERROR("fail, connection write parentWindowId error");
282         return RET_ERR_IPC_FAILED;
283     }
284 
285     if (!data.WriteInt32(parameter.parentTreeId)) {
286         HILOG_ERROR("fail, connection write parentTreeId error");
287         return RET_ERR_IPC_FAILED;
288     }
289 
290     if (!data.WriteInt64(parameter.elementId)) {
291         HILOG_ERROR("fail, connection write elementId error");
292         return RET_ERR_IPC_FAILED;
293     }
294 
295     if (!data.WriteRemoteObject(operation->AsObject())) {
296         HILOG_ERROR("fail, connection write parcelable operation error");
297         return RET_ERR_IPC_FAILED;
298     }
299 
300     if (!SendTransactCmd(AccessibilityInterfaceCode::CARDREGISTER_INTERACTION_CONNECTION,
301         data, reply, option)) {
302         HILOG_ERROR("RegisterElementOperator fail");
303         return RET_ERR_IPC_FAILED;
304     }
305     return RET_OK;
306 }
307 
DeregisterElementOperator(const int32_t windowId)308 RetError AccessibleAbilityManagerServiceProxy::DeregisterElementOperator(const int32_t windowId)
309 {
310     HILOG_DEBUG("windowId(%{public}d)", windowId);
311     MessageParcel data;
312     MessageParcel reply;
313     MessageOption option(MessageOption::TF_ASYNC);
314 
315     if (!WriteInterfaceToken(data)) {
316         HILOG_ERROR("fail, connection write Token");
317         return RET_ERR_IPC_FAILED;
318     }
319 
320     if (!data.WriteInt32(windowId)) {
321         HILOG_ERROR("fail, connection write userId error");
322         return RET_ERR_IPC_FAILED;
323     }
324 
325     if (!SendTransactCmd(AccessibilityInterfaceCode::DEREGISTER_INTERACTION_CONNECTION,
326         data, reply, option)) {
327         HILOG_ERROR("DeregisterElementOperator fail");
328         return RET_ERR_IPC_FAILED;
329     }
330     return RET_OK;
331 }
332 
DeregisterElementOperator(const int32_t windowId,const int32_t treeId)333 RetError AccessibleAbilityManagerServiceProxy::DeregisterElementOperator(const int32_t windowId, const int32_t treeId)
334 {
335     HILOG_DEBUG("windowId(%{public}d)", windowId);
336     MessageParcel data;
337     MessageParcel reply;
338     MessageOption option(MessageOption::TF_ASYNC);
339 
340     if (!WriteInterfaceToken(data)) {
341         HILOG_ERROR("fail, connection write Token");
342         return RET_ERR_IPC_FAILED;
343     }
344 
345     if (!data.WriteInt32(windowId)) {
346         HILOG_ERROR("fail, connection write windowId error");
347         return RET_ERR_IPC_FAILED;
348     }
349 
350     if (!data.WriteInt32(treeId)) {
351         HILOG_ERROR("fail, connection write treeId error");
352         return RET_ERR_IPC_FAILED;
353     }
354     if (!SendTransactCmd(AccessibilityInterfaceCode::CARDDEREGISTER_INTERACTION_CONNECTION,
355         data, reply, option)) {
356         HILOG_ERROR("DeregisterElementOperator fail");
357         return RET_ERR_IPC_FAILED;
358     }
359     return RET_OK;
360 }
361 
GetCaptionProperty(AccessibilityConfig::CaptionProperty & caption)362 RetError AccessibleAbilityManagerServiceProxy::GetCaptionProperty(AccessibilityConfig::CaptionProperty &caption)
363 {
364     HILOG_DEBUG();
365     MessageParcel data;
366     MessageParcel reply;
367     MessageOption option;
368     AccessibilityConfig::CaptionProperty property = {};
369     if (!WriteInterfaceToken(data)) {
370         HILOG_ERROR("fail, connection write Token error");
371         return RET_ERR_IPC_FAILED;
372     }
373 
374     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_CAPTION_PROPERTY,
375         data, reply, option)) {
376         HILOG_ERROR("GetCaptionProperty fail");
377         return RET_ERR_IPC_FAILED;
378     }
379     RetError ret = static_cast<RetError>(reply.ReadInt32());
380     if (ret == RET_OK) {
381         caption = *reply.ReadStrongParcelable<CaptionPropertyParcel>();
382     }
383     return ret;
384 }
385 
RegisterCaptionObserver(const sptr<IAccessibleAbilityManagerCaptionObserver> & client)386 uint32_t AccessibleAbilityManagerServiceProxy::RegisterCaptionObserver(
387     const sptr<IAccessibleAbilityManagerCaptionObserver> &client)
388 {
389     HILOG_DEBUG();
390     MessageParcel data;
391     MessageParcel reply;
392     MessageOption option;
393 
394     if (client == nullptr) {
395         HILOG_ERROR("RegisterCaptionObserver fail, Input client is null");
396         return TRANSACTION_ERR;
397     }
398 
399     if (!WriteInterfaceToken(data)) {
400         HILOG_ERROR("RegisterCaptionObserver fail, connection write Token error");
401         return TRANSACTION_ERR;
402     }
403 
404     if (!data.WriteRemoteObject(client->AsObject())) {
405         HILOG_ERROR("RegisterCaptionObserver fail, connection write client error");
406         return TRANSACTION_ERR;
407     }
408 
409     if (!SendTransactCmd(AccessibilityInterfaceCode::REGISTER_CAPTION_PROPERTY_CALLBACK,
410         data, reply, option)) {
411         HILOG_ERROR("RegisterCaptionPropertyCallback fail");
412         return TRANSACTION_ERR;
413     }
414 
415     return reply.ReadUint32();
416 }
417 
GetEnabledState()418 bool AccessibleAbilityManagerServiceProxy::GetEnabledState()
419 {
420     HILOG_DEBUG();
421     MessageParcel data;
422     MessageParcel reply;
423     MessageOption option;
424 
425     if (!WriteInterfaceToken(data)) {
426         HILOG_ERROR("fail, connection write Token");
427         return false;
428     }
429     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ENABLED,
430         data, reply, option)) {
431         HILOG_ERROR("GetEnabledState fail");
432         return false;
433     }
434     return reply.ReadBool();
435 }
436 
GetCaptionState(bool & state)437 RetError AccessibleAbilityManagerServiceProxy::GetCaptionState(bool &state)
438 {
439     HILOG_DEBUG();
440     MessageParcel data;
441     MessageParcel reply;
442     MessageOption option;
443 
444     if (!WriteInterfaceToken(data)) {
445         HILOG_ERROR("fail, connection write Token");
446         return RET_ERR_IPC_FAILED;
447     }
448     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_CAPTION_STATE,
449         data, reply, option)) {
450         HILOG_ERROR("GetCaptionState fail");
451         return RET_ERR_IPC_FAILED;
452     }
453     RetError ret = static_cast<RetError>(reply.ReadInt32());
454     if (ret == RET_OK) {
455         state = reply.ReadBool();
456     }
457     return ret;
458 }
459 
GetTouchGuideState()460 bool AccessibleAbilityManagerServiceProxy::GetTouchGuideState()
461 {
462     HILOG_DEBUG();
463     MessageParcel data;
464     MessageParcel reply;
465     MessageOption option;
466 
467     if (!WriteInterfaceToken(data)) {
468         HILOG_ERROR("fail, connection write Token");
469         return false;
470     }
471     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_TOUCH_GUIDE_STATE,
472         data, reply, option)) {
473         HILOG_ERROR("GetTouchGuideState fail");
474         return false;
475     }
476     return reply.ReadBool();
477 }
478 
GetGestureState()479 bool AccessibleAbilityManagerServiceProxy::GetGestureState()
480 {
481     HILOG_DEBUG();
482     MessageParcel data;
483     MessageParcel reply;
484     MessageOption option;
485 
486     if (!WriteInterfaceToken(data)) {
487         HILOG_ERROR("fail, connection write Token");
488         return false;
489     }
490     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_GESTURE_STATE,
491         data, reply, option)) {
492         HILOG_ERROR("GetGestureState fail");
493         return false;
494     }
495     return reply.ReadBool();
496 }
497 
GetKeyEventObserverState()498 bool AccessibleAbilityManagerServiceProxy::GetKeyEventObserverState()
499 {
500     HILOG_DEBUG();
501     MessageParcel data;
502     MessageParcel reply;
503     MessageOption option;
504 
505     if (!WriteInterfaceToken(data)) {
506         HILOG_ERROR("fail, connection write Token");
507         return false;
508     }
509     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_KEY_EVENT_OBSERVE_STATE,
510         data, reply, option)) {
511         HILOG_ERROR("GetKeyEventObserverState fail");
512         return false;
513     }
514     return reply.ReadBool();
515 }
516 
GetScreenReaderState()517 bool AccessibleAbilityManagerServiceProxy::GetScreenReaderState()
518 {
519     HILOG_DEBUG();
520     MessageParcel data;
521     MessageParcel reply;
522     MessageOption option;
523 
524     if (!WriteInterfaceToken(data)) {
525         HILOG_ERROR("fail, connection write Token");
526         return false;
527     }
528     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SCREEN_READER_STATE,
529         data, reply, option)) {
530         HILOG_ERROR("GetScreenReaderState fail");
531         return false;
532     }
533     return reply.ReadBool();
534 }
535 
EnableAbility(const std::string & name,const uint32_t capabilities)536 RetError AccessibleAbilityManagerServiceProxy::EnableAbility(const std::string &name, const uint32_t capabilities)
537 {
538     HILOG_DEBUG();
539     MessageParcel data;
540     MessageParcel reply;
541     MessageOption option;
542 
543     if (!WriteInterfaceToken(data)) {
544         HILOG_ERROR("EnableAbility fail, connection write Token");
545         return RET_ERR_IPC_FAILED;
546     }
547 
548     if (!data.WriteString(name)) {
549         HILOG_ERROR("name write error: %{public}s, ", name.c_str());
550         return RET_ERR_IPC_FAILED;
551     }
552 
553     if (!data.WriteUint32(capabilities)) {
554         HILOG_ERROR("capabilities write error: %{public}d, ", capabilities);
555         return RET_ERR_IPC_FAILED;
556     }
557 
558     if (!SendTransactCmd(AccessibilityInterfaceCode::ENABLE_ABILITIES,
559         data, reply, option)) {
560         HILOG_ERROR("EnableAbility fail");
561         return RET_ERR_IPC_FAILED;
562     }
563     return static_cast<RetError>(reply.ReadInt32());
564 }
565 
GetEnabledAbilities(std::vector<std::string> & enabledAbilities)566 RetError AccessibleAbilityManagerServiceProxy::GetEnabledAbilities(std::vector<std::string> &enabledAbilities)
567 {
568     HILOG_DEBUG();
569     MessageParcel data;
570     MessageParcel reply;
571     MessageOption option;
572 
573     if (!WriteInterfaceToken(data)) {
574         HILOG_ERROR("fail, connection write Token error");
575         return RET_ERR_IPC_FAILED;
576     }
577     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ENABLED_OBJECT,
578         data, reply, option)) {
579         HILOG_ERROR("GetEnabledAbilities fail");
580         return RET_ERR_IPC_FAILED;
581     }
582 
583     int32_t dev_num = reply.ReadInt32();
584     if (dev_num < 0 || dev_num > ABILITY_SIZE_MAX) {
585         HILOG_ERROR("dev_num is invalid");
586         return RET_ERR_INVALID_PARAM;
587     }
588 
589     for (int32_t i = 0; i < dev_num; i++) {
590         enabledAbilities.push_back(reply.ReadString());
591     }
592     return static_cast<RetError>(reply.ReadInt32());
593 }
594 
DisableAbility(const std::string & name)595 RetError AccessibleAbilityManagerServiceProxy::DisableAbility(const std::string &name)
596 {
597     HILOG_DEBUG();
598     MessageParcel data;
599     MessageParcel reply;
600     MessageOption option;
601 
602     if (!WriteInterfaceToken(data)) {
603         HILOG_ERROR("DisableAbility fail, connection write Token");
604         return RET_ERR_IPC_FAILED;
605     }
606 
607     if (!data.WriteString(name)) {
608         HILOG_ERROR("name write error: %{public}s, ", name.c_str());
609         return RET_ERR_IPC_FAILED;
610     }
611     if (!SendTransactCmd(AccessibilityInterfaceCode::DISABLE_ABILITIES,
612         data, reply, option)) {
613         HILOG_ERROR("DisableAbility fail");
614         return RET_ERR_IPC_FAILED;
615     }
616     return static_cast<RetError>(reply.ReadInt32());
617 }
618 
GetActiveWindow()619 int32_t AccessibleAbilityManagerServiceProxy::GetActiveWindow()
620 {
621     HILOG_DEBUG();
622     MessageParcel data;
623     MessageParcel reply;
624     MessageOption option;
625 
626     if (!WriteInterfaceToken(data)) {
627         HILOG_ERROR("fail, connection write Token");
628         return false;
629     }
630 
631     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ACTIVE_WINDOW,
632         data, reply, option)) {
633         HILOG_ERROR("GetActiveWindow fail");
634         return false;
635     }
636     return reply.ReadInt32();
637 }
638 
EnableUITestAbility(const sptr<IRemoteObject> & obj)639 RetError AccessibleAbilityManagerServiceProxy::EnableUITestAbility(const sptr<IRemoteObject> &obj)
640 {
641     HILOG_DEBUG();
642     MessageParcel data;
643     MessageParcel reply;
644     MessageOption option;
645 
646     if (!WriteInterfaceToken(data)) {
647         HILOG_ERROR("fail, connection write Token");
648         return RET_ERR_IPC_FAILED;
649     }
650 
651     if (!data.WriteRemoteObject(obj)) {
652         HILOG_ERROR("fail, connection write obj");
653         return RET_ERR_IPC_FAILED;
654     }
655 
656     if (!SendTransactCmd(AccessibilityInterfaceCode::ENABLE_UI_TEST_ABILITY,
657         data, reply, option)) {
658         HILOG_ERROR("EnableUITestAbility fail");
659         return RET_ERR_IPC_FAILED;
660     }
661     RetError result = static_cast<RetError>(reply.ReadInt32());
662     HILOG_DEBUG("enable result is %{public}d", result);
663     return result;
664 }
665 
DisableUITestAbility()666 RetError AccessibleAbilityManagerServiceProxy::DisableUITestAbility()
667 {
668     HILOG_DEBUG();
669     MessageParcel data;
670     MessageParcel reply;
671     MessageOption option;
672 
673     if (!WriteInterfaceToken(data)) {
674         HILOG_ERROR("fail, connection write Token");
675         return RET_ERR_IPC_FAILED;
676     }
677 
678     if (!SendTransactCmd(AccessibilityInterfaceCode::DISABLE_UI_TEST_ABILITY,
679         data, reply, option)) {
680         HILOG_ERROR("DisableUITestAbility fail");
681         return RET_ERR_IPC_FAILED;
682     }
683     return static_cast<RetError>(reply.ReadInt32());
684 }
685 
SetScreenMagnificationState(const bool state)686 RetError AccessibleAbilityManagerServiceProxy::SetScreenMagnificationState(const bool state)
687 {
688     HILOG_DEBUG();
689     MessageParcel data;
690     MessageParcel reply;
691     MessageOption option;
692 
693     if (!WriteInterfaceToken(data)) {
694         HILOG_ERROR("SetScreenMagnificationState fail, connection write Token");
695         return RET_ERR_IPC_FAILED;
696     }
697 
698     if (!data.WriteBool(state)) {
699         HILOG_ERROR("SetScreenMagnificationState fail, connection write parcelable Caption State ");
700         return RET_ERR_IPC_FAILED;
701     }
702 
703     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_SCREENMAGNIFIER_STATE, data, reply, option)) {
704         HILOG_ERROR("SetScreenMagnificationState fail");
705         return RET_ERR_IPC_FAILED;
706     }
707 
708     return static_cast<RetError>(reply.ReadInt32());
709 }
710 
SetShortKeyState(const bool state)711 RetError AccessibleAbilityManagerServiceProxy::SetShortKeyState(const bool state)
712 {
713     HILOG_DEBUG();
714     MessageParcel data;
715     MessageParcel reply;
716     MessageOption option;
717 
718     if (!WriteInterfaceToken(data)) {
719         HILOG_ERROR("SetShortKeyState fail, connection write Token");
720         return RET_ERR_IPC_FAILED;
721     }
722 
723     if (!data.WriteBool(state)) {
724         HILOG_ERROR("SetShortKeyState fail, connection write parcelable Caption State ");
725         return RET_ERR_IPC_FAILED;
726     }
727 
728     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_SHORTKEY_STATE, data, reply, option)) {
729         HILOG_ERROR("SetShortKeyState fail");
730         return RET_ERR_IPC_FAILED;
731     }
732 
733     return static_cast<RetError>(reply.ReadInt32());
734 }
735 
SetMouseKeyState(const bool state)736 RetError AccessibleAbilityManagerServiceProxy::SetMouseKeyState(const bool state)
737 {
738     HILOG_DEBUG();
739     MessageParcel data;
740     MessageParcel reply;
741     MessageOption option;
742 
743     if (!WriteInterfaceToken(data)) {
744         HILOG_ERROR("SetMouseKeyState fail, connection write Token");
745         return RET_ERR_IPC_FAILED;
746     }
747 
748     if (!data.WriteBool(state)) {
749         HILOG_ERROR("SetMouseKeyState fail, connection write parcelable Caption State");
750         return RET_ERR_IPC_FAILED;
751     }
752 
753     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_MOUSEKEY_STATE, data, reply, option)) {
754         HILOG_ERROR("SetMouseKeyState fail");
755         return RET_ERR_IPC_FAILED;
756     }
757 
758     return static_cast<RetError>(reply.ReadInt32());
759 }
760 
SetMouseAutoClick(const int32_t time)761 RetError AccessibleAbilityManagerServiceProxy::SetMouseAutoClick(const int32_t time)
762 {
763     HILOG_DEBUG();
764     MessageParcel data;
765     MessageParcel reply;
766     MessageOption option;
767 
768     if (!WriteInterfaceToken(data)) {
769         HILOG_ERROR("fail, connection write Token");
770         return RET_ERR_IPC_FAILED;
771     }
772 
773     if (!data.WriteInt32(time)) {
774         HILOG_ERROR("fail, connection write SetMouseAutoClick time");
775         return RET_ERR_IPC_FAILED;
776     }
777 
778     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_MOUSEKEY_AUTOCLICK, data, reply, option)) {
779         HILOG_ERROR("SetMouseAutoClick fail");
780         return RET_ERR_IPC_FAILED;
781     }
782 
783     return static_cast<RetError>(reply.ReadInt32());
784 }
785 
SetShortkeyTarget(const std::string & name)786 RetError AccessibleAbilityManagerServiceProxy::SetShortkeyTarget(const std::string &name)
787 {
788     HILOG_DEBUG();
789     MessageParcel data;
790     MessageParcel reply;
791     MessageOption option;
792 
793     if (!WriteInterfaceToken(data)) {
794         HILOG_ERROR("DisableAbility fail, connection write Token");
795         return RET_ERR_IPC_FAILED;
796     }
797 
798     if (!data.WriteString(name)) {
799         HILOG_ERROR("fail, connection write SetShortkeyTarget name");
800         return RET_ERR_IPC_FAILED;
801     }
802 
803     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_SHORTKEY_TARGET, data, reply, option)) {
804         HILOG_ERROR("SetShortkeyTarget fail");
805         return RET_ERR_IPC_FAILED;
806     }
807 
808     return static_cast<RetError>(reply.ReadInt32());
809 }
810 
SetShortkeyMultiTarget(const std::vector<std::string> & name)811 RetError AccessibleAbilityManagerServiceProxy::SetShortkeyMultiTarget(const std::vector<std::string> &name)
812 {
813     HILOG_DEBUG();
814     MessageParcel data;
815     MessageParcel reply;
816     MessageOption option;
817 
818     if (!WriteInterfaceToken(data)) {
819         HILOG_ERROR("DisableAbility fail, connection write Token");
820         return RET_ERR_IPC_FAILED;
821     }
822 
823     if (!data.WriteStringVector(name)) {
824         HILOG_ERROR("fail, connection write SetShortkeyMultiTarget name");
825         return RET_ERR_IPC_FAILED;
826     }
827 
828     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_SHORTKEY_MULTI_TARGET, data, reply, option)) {
829         HILOG_ERROR("send SetShortkeyMultiTarget fail");
830         return RET_ERR_IPC_FAILED;
831     }
832 
833     return static_cast<RetError>(reply.ReadInt32());
834 }
835 
SetHighContrastTextState(const bool state)836 RetError AccessibleAbilityManagerServiceProxy::SetHighContrastTextState(const bool state)
837 {
838     HILOG_DEBUG();
839     MessageParcel data;
840     MessageParcel reply;
841     MessageOption option;
842 
843     if (!WriteInterfaceToken(data)) {
844         HILOG_ERROR("SetHighContrastTextState fail, connection write Token");
845         return RET_ERR_IPC_FAILED;
846     }
847 
848     if (!data.WriteBool(state)) {
849         HILOG_ERROR("SetHighContrastTextState fail, connection write parcelable Caption State");
850         return RET_ERR_IPC_FAILED;
851     }
852 
853     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_HIGHCONTRASTTEXT_STATE, data, reply, option)) {
854         HILOG_ERROR("SetHighContrastTextState fail");
855         return RET_ERR_IPC_FAILED;
856     }
857 
858     return static_cast<RetError>(reply.ReadInt32());
859 }
860 
SetInvertColorState(const bool state)861 RetError AccessibleAbilityManagerServiceProxy::SetInvertColorState(const bool state)
862 {
863     HILOG_DEBUG();
864     MessageParcel data;
865     MessageParcel reply;
866     MessageOption option;
867 
868     if (!WriteInterfaceToken(data)) {
869         HILOG_ERROR("SetInvertColorState fail, connection write Token");
870         return RET_ERR_IPC_FAILED;
871     }
872 
873     if (!data.WriteBool(state)) {
874         HILOG_ERROR("SetInvertColorState fail, connection write parcelable Caption State ");
875         return RET_ERR_IPC_FAILED;
876     }
877 
878     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_INVERTCOLOR_STATE, data, reply, option)) {
879         HILOG_ERROR("SetInvertColorState fail");
880         return RET_ERR_IPC_FAILED;
881     }
882 
883     return static_cast<RetError>(reply.ReadInt32());
884 }
885 
SetAnimationOffState(const bool state)886 RetError AccessibleAbilityManagerServiceProxy::SetAnimationOffState(const bool state)
887 {
888     HILOG_DEBUG();
889     MessageParcel data;
890     MessageParcel reply;
891     MessageOption option;
892 
893     if (!WriteInterfaceToken(data)) {
894         HILOG_ERROR("SetAnimationOffState fail, connection write Token");
895         return RET_ERR_IPC_FAILED;
896     }
897 
898     if (!data.WriteBool(state)) {
899         HILOG_ERROR("SetAnimationOffState fail, connection write parcelable Caption State ");
900         return RET_ERR_IPC_FAILED;
901     }
902 
903     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_ANIMATIONOFF_STATE, data, reply, option)) {
904         HILOG_ERROR("SetAnimationOffState fail");
905         return RET_ERR_IPC_FAILED;
906     }
907 
908     return static_cast<RetError>(reply.ReadInt32());
909 }
910 
SetAudioMonoState(const bool state)911 RetError AccessibleAbilityManagerServiceProxy::SetAudioMonoState(const bool state)
912 {
913     HILOG_DEBUG();
914     MessageParcel data;
915     MessageParcel reply;
916     MessageOption option;
917 
918     if (!WriteInterfaceToken(data)) {
919         HILOG_ERROR("SetAudioMonoState fail, connection write Token");
920         return RET_ERR_IPC_FAILED;
921     }
922 
923     if (!data.WriteBool(state)) {
924         HILOG_ERROR("SetAudioMonoState fail, connection write parcelable Caption State ");
925         return RET_ERR_IPC_FAILED;
926     }
927 
928     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_AUDIOMONO_STATE, data, reply, option)) {
929         HILOG_ERROR("SetAudioMonoState fail");
930         return RET_ERR_IPC_FAILED;
931     }
932 
933     return static_cast<RetError>(reply.ReadInt32());
934 }
935 
SetDaltonizationState(const bool state)936 RetError AccessibleAbilityManagerServiceProxy::SetDaltonizationState(const bool state)
937 {
938     HILOG_DEBUG();
939     MessageParcel data;
940     MessageParcel reply;
941     MessageOption option;
942 
943     if (!WriteInterfaceToken(data)) {
944         HILOG_ERROR("SetDaltonizationState fail, connection write Token");
945         return RET_ERR_IPC_FAILED;
946     }
947 
948     if (!data.WriteBool(state)) {
949         HILOG_ERROR("SetDaltonizationState fail, connection write parcelable Caption State");
950         return RET_ERR_IPC_FAILED;
951     }
952 
953     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE, data, reply, option)) {
954         HILOG_ERROR("SetDaltonizationState fail");
955         return RET_ERR_IPC_FAILED;
956     }
957 
958     return static_cast<RetError>(reply.ReadInt32());
959 }
960 
SetDaltonizationColorFilter(const uint32_t filter)961 RetError AccessibleAbilityManagerServiceProxy::SetDaltonizationColorFilter(const uint32_t filter)
962 {
963     HILOG_DEBUG();
964     MessageParcel data;
965     MessageParcel reply;
966     MessageOption option;
967 
968     if (!WriteInterfaceToken(data)) {
969         HILOG_ERROR("fail, connection write Token");
970         return RET_ERR_IPC_FAILED;
971     }
972 
973     if (!data.WriteUint32(filter)) {
974         HILOG_ERROR("fail, connection write SetDaltonizationColorFilter time");
975         return RET_ERR_IPC_FAILED;
976     }
977 
978     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_DALTONIZATION_COLORFILTER,
979         data, reply, option)) {
980         HILOG_ERROR("SetDaltonizationColorFilter fail");
981         return RET_ERR_IPC_FAILED;
982     }
983 
984     return static_cast<RetError>(reply.ReadInt32());
985 }
986 
SetContentTimeout(const uint32_t time)987 RetError AccessibleAbilityManagerServiceProxy::SetContentTimeout(const uint32_t time)
988 {
989     HILOG_DEBUG();
990     MessageParcel data;
991     MessageParcel reply;
992     MessageOption option;
993 
994     if (!WriteInterfaceToken(data)) {
995         HILOG_ERROR("fail, connection write Token");
996         return RET_ERR_IPC_FAILED;
997     }
998 
999     if (!data.WriteUint32(time)) {
1000         HILOG_ERROR("fail, connection write SetContentTimeout time");
1001         return RET_ERR_IPC_FAILED;
1002     }
1003 
1004     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_CONTENT_TIMEOUT, data, reply, option)) {
1005         HILOG_ERROR("SetContentTimeout fail");
1006         return RET_ERR_IPC_FAILED;
1007     }
1008 
1009     return static_cast<RetError>(reply.ReadInt32());
1010 }
1011 
SetBrightnessDiscount(const float discount)1012 RetError AccessibleAbilityManagerServiceProxy::SetBrightnessDiscount(const float discount)
1013 {
1014     HILOG_DEBUG();
1015     MessageParcel data;
1016     MessageParcel reply;
1017     MessageOption option;
1018 
1019     if (!WriteInterfaceToken(data)) {
1020         HILOG_ERROR("fail, connection write Token");
1021         return RET_ERR_IPC_FAILED;
1022     }
1023 
1024     if (!data.WriteFloat(discount)) {
1025         HILOG_ERROR("fail, connection write SetBrightnessDiscount time");
1026         return RET_ERR_IPC_FAILED;
1027     }
1028 
1029     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_BRIGHTNESS_DISCOUNT, data, reply, option)) {
1030         HILOG_ERROR("SetBrightnessDiscount fail");
1031         return RET_ERR_IPC_FAILED;
1032     }
1033 
1034     return static_cast<RetError>(reply.ReadInt32());
1035 }
1036 
SetAudioBalance(const float balance)1037 RetError AccessibleAbilityManagerServiceProxy::SetAudioBalance(const float balance)
1038 {
1039     HILOG_DEBUG();
1040     MessageParcel data;
1041     MessageParcel reply;
1042     MessageOption option;
1043 
1044     if (!WriteInterfaceToken(data)) {
1045         HILOG_ERROR("fail, connection write Token");
1046         return RET_ERR_IPC_FAILED;
1047     }
1048 
1049     if (!data.WriteFloat(balance)) {
1050         HILOG_ERROR("fail, connection write SetAudioBalance time");
1051         return RET_ERR_IPC_FAILED;
1052     }
1053 
1054     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_AUDIO_BALANCE, data, reply, option)) {
1055         HILOG_ERROR("SetAudioBalance fail");
1056         return RET_ERR_IPC_FAILED;
1057     }
1058 
1059     return static_cast<RetError>(reply.ReadInt32());
1060 }
1061 
SetClickResponseTime(const uint32_t time)1062 RetError AccessibleAbilityManagerServiceProxy::SetClickResponseTime(const uint32_t time)
1063 {
1064     HILOG_DEBUG();
1065     MessageParcel data;
1066     MessageParcel reply;
1067     MessageOption option;
1068 
1069     if (!WriteInterfaceToken(data)) {
1070         HILOG_ERROR("fail, connection write Token");
1071         return RET_ERR_IPC_FAILED;
1072     }
1073 
1074     if (!data.WriteUint32(time)) {
1075         HILOG_ERROR("fail, connection write SetAudioBalance time");
1076         return RET_ERR_IPC_FAILED;
1077     }
1078 
1079     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_CLICK_RESPONSE_TIME, data, reply, option)) {
1080         HILOG_ERROR("SetClickResponseTime fail");
1081         return RET_ERR_IPC_FAILED;
1082     }
1083 
1084     return static_cast<RetError>(reply.ReadInt32());
1085 }
1086 
SetIgnoreRepeatClickState(const bool state)1087 RetError AccessibleAbilityManagerServiceProxy::SetIgnoreRepeatClickState(const bool state)
1088 {
1089     HILOG_DEBUG();
1090     MessageParcel data;
1091     MessageParcel reply;
1092     MessageOption option;
1093 
1094     if (!WriteInterfaceToken(data)) {
1095         HILOG_ERROR("fail, connection write Token");
1096         return RET_ERR_IPC_FAILED;
1097     }
1098 
1099     if (!data.WriteBool(state)) {
1100         HILOG_ERROR("fail, connection write SetAudioBalance time");
1101         return RET_ERR_IPC_FAILED;
1102     }
1103 
1104     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_STATE, data, reply, option)) {
1105         HILOG_ERROR("SetIgnoreRepeatClickState fail");
1106         return RET_ERR_IPC_FAILED;
1107     }
1108 
1109     return static_cast<RetError>(reply.ReadInt32());
1110 }
1111 
SetIgnoreRepeatClickTime(const uint32_t time)1112 RetError AccessibleAbilityManagerServiceProxy::SetIgnoreRepeatClickTime(const uint32_t time)
1113 {
1114     HILOG_DEBUG();
1115     MessageParcel data;
1116     MessageParcel reply;
1117     MessageOption option;
1118 
1119     if (!WriteInterfaceToken(data)) {
1120         HILOG_ERROR("fail, connection write Token");
1121         return RET_ERR_IPC_FAILED;
1122     }
1123 
1124     if (!data.WriteUint32(time)) {
1125         HILOG_ERROR("fail, connection write SetAudioBalance time");
1126         return RET_ERR_IPC_FAILED;
1127     }
1128 
1129     if (!SendTransactCmd(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_TIME, data, reply, option)) {
1130         HILOG_ERROR("SetIgnoreRepeatClickTime fail");
1131         return RET_ERR_IPC_FAILED;
1132     }
1133 
1134     return static_cast<RetError>(reply.ReadInt32());
1135 }
1136 
GetScreenMagnificationState(bool & state)1137 RetError AccessibleAbilityManagerServiceProxy::GetScreenMagnificationState(bool &state)
1138 {
1139     HILOG_DEBUG();
1140     MessageParcel data;
1141     MessageParcel reply;
1142     MessageOption option;
1143 
1144     if (!WriteInterfaceToken(data)) {
1145         HILOG_ERROR("fail, connection write Token");
1146         return RET_ERR_IPC_FAILED;
1147     }
1148     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SCREENMAGNIFIER_STATE,
1149         data, reply, option)) {
1150         HILOG_ERROR("GetScreenMagnificationState fail");
1151         return RET_ERR_IPC_FAILED;
1152     }
1153 
1154     RetError ret = static_cast<RetError>(reply.ReadInt32());
1155     if (ret == RET_OK) {
1156         state = reply.ReadBool();
1157     }
1158     return ret;
1159 }
1160 
GetShortKeyState(bool & state)1161 RetError AccessibleAbilityManagerServiceProxy::GetShortKeyState(bool &state)
1162 {
1163     HILOG_DEBUG();
1164     MessageParcel data;
1165     MessageParcel reply;
1166     MessageOption option;
1167 
1168     if (!WriteInterfaceToken(data)) {
1169         HILOG_ERROR("fail, connection write Token");
1170         return RET_ERR_IPC_FAILED;
1171     }
1172     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SHORTKEY_STATE,
1173         data, reply, option)) {
1174         HILOG_ERROR("GetShortKeyState fail");
1175         return RET_ERR_IPC_FAILED;
1176     }
1177     RetError ret = static_cast<RetError>(reply.ReadInt32());
1178     if (ret == RET_OK) {
1179         state = reply.ReadBool();
1180     }
1181     return ret;
1182 }
1183 
GetMouseKeyState(bool & state)1184 RetError AccessibleAbilityManagerServiceProxy::GetMouseKeyState(bool &state)
1185 {
1186     HILOG_DEBUG();
1187     MessageParcel data;
1188     MessageParcel reply;
1189     MessageOption option;
1190 
1191     if (!WriteInterfaceToken(data)) {
1192         HILOG_ERROR("fail, connection write Token");
1193         return RET_ERR_IPC_FAILED;
1194     }
1195     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_MOUSEKEY_STATE,
1196         data, reply, option)) {
1197         HILOG_ERROR("GetMouseKeyState fail");
1198         return RET_ERR_IPC_FAILED;
1199     }
1200     RetError ret = static_cast<RetError>(reply.ReadInt32());
1201     if (ret == RET_OK) {
1202         state = reply.ReadBool();
1203     }
1204     return ret;
1205 }
1206 
GetMouseAutoClick(int32_t & time)1207 RetError AccessibleAbilityManagerServiceProxy::GetMouseAutoClick(int32_t &time)
1208 {
1209     HILOG_DEBUG();
1210     MessageParcel data;
1211     MessageParcel reply;
1212     MessageOption option;
1213 
1214     if (!WriteInterfaceToken(data)) {
1215         HILOG_ERROR("fail, connection write Token");
1216         return RET_ERR_IPC_FAILED;
1217     }
1218     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_MOUSEKEY_AUTOCLICK,
1219         data, reply, option)) {
1220         HILOG_ERROR("GetMouseAutoClick fail");
1221         return RET_ERR_IPC_FAILED;
1222     }
1223     RetError ret = static_cast<RetError>(reply.ReadInt32());
1224     if (ret == RET_OK) {
1225         time = reply.ReadInt32();
1226     }
1227     return ret;
1228 }
1229 
GetShortkeyTarget(std::string & name)1230 RetError AccessibleAbilityManagerServiceProxy::GetShortkeyTarget(std::string &name)
1231 {
1232     HILOG_DEBUG();
1233     MessageParcel data;
1234     MessageParcel reply;
1235     MessageOption option;
1236     if (!WriteInterfaceToken(data)) {
1237         HILOG_ERROR("fail, connection write Token");
1238         return RET_ERR_IPC_FAILED;
1239     }
1240     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SHORTKEY_TARGET,
1241         data, reply, option)) {
1242         HILOG_ERROR("GetShortkeyTarget fail");
1243         return RET_ERR_IPC_FAILED;
1244     }
1245     RetError ret = static_cast<RetError>(reply.ReadInt32());
1246     if (ret == RET_OK) {
1247         name = reply.ReadString();
1248     }
1249     return ret;
1250 }
1251 
GetShortkeyMultiTarget(std::vector<std::string> & name)1252 RetError AccessibleAbilityManagerServiceProxy::GetShortkeyMultiTarget(std::vector<std::string> &name)
1253 {
1254     HILOG_DEBUG();
1255     MessageParcel data;
1256     MessageParcel reply;
1257     MessageOption option;
1258     if (!WriteInterfaceToken(data)) {
1259         HILOG_ERROR("fail, connection write Token");
1260         return RET_ERR_IPC_FAILED;
1261     }
1262     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SHORTKEY_MULTI_TARGET,
1263         data, reply, option)) {
1264         HILOG_ERROR("GetShortkeyMultiTarget fail");
1265         return RET_ERR_IPC_FAILED;
1266     }
1267     RetError ret = static_cast<RetError>(reply.ReadInt32());
1268     if (ret != RET_OK) {
1269         return ret;
1270     }
1271     if (!reply.ReadStringVector(&name)) {
1272         return RET_ERR_IPC_FAILED;
1273     }
1274     return RET_OK;
1275 }
1276 
GetHighContrastTextState(bool & state)1277 RetError AccessibleAbilityManagerServiceProxy::GetHighContrastTextState(bool &state)
1278 {
1279     HILOG_DEBUG();
1280     MessageParcel data;
1281     MessageParcel reply;
1282     MessageOption option;
1283 
1284     if (!WriteInterfaceToken(data)) {
1285         HILOG_ERROR("fail, connection write Token");
1286         return RET_ERR_IPC_FAILED;
1287     }
1288     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_HIGHCONTRASTTEXT_STATE,
1289         data, reply, option)) {
1290         HILOG_ERROR("GetHighContrastTextState fail");
1291         return RET_ERR_IPC_FAILED;
1292     }
1293     RetError ret = static_cast<RetError>(reply.ReadInt32());
1294     if (ret == RET_OK) {
1295         state = reply.ReadBool();
1296     }
1297     return ret;
1298 }
1299 
GetInvertColorState(bool & state)1300 RetError AccessibleAbilityManagerServiceProxy::GetInvertColorState(bool &state)
1301 {
1302     HILOG_DEBUG();
1303     MessageParcel data;
1304     MessageParcel reply;
1305     MessageOption option;
1306 
1307     if (!WriteInterfaceToken(data)) {
1308         HILOG_ERROR("fail, connection write Token");
1309         return RET_ERR_IPC_FAILED;
1310     }
1311     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_INVERTCOLOR_STATE,
1312         data, reply, option)) {
1313         HILOG_ERROR("GetInvertColorState fail");
1314         return RET_ERR_IPC_FAILED;
1315     }
1316     RetError ret = static_cast<RetError>(reply.ReadInt32());
1317     if (ret == RET_OK) {
1318         state = reply.ReadBool();
1319     }
1320     return ret;
1321 }
1322 
GetAnimationOffState(bool & state)1323 RetError AccessibleAbilityManagerServiceProxy::GetAnimationOffState(bool &state)
1324 {
1325     HILOG_DEBUG();
1326     MessageParcel data;
1327     MessageParcel reply;
1328     MessageOption option;
1329 
1330     if (!WriteInterfaceToken(data)) {
1331         HILOG_ERROR("fail, connection write Token");
1332         return RET_ERR_IPC_FAILED;
1333     }
1334     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ANIMATIONOFF_STATE,
1335         data, reply, option)) {
1336         HILOG_ERROR("GetAnimationOffState fail");
1337         return RET_ERR_IPC_FAILED;
1338     }
1339     RetError ret = static_cast<RetError>(reply.ReadInt32());
1340     if (ret == RET_OK) {
1341         state = reply.ReadBool();
1342     }
1343     return ret;
1344 }
1345 
GetAudioMonoState(bool & state)1346 RetError AccessibleAbilityManagerServiceProxy::GetAudioMonoState(bool &state)
1347 {
1348     HILOG_DEBUG();
1349     MessageParcel data;
1350     MessageParcel reply;
1351     MessageOption option;
1352 
1353     if (!WriteInterfaceToken(data)) {
1354         HILOG_ERROR("fail, connection write Token");
1355         return RET_ERR_IPC_FAILED;
1356     }
1357     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_AUDIOMONO_STATE,
1358         data, reply, option)) {
1359         HILOG_ERROR("GetAudioMonoState fail");
1360         return RET_ERR_IPC_FAILED;
1361     }
1362     RetError ret = static_cast<RetError>(reply.ReadInt32());
1363     if (ret == RET_OK) {
1364         state = reply.ReadBool();
1365     }
1366     return ret;
1367 }
1368 
GetDaltonizationState(bool & state)1369 RetError AccessibleAbilityManagerServiceProxy::GetDaltonizationState(bool &state)
1370 {
1371     HILOG_DEBUG();
1372     MessageParcel data;
1373     MessageParcel reply;
1374     MessageOption option;
1375 
1376     if (!WriteInterfaceToken(data)) {
1377         HILOG_ERROR("fail, connection write Token");
1378         return RET_ERR_IPC_FAILED;
1379     }
1380     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_DALTONIZATION_STATE,
1381         data, reply, option)) {
1382         HILOG_ERROR("GetDaltonizationState fail");
1383         return RET_ERR_IPC_FAILED;
1384     }
1385     RetError ret = static_cast<RetError>(reply.ReadInt32());
1386     if (ret == RET_OK) {
1387         state = reply.ReadBool();
1388     }
1389     return ret;
1390 }
1391 
GetDaltonizationColorFilter(uint32_t & type)1392 RetError AccessibleAbilityManagerServiceProxy::GetDaltonizationColorFilter(uint32_t &type)
1393 {
1394     HILOG_DEBUG();
1395     MessageParcel data;
1396     MessageParcel reply;
1397     MessageOption option;
1398 
1399     if (!WriteInterfaceToken(data)) {
1400         HILOG_ERROR("fail, connection write Token");
1401         return RET_ERR_IPC_FAILED;
1402     }
1403     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_DALTONIZATION_COLORFILTER,
1404         data, reply, option)) {
1405         HILOG_ERROR("GetDaltonizationColorFilter fail");
1406         return RET_ERR_IPC_FAILED;
1407     }
1408     RetError ret = static_cast<RetError>(reply.ReadInt32());
1409     if (ret == RET_OK) {
1410         type = reply.ReadUint32();
1411     }
1412     return ret;
1413 }
1414 
GetContentTimeout(uint32_t & timer)1415 RetError AccessibleAbilityManagerServiceProxy::GetContentTimeout(uint32_t &timer)
1416 {
1417     HILOG_DEBUG();
1418     MessageParcel data;
1419     MessageParcel reply;
1420     MessageOption option;
1421 
1422     if (!WriteInterfaceToken(data)) {
1423         HILOG_ERROR("fail, connection write Token");
1424         return RET_ERR_IPC_FAILED;
1425     }
1426     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_CONTENT_TIMEOUT,
1427         data, reply, option)) {
1428         HILOG_ERROR("GetContentTimeout fail");
1429         return RET_ERR_IPC_FAILED;
1430     }
1431     RetError ret = static_cast<RetError>(reply.ReadInt32());
1432     if (ret == RET_OK) {
1433         timer = reply.ReadUint32();
1434     }
1435     return ret;
1436 }
1437 
GetBrightnessDiscount(float & brightness)1438 RetError AccessibleAbilityManagerServiceProxy::GetBrightnessDiscount(float &brightness)
1439 {
1440     HILOG_DEBUG();
1441     MessageParcel data;
1442     MessageParcel reply;
1443     MessageOption option;
1444 
1445     if (!WriteInterfaceToken(data)) {
1446         HILOG_ERROR("fail, connection write Token");
1447         return RET_ERR_IPC_FAILED;
1448     }
1449     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_BRIGHTNESS_DISCOUNT,
1450         data, reply, option)) {
1451         HILOG_ERROR("GetBrightnessDiscount fail");
1452         return RET_ERR_IPC_FAILED;
1453     }
1454     RetError ret = static_cast<RetError>(reply.ReadInt32());
1455     if (ret == RET_OK) {
1456         brightness = reply.ReadFloat();
1457     }
1458     return ret;
1459 }
1460 
GetAudioBalance(float & balance)1461 RetError AccessibleAbilityManagerServiceProxy::GetAudioBalance(float &balance)
1462 {
1463     HILOG_DEBUG();
1464     MessageParcel data;
1465     MessageParcel reply;
1466     MessageOption option;
1467 
1468     if (!WriteInterfaceToken(data)) {
1469         HILOG_ERROR("fail, connection write Token");
1470         return RET_ERR_IPC_FAILED;
1471     }
1472     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_AUDIO_BALANCE,
1473         data, reply, option)) {
1474         HILOG_ERROR("GetAudioBalance fail");
1475         return RET_ERR_IPC_FAILED;
1476     }
1477     RetError ret = static_cast<RetError>(reply.ReadInt32());
1478     if (ret == RET_OK) {
1479         balance = reply.ReadFloat();
1480     }
1481     return ret;
1482 }
1483 
GetClickResponseTime(uint32_t & time)1484 RetError AccessibleAbilityManagerServiceProxy::GetClickResponseTime(uint32_t& time)
1485 {
1486     HILOG_DEBUG();
1487     MessageParcel data;
1488     MessageParcel reply;
1489     MessageOption option;
1490 
1491     if (!WriteInterfaceToken(data)) {
1492         HILOG_ERROR("fail, connection write Token");
1493         return RET_ERR_IPC_FAILED;
1494     }
1495     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_CLICK_RESPONSE_TIME,
1496         data, reply, option)) {
1497         HILOG_ERROR("GetAudioBalance fail");
1498         return RET_ERR_IPC_FAILED;
1499     }
1500     RetError ret = static_cast<RetError>(reply.ReadInt32());
1501     if (ret == RET_OK) {
1502         time = reply.ReadUint32();
1503     }
1504     return ret;
1505 }
1506 
GetIgnoreRepeatClickState(bool & state)1507 RetError AccessibleAbilityManagerServiceProxy::GetIgnoreRepeatClickState(bool& state)
1508 {
1509     HILOG_DEBUG();
1510     MessageParcel data;
1511     MessageParcel reply;
1512     MessageOption option;
1513 
1514     if (!WriteInterfaceToken(data)) {
1515         HILOG_ERROR("fail, connection write Token");
1516         return RET_ERR_IPC_FAILED;
1517     }
1518     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_STATE,
1519         data, reply, option)) {
1520         HILOG_ERROR("GetAudioBalance fail");
1521         return RET_ERR_IPC_FAILED;
1522     }
1523     RetError ret = static_cast<RetError>(reply.ReadInt32());
1524     if (ret == RET_OK) {
1525         state = reply.ReadBool();
1526     }
1527     return ret;
1528 }
1529 
GetIgnoreRepeatClickTime(uint32_t & time)1530 RetError AccessibleAbilityManagerServiceProxy::GetIgnoreRepeatClickTime(uint32_t& time)
1531 {
1532     HILOG_DEBUG();
1533     MessageParcel data;
1534     MessageParcel reply;
1535     MessageOption option;
1536 
1537     if (!WriteInterfaceToken(data)) {
1538         HILOG_ERROR("fail, connection write Token");
1539         return RET_ERR_IPC_FAILED;
1540     }
1541     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_TIME,
1542         data, reply, option)) {
1543         HILOG_ERROR("GetAudioBalance fail");
1544         return RET_ERR_IPC_FAILED;
1545     }
1546     RetError ret = static_cast<RetError>(reply.ReadInt32());
1547     if (ret == RET_OK) {
1548         time = reply.ReadUint32();
1549     }
1550     return ret;
1551 }
1552 
GetAllConfigs(AccessibilityConfigData & configData)1553 void AccessibleAbilityManagerServiceProxy::GetAllConfigs(AccessibilityConfigData& configData)
1554 {
1555     HILOG_DEBUG();
1556     MessageParcel data;
1557     MessageParcel reply;
1558     MessageOption option;
1559 
1560     if (!WriteInterfaceToken(data)) {
1561         HILOG_ERROR("fail, connection write Token");
1562         return;
1563     }
1564     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ALL_CONFIGS,
1565         data, reply, option)) {
1566         HILOG_ERROR("GetAllConfigs fail");
1567         return;
1568     }
1569 
1570     RetError ret = static_cast<RetError>(reply.ReadInt32());
1571     if (ret != RET_OK) {
1572         HILOG_ERROR("GetAllConfigs failed %{public}d", ret);
1573         return;
1574     }
1575     std::vector<std::string> tmpMultiTarget;
1576     configData.highContrastText_ = reply.ReadBool();
1577     configData.invertColor_ = reply.ReadBool();
1578     configData.animationOff_ = reply.ReadBool();
1579     configData.audioMono_ = reply.ReadBool();
1580     configData.mouseKey_ = reply.ReadBool();
1581     configData.captionState_ = reply.ReadBool();
1582     configData.screenMagnifier_ = reply.ReadBool();
1583     configData.shortkey_ = reply.ReadBool();
1584     configData.mouseAutoClick_ = reply.ReadInt32();
1585     configData.daltonizationState_ = reply.ReadBool();
1586     configData.daltonizationColorFilter_ = reply.ReadUint32();
1587     configData.contentTimeout_ = reply.ReadUint32();
1588     configData.brightnessDiscount_ = reply.ReadFloat();
1589     configData.audioBalance_ = reply.ReadFloat();
1590     configData.shortkeyTarget_ = reply.ReadString();
1591     configData.captionProperty_ = *reply.ReadStrongParcelable<CaptionPropertyParcel>();
1592     reply.ReadStringVector(&tmpMultiTarget);
1593     configData.shortkeyMultiTarget_ = tmpMultiTarget;
1594 }
1595 
RegisterEnableAbilityListsObserver(const sptr<IAccessibilityEnableAbilityListsObserver> & observer)1596 void AccessibleAbilityManagerServiceProxy::RegisterEnableAbilityListsObserver(
1597     const sptr<IAccessibilityEnableAbilityListsObserver> &observer)
1598 {
1599     HILOG_DEBUG();
1600     MessageParcel data;
1601     MessageParcel reply;
1602     MessageOption option(MessageOption::TF_ASYNC);
1603 
1604     if (observer == nullptr) {
1605         HILOG_ERROR("observer is nullptr");
1606         return;
1607     }
1608 
1609     if (!WriteInterfaceToken(data)) {
1610         HILOG_ERROR("write interface token error");
1611         return;
1612     }
1613 
1614     if (!data.WriteRemoteObject(observer->AsObject())) {
1615         HILOG_ERROR("observer write remote object error");
1616         return;
1617     }
1618 
1619     if (!SendTransactCmd(AccessibilityInterfaceCode::REGISTER_ENABLE_ABILITY_LISTS_OBSERVER,
1620         data, reply, option)) {
1621         HILOG_ERROR("RegisterEnableAbilityListsObserver fail");
1622         return;
1623     }
1624 }
1625 
RegisterConfigObserver(const sptr<IAccessibleAbilityManagerConfigObserver> & client)1626 uint32_t AccessibleAbilityManagerServiceProxy::RegisterConfigObserver(
1627     const sptr<IAccessibleAbilityManagerConfigObserver> &client)
1628 {
1629     HILOG_DEBUG();
1630     MessageParcel data;
1631     MessageParcel reply;
1632     MessageOption option(MessageOption::TF_SYNC);
1633 
1634     if (client == nullptr) {
1635         HILOG_ERROR("RegisterConfigObserver fail, Input client is null");
1636         return TRANSACTION_ERR;
1637     }
1638 
1639     if (!WriteInterfaceToken(data)) {
1640         HILOG_ERROR("RegisterConfigObserver fail, connection write Token error");
1641         return TRANSACTION_ERR;
1642     }
1643 
1644     if (!data.WriteRemoteObject(client->AsObject())) {
1645         HILOG_ERROR("RegisterConfigObserver fail, connection write client error");
1646         return TRANSACTION_ERR;
1647     }
1648 
1649     if (!SendTransactCmd(AccessibilityInterfaceCode::REGISTER_CONFIG_CALLBACK,
1650         data, reply, option)) {
1651         HILOG_ERROR("RegisterStateCallback fail");
1652         return TRANSACTION_ERR;
1653     }
1654 
1655     return reply.ReadUint32();
1656 }
1657 
GetRealWindowAndElementId(int32_t & windowId,int64_t & elementId)1658 void AccessibleAbilityManagerServiceProxy::GetRealWindowAndElementId(int32_t& windowId, int64_t& elementId)
1659 {
1660     HILOG_DEBUG();
1661     MessageParcel data;
1662     MessageParcel reply;
1663     MessageOption option(MessageOption::TF_SYNC);
1664 
1665     if (!WriteInterfaceToken(data)) {
1666         HILOG_ERROR("write Token fail");
1667         return;
1668     }
1669 
1670     if (!data.WriteInt32(windowId)) {
1671         HILOG_ERROR("write windowId fail");
1672         return;
1673     }
1674 
1675     if (!data.WriteInt64(elementId)) {
1676         HILOG_ERROR("write elementId fail");
1677         return;
1678     }
1679 
1680     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_WINDOW_AND_ELEMENT_ID,
1681         data, reply, option)) {
1682         HILOG_ERROR("GetRealWindowAndElementId fail");
1683         return;
1684     }
1685 
1686     windowId = reply.ReadInt32();
1687     elementId = reply.ReadInt64();
1688 }
1689 
GetSceneBoardInnerWinId(int32_t windowId,int64_t elementId,int32_t & innerWid)1690 void AccessibleAbilityManagerServiceProxy::GetSceneBoardInnerWinId(int32_t windowId, int64_t elementId,
1691     int32_t& innerWid)
1692 {
1693     HILOG_DEBUG();
1694     MessageParcel data;
1695     MessageParcel reply;
1696     MessageOption option(MessageOption::TF_SYNC);
1697 
1698     if (!WriteInterfaceToken(data)) {
1699         HILOG_ERROR("write Token fail");
1700         return;
1701     }
1702 
1703     if (!data.WriteInt32(windowId)) {
1704         HILOG_ERROR("write windowId fail");
1705         return;
1706     }
1707 
1708     if (!data.WriteInt64(elementId)) {
1709         HILOG_ERROR("write elementId fail");
1710         return;
1711     }
1712 
1713     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_SCENE_BOARD_INNER_WINDOW_ID,
1714         data, reply, option)) {
1715         HILOG_ERROR("GetSceneBoardInnerWinId fail");
1716         return;
1717     }
1718 
1719     innerWid = reply.ReadInt32();
1720 }
1721 
GetFocusedWindowId(int32_t & focusedWindowId)1722 RetError AccessibleAbilityManagerServiceProxy::GetFocusedWindowId(int32_t &focusedWindowId)
1723 {
1724     HILOG_DEBUG();
1725     MessageParcel data;
1726     MessageParcel reply;
1727     MessageOption option;
1728     if (!WriteInterfaceToken(data)) {
1729         HILOG_ERROR("write token fail");
1730         return RET_ERR_IPC_FAILED;
1731     }
1732 
1733     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_FOCUSED_WINDOW_ID, data, reply, option)) {
1734         HILOG_ERROR("GetFocusedWindowId fail");
1735         return RET_ERR_IPC_FAILED;
1736     }
1737 
1738     focusedWindowId = reply.ReadInt32();
1739     return RET_OK;
1740 }
1741 
RemoveRequestId(int32_t requestId)1742 void AccessibleAbilityManagerServiceProxy::RemoveRequestId(int32_t requestId)
1743 {
1744     HILOG_DEBUG();
1745     MessageParcel data;
1746     MessageParcel reply;
1747     MessageOption option;
1748     if (!WriteInterfaceToken(data)) {
1749         HILOG_ERROR("write token fail");
1750         return;
1751     }
1752 
1753     if (!data.WriteInt32(requestId)) {
1754         HILOG_ERROR("write requestId fail");
1755         return;
1756     }
1757 
1758     if (!SendTransactCmd(AccessibilityInterfaceCode::REMOVE_REQUEST_ID, data, reply, option)) {
1759         HILOG_ERROR("GetFocusedWindowId fail");
1760         return;
1761     }
1762     return;
1763 }
1764 
GetRootParentId(int32_t windowsId,int32_t treeId)1765 int64_t AccessibleAbilityManagerServiceProxy::GetRootParentId(int32_t windowsId, int32_t treeId)
1766 {
1767     HILOG_DEBUG();
1768     MessageParcel data;
1769     MessageParcel reply;
1770     MessageOption option;
1771     if (!WriteInterfaceToken(data)) {
1772         HILOG_ERROR("write token fail");
1773         return false;
1774     }
1775 
1776     if (!data.WriteInt32(windowsId)) {
1777         HILOG_ERROR("write windowsId fail");
1778         return RET_ERR_IPC_FAILED;
1779     }
1780 
1781     if (!data.WriteInt32(treeId)) {
1782         HILOG_ERROR("write treeId fail");
1783         return RET_ERR_IPC_FAILED;
1784     }
1785 
1786     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ROOT_PARENT_ID, data, reply, option)) {
1787         HILOG_ERROR("GetRootParentId fail");
1788         return false;
1789     }
1790     return reply.ReadInt64();
1791 }
1792 
GetAllTreeId(int32_t windowId,std::vector<int32_t> & treeIds)1793 RetError AccessibleAbilityManagerServiceProxy::GetAllTreeId(int32_t windowId, std::vector<int32_t> &treeIds)
1794 {
1795     HILOG_DEBUG();
1796     MessageParcel data;
1797     MessageParcel reply;
1798     MessageOption option;
1799 
1800     if (!WriteInterfaceToken(data)) {
1801         HILOG_ERROR("fail, connection write Token error");
1802         return RET_ERR_IPC_FAILED;
1803     }
1804 
1805     if (!data.WriteInt32(windowId)) {
1806         HILOG_ERROR("write windowId fail");
1807         return RET_ERR_IPC_FAILED;
1808     }
1809 
1810     if (!SendTransactCmd(AccessibilityInterfaceCode::GET_ALL_TREE_ID,
1811         data, reply, option)) {
1812         HILOG_ERROR("GetAllTreeId fail");
1813         return RET_ERR_IPC_FAILED;
1814     }
1815     RetError result = static_cast<RetError>(reply.ReadInt32());
1816     if (result == RET_OK) {
1817         int32_t treeIdSize = reply.ReadInt32();
1818         if (treeIdSize < 0 || treeIdSize > TREE_ID_MAX) {
1819             HILOG_ERROR("treeIdSize is invalid, treeIdSize: %{public}d", treeIdSize);
1820             return RET_ERR_INVALID_PARAM;
1821         }
1822         for (int32_t i = 0; i < treeIdSize; i++) {
1823             treeIds.emplace_back(reply.ReadInt32());
1824         }
1825     }
1826     return result;
1827 }
1828 } // namespace Accessibility
1829 } // namespace OHOS