• 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_channel_client.h"
17 
18 #include <cinttypes>
19 #include <hitrace_meter.h>
20 #include "accessibility_element_operator_callback_impl.h"
21 #include "hilog_wrapper.h"
22 
23 namespace OHOS {
24 namespace Accessibility {
25 namespace {
26     constexpr uint32_t TIME_OUT_OPERATOR = 5000;
27     constexpr int32_t REQUEST_ID_MAX = 0x0000FFFF;
28 } // namespace
29 
GenerateRequestId()30 int32_t AccessibleAbilityChannelClient::GenerateRequestId()
31 {
32     int32_t requestId = requestId_++;
33     requestId = requestId % REQUEST_ID_MAX;
34 
35     return requestId;
36 }
37 
GetRemote()38 sptr<IRemoteObject> AccessibleAbilityChannelClient::GetRemote()
39 {
40     return proxy_->AsObject();
41 }
42 
SetOnKeyPressEventResult(const bool handled,const int32_t sequence)43 void AccessibleAbilityChannelClient::SetOnKeyPressEventResult(const bool handled, const int32_t sequence)
44 {
45     HILOG_INFO("[channelId:%{public}d]", channelId_);
46     if (proxy_) {
47         proxy_->SetOnKeyPressEventResult(handled, sequence);
48     } else {
49         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
50     }
51 }
52 
FindFocusedElementInfo(int32_t accessibilityWindowId,int64_t elementId,int32_t focusType,AccessibilityElementInfo & elementInfo)53 RetError AccessibleAbilityChannelClient::FindFocusedElementInfo(int32_t accessibilityWindowId,
54     int64_t elementId, int32_t focusType, AccessibilityElementInfo &elementInfo)
55 {
56     HILOG_DEBUG("[channelId:%{public}d]", channelId_);
57     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "FindFocusedElement");
58     if (proxy_ == nullptr) {
59         HILOG_ERROR("FindFocusedElementInfo Failed to connect to aams [channelId:%{public}d]",
60             channelId_);
61         return RET_ERR_SAMGR;
62     }
63 
64     int32_t requestId = GenerateRequestId();
65     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
66         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
67     if (elementOperator == nullptr) {
68         HILOG_ERROR("FindFocusedElementInfo Failed to create elementOperator.");
69         return RET_ERR_NULLPTR;
70     }
71     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
72 
73     int32_t windowId = accessibilityWindowId;
74     if (accessibilityWindowId == ANY_WINDOW_ID && focusType == FOCUS_TYPE_ACCESSIBILITY &&
75         accessibilityFocusedWindowId_ != INVALID_WINDOW_ID) {
76         windowId = accessibilityFocusedWindowId_;
77         HILOG_INFO("Convert into accessibility focused window id[%{public}d]", windowId);
78     }
79 
80     RetError ret = proxy_->FindFocusedElementInfo(windowId,
81         elementId, focusType, requestId, elementOperator);
82     if (ret != RET_OK) {
83         HILOG_ERROR("FindFocusedElementInfo failed. ret[%{public}d]", ret);
84         return ret;
85     }
86     HILOG_DEBUG("channelId:%{public}d, windowId:%{public}d, elementId:%{public}" PRId64 ", focusType:%{public}d",
87         channelId_, windowId, elementId, focusType);
88 
89     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
90     if (wait != ffrt::future_status::ready) {
91         HILOG_ERROR("FindFocusedElementInfo Failed to wait result");
92         return RET_ERR_TIME_OUT;
93     }
94 
95     if (elementOperator->accessibilityInfoResult_.GetAccessibilityId() ==
96         AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID) {
97         HILOG_ERROR("FindFocusedElementInfo The elementInfo from ace is wrong");
98         return RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE;
99     }
100     HILOG_INFO("Get result successfully from ace.");
101 
102     elementInfo = elementOperator->accessibilityInfoResult_;
103     elementInfo.SetMainWindowId(windowId);
104     return RET_OK;
105 }
106 
SendSimulateGesture(const std::shared_ptr<AccessibilityGestureInjectPath> & gesturePath)107 RetError AccessibleAbilityChannelClient::SendSimulateGesture(
108     const std::shared_ptr<AccessibilityGestureInjectPath> &gesturePath)
109 {
110     HILOG_INFO("[channelId:%{public}d]", channelId_);
111     if (proxy_) {
112         return proxy_->SendSimulateGesture(gesturePath);
113     } else {
114         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
115         return RET_ERR_SAMGR;
116     }
117 }
118 
GetCursorPosition(int32_t accessibilityWindowId,int64_t elementId,int32_t & position)119 RetError AccessibleAbilityChannelClient::GetCursorPosition(
120     int32_t accessibilityWindowId, int64_t elementId, int32_t &position)
121 {
122     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "GetCursorPosition");
123     if (proxy_ == nullptr) {
124         HILOG_ERROR("GetCursorPosition Failed to connect to aams [channelId:%{public}d]",
125             channelId_);
126         return RET_ERR_SAMGR;
127     }
128 
129     int32_t requestId = GenerateRequestId();
130     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
131         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
132     if (elementOperator == nullptr) {
133         HILOG_ERROR("GetCursorPosition Failed to create elementOperator.");
134         return RET_ERR_NULLPTR;
135     }
136     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
137 
138     RetError ret = proxy_->GetCursorPosition(accessibilityWindowId, elementId, requestId, elementOperator);
139     if (ret != RET_OK) {
140         HILOG_ERROR("ExecuteAction failed. ret[%{public}d]", ret);
141         return ret;
142     }
143 
144     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
145     if (wait != ffrt::future_status::ready) {
146         HILOG_ERROR("GetCursorPosition Failed to wait result");
147         return RET_ERR_TIME_OUT;
148     }
149 
150     position = elementOperator->CursorPosition_;
151     HILOG_INFO("position%{public}d", position);
152     return RET_OK;
153 }
154 
ExecuteAction(int32_t accessibilityWindowId,int64_t elementId,int32_t action,const std::map<std::string,std::string> & actionArguments)155 RetError AccessibleAbilityChannelClient::ExecuteAction(int32_t accessibilityWindowId,
156     int64_t elementId, int32_t action, const std::map<std::string, std::string> &actionArguments)
157 {
158     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "ExecuteAction");
159     if (proxy_ == nullptr) {
160         HILOG_ERROR("ExecuteAction Failed to connect to aams [channelId:%{public}d]", channelId_);
161         return RET_ERR_SAMGR;
162     }
163     if (action == ActionType::ACCESSIBILITY_ACTION_ACCESSIBILITY_FOCUS &&
164         accessibilityFocusedElementId_ != INVALID_WINDOW_ID && accessibilityFocusedWindowId_ != INVALID_WINDOW_ID) {
165         ExecuteAction(accessibilityFocusedWindowId_, accessibilityFocusedElementId_,
166             ActionType::ACCESSIBILITY_ACTION_CLEAR_ACCESSIBILITY_FOCUS, actionArguments);
167     }
168 
169     int32_t requestId = GenerateRequestId();
170     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
171         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
172     if (elementOperator == nullptr) {
173         HILOG_ERROR("ExecuteAction Failed to create elementOperator.");
174         return RET_ERR_NULLPTR;
175     }
176     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
177 
178     RetError ret = proxy_->ExecuteAction(accessibilityWindowId,
179         elementId, action, actionArguments, requestId, elementOperator);
180     if (ret != RET_OK) {
181         HILOG_ERROR("ExecuteAction failed. action[%{public}d], ret[%{public}d]", action, ret);
182         return ret;
183     }
184 
185     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
186     if (wait != ffrt::future_status::ready) {
187         HILOG_ERROR("execute action: %{public}d failed to wait result", action);
188         return RET_ERR_TIME_OUT;
189     }
190     HILOG_INFO("action:[%{public}d], executeActionResult_[%{public}d], elementId:%{public}" PRId64 "",
191         action, elementOperator->executeActionResult_, elementId);
192 
193     if (elementOperator->executeActionResult_) {
194         switch (action) {
195             case ActionType::ACCESSIBILITY_ACTION_ACCESSIBILITY_FOCUS:
196                 accessibilityFocusedWindowId_ = accessibilityWindowId;
197                 accessibilityFocusedElementId_ = elementId;
198                 break;
199             case ActionType::ACCESSIBILITY_ACTION_CLEAR_ACCESSIBILITY_FOCUS:
200                 accessibilityFocusedWindowId_ = INVALID_WINDOW_ID;
201                 accessibilityFocusedElementId_ = INVALID_WINDOW_ID;
202                 break;
203             default:
204                 break;
205         }
206     }
207     return elementOperator->executeActionResult_ ? RET_OK : RET_ERR_PERFORM_ACTION_FAILED_BY_ACE;
208 }
209 
EnableScreenCurtain(bool isEnable)210 RetError AccessibleAbilityChannelClient::EnableScreenCurtain(bool isEnable)
211 {
212     HILOG_INFO("[channelId:%{public}d]", channelId_);
213     if (proxy_ == nullptr) {
214         HILOG_ERROR("EnableScreenCurtain Failed to connect to aams [channelId:%{public}d]", channelId_);
215         return RET_ERR_SAMGR;
216     }
217     return  proxy_->EnableScreenCurtain(isEnable);
218 }
219 
SearchElementInfosByAccessibilityId(int32_t accessibilityWindowId,int64_t elementId,int32_t mode,std::vector<AccessibilityElementInfo> & elementInfos,int32_t treeId,bool isFilter)220 RetError AccessibleAbilityChannelClient::SearchElementInfosByAccessibilityId(int32_t accessibilityWindowId,
221     int64_t elementId, int32_t mode, std::vector<AccessibilityElementInfo> &elementInfos, int32_t treeId,
222     bool isFilter)
223 {
224     int32_t requestId = GenerateRequestId();
225     HILOG_DEBUG("channelId:%{public}d, elementId:%{public}" PRId64 ", windowId:%{public}d, requestId:%{public}d",
226         channelId_, elementId, accessibilityWindowId, requestId);
227     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "SearchElementById");
228     if (proxy_ == nullptr) {
229         HILOG_ERROR("SearchElementInfosByAccessibilityId Failed to connect to aams [channelId:%{public}d]",
230             channelId_);
231         return RET_ERR_SAMGR;
232     }
233 
234     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
235         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
236     if (elementOperator == nullptr) {
237         HILOG_ERROR("SearchElementInfosByAccessibilityId Failed to create elementOperator.");
238         return RET_ERR_NULLPTR;
239     }
240     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
241     ElementBasicInfo elementBasicInfo {};
242     elementBasicInfo.windowId = accessibilityWindowId;
243     elementBasicInfo.treeId = treeId;
244     elementBasicInfo.elementId = elementId;
245 
246     RetError ret = proxy_->SearchElementInfoByAccessibilityId(elementBasicInfo, requestId,
247         elementOperator, mode, isFilter);
248     if (ret != RET_OK) {
249         HILOG_ERROR("searchElement failed. ret: %{public}d. elementId: %{public}" PRId64 ", requestId :[%{public}d]",
250             ret, elementId, requestId);
251         return ret;
252     }
253 
254     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
255     if (wait != ffrt::future_status::ready) {
256         HILOG_ERROR("SearchElementInfosByAccessibilityId Failed to wait result");
257         return RET_ERR_TIME_OUT;
258     }
259 
260     for (auto &info : elementOperator->elementInfosResult_) {
261         if (info.GetAccessibilityId() == AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID) {
262             HILOG_ERROR("SearchElementInfosByAccessibilityId The elementInfo from ace is wrong");
263             return RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE;
264         }
265     }
266     HILOG_DEBUG("Get result successfully from ace. size[%{public}zu]", elementOperator->elementInfosResult_.size());
267     elementInfos = elementOperator->elementInfosResult_;
268     if (!elementInfos.empty()) {
269         for (auto &element : elementInfos) {
270             element.SetMainWindowId(accessibilityWindowId);
271         }
272     }
273     return RET_OK;
274 }
275 
SearchDefaultFocusedByWindowId(int32_t accessibilityWindowId,int64_t elementId,int32_t mode,std::vector<AccessibilityElementInfo> & elementInfos,int32_t treeId,bool isFilter)276 RetError AccessibleAbilityChannelClient::SearchDefaultFocusedByWindowId(int32_t accessibilityWindowId,
277     int64_t elementId, int32_t mode, std::vector<AccessibilityElementInfo> &elementInfos, int32_t treeId, bool isFilter)
278 {
279     int32_t requestId = GenerateRequestId();
280     HILOG_DEBUG("channelId:%{public}d, windowId:%{public}d, requestId:%{public}d",
281         channelId_, accessibilityWindowId, requestId);
282     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "SearchDefaultFocusedByWindowId");
283     if (proxy_ == nullptr) {
284         HILOG_ERROR("SearchDefaultFocusedByWindowId Failed to connect to aams [channelId:%{public}d]",
285             channelId_);
286         return RET_ERR_SAMGR;
287     }
288 
289     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
290         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
291     if (elementOperator == nullptr) {
292         HILOG_ERROR("SearchDefaultFocusedByWindowId Failed to create elementOperator.");
293         return RET_ERR_NULLPTR;
294     }
295     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
296     ElementBasicInfo elementBasicInfo {};
297     elementBasicInfo.windowId = accessibilityWindowId;
298     elementBasicInfo.elementId = elementId;
299     elementBasicInfo.treeId = treeId;
300 
301     RetError ret = proxy_->SearchDefaultFocusedByWindowId(elementBasicInfo, requestId,
302         elementOperator, mode, isFilter);
303     if (ret != RET_OK) {
304         HILOG_ERROR("search default focus failed. ret: %{public}d, requestId :[%{public}d]",
305             ret, requestId);
306         return ret;
307     }
308 
309     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
310     if (wait != ffrt::future_status::ready) {
311         HILOG_ERROR("SearchDefaultFocusedByWindowId Failed to wait result");
312         return RET_ERR_TIME_OUT;
313     }
314 
315     for (auto &info : elementOperator->elementInfosResult_) {
316         if (info.GetAccessibilityId() == AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID) {
317             HILOG_ERROR("SearchDefaultFocusedByWindowId The elementInfo from ace is wrong");
318             return RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE;
319         }
320     }
321     elementInfos = elementOperator->elementInfosResult_;
322     HILOG_DEBUG("Get result successfully from arkUI elementInfos size[%{public}zu]", elementInfos.size());
323     return RET_OK;
324 }
325 
GetWindow(const int32_t windowId,AccessibilityWindowInfo & windowInfo)326 RetError AccessibleAbilityChannelClient::GetWindow(const int32_t windowId, AccessibilityWindowInfo &windowInfo)
327 {
328     HILOG_DEBUG("[channelId:%{public}d] [windowId:%{public}d]", channelId_, windowId);
329     HITRACE_METER(HITRACE_TAG_ACCESSIBILITY_MANAGER);
330     if (proxy_ == nullptr) {
331         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
332         return RET_ERR_SAMGR;
333     }
334     return proxy_->GetWindow(windowId, windowInfo);
335 }
336 
GetWindows(std::vector<AccessibilityWindowInfo> & windows)337 RetError AccessibleAbilityChannelClient::GetWindows(std::vector<AccessibilityWindowInfo> &windows)
338 {
339     HILOG_DEBUG("[channelId:%{public}d]", channelId_);
340     HITRACE_METER(HITRACE_TAG_ACCESSIBILITY_MANAGER);
341     if (proxy_) {
342         return proxy_->GetWindows(windows);
343     } else {
344         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
345         return RET_ERR_SAMGR;
346     }
347 }
348 
GetWindows(const uint64_t displayId,std::vector<AccessibilityWindowInfo> & windows) const349 RetError AccessibleAbilityChannelClient::GetWindows(const uint64_t displayId,
350     std::vector<AccessibilityWindowInfo> &windows) const
351 {
352     HILOG_DEBUG("[channelId:%{public}d] [displayId:%{public}" PRIu64 "]", channelId_, displayId);
353     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "GetWindowsByDisplayId");
354     if (proxy_) {
355         return proxy_->GetWindowsByDisplayId(displayId, windows);
356     } else {
357         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
358         return RET_ERR_SAMGR;
359     }
360 }
361 
SearchElementInfosByText(int32_t accessibilityWindowId,int64_t elementId,const std::string & text,std::vector<AccessibilityElementInfo> & elementInfos)362 RetError AccessibleAbilityChannelClient::SearchElementInfosByText(int32_t accessibilityWindowId,
363     int64_t elementId, const std::string &text, std::vector<AccessibilityElementInfo> &elementInfos)
364 {
365     HILOG_DEBUG("[channelId:%{public}d]", channelId_);
366     HITRACE_METER_NAME(HITRACE_TAG_ACCESSIBILITY_MANAGER, "SearchElementByText");
367     if (proxy_ == nullptr) {
368         HILOG_ERROR("SearchElementInfosByText Failed to connect to aams [channelId:%{public}d]",
369             channelId_);
370         return RET_ERR_SAMGR;
371     }
372 
373     int32_t requestId = GenerateRequestId();
374     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
375         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
376     if (elementOperator == nullptr) {
377         HILOG_ERROR("SearchElementInfosByText Failed to create elementOperator.");
378         return RET_ERR_NULLPTR;
379     }
380     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
381 
382     RetError ret = proxy_->SearchElementInfosByText(accessibilityWindowId,
383         elementId, text, requestId, elementOperator);
384     if (ret != RET_OK) {
385         HILOG_ERROR("SearchElementInfosByText failed. ret[%{public}d]", ret);
386         return ret;
387     }
388 
389     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
390     if (wait != ffrt::future_status::ready) {
391         HILOG_ERROR("SearchElementInfosByText Failed to wait result");
392         return RET_ERR_TIME_OUT;
393     }
394 
395     for (auto &info : elementOperator->elementInfosResult_) {
396         if (info.GetAccessibilityId() == AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID) {
397             HILOG_ERROR("SearchElementInfosByText The elementInfo from ace is wrong");
398             return RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE;
399         }
400     }
401     HILOG_INFO("Get result successfully from ace. size[%{public}zu]", elementOperator->elementInfosResult_.size());
402     elementInfos = elementOperator->elementInfosResult_;
403     return RET_OK;
404 }
405 
FocusMoveSearch(int32_t accessibilityWindowId,int64_t elementId,int32_t direction,AccessibilityElementInfo & elementInfo)406 RetError AccessibleAbilityChannelClient::FocusMoveSearch(int32_t accessibilityWindowId,
407     int64_t elementId, int32_t direction, AccessibilityElementInfo &elementInfo)
408 {
409     HILOG_DEBUG("[channelId:%{public}d]", channelId_);
410     if (proxy_ == nullptr) {
411         HILOG_ERROR("FocusMoveSearch Failed to connect to aams [channelId:%{public}d]", channelId_);
412         return RET_ERR_SAMGR;
413     }
414 
415     int32_t requestId = GenerateRequestId();
416     sptr<AccessibilityElementOperatorCallbackImpl> elementOperator =
417         new(std::nothrow) AccessibilityElementOperatorCallbackImpl();
418     if (elementOperator == nullptr) {
419         HILOG_ERROR("FocusMoveSearch Failed to create elementOperator.");
420         return RET_ERR_NULLPTR;
421     }
422     ffrt::future<void> promiseFuture = elementOperator->promise_.get_future();
423 
424     RetError ret = proxy_->FocusMoveSearch(accessibilityWindowId, elementId, direction, requestId, elementOperator);
425     if (ret != RET_OK) {
426         HILOG_ERROR("FocusMoveSearch failed. ret[%{public}d]", ret);
427         return ret;
428     }
429 
430     ffrt::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
431     if (wait != ffrt::future_status::ready) {
432         HILOG_ERROR("FocusMoveSearch Failed to wait result");
433         return RET_ERR_TIME_OUT;
434     }
435 
436     if (elementOperator->accessibilityInfoResult_.GetAccessibilityId() ==
437         AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID) {
438         HILOG_ERROR("FocusMoveSearch The elementInfo from ace is wrong");
439         return RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE;
440     }
441 
442     HILOG_INFO("Get result successfully from ace");
443     elementInfo = elementOperator->accessibilityInfoResult_;
444     return RET_OK;
445 }
446 
SetTargetBundleName(const std::vector<std::string> & targetBundleNames)447 RetError AccessibleAbilityChannelClient::SetTargetBundleName(const std::vector<std::string> &targetBundleNames)
448 {
449     HILOG_INFO("[channelId:%{public}d]", channelId_);
450     if (proxy_) {
451         return proxy_->SetTargetBundleName(targetBundleNames);
452     } else {
453         HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_);
454         return RET_ERR_SAMGR;
455     }
456 }
457 } // namespace Accessibility
458 } // namespace OHOS
459