• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-2024 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_input_interceptor.h"
17 #include "accessibility_keyevent_filter.h"
18 #include "accessibility_mouse_autoclick.h"
19 #include "accessibility_short_key.h"
20 #include "accessibility_screen_touch.h"
21 #include "accessibility_touch_exploration.h"
22 #include "accessibility_touchEvent_injector.h"
23 #include "accessibility_zoom_gesture.h"
24 #include "window_magnification_gesture.h"
25 #include "accessible_ability_manager_service.h"
26 #include "hilog_wrapper.h"
27 #include "key_event.h"
28 #include "input_event.h"
29 #ifdef ACCESSIBILITY_WATCH_FEATURE
30 #include "res_type.h"
31 #include "res_sched_client.h"
32 #endif // ACCESSIBILITY_WATCH_FEATURE
33 
34 namespace OHOS {
35 namespace Accessibility {
36 sptr<AccessibilityInputInterceptor> AccessibilityInputInterceptor::instance_ = nullptr;
GetInstance()37 sptr<AccessibilityInputInterceptor> AccessibilityInputInterceptor::GetInstance()
38 {
39     HILOG_DEBUG();
40 
41     if (!instance_) {
42         instance_ = new(std::nothrow) AccessibilityInputInterceptor();
43         if (!instance_) {
44             HILOG_ERROR("instance_ is null");
45             return nullptr;
46         }
47     }
48     return instance_;
49 }
50 
AccessibilityInputInterceptor()51 AccessibilityInputInterceptor::AccessibilityInputInterceptor()
52 {
53     HILOG_DEBUG();
54 
55     inputManager_ = MMI::InputManager::GetInstance();
56     eventHandler_ = std::make_shared<AppExecFwk::EventHandler>(
57         Singleton<AccessibleAbilityManagerService>::GetInstance().GetInputManagerRunner());
58 }
59 
~AccessibilityInputInterceptor()60 AccessibilityInputInterceptor::~AccessibilityInputInterceptor()
61 {
62     HILOG_DEBUG();
63 
64     availableFunctions_ = 0;
65     DestroyInterceptor();
66     DestroyTransmitters();
67     inputManager_ = nullptr;
68     inputEventConsumer_ = nullptr;
69 }
70 
OnKeyEvent(MMI::KeyEvent & event)71 bool AccessibilityInputInterceptor::OnKeyEvent(MMI::KeyEvent &event)
72 {
73     HILOG_DEBUG();
74 
75     event.AddFlag(MMI::InputEvent::EVENT_FLAG_NO_INTERCEPT);
76     std::shared_ptr<MMI::KeyEvent> keyEvent = std::make_shared<MMI::KeyEvent>(event);
77     if (inputManager_) {
78         inputManager_->SimulateInputEvent(keyEvent);
79     } else {
80         HILOG_ERROR("inputManager_ is null.");
81     }
82     return true;
83 }
84 
OnPointerEvent(MMI::PointerEvent & event)85 bool AccessibilityInputInterceptor::OnPointerEvent(MMI::PointerEvent &event)
86 {
87     if (event.GetPointerAction() != MMI::PointerEvent::POINTER_ACTION_MOVE &&
88         event.GetPointerAction() != MMI::PointerEvent::POINTER_ACTION_HOVER_MOVE) {
89         HILOG_INFO("PointerAction:%{public}d, SourceType:%{public}d, PointerId:%{public}d",
90             event.GetPointerAction(), event.GetSourceType(), event.GetPointerId());
91     } else {
92         HILOG_DEBUG("PointerAction:%{public}d, SourceType:%{public}d, PointerId:%{public}d",
93             event.GetPointerAction(), event.GetSourceType(), event.GetPointerId());
94     }
95 
96     event.AddFlag(MMI::InputEvent::EVENT_FLAG_NO_INTERCEPT);
97     std::shared_ptr<MMI::PointerEvent> pointerEvent = std::make_shared<MMI::PointerEvent>(event);
98     if (inputManager_) {
99         inputManager_->SimulateInputEvent(pointerEvent);
100     } else {
101         HILOG_ERROR("inputManager_ is null.");
102     }
103     return true;
104 }
105 
OnMoveMouse(int32_t offsetX,int32_t offsetY)106 void AccessibilityInputInterceptor::OnMoveMouse(int32_t offsetX, int32_t offsetY)
107 {
108     HILOG_DEBUG("offsetX:%{public}d, offsetY:%{public}d", offsetX, offsetY);
109     if (inputManager_) {
110         inputManager_->MoveMouse(offsetX, offsetY);
111     } else {
112         HILOG_ERROR("inputManager_ is null.");
113     }
114 }
115 
SetAvailableFunctions(uint32_t availableFunctions)116 void AccessibilityInputInterceptor::SetAvailableFunctions(uint32_t availableFunctions)
117 {
118     HILOG_INFO("function[%{public}d].", availableFunctions);
119 
120     if (((availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION) != FEATURE_SCREEN_MAGNIFICATION) &&
121         (availableFunctions_ == availableFunctions) && ((availableFunctions & FEATURE_SCREEN_TOUCH) == 0)) {
122         return;
123     }
124     availableFunctions_ = availableFunctions;
125 
126     if (!eventHandler_) {
127         HILOG_ERROR("eventHandler is empty!");
128         return;
129     }
130     eventHandler_->PostTask([this] {
131         DestroyTransmitters();
132         CreateTransmitters();
133         UpdateInterceptor();
134     });
135 }
136 
CreateTransmitters()137 void AccessibilityInputInterceptor::CreateTransmitters()
138 {
139     HILOG_DEBUG("function[%{public}u].", availableFunctions_);
140 
141     if (!availableFunctions_) {
142         return;
143     }
144 
145     if ((availableFunctions_ & FEATURE_MOUSE_KEY) && (!mouseKey_)) {
146         mouseKey_ = new(std::nothrow) AccessibilityMouseKey();
147         if (mouseKey_) {
148             mouseKey_->SetNext(instance_);
149         }
150     }
151 
152     if ((availableFunctions_ & FEATURE_MOUSE_AUTOCLICK) ||
153         (availableFunctions_ & FEATURE_INJECT_TOUCH_EVENTS) ||
154         (availableFunctions_ & FEATURE_TOUCH_EXPLORATION) ||
155         (availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION) ||
156         (availableFunctions_ & FEATURE_SCREEN_TOUCH)) {
157         CreatePointerEventTransmitters();
158     }
159 
160     if (availableFunctions_ & FEATURE_FILTER_KEY_EVENTS) {
161         CreateKeyEventTransmitters();
162     }
163 }
164 
CreatePointerEventTransmitters()165 void AccessibilityInputInterceptor::CreatePointerEventTransmitters()
166 {
167     HILOG_DEBUG();
168 
169     sptr<EventTransmission> header = nullptr;
170     sptr<EventTransmission> current = nullptr;
171 
172     if (availableFunctions_& FEATURE_MOUSE_AUTOCLICK) {
173         sptr<AccessibilityMouseAutoclick> mouseAutoclick = new(std::nothrow) AccessibilityMouseAutoclick();
174         if (!mouseAutoclick) {
175             HILOG_ERROR("mouseAutoclick is null");
176             return;
177         }
178         SetNextEventTransmitter(header, current, mouseAutoclick);
179     }
180 
181     if (availableFunctions_& FEATURE_INJECT_TOUCH_EVENTS) {
182         sptr<TouchEventInjector> touchEventInjector = new(std::nothrow) TouchEventInjector();
183         if (!touchEventInjector) {
184             HILOG_ERROR("touchEventInjector is null");
185             return;
186         }
187         SetNextEventTransmitter(header, current, touchEventInjector);
188         Singleton<AccessibleAbilityManagerService>::GetInstance().SetTouchEventInjector(touchEventInjector);
189     }
190 
191     if (availableFunctions_& FEATURE_SCREEN_MAGNIFICATION) {
192         CreateMagnificationGesture(header, current);
193     } else {
194         ClearMagnificationGesture();
195     }
196 
197     if (availableFunctions_& FEATURE_TOUCH_EXPLORATION) {
198         sptr<TouchExploration> touchExploration = new(std::nothrow) TouchExploration();
199         if (!touchExploration) {
200             HILOG_ERROR("touchExploration is null");
201             return;
202         }
203         touchExploration->StartUp();
204         SetNextEventTransmitter(header, current, touchExploration);
205     }
206 
207     if ((availableFunctions_ & FEATURE_SCREEN_TOUCH) && ((availableFunctions_ & FEATURE_TOUCH_EXPLORATION) == 0)) {
208         sptr<AccessibilityScreenTouch> screenTouch = new(std::nothrow) AccessibilityScreenTouch();
209         if (!screenTouch) {
210             HILOG_ERROR("screenTouch is null");
211             return;
212         }
213         SetNextEventTransmitter(header, current, screenTouch);
214     }
215 
216     SetNextEventTransmitter(header, current, instance_);
217     pointerEventTransmitters_ = header;
218 }
219 
CreateMagnificationGesture(sptr<EventTransmission> & header,sptr<EventTransmission> & current)220 void AccessibilityInputInterceptor::CreateMagnificationGesture(sptr<EventTransmission> &header,
221     sptr<EventTransmission> &current)
222 {
223     Singleton<AccessibleAbilityManagerService>::GetInstance().InitMagnification();
224     uint32_t magnificationMode = Singleton<AccessibleAbilityManagerService>::GetInstance().GetMagnificationMode();
225     if (magnificationMode == FULL_SCREEN_MAGNIFICATION) {
226         HILOG_INFO("create zoomGesture");
227         CreatZoomGesture();
228         if (zoomGesture_ == nullptr) {
229             HILOG_ERROR("zoomGesture create error.");
230             return;
231         }
232         SetNextEventTransmitter(header, current, zoomGesture_);
233     } else if (magnificationMode == WINDOW_MAGNIFICATION) {
234         HILOG_INFO("create windowMagnificationGesture");
235         CreatWindowMagnificationGesture();
236         if (windowMagnificationGesture_ == nullptr) {
237             HILOG_ERROR("windowMagnificationGesture create error.");
238             return;
239         }
240         SetNextEventTransmitter(header, current, windowMagnificationGesture_);
241     } else {
242         HILOG_WARN("invalid magnificationMode");
243         ClearMagnificationGesture();
244     }
245 }
246 
CreatZoomGesture()247 void AccessibilityInputInterceptor::CreatZoomGesture()
248 {
249     std::shared_ptr<FullScreenMagnificationManager> fullScreenMagnificationManager =
250         Singleton<AccessibleAbilityManagerService>::GetInstance().GetFullScreenMagnificationManager();
251     std::shared_ptr<MagnificationMenuManager> menuManager =
252         Singleton<AccessibleAbilityManagerService>::GetInstance().GetMenuManager();
253     if (fullScreenMagnificationManager == nullptr) {
254         HILOG_ERROR("get windowMagnification manager failed.");
255         return;
256     }
257     if (menuManager == nullptr) {
258         HILOG_ERROR("get menu manager failed.");
259         return;
260     }
261     if (zoomGesture_ == nullptr) {
262         sptr<AccessibilityZoomGesture> zoomGesture =
263             new(std::nothrow) AccessibilityZoomGesture(fullScreenMagnificationManager, menuManager);
264         if (zoomGesture == nullptr) {
265             HILOG_ERROR("zoomGesture create error.");
266             return;
267         }
268         zoomGesture_ = zoomGesture;
269     }
270 
271     if (needInteractMagnification_) {
272         zoomGesture_->StartMagnificationInteract();
273         needInteractMagnification_ = false;
274     }
275 }
276 
CreatWindowMagnificationGesture()277 void AccessibilityInputInterceptor::CreatWindowMagnificationGesture()
278 {
279     std::shared_ptr<WindowMagnificationManager> windowMagnificationManager =
280         Singleton<AccessibleAbilityManagerService>::GetInstance().GetWindowMagnificationManager();
281     std::shared_ptr<MagnificationMenuManager> menuManager =
282         Singleton<AccessibleAbilityManagerService>::GetInstance().GetMenuManager();
283     if (windowMagnificationManager == nullptr) {
284         HILOG_ERROR("get windowMagnification manager failed.");
285         return;
286     }
287     if (menuManager == nullptr) {
288         HILOG_ERROR("get menu manager failed.");
289         return;
290     }
291     if (windowMagnificationGesture_ == nullptr) {
292         sptr<WindowMagnificationGesture> windowMagnificationGesture =
293             new(std::nothrow) WindowMagnificationGesture(windowMagnificationManager, menuManager);
294         if (windowMagnificationGesture == nullptr) {
295             HILOG_ERROR("windowMagnificationGesture create error.");
296             return;
297         }
298         windowMagnificationGesture_ = windowMagnificationGesture;
299     }
300     if (needInteractMagnification_) {
301         windowMagnificationGesture_->StartMagnificationInteract();
302         needInteractMagnification_ = false;
303     }
304 }
305 
ClearMagnificationGesture()306 void AccessibilityInputInterceptor::ClearMagnificationGesture()
307 {
308     zoomGesture_ = nullptr;
309     windowMagnificationGesture_ = nullptr;
310 }
311 
CreateKeyEventTransmitters()312 void AccessibilityInputInterceptor::CreateKeyEventTransmitters()
313 {
314     HILOG_DEBUG();
315 
316     sptr<EventTransmission> header = nullptr;
317     sptr<EventTransmission> current = nullptr;
318 
319     if (availableFunctions_& FEATURE_FILTER_KEY_EVENTS) {
320         sptr<KeyEventFilter> keyEventFilter = new(std::nothrow) KeyEventFilter();
321         if (!keyEventFilter) {
322             HILOG_ERROR("keyEventFilter is null");
323             return;
324         }
325         Singleton<AccessibleAbilityManagerService>::GetInstance().SetKeyEventFilter(keyEventFilter);
326         SetNextEventTransmitter(header, current, keyEventFilter);
327     }
328 
329     SetNextEventTransmitter(header, current, instance_);
330     keyEventTransmitters_ = header;
331 }
332 
UpdateInterceptor()333 void AccessibilityInputInterceptor::UpdateInterceptor()
334 {
335     std::lock_guard<ffrt::mutex> lock(mutex_);
336     HILOG_DEBUG();
337     if (!inputManager_) {
338         HILOG_ERROR("inputManger is null.");
339         return;
340     }
341 
342     if (interceptorId_ >= 0) {
343         inputManager_->RemoveInterceptor(interceptorId_);
344         interceptorId_ = -1;
345     }
346 
347     if ((availableFunctions_ & FEATURE_MOUSE_AUTOCLICK) ||
348         (availableFunctions_ & FEATURE_TOUCH_EXPLORATION) ||
349         (availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION) ||
350         (availableFunctions_ & FEATURE_MOUSE_KEY) ||
351         (availableFunctions_ & FEATURE_SCREEN_TOUCH)) {
352             inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
353             interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_);
354     } else if (availableFunctions_ & FEATURE_FILTER_KEY_EVENTS) {
355             inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
356             interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_, PRIORITY_EVENT,
357                 MMI::CapabilityToTags(MMI::INPUT_DEV_CAP_KEYBOARD));
358     }
359     HILOG_INFO("interceptorId:%{public}d", interceptorId_);
360 }
361 
DestroyInterceptor()362 void AccessibilityInputInterceptor::DestroyInterceptor()
363 {
364     HILOG_DEBUG("interceptorId:%{public}d.", interceptorId_);
365 
366     if (!inputManager_) {
367         HILOG_ERROR("inputManager_ is null.");
368         return;
369     }
370     if (interceptorId_ >= 0) {
371         inputManager_->RemoveInterceptor(interceptorId_);
372     }
373     interceptorId_ = -1;
374 }
375 
DestroyTransmitters()376 void AccessibilityInputInterceptor::DestroyTransmitters()
377 {
378     std::lock_guard<ffrt::mutex> lock(mutex_);
379     HILOG_DEBUG();
380 
381     if ((availableFunctions_ & FEATURE_MOUSE_KEY) != FEATURE_MOUSE_KEY) {
382         if (mouseKey_) {
383             mouseKey_->DestroyEvents();
384             mouseKey_ = nullptr;
385         }
386     }
387 
388     if (pointerEventTransmitters_ != nullptr) {
389         pointerEventTransmitters_->DestroyEvents();
390         Singleton<AccessibleAbilityManagerService>::GetInstance().SetTouchEventInjector(nullptr);
391         pointerEventTransmitters_= nullptr;
392         zoomGesture_ = nullptr;
393         windowMagnificationGesture_ = nullptr;
394     }
395     if (keyEventTransmitters_ != nullptr) {
396         keyEventTransmitters_->DestroyEvents();
397         Singleton<AccessibleAbilityManagerService>::GetInstance().SetKeyEventFilter(nullptr);
398         keyEventTransmitters_ = nullptr;
399     }
400 }
401 
ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event)402 void AccessibilityInputInterceptor::ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event)
403 {
404     std::lock_guard<ffrt::mutex> lock(mutex_);
405     HILOG_DEBUG();
406 
407     if (mouseKey_) {
408         mouseKey_->OnPointerEvent(*event);
409     }
410 
411     if (!pointerEventTransmitters_) {
412         HILOG_DEBUG("pointerEventTransmitters_ is empty.");
413         const_cast<AccessibilityInputInterceptor*>(this)->OnPointerEvent(*event);
414         return;
415     }
416 
417     pointerEventTransmitters_->OnPointerEvent(*event);
418 }
419 
ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event)420 void AccessibilityInputInterceptor::ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event)
421 {
422     std::lock_guard<ffrt::mutex> lock(mutex_);
423     HILOG_DEBUG();
424 
425     if (mouseKey_) {
426         bool result = mouseKey_->OnKeyEvent(*event);
427         if (result) {
428             HILOG_DEBUG("The event is mouse key event.");
429             return;
430         }
431     }
432 
433     if (!keyEventTransmitters_) {
434         HILOG_DEBUG("keyEventTransmitters_ is empty.");
435         const_cast<AccessibilityInputInterceptor*>(this)->OnKeyEvent(*event);
436         return;
437     }
438 
439     keyEventTransmitters_->OnKeyEvent(*event);
440 }
441 
SetNextEventTransmitter(sptr<EventTransmission> & header,sptr<EventTransmission> & current,const sptr<EventTransmission> & next)442 void AccessibilityInputInterceptor::SetNextEventTransmitter(sptr<EventTransmission> &header,
443     sptr<EventTransmission> &current, const sptr<EventTransmission> &next)
444 {
445     HILOG_DEBUG();
446 
447     if (current != nullptr) {
448         current->SetNext(next);
449     } else {
450         header = next;
451     }
452     current = next;
453 }
454 
ShieldZoomGesture(bool flag)455 void AccessibilityInputInterceptor::ShieldZoomGesture(bool flag)
456 {
457     HILOG_INFO("flag = %{public}d", flag);
458     if (zoomGesture_) {
459         zoomGesture_->ShieldZoomGesture(flag);
460     }
461     if (windowMagnificationGesture_) {
462         windowMagnificationGesture_->ShieldZoomGesture(flag);
463     }
464 }
465 
RefreshDisplayInfo()466 void AccessibilityInputInterceptor::RefreshDisplayInfo()
467 {
468     if (!zoomGesture_) {
469         return;
470     }
471     zoomGesture_->GetWindowParam(true);
472 }
473 
StartMagnificationInteract(uint32_t mode)474 void AccessibilityInputInterceptor::StartMagnificationInteract(uint32_t mode)
475 {
476     HILOG_DEBUG("mode = %{public}d", mode);
477     needInteractMagnification_ = true;
478 }
479 
DisableGesture(uint32_t mode)480 void AccessibilityInputInterceptor::DisableGesture(uint32_t mode)
481 {
482     HILOG_DEBUG("mode = %{public}d", mode);
483     if (mode == FULL_SCREEN_MAGNIFICATION && zoomGesture_ != nullptr) {
484         zoomGesture_->DisableGesture();
485     } else if (mode == WINDOW_MAGNIFICATION && windowMagnificationGesture_ != nullptr) {
486         windowMagnificationGesture_->DisableGesture();
487     } else {
488         HILOG_WARN("invalid mode.");
489     }
490 }
491 
EnableGesture(uint32_t mode)492 void AccessibilityInputInterceptor::EnableGesture(uint32_t mode)
493 {
494     HILOG_DEBUG("mode = %{public}d", mode);
495     if (mode == FULL_SCREEN_MAGNIFICATION && zoomGesture_ != nullptr) {
496         zoomGesture_->StartMagnificationInteract();
497     } else if (mode == WINDOW_MAGNIFICATION && windowMagnificationGesture_ != nullptr) {
498         windowMagnificationGesture_->StartMagnificationInteract();
499     } else {
500         HILOG_WARN("invalid mode.");
501     }
502 }
503 
AccessibilityInputEventConsumer()504 AccessibilityInputEventConsumer::AccessibilityInputEventConsumer()
505 {
506     HILOG_DEBUG();
507     eventHandler_ = std::make_shared<AppExecFwk::EventHandler>(
508         Singleton<AccessibleAbilityManagerService>::GetInstance().GetInputManagerRunner());
509 #ifdef ACCESSIBILITY_WATCH_FEATURE
510     eventHandler_->PostTask([] {
511         auto pid = getpid();
512         auto tid = gettid();
513         uint32_t qosLevel = 7;
514         std::string strBundleName = "accessibility";
515         std::string strPid = std::to_string(pid);
516         std::string strTid = std::to_string(tid);
517         std::string strQos = std::to_string(qosLevel);
518         std::unordered_map<std::string, std::string> mapPayLoad;
519         mapPayLoad["pid"] = strPid;
520         mapPayLoad[strTid] = strQos;
521         mapPayLoad["bundleName"] = strBundleName;
522         uint32_t type = OHOS::ResourceSchedule::ResType::RES_TYPE_THREAD_QOS_CHANGE;
523         OHOS::ResourceSchedule::ResSchedClient::GetInstance().ReportData(type, 0, mapPayLoad);
524     });
525 #endif // ACCESSIBILITY_WATCH_FEATURE
526 }
527 
~AccessibilityInputEventConsumer()528 AccessibilityInputEventConsumer::~AccessibilityInputEventConsumer()
529 {
530     HILOG_DEBUG();
531 
532     eventHandler_ = nullptr;
533 }
534 
OnInputEvent(std::shared_ptr<MMI::KeyEvent> keyEvent) const535 void AccessibilityInputEventConsumer::OnInputEvent(std::shared_ptr<MMI::KeyEvent> keyEvent) const
536 {
537     HILOG_DEBUG();
538     if (!keyEvent) {
539         HILOG_WARN("keyEvent is null.");
540         return;
541     }
542 
543     auto interceptor = AccessibilityInputInterceptor::GetInstance();
544     if (!interceptor) {
545         HILOG_ERROR("interceptor is null.");
546         return;
547     }
548 
549     if (!eventHandler_) {
550         HILOG_ERROR("eventHandler is empty.");
551         return;
552     }
553 
554     auto task = [keyEvent, interceptor] {interceptor->ProcessKeyEvent(keyEvent);};
555     eventHandler_->PostTask(task, "InputKeyEvent");
556 }
557 
OnInputEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent) const558 void AccessibilityInputEventConsumer::OnInputEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent) const
559 {
560     if (!pointerEvent) {
561         HILOG_WARN("pointerEvent is null.");
562         return;
563     }
564 
565     if (pointerEvent->GetPointerAction() != MMI::PointerEvent::POINTER_ACTION_MOVE) {
566         HILOG_INFO("PointerAction:%{public}d, SourceType:%{public}d, PointerId:%{public}d.",
567             pointerEvent->GetPointerAction(), pointerEvent->GetSourceType(), pointerEvent->GetPointerId());
568     } else {
569         HILOG_DEBUG("PointerAction:%{public}d, SourceType:%{public}d, PointerId:%{public}d.",
570             pointerEvent->GetPointerAction(), pointerEvent->GetSourceType(), pointerEvent->GetPointerId());
571     }
572 
573     auto interceptor = AccessibilityInputInterceptor::GetInstance();
574     if (!interceptor) {
575         HILOG_ERROR("interceptor is null.");
576         return;
577     }
578 
579     if (!eventHandler_) {
580         HILOG_ERROR("eventHandler is empty.");
581         return;
582     }
583     auto task = [pointerEvent, interceptor] {interceptor->ProcessPointerEvent(pointerEvent);};
584     eventHandler_->PostTask(task, "InputPointerEvent");
585 }
586 } // namespace Accessibility
587 } // namespace OHOS