!953 修复横屏下触摸事件异常

Merge pull request !953 from taojuncun/zpf
This commit is contained in:
openharmony_ci 2024-03-08 02:05:46 +00:00 committed by Gitee
commit 8cb469c57c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 8 deletions

View File

@ -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;

View File

@ -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));
}
}