mirror of
https://github.com/openharmony/accessibility.git
synced 2026-08-25 11:51:38 -04:00
@@ -55,6 +55,7 @@ accessibleabilityms_files = [
|
||||
"${services_path}/src/accessibility_mouse_autoclick.cpp",
|
||||
"${services_path}/src/accessibility_multifinger_multitap.cpp",
|
||||
"${services_path}/src/accessibility_mouse_key.cpp",
|
||||
"${services_path}/src/accessibility_screen_touch.cpp",
|
||||
"${services_path}/src/accessibility_short_key.cpp",
|
||||
"${services_path}/src/accessibility_window_manager.cpp",
|
||||
"${services_path}/src/accessibility_display_manager.cpp",
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
// Feature flag for mouse key.
|
||||
static constexpr uint32_t FEATURE_MOUSE_KEY = 0x00000040;
|
||||
|
||||
// Feature flag for screen touch.
|
||||
static constexpr uint32_t FEATURE_SCREEN_TOUCH = 0x00000080;
|
||||
|
||||
static sptr<AccessibilityInputInterceptor> GetInstance();
|
||||
~AccessibilityInputInterceptor();
|
||||
void ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event) const;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBILITY_SCREEN_TOUCH_H
|
||||
#define ACCESSIBILITY_SCREEN_TOUCH_H
|
||||
|
||||
#include <string>
|
||||
#include "accessibility_event_transmission.h"
|
||||
#include "accessibility_gesture_recognizer.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
enum ScreenTouchState : int32_t {
|
||||
DEFAULT_STATE,
|
||||
CLICK_RESPONSE_DELAY_STATE,
|
||||
IGNORE_REPEAT_CLICK_STATE,
|
||||
BOTH_RESPONSE_DELAY_IGNORE_REPEAT_CLICK
|
||||
};
|
||||
|
||||
class AccessibilityScreenTouch : public EventTransmission {
|
||||
public:
|
||||
/**
|
||||
* @brief A constructor used to create a screen touch instance.
|
||||
*/
|
||||
AccessibilityScreenTouch();
|
||||
|
||||
/**
|
||||
* @brief A destructor used to delete the screen touch instance.
|
||||
*/
|
||||
~AccessibilityScreenTouch() {}
|
||||
|
||||
/**
|
||||
* @brief Handle pointer events from previous event stream node.
|
||||
*
|
||||
* @param event the pointer event to be handled.
|
||||
* @return true: the event has been processed and does not need to be passed to the next node;
|
||||
* false: the event is not processed.
|
||||
*/
|
||||
bool OnPointerEvent(MMI::PointerEvent &event) override;
|
||||
|
||||
uint32_t GetRealClickResponseTime();
|
||||
uint32_t GetRealIgnoreRepeatClickTime();
|
||||
bool GetRealIgnoreRepeatClickState();
|
||||
private:
|
||||
void HandleResponseDelayStateInnerDown(MMI::PointerEvent &event);
|
||||
void HandleResponseDelayStateInnerMove(MMI::PointerEvent &event);
|
||||
void HandleResponseDelayStateInnerUp(MMI::PointerEvent &event);
|
||||
void HandleResponseDelayState(MMI::PointerEvent &event);
|
||||
|
||||
void HandleIgnoreRepeatClickStateInnerDown(MMI::PointerEvent &event);
|
||||
void HandleIgnoreRepeatClickStateInnerMove(MMI::PointerEvent &event);
|
||||
void HandleIgnoreRepeatClickStateInnerUp(MMI::PointerEvent &event);
|
||||
void HandleIgnoreRepeatClickState(MMI::PointerEvent &event);
|
||||
|
||||
void HandleBothStateInnerDown(MMI::PointerEvent &event);
|
||||
void HandleBothStateInnerMove(MMI::PointerEvent &event);
|
||||
void HandleBothStateInnerUp(MMI::PointerEvent &event);
|
||||
void HandleBothState(MMI::PointerEvent &event);
|
||||
|
||||
void Clear();
|
||||
|
||||
bool isFirstDownEvent_ = false;
|
||||
bool isMoveBeyondThreshold_ = false;
|
||||
int64_t startTime_ = 0; // microsecond
|
||||
double threshold_ = 0.0;
|
||||
MMI::PointerEvent::PointerItem startPointer_ = {};
|
||||
|
||||
int64_t lastUpTime_ = 0;
|
||||
bool isInterceptClick_ = false;
|
||||
|
||||
ScreenTouchState currentState_;
|
||||
uint32_t clickResponseTime_;
|
||||
bool ignoreRepeatClickState_;
|
||||
uint32_t ignoreRepeatClickTime_;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif // ACCESSIBILITY_TOUCH_GUIDER_H
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "accessibility_keyevent_filter.h"
|
||||
#include "accessibility_mouse_autoclick.h"
|
||||
#include "accessibility_short_key.h"
|
||||
#include "accessibility_screen_touch.h"
|
||||
#include "accessibility_touch_guider.h"
|
||||
#include "accessibility_touchEvent_injector.h"
|
||||
#include "accessibility_zoom_gesture.h"
|
||||
@@ -132,7 +133,8 @@ void AccessibilityInputInterceptor::CreateTransmitters()
|
||||
if ((availableFunctions_ & FEATURE_MOUSE_AUTOCLICK) ||
|
||||
(availableFunctions_ & FEATURE_INJECT_TOUCH_EVENTS) ||
|
||||
(availableFunctions_ & FEATURE_TOUCH_EXPLORATION) ||
|
||||
(availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION)) {
|
||||
(availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION) ||
|
||||
(availableFunctions_ & FEATURE_SCREEN_TOUCH)) {
|
||||
CreatePointerEventTransmitters();
|
||||
}
|
||||
|
||||
@@ -187,6 +189,15 @@ void AccessibilityInputInterceptor::CreatePointerEventTransmitters()
|
||||
SetNextEventTransmitter(header, current, touchGuider);
|
||||
}
|
||||
|
||||
if (availableFunctions_& FEATURE_SCREEN_TOUCH) {
|
||||
sptr<AccessibilityScreenTouch> screenTouch = new(std::nothrow) AccessibilityScreenTouch();
|
||||
if (!screenTouch) {
|
||||
HILOG_ERROR("screenTouch is null");
|
||||
return;
|
||||
}
|
||||
SetNextEventTransmitter(header, current, screenTouch);
|
||||
}
|
||||
|
||||
SetNextEventTransmitter(header, current, instance_);
|
||||
pointerEventTransmitters_ = header;
|
||||
}
|
||||
@@ -235,7 +246,8 @@ void AccessibilityInputInterceptor::UpdateInterceptor()
|
||||
(availableFunctions_ & FEATURE_SCREEN_MAGNIFICATION) ||
|
||||
(availableFunctions_ & FEATURE_FILTER_KEY_EVENTS) ||
|
||||
(availableFunctions_ & FEATURE_MOUSE_KEY) ||
|
||||
(availableFunctions_ & FEATURE_SHORT_KEY)) {
|
||||
(availableFunctions_ & FEATURE_SHORT_KEY) ||
|
||||
(availableFunctions_ & FEATURE_SCREEN_TOUCH)) {
|
||||
if (interceptorId_ < 0) {
|
||||
inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
|
||||
interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_);
|
||||
|
||||
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include "accessibility_screen_touch.h"
|
||||
#include "accessible_ability_manager_service.h"
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
constexpr int32_t POINTER_COUNT_1 = 1;
|
||||
constexpr int32_t DISPLAY_WIDTH_RATIO = 150;
|
||||
|
||||
constexpr uint32_t CLICK_RESPONSE_DELAY_SHORT = 0;
|
||||
constexpr uint32_t CLICK_RESPONSE_DELAY_MEDIUM = 1;
|
||||
constexpr uint32_t CLICK_RESPONSE_DELAY_LONG = 2;
|
||||
|
||||
constexpr uint32_t CLICK_RESPONSE_TIME_SHORT = 0; // ms
|
||||
constexpr uint32_t CLICK_RESPONSE_TIME_MEDIUM = 300; // ms
|
||||
constexpr uint32_t CLICK_RESPONSE_TIME_LONG = 600; // ms
|
||||
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_SHORTEST = 0;
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_SHORT = 1;
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_MEDIUM = 2;
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_LONG = 3;
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_LONGEST = 4;
|
||||
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_SHORTEST = 100; // ms
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_SHORT = 400; // ms
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_MEDIUM = 700; // ms
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_LONG = 1000; // ms
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_LONGEST = 1300; // ms
|
||||
|
||||
const std::map<uint32_t, uint32_t> CLICK_RESPONSE_TIME_MAP = {
|
||||
{CLICK_RESPONSE_DELAY_SHORT, CLICK_RESPONSE_TIME_SHORT},
|
||||
{CLICK_RESPONSE_DELAY_MEDIUM, CLICK_RESPONSE_TIME_MEDIUM},
|
||||
{CLICK_RESPONSE_DELAY_LONG, CLICK_RESPONSE_TIME_LONG}
|
||||
};
|
||||
|
||||
const std::map<uint32_t, uint32_t> IGNORE_REPEAT_CLICK_TIME_MAP = {
|
||||
{IGNORE_REPEAT_CLICK_SHORTEST, IGNORE_REPEAT_CLICK_TIME_SHORTEST},
|
||||
{IGNORE_REPEAT_CLICK_SHORT, IGNORE_REPEAT_CLICK_TIME_SHORT},
|
||||
{IGNORE_REPEAT_CLICK_MEDIUM, IGNORE_REPEAT_CLICK_TIME_MEDIUM},
|
||||
{IGNORE_REPEAT_CLICK_LONG, IGNORE_REPEAT_CLICK_TIME_LONG},
|
||||
{IGNORE_REPEAT_CLICK_LONGEST, IGNORE_REPEAT_CLICK_TIME_LONGEST}
|
||||
};
|
||||
|
||||
AccessibilityScreenTouch::AccessibilityScreenTouch()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
// get from account data directly
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
clickResponseTime_ = accountData->GetConfig()->GetClickResponseTime();
|
||||
ignoreRepeatClickState_ = accountData->GetConfig()->GetIgnoreRepeatClickState();
|
||||
ignoreRepeatClickTime_ = accountData->GetConfig()->GetIgnoreRepeatClickTime();
|
||||
|
||||
if (clickResponseTime_ > 0 && ignoreRepeatClickState_ == true) {
|
||||
currentState_ = BOTH_RESPONSE_DELAY_IGNORE_REPEAT_CLICK;
|
||||
} else if (clickResponseTime_ > 0) {
|
||||
currentState_ = CLICK_RESPONSE_DELAY_STATE;
|
||||
} else if (ignoreRepeatClickState_ == true) {
|
||||
currentState_ = IGNORE_REPEAT_CLICK_STATE;
|
||||
} else {
|
||||
currentState_ = DEFAULT_STATE;
|
||||
}
|
||||
|
||||
AccessibilityDisplayManager &displayMgr = Singleton<AccessibilityDisplayManager>::GetInstance();
|
||||
auto display = displayMgr.GetDefaultDisplay();
|
||||
if (!display) {
|
||||
HILOG_ERROR("get display is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
threshold_ = CALCULATION_DIMENSION(display->GetWidth()) / DISPLAY_WIDTH_RATIO;
|
||||
}
|
||||
|
||||
uint32_t AccessibilityScreenTouch::GetRealClickResponseTime()
|
||||
{
|
||||
auto iter = CLICK_RESPONSE_TIME_MAP.find(clickResponseTime_);
|
||||
if (iter != CLICK_RESPONSE_TIME_MAP.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return CLICK_RESPONSE_TIME_MAP.at(CLICK_RESPONSE_DELAY_SHORT);
|
||||
}
|
||||
|
||||
uint32_t AccessibilityScreenTouch::GetRealIgnoreRepeatClickTime()
|
||||
{
|
||||
auto iter = IGNORE_REPEAT_CLICK_TIME_MAP.find(ignoreRepeatClickTime_);
|
||||
if (iter != IGNORE_REPEAT_CLICK_TIME_MAP.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return IGNORE_REPEAT_CLICK_TIME_MAP.at(IGNORE_REPEAT_CLICK_SHORTEST);
|
||||
}
|
||||
|
||||
bool AccessibilityScreenTouch::GetRealIgnoreRepeatClickState()
|
||||
{
|
||||
return ignoreRepeatClickState_;
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleResponseDelayStateInnerDown(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
MMI::PointerEvent::PointerItem pointerItem;
|
||||
if (!event.GetPointerItem(event.GetPointerId(), pointerItem)) {
|
||||
HILOG_WARN("get GetPointerItem %{public}d failed", event.GetPointerId());
|
||||
}
|
||||
|
||||
startTime_ = event.GetActionTime();
|
||||
startPointer_ = pointerItem;
|
||||
isMoveBeyondThreshold_ = false;
|
||||
isFirstDownEvent_ = true;
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleResponseDelayStateInnerMove(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isMoveBeyondThreshold_ == true) {
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
MMI::PointerEvent::PointerItem pointerItem;
|
||||
if (!event.GetPointerItem(event.GetPointerId(), pointerItem)) {
|
||||
HILOG_WARN("get GetPointerItem %{public}d failed", event.GetPointerId());
|
||||
}
|
||||
|
||||
float offsetX = startPointer_.GetDisplayX() - pointerItem.GetDisplayX();
|
||||
float offsetY = startPointer_.GetDisplayY() - pointerItem.GetDisplayY();
|
||||
double duration = hypot(offsetX, offsetY);
|
||||
if (duration > threshold_) {
|
||||
event.SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
isMoveBeyondThreshold_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((startTime_ + GetRealClickResponseTime() * US_TO_MS) > event.GetActionTime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFirstDownEvent_ == true) {
|
||||
event.SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
isFirstDownEvent_ = false;
|
||||
return;
|
||||
}
|
||||
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleResponseDelayStateInnerUp(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isMoveBeyondThreshold_ == true) {
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((startTime_ + GetRealClickResponseTime() * US_TO_MS) > event.GetActionTime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFirstDownEvent_ == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleResponseDelayState(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
switch (event.GetPointerAction()) {
|
||||
case MMI::PointerEvent::POINTER_ACTION_DOWN:
|
||||
HandleResponseDelayStateInnerDown(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_MOVE:
|
||||
HandleResponseDelayStateInnerMove(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_UP:
|
||||
HandleResponseDelayStateInnerUp(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleIgnoreRepeatClickStateInnerDown(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t downTime = event.GetActionTime();
|
||||
if ((downTime - lastUpTime_) / US_TO_MS < GetRealIgnoreRepeatClickTime()) {
|
||||
isInterceptClick_ = true;
|
||||
}
|
||||
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
isInterceptClick_ = false;
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleIgnoreRepeatClickStateInnerMove(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInterceptClick_ == false) {
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleIgnoreRepeatClickStateInnerUp(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInterceptClick_ == false) {
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
lastUpTime_ = event.GetActionTime();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleIgnoreRepeatClickState(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
switch (event.GetPointerAction()) {
|
||||
case MMI::PointerEvent::POINTER_ACTION_DOWN:
|
||||
HandleIgnoreRepeatClickStateInnerDown(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_MOVE:
|
||||
HandleIgnoreRepeatClickStateInnerMove(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_UP:
|
||||
HandleIgnoreRepeatClickStateInnerUp(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleBothStateInnerDown(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t downTime = event.GetActionTime();
|
||||
if ((downTime - lastUpTime_) / US_TO_MS < GetRealIgnoreRepeatClickTime()) {
|
||||
isInterceptClick_ = true;
|
||||
}
|
||||
|
||||
HandleResponseDelayStateInnerDown(event);
|
||||
isInterceptClick_ = false;
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleBothStateInnerMove(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInterceptClick_ == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
HandleResponseDelayStateInnerMove(event);
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleBothStateInnerUp(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetPointerIds().size() > POINTER_COUNT_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInterceptClick_ == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
lastUpTime_ = event.GetActionTime();
|
||||
HandleResponseDelayStateInnerUp(event);
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::HandleBothState(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
switch (event.GetPointerAction()) {
|
||||
case MMI::PointerEvent::POINTER_ACTION_DOWN:
|
||||
HandleBothStateInnerDown(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_MOVE:
|
||||
HandleBothStateInnerMove(event);
|
||||
break;
|
||||
case MMI::PointerEvent::POINTER_ACTION_UP:
|
||||
HandleBothStateInnerUp(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouch::Clear()
|
||||
{
|
||||
isMoveBeyondThreshold_ = false;
|
||||
isInterceptClick_ = false;
|
||||
startPointer_ = {};
|
||||
}
|
||||
|
||||
bool AccessibilityScreenTouch::OnPointerEvent(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (event.GetSourceType() != MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN) {
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.GetPointerAction() == MMI::PointerEvent::POINTER_ACTION_CANCEL) {
|
||||
Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
switch(currentState_) {
|
||||
case ScreenTouchState::CLICK_RESPONSE_DELAY_STATE:
|
||||
HandleResponseDelayState(event);
|
||||
break;
|
||||
case ScreenTouchState::IGNORE_REPEAT_CLICK_STATE:
|
||||
HandleIgnoreRepeatClickState(event);
|
||||
break;
|
||||
case ScreenTouchState::BOTH_RESPONSE_DELAY_IGNORE_REPEAT_CLICK:
|
||||
HandleBothState(event);
|
||||
break;
|
||||
case ScreenTouchState::DEFAULT_STATE:
|
||||
default:
|
||||
EventTransmission::OnPointerEvent(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
@@ -310,7 +310,7 @@ bool AccessibilitySettingsConfig::SetStatePrefExec(int32_t type)
|
||||
strValue = StateChange(audioMonoState_);
|
||||
pref_->PutString("audioMono", strValue);
|
||||
} else if (type == STATE::IGNOREREPEATCLICKSTATE) {
|
||||
pref_->PutString("ignoreRepeatClickTime", StateChange(ignoreRepeatClickTime_));
|
||||
pref_->PutString("ignoreRepeatClickState", StateChange(ignoreRepeatClickState_));
|
||||
} else {
|
||||
ret = false;
|
||||
HILOG_ERROR("invalid parameter type = [%{public}d]", type);
|
||||
@@ -574,8 +574,8 @@ void AccessibilitySettingsConfig::InitSetting()
|
||||
strValue = pref_->GetString("audioMono", "");
|
||||
audioMonoState_ = std::strcmp(strValue.c_str(), "on") ? false : true;
|
||||
|
||||
strValue = pref_->GetString("ignoreRepeatClickTime", "");
|
||||
ignoreRepeatClickTime_ = std::strcmp(strValue.c_str(), "on") ? false : true;
|
||||
strValue = pref_->GetString("ignoreRepeatClickState", "");
|
||||
ignoreRepeatClickState_ = std::strcmp(strValue.c_str(), "on") ? false : true;
|
||||
|
||||
shortkeyTarget_ = pref_->GetString("ShortkeyTarget", "none");
|
||||
mouseAutoClick_ = static_cast<int32_t>(pref_->GetInt("MouseAutoClick", -1));
|
||||
|
||||
@@ -1633,6 +1633,7 @@ RetError AccessibleAbilityManagerService::SetClickResponseTime(const uint32_t ti
|
||||
RetError ret = accountData->GetConfig()->SetClickResponseTime(time);
|
||||
syncPromise.set_value(ret);
|
||||
UpdateClickResponseTime();
|
||||
UpdateInputFilter();
|
||||
}), "TASK_SET_CLICK_RESPONSE_TIME");
|
||||
return syncFuture.get();
|
||||
}
|
||||
@@ -1659,6 +1660,7 @@ RetError AccessibleAbilityManagerService::SetIgnoreRepeatClickState(const bool s
|
||||
RetError ret = accountData->GetConfig()->SetIgnoreRepeatClickState(state);
|
||||
syncPromise.set_value(ret);
|
||||
UpdateConfigState();
|
||||
UpdateInputFilter();
|
||||
}), "TASK_SET_IGNORE_REPEAT_CLICK_STATE");
|
||||
return syncFuture.get();
|
||||
}
|
||||
@@ -1685,6 +1687,7 @@ RetError AccessibleAbilityManagerService::SetIgnoreRepeatClickTime(const uint32_
|
||||
RetError ret = accountData->GetConfig()->SetIgnoreRepeatClickTime(time);
|
||||
syncPromise.set_value(ret);
|
||||
UpdateIgnoreRepeatClickTime();
|
||||
UpdateInputFilter();
|
||||
}), "TASK_SET_IGNORE_REPEAT_CLICK_TIME");
|
||||
return syncFuture.get();
|
||||
}
|
||||
|
||||
@@ -321,6 +321,7 @@ ohos_unittest("accessibility_input_interceptor_test") {
|
||||
"../src/accessibility_mouse_autoclick.cpp",
|
||||
"../src/accessibility_mouse_key.cpp",
|
||||
"../src/accessibility_multifinger_multitap.cpp",
|
||||
"../src/accessibility_screen_touch.cpp",
|
||||
"../src/accessibility_short_key.cpp",
|
||||
"../src/accessibility_touch_guider.cpp",
|
||||
"../src/accessible_ability_manager_service_event_handler.cpp",
|
||||
@@ -511,6 +512,7 @@ ohos_unittest("accessible_ability_connection_test") {
|
||||
"../src/accessibility_mouse_autoclick.cpp",
|
||||
"../src/accessibility_mouse_key.cpp",
|
||||
"../src/accessibility_multifinger_multitap.cpp",
|
||||
"../src/accessibility_screen_touch.cpp",
|
||||
"../src/accessibility_settings_config.cpp",
|
||||
"../src/accessibility_short_key.cpp",
|
||||
"../src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -856,6 +858,57 @@ ohos_unittest("accessibility_mouse_autoclick_test") {
|
||||
]
|
||||
}
|
||||
|
||||
################################################################################
|
||||
ohos_unittest("accessibility_screen_touch_test") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"../../test/mock/mock_common_event_data.cpp",
|
||||
"../../test/mock/mock_common_event_manager.cpp",
|
||||
"../../test/mock/mock_common_event_subscribe_info.cpp",
|
||||
"../../test/mock/mock_common_event_subscriber.cpp",
|
||||
"../../test/mock/mock_matching_skill.cpp",
|
||||
"mock/src/mock_accessibility_common_event.cpp",
|
||||
"mock/src/mock_accessibility_event_transmission.cpp",
|
||||
"mock/src/mock_accessibility_settings_config.cpp",
|
||||
"mock/src/mock_accessible_ability_client_stub_impl.cpp",
|
||||
"mock/src/mock_system_ability.cpp",
|
||||
"unittest/accessibility_screen_touch_test.cpp",
|
||||
]
|
||||
sources += aams_mock_distributeddatamgr_src
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
"../../../resources/config/build:coverage_flags",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../../../../../../third_party/googletest:gmock_main",
|
||||
"../../../../../../third_party/googletest:gtest_main",
|
||||
"../../../common/interface:accessibility_interface",
|
||||
"../../../interfaces/innerkits/common:accessibility_common",
|
||||
"../../aams:accessibleabilityms",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"hilog:libhilog",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_core",
|
||||
"os_account:domain_account_innerkits",
|
||||
"os_account:os_account_innerkits",
|
||||
"resource_management:global_resmgr",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"window_manager:libdm",
|
||||
"window_manager:libwm",
|
||||
]
|
||||
}
|
||||
|
||||
################################################################################
|
||||
ohos_unittest("accessibility_mouse_key_test") {
|
||||
module_out_path = module_output_path
|
||||
@@ -1054,6 +1107,7 @@ group("unittest") {
|
||||
":accessibility_keyevent_filter_test",
|
||||
":accessibility_mouse_autoclick_test",
|
||||
":accessibility_mouse_key_test",
|
||||
":accessibility_screen_touch_test",
|
||||
":accessibility_settings_config_test",
|
||||
":accessibility_short_key_test",
|
||||
":accessibility_touch_guider_test",
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "accessibility_common_helper.h"
|
||||
#include "accessibility_screen_touch.h"
|
||||
#include "accessibility_ut_helper.h"
|
||||
#include "accessible_ability_manager_service.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
namespace {
|
||||
constexpr uint32_t CLICK_RESPONSE_TIME_LONG = 600; // ms
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_TIME_LONGEST = 1300; // ms
|
||||
constexpr uint32_t CLICK_RESPONSE_DELAY_LONG = 2;
|
||||
constexpr uint32_t IGNORE_REPEAT_CLICK_LONGEST = 4;
|
||||
constexpr uint32_t TIMESTAMP_800 = 800;
|
||||
constexpr uint32_t TIMESTAMP_1200 = 1200;
|
||||
constexpr uint32_t TIMESTAMP_1500 = 1500;
|
||||
constexpr uint32_t TIMESTAMP_1600 = 1600;
|
||||
constexpr uint32_t TIMESTAMP_1700 = 1700;
|
||||
constexpr uint32_t TIMESTAMP_2700 = 2700;
|
||||
constexpr uint32_t TIMESTAMP_2800 = 2800;
|
||||
} // namespace
|
||||
|
||||
class AccessibilityScreenTouchUnitTest : public ::testing::Test {
|
||||
public:
|
||||
AccessibilityScreenTouchUnitTest()
|
||||
{}
|
||||
~AccessibilityScreenTouchUnitTest()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
std::shared_ptr<MMI::PointerEvent> SetPointerEvent(uint32_t time, uint32_t action);
|
||||
|
||||
std::shared_ptr<AccessibilityScreenTouch> screenTouch_ = nullptr;
|
||||
};
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessibilityScreenTouchUnitTest Start ######################";
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().OnStart();
|
||||
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::TearDownTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessibilityScreenTouchUnitTest End ######################";
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().OnStop();
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::SetUp()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "SetUp";
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::TearDown()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "TearDown";
|
||||
}
|
||||
|
||||
std::shared_ptr<MMI::PointerEvent> AccessibilityScreenTouchUnitTest::SetPointerEvent(uint32_t time, uint32_t action)
|
||||
{
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(action);
|
||||
event->SetPointerId(0);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
item.SetPointerId(0);
|
||||
event->AddPointerItem(item);
|
||||
event->SetActionTime(time);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_001
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
|
||||
EXPECT_EQ(screenTouch_->GetRealClickResponseTime(), CLICK_RESPONSE_TIME_LONG);
|
||||
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickTime(), IGNORE_REPEAT_CLICK_TIME_LONGEST);
|
||||
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickState(), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_002
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_002 start";
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (screenTouch_ == nullptr || event == nullptr) {
|
||||
GTEST_LOG_(INFO) << "null pointer";
|
||||
}
|
||||
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*event), false);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_003
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_003 start";
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (screenTouch_ == nullptr || event == nullptr) {
|
||||
GTEST_LOG_(INFO) << "null pointer";
|
||||
}
|
||||
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_CANCEL);
|
||||
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*event), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_004
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_004, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_004 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(0);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_005
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_005, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_005 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(0);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1200, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_005 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_006
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_006, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_006 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(0, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove1 = SetPointerEvent(TIMESTAMP_800, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove1);
|
||||
|
||||
auto eventMove2 = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove2);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_006 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_007
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_007, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_007 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove1 = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove1);
|
||||
|
||||
auto eventMove2 = SetPointerEvent(TIMESTAMP_2700, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove2);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_2800, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_007 end";
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
@@ -76,6 +76,7 @@ ohos_moduletest("aams_accessibility_touch_guider_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -156,6 +157,7 @@ ohos_moduletest("aams_accessibility_touchEvent_injector_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -237,6 +239,7 @@ ohos_moduletest("aams_accessible_ability_channel_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -323,6 +326,7 @@ ohos_moduletest("aams_server_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -407,6 +411,7 @@ ohos_moduletest("aams_accessibility_keyevent_filter_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
@@ -486,6 +491,7 @@ ohos_moduletest("aams_common_event_registry_test") {
|
||||
"../aams/src/accessibility_mouse_autoclick.cpp",
|
||||
"../aams/src/accessibility_mouse_key.cpp",
|
||||
"../aams/src/accessibility_multifinger_multitap.cpp",
|
||||
"../aams/src/accessibility_screen_touch.cpp",
|
||||
"../aams/src/accessibility_settings_config.cpp",
|
||||
"../aams/src/accessibility_short_key.cpp",
|
||||
"../aams/src/accessibility_touchEvent_injector.cpp",
|
||||
|
||||
Reference in New Issue
Block a user