mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
commit
8cb469c57c
@ -69,6 +69,8 @@ public:
|
||||
// Feature flag for screen touch.
|
||||
static constexpr uint32_t FEATURE_SCREEN_TOUCH = 0x00000080;
|
||||
|
||||
static constexpr uint32_t PRIORITY_EVENT = 500;
|
||||
|
||||
static sptr<AccessibilityInputInterceptor> GetInstance();
|
||||
~AccessibilityInputInterceptor();
|
||||
void ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event) const;
|
||||
|
@ -240,6 +240,11 @@ void AccessibilityInputInterceptor::UpdateInterceptor()
|
||||
return;
|
||||
}
|
||||
|
||||
if (interceptorId_ >= 0) {
|
||||
inputManager_->RemoveInterceptor(interceptorId_);
|
||||
interceptorId_ = -1;
|
||||
}
|
||||
|
||||
HILOG_INFO("interceptorId:%{public}d", interceptorId_);
|
||||
if ((availableFunctions_ & FEATURE_MOUSE_AUTOCLICK) ||
|
||||
(availableFunctions_ & FEATURE_TOUCH_EXPLORATION) ||
|
||||
@ -248,16 +253,12 @@ void AccessibilityInputInterceptor::UpdateInterceptor()
|
||||
(availableFunctions_ & FEATURE_MOUSE_KEY) ||
|
||||
(availableFunctions_ & FEATURE_SHORT_KEY) ||
|
||||
(availableFunctions_ & FEATURE_SCREEN_TOUCH)) {
|
||||
if (interceptorId_ < 0) {
|
||||
inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
|
||||
interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_);
|
||||
HILOG_DEBUG("interceptorId:%{public}d.", interceptorId_);
|
||||
}
|
||||
} else {
|
||||
if (interceptorId_ >= 0) {
|
||||
inputManager_->RemoveInterceptor(interceptorId_);
|
||||
}
|
||||
interceptorId_ = -1;
|
||||
} else if ((availableFunctions_ & FEATURE_FILTER_KEY_EVENTS) || (availableFunctions_ & FEATURE_SHORT_KEY)) {
|
||||
inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
|
||||
interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_, PRIORITY_EVENT,
|
||||
MMI::CapabilityToTags(MMI::INPUT_DEV_CAP_KEYBOARD));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user