mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 09:01:34 +00:00
codedex问题修正
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
8c98e60084
commit
528bb921b2
@ -52,14 +52,14 @@ bool AccessibilityExtensionContext::GestureSimulate(uint32_t sequence,
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t totalDurationTime = 0;
|
||||
int64_t totalDurationTime = 0;
|
||||
for (auto gesturePath : gesturePathDefineList) {
|
||||
totalDurationTime += gesturePath.GetDurationTime();
|
||||
}
|
||||
HILOG_DEBUG("The total duration time is %{public}d.", totalDurationTime);
|
||||
HILOG_DEBUG("The total duration time is %{public}lld.", totalDurationTime);
|
||||
|
||||
if (totalDurationTime > gesturePathDefineList.front().GetMaxStrokeDuration()) {
|
||||
HILOG_ERROR("The total duration time : [%{public}d] is not allowed.", totalDurationTime);
|
||||
HILOG_ERROR("The total duration time : [%{public}lld] is not allowed.", totalDurationTime);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -287,12 +287,12 @@ void AccessibilityElementInfo::SetEnabled(const bool enabled)
|
||||
|
||||
bool AccessibilityElementInfo::IsPassword() const
|
||||
{
|
||||
return password_;
|
||||
return isPassword_;
|
||||
}
|
||||
|
||||
void AccessibilityElementInfo::SetPassword(const bool password)
|
||||
void AccessibilityElementInfo::SetPassword(const bool type)
|
||||
{
|
||||
(void)password;
|
||||
(void)type;
|
||||
}
|
||||
|
||||
bool AccessibilityElementInfo::IsScrollable() const
|
||||
|
@ -243,12 +243,12 @@ void AccessibilityEventInfo::SetEventType(const EventType eventType)
|
||||
eventType_ = eventType;
|
||||
}
|
||||
|
||||
long long AccessibilityEventInfo::GetTimeStamp() const
|
||||
int64_t AccessibilityEventInfo::GetTimeStamp() const
|
||||
{
|
||||
return timeStamp_;
|
||||
}
|
||||
|
||||
void AccessibilityEventInfo::SetTimeStamp(const long long eventTime)
|
||||
void AccessibilityEventInfo::SetTimeStamp(const int64_t eventTime)
|
||||
{
|
||||
(void)eventTime;
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterStateCallback(
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy::GetAbilityList(const int abilityTypes,
|
||||
const int stateType)
|
||||
std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy::GetAbilityList(
|
||||
const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
std::vector<AccessibilityAbilityInfo> abilityInfos {};
|
||||
return abilityInfos;
|
||||
|
@ -69,12 +69,12 @@ GesturePathPositionDefine *GesturePathPositionDefine::Unmarshalling(Parcel &parc
|
||||
}
|
||||
|
||||
GesturePathDefine::GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
GesturePathPositionDefine &endPosition, uint32_t durationTime)
|
||||
GesturePathPositionDefine &endPosition, int64_t durationTime)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK GesturePathDefine";
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetDurationTime()
|
||||
int64_t GesturePathDefine::GetDurationTime()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK GesturePathDefine GetDurationTime";
|
||||
return durationTime_;
|
||||
@ -86,7 +86,7 @@ GesturePathPositionDefine &GesturePathDefine::GetEndPosition()
|
||||
return endPosition_;
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
int64_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK GesturePathDefine GetMaxStrokeDuration";
|
||||
return MAX_STROKE_DURATION;
|
||||
@ -104,7 +104,7 @@ GesturePathPositionDefine &GesturePathDefine::GetStartPosition()
|
||||
return startPosition_;
|
||||
}
|
||||
|
||||
void GesturePathDefine::SetDurationTime(uint32_t durationTime)
|
||||
void GesturePathDefine::SetDurationTime(int64_t durationTime)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK GesturePathDefine SetDurationTime";
|
||||
durationTime_ = durationTime;
|
||||
|
@ -66,7 +66,8 @@ public:
|
||||
* 2 indicates that the ability is disabled; 4 indicates that the ability has been installed.
|
||||
* @return
|
||||
*/
|
||||
virtual std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType) = 0;
|
||||
virtual std::vector<AccessibilityAbilityInfo> GetAbilityList(const uint32_t abilityTypes,
|
||||
const int32_t stateType) = 0;
|
||||
|
||||
/**
|
||||
* @brief Register the interaction operation, so the AA can get node info from ACE.
|
||||
|
@ -74,7 +74,8 @@ public:
|
||||
* 2 indicates that the ability is disabled; 4 indicates that the ability has been installed.
|
||||
* @return
|
||||
*/
|
||||
virtual std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType) override;
|
||||
virtual std::vector<AccessibilityAbilityInfo> GetAbilityList(
|
||||
const uint32_t abilityTypes, const int32_t stateType) override;
|
||||
|
||||
/**
|
||||
* @brief Register the interaction operation, so the AA can get node info from ACE.
|
||||
|
@ -89,14 +89,14 @@ public:
|
||||
~GesturePathDefine() {}
|
||||
|
||||
GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
GesturePathPositionDefine &endPosition, uint32_t durationTime);
|
||||
GesturePathPositionDefine &endPosition, int64_t durationTime);
|
||||
|
||||
/**
|
||||
* @brief Obtains the duration for completing the maximum number of gesture strokes.
|
||||
* @param
|
||||
* @return Return the duration for completing the maximum number of gesture strokes.
|
||||
*/
|
||||
static uint32_t GetMaxStrokeDuration();
|
||||
static int64_t GetMaxStrokeDuration();
|
||||
|
||||
/**
|
||||
* @brief Obtains the maximum number of strokes in this gesture path.
|
||||
@ -110,7 +110,7 @@ public:
|
||||
* @param
|
||||
* @return Return the duration in which this gesture path continues.
|
||||
*/
|
||||
uint32_t GetDurationTime();
|
||||
int64_t GetDurationTime();
|
||||
|
||||
/**
|
||||
* @brief Obtains the end position of this gesture path.
|
||||
@ -131,7 +131,7 @@ public:
|
||||
* @param durationTime The duration for this gesture path to continue.
|
||||
* @return
|
||||
*/
|
||||
void SetDurationTime(uint32_t durationTime);
|
||||
void SetDurationTime(int64_t durationTime);
|
||||
|
||||
/**
|
||||
* @brief Sets the end position of this gesture path.
|
||||
@ -169,12 +169,12 @@ public:
|
||||
static GesturePathDefine *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
const static uint32_t MAX_STROKE_DURATION = 60 * 1000;
|
||||
const static int64_t MAX_STROKE_DURATION = 60 * 1000;
|
||||
const static uint32_t MAX_STROKES = 10;
|
||||
|
||||
GesturePathPositionDefine startPosition_;
|
||||
GesturePathPositionDefine endPosition_;
|
||||
uint32_t durationTime_ = 0;
|
||||
int64_t durationTime_ = 0;
|
||||
};
|
||||
|
||||
class GestureResultListener {
|
||||
|
@ -102,7 +102,7 @@ bool AccessibilityElementInfo::ReadFromParcel(Parcel &parcel)
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, clickable_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, longClickable_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, enable_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, password_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isPassword_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, scrollable_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, editable_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, popupSupported_);
|
||||
@ -173,7 +173,7 @@ bool AccessibilityElementInfo::Marshalling(Parcel &parcel) const
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, clickable_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, longClickable_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, enable_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, password_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isPassword_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, scrollable_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, editable_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, popupSupported_);
|
||||
@ -598,14 +598,14 @@ void AccessibilityElementInfo::SetEnabled(const bool enabled)
|
||||
|
||||
bool AccessibilityElementInfo::IsPassword() const
|
||||
{
|
||||
HILOG_DEBUG("password_[%{public}d]", password_);
|
||||
return password_;
|
||||
HILOG_DEBUG();
|
||||
return isPassword_;
|
||||
}
|
||||
|
||||
void AccessibilityElementInfo::SetPassword(const bool password)
|
||||
void AccessibilityElementInfo::SetPassword(const bool type)
|
||||
{
|
||||
password_ = password;
|
||||
HILOG_DEBUG("password_[%{public}d]", password_);
|
||||
HILOG_DEBUG("type[%{public}d]", type);
|
||||
isPassword_ = type;
|
||||
}
|
||||
|
||||
bool AccessibilityElementInfo::IsScrollable() const
|
||||
|
@ -29,7 +29,7 @@ bool AccessibilityElementAsyncOperatorMng::SearchElementResultTimer(const int se
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
struct timeval getTime {};
|
||||
gettimeofday(&getTime, NULL);
|
||||
uint64_t startTime = getTime.tv_sec * SECOND_TO_MILLIS + getTime.tv_usec;
|
||||
uint64_t startTime = (uint64_t)(getTime.tv_sec * SECOND_TO_MILLIS + getTime.tv_usec);
|
||||
HILOG_DEBUG("element sequence[%{public}d]", sequence);
|
||||
|
||||
do {
|
||||
@ -37,8 +37,8 @@ bool AccessibilityElementAsyncOperatorMng::SearchElementResultTimer(const int se
|
||||
return true;
|
||||
}
|
||||
gettimeofday(&getTime, NULL);
|
||||
uint64_t endTime = getTime.tv_sec * SECOND_TO_MILLIS + getTime.tv_usec;
|
||||
uint64_t waitTime = endTime - startTime;
|
||||
uint64_t endTime = (uint64_t)(getTime.tv_sec * SECOND_TO_MILLIS + getTime.tv_usec);
|
||||
uint64_t waitTime = (uint64_t)(endTime - startTime);
|
||||
if (TIMEOUT_OPERATOR_MILLIS < waitTime) {
|
||||
completed_ = true;
|
||||
HILOG_ERROR("Failed to wait sequence[%{public}d], feedbackSequence_[%{public}d]",
|
||||
|
@ -451,13 +451,13 @@ void AccessibilityEventInfo::SetEventType(const EventType eventType)
|
||||
HILOG_DEBUG("eventType_[%{public}d]", eventType_);
|
||||
}
|
||||
|
||||
long long AccessibilityEventInfo::GetTimeStamp() const
|
||||
int64_t AccessibilityEventInfo::GetTimeStamp() const
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
return timeStamp_;
|
||||
}
|
||||
|
||||
void AccessibilityEventInfo::SetTimeStamp(const long long eventTime)
|
||||
void AccessibilityEventInfo::SetTimeStamp(const int64_t eventTime)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
timeStamp_ = eventTime;
|
||||
@ -500,16 +500,14 @@ ActionType AccessibilityEventInfo::GetTriggerAction() const
|
||||
}
|
||||
|
||||
AccessibilityEventInfo::AccessibilityEventInfo(int windowId, WindowUpdateType windowChangeTypes)
|
||||
: eventType_(TYPE_WINDOW_UPDATE), windowChangeTypes_(windowChangeTypes)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
eventType_ = TYPE_WINDOW_UPDATE;
|
||||
windowChangeTypes_ = windowChangeTypes;
|
||||
SetWindowId(windowId);
|
||||
}
|
||||
|
||||
AccessibilityEventInfo::AccessibilityEventInfo(EventType eventType)
|
||||
AccessibilityEventInfo::AccessibilityEventInfo(EventType eventType) : eventType_(eventType)
|
||||
{
|
||||
eventType_ = eventType;
|
||||
HILOG_DEBUG("eventType_[%{public}d]", eventType_);
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ bool AccessibilitySystemAbilityClient::IsCaptionEnabled()
|
||||
}
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> AccessibilitySystemAbilityClient::GetAbilityList(
|
||||
const int accessibilityAbilityTypes, const AbilityStateType stateType)
|
||||
const uint32_t accessibilityAbilityTypes, const AbilityStateType stateType)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
bool check = false;
|
||||
|
@ -202,7 +202,7 @@ uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterStateCallback(
|
||||
}
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy::GetAbilityList(
|
||||
const int abilityTypes, const int stateType)
|
||||
const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
@ -217,7 +217,7 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
return errorList;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(abilityTypes)) {
|
||||
if (!data.WriteUint32(abilityTypes)) {
|
||||
HILOG_ERROR("fail, connection write abilityTypes error");
|
||||
return errorList;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ ErrCode AccessibleAbilityManagerServiceStateStub::HandleOnStateChanged(MessagePa
|
||||
MessageParcel &reply)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
int stateType = data.ReadUint32();
|
||||
uint32_t stateType = data.ReadUint32();
|
||||
OnStateChanged(stateType);
|
||||
|
||||
return NO_ERROR;
|
||||
|
@ -151,12 +151,12 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleGetAbilityList(MessageP
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int abilityTypes = data.ReadInt32();
|
||||
int stateType = data.ReadInt32();
|
||||
uint32_t abilityTypes = data.ReadUint32();
|
||||
int32_t stateType = data.ReadInt32();
|
||||
std::vector<AccessibilityAbilityInfo> abilityInfos {};
|
||||
abilityInfos = GetAbilityList(abilityTypes, stateType);
|
||||
|
||||
int32_t abilityInfoSize = abilityInfos.size();
|
||||
int32_t abilityInfoSize = (int32_t)abilityInfos.size();
|
||||
reply.WriteInt32(abilityInfoSize);
|
||||
for (auto& abilityInfo : abilityInfos) {
|
||||
if (!reply.WriteParcelable(&abilityInfo)) {
|
||||
@ -386,10 +386,10 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleGetInstalledAbilities(
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> it = GetInstalledAbilities();
|
||||
int num = it.size();
|
||||
int32_t num = (int32_t)it.size();
|
||||
|
||||
reply.WriteInt32(it.size());
|
||||
for (int i = 0; i < num; i++) {
|
||||
reply.WriteInt32(num);
|
||||
for (int32_t i = 0; i < num; i++) {
|
||||
bool ret = reply.WriteParcelable(&it[i]);
|
||||
if (!ret) {
|
||||
return ErrCode::ERROR;
|
||||
|
@ -81,7 +81,7 @@ GesturePathPositionDefine *GesturePathPositionDefine::Unmarshalling(Parcel &parc
|
||||
}
|
||||
|
||||
GesturePathDefine::GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
GesturePathPositionDefine &endPosition, uint32_t durationTime)
|
||||
GesturePathPositionDefine &endPosition, int64_t durationTime)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
|
||||
@ -102,9 +102,9 @@ GesturePathDefine::GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
durationTime_ = durationTime;
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetDurationTime()
|
||||
int64_t GesturePathDefine::GetDurationTime()
|
||||
{
|
||||
HILOG_DEBUG("start and max stroke duration is %{public}d", durationTime_);
|
||||
HILOG_DEBUG("start and max stroke duration is %{public}lld", durationTime_);
|
||||
return durationTime_;
|
||||
}
|
||||
|
||||
@ -114,9 +114,9 @@ GesturePathPositionDefine &GesturePathDefine::GetEndPosition()
|
||||
return endPosition_;
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
int64_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
{
|
||||
HILOG_DEBUG("start and max stroke duration is %{public}d", MAX_STROKE_DURATION);
|
||||
HILOG_DEBUG("start and max stroke duration is %{public}lld", MAX_STROKE_DURATION);
|
||||
return MAX_STROKE_DURATION;
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ GesturePathPositionDefine &GesturePathDefine::GetStartPosition()
|
||||
return startPosition_;
|
||||
}
|
||||
|
||||
void GesturePathDefine::SetDurationTime(uint32_t durationTime)
|
||||
void GesturePathDefine::SetDurationTime(int64_t durationTime)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
durationTime_ = durationTime;
|
||||
@ -168,7 +168,7 @@ bool GesturePathDefine::ReadFromParcel(Parcel &parcel)
|
||||
}
|
||||
endPosition_ = *endPosition;
|
||||
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, durationTime_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, durationTime_);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -178,7 +178,7 @@ bool GesturePathDefine::Marshalling(Parcel &parcel) const
|
||||
HILOG_DEBUG("start.");
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &startPosition_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &endPosition_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, durationTime_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, durationTime_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType)
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
AccessibilityAbilityInfo info {};
|
||||
std::vector<AccessibilityAbilityInfo> infos;
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType)
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
std::vector<AccessibilityAbilityInfo> infos;
|
||||
return infos;
|
||||
|
@ -26,7 +26,7 @@ using namespace std;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
const uint32_t MAX_STROKE_DURATION = 60 * 1000;
|
||||
const int64_t MAX_STROKE_DURATION = 60 * 1000;
|
||||
const uint32_t MAX_STROKES = 10;
|
||||
|
||||
class UnitTestGestureResultListener : public GestureResultListener {
|
||||
@ -210,7 +210,7 @@ HWTEST_F(GestureSimulationUnitTest, GestureSimulation_Unittest_GesturePathDefine
|
||||
|
||||
GesturePathPositionDefine startPosition {};
|
||||
GesturePathPositionDefine endPosition {};
|
||||
uint32_t durationTime = 1;
|
||||
int64_t durationTime = 1;
|
||||
startPosition.SetPositionX(-1);
|
||||
shared_ptr<GesturePathDefine> path = make_shared<GesturePathDefine>(startPosition, endPosition, durationTime);
|
||||
EXPECT_NE(path->GetStartPosition().GetPositionX(), -1);
|
||||
@ -229,7 +229,7 @@ HWTEST_F(GestureSimulationUnitTest, GestureSimulation_Unittest_GesturePathDefine
|
||||
|
||||
GesturePathPositionDefine startPosition {};
|
||||
GesturePathPositionDefine endPosition {};
|
||||
uint32_t durationTime = 1;
|
||||
int64_t durationTime = 1;
|
||||
endPosition.SetPositionX(-1);
|
||||
shared_ptr<GesturePathDefine> path = make_shared<GesturePathDefine>(startPosition, endPosition, durationTime);
|
||||
EXPECT_NE(path->GetEndPosition().GetPositionX(), -1);
|
||||
@ -278,7 +278,7 @@ HWTEST_F(GestureSimulationUnitTest, GestureSimulation_Unittest_GesturePathDefine
|
||||
GTEST_LOG_(INFO) << "GestureSimulation_Unittest_GesturePathDefine_GetDurationTime_001 start";
|
||||
|
||||
GesturePathDefine path {};
|
||||
uint32_t durationTime = 1;
|
||||
int64_t durationTime = 1;
|
||||
|
||||
path.SetDurationTime(durationTime);
|
||||
EXPECT_EQ(path.GetDurationTime(), durationTime);
|
||||
@ -342,7 +342,7 @@ HWTEST_F(GestureSimulationUnitTest,
|
||||
GTEST_LOG_(INFO) << "GestureSimulation_Unittest_GesturePathDefine_SetDurationTime_001 start";
|
||||
|
||||
GesturePathDefine path {};
|
||||
uint32_t durationTime = 1;
|
||||
int64_t durationTime = 1;
|
||||
|
||||
path.SetDurationTime(durationTime);
|
||||
|
||||
@ -435,7 +435,7 @@ HWTEST_F(GestureSimulationUnitTest,
|
||||
startposition.SetPositionY(1.0);
|
||||
endposition.SetPositionX(2.0);
|
||||
endposition.SetPositionY(2.0);
|
||||
uint32_t durationTime = 1;
|
||||
int64_t durationTime = 1;
|
||||
|
||||
GesturePathDefine path {};
|
||||
path.SetDurationTime(durationTime);
|
||||
|
@ -1147,12 +1147,12 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Set whether the content in this node is a password
|
||||
* @param password true: password, otherwise is not.
|
||||
* @param type true: password, otherwise is not.
|
||||
* @return
|
||||
* @since 3
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
void SetPassword(const bool password);
|
||||
void SetPassword(const bool type);
|
||||
|
||||
/**
|
||||
* @brief Checks whether this node is scrollable.
|
||||
@ -1814,7 +1814,7 @@ private:
|
||||
bool clickable_ = false;
|
||||
bool longClickable_ = false;
|
||||
bool enable_ = false;
|
||||
bool password_ = false;
|
||||
bool isPassword_ = false;
|
||||
bool scrollable_ = false;
|
||||
bool editable_ = false;
|
||||
bool popupSupported_ = false;
|
||||
|
@ -48,7 +48,7 @@ enum WindowsContentChangeTypes : int {
|
||||
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION = 0x00000004,
|
||||
};
|
||||
|
||||
enum EventType : int {
|
||||
enum EventType : uint32_t {
|
||||
TYPE_VIEW_INVALID = 0,
|
||||
TYPE_VIEW_CLICKED_EVENT = 0x00000001,
|
||||
TYPE_VIEW_LONG_CLICKED_EVENT = 0x00000002,
|
||||
@ -571,7 +571,7 @@ public:
|
||||
* @since 3
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
long long GetTimeStamp() const;
|
||||
int64_t GetTimeStamp() const;
|
||||
|
||||
/**
|
||||
* @brief ASAC set the time of accessibility is sent to AA
|
||||
@ -580,7 +580,7 @@ public:
|
||||
* @since 3
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
void SetTimeStamp(const long long eventTime); // remained:for send event timestamp
|
||||
void SetTimeStamp(const int64_t eventTime); // remained:for send event timestamp
|
||||
|
||||
/**
|
||||
* @brief Gets the bundle name of the event source, that is, the bundle name of the target application.
|
||||
@ -722,11 +722,11 @@ private:
|
||||
EventType eventType_ = TYPE_VIEW_INVALID;
|
||||
std::string bundleName_ = "";
|
||||
ActionType triggerAction_ = ACCESSIBILITY_ACTION_INVALID;
|
||||
long long timeStamp_ = 0;
|
||||
int64_t timeStamp_ = 0;
|
||||
TextMoveUnit textMoveStep_ = STEP_CHARACTER;
|
||||
WindowsContentChangeTypes windowContentChangeTypes_ = CONTENT_CHANGE_TYPE_INVALID;
|
||||
WindowUpdateType windowChangeTypes_ = WINDOW_UPDATE_INVALID;
|
||||
GestureType gestureType_;
|
||||
GestureType gestureType_ = GESTURE_INVALID;
|
||||
int recordsCount_ = 0;
|
||||
std::vector<AccessibilityEventInfo> records_;
|
||||
NotificationCategory category_ = CATEGORY_INVALID;
|
||||
|
@ -39,7 +39,7 @@ enum AccessibilityControlType : int {
|
||||
CONTENT_TEXT = 0x00000004,
|
||||
};
|
||||
|
||||
enum AbilityStateType : int {
|
||||
enum AbilityStateType : int32_t {
|
||||
ABILITY_STATE_INVALID = 0,
|
||||
ABILITY_STATE_ENABLE,
|
||||
ABILITY_STATE_DISABLE,
|
||||
@ -54,7 +54,7 @@ enum AbilityStateType : int {
|
||||
*/
|
||||
class AccessibilitySystemAbilityClient {
|
||||
public:
|
||||
static const int NUM_INT32 = 32;
|
||||
static const int32_t NUM_INT32 = 32;
|
||||
static const uint32_t STATE_ACCESSIBILITY_ENABLED = 0x00000001;
|
||||
static const uint32_t STATE_EXPLORATION_ENABLED = 0x00000002;
|
||||
static const uint32_t STATE_CAPTION_ENABLED = 0x00000004;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
* @return
|
||||
*/
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(
|
||||
const int accessibilityAbilityTypes, const AbilityStateType stateType);
|
||||
const uint32_t accessibilityAbilityTypes, const AbilityStateType stateType);
|
||||
|
||||
/**
|
||||
* @brief Obtains the AccessibilitySystemAbilityClient instance.
|
||||
|
@ -95,8 +95,8 @@ struct NAccessibilitySystemAbilityClient {
|
||||
napi_env env_ {};
|
||||
bool enabled_ = false;
|
||||
bool touchEnabled_ = false;
|
||||
OHOS::Accessibility::AbilityStateType stateTypes_;
|
||||
int32_t abilityTypes_ = 0;
|
||||
OHOS::Accessibility::AbilityStateType stateTypes_ = OHOS::Accessibility::ABILITY_STATE_INVALID;
|
||||
uint32_t abilityTypes_ = 0;
|
||||
std::vector<OHOS::Accessibility::AccessibilityAbilityInfo> abilityList_ {};
|
||||
std::map<std::string, OHOS::AppExecFwk::ElementName> enabledAbilities_ {};
|
||||
OHOS::Accessibility::CaptionProperty captionProperty_ {};
|
||||
|
@ -182,7 +182,7 @@ napi_value NAccessibilityClient::GetAbilityList(napi_env env, napi_callback_info
|
||||
[](napi_env env, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
callbackInfo->abilityList_ = AccessibilitySystemAbilityClient::GetInstance()->GetAbilityList(
|
||||
int(callbackInfo->abilityTypes_), callbackInfo->stateTypes_);
|
||||
callbackInfo->abilityTypes_, callbackInfo->stateTypes_);
|
||||
HILOG_INFO("GetAbilityList Executing GetAbilityList[%{public}d]", callbackInfo->abilityList_.size());
|
||||
},
|
||||
// execute the complete function
|
||||
@ -1555,7 +1555,7 @@ napi_value NAccessibilityClient::DeregisterCaptionStateCallback(napi_env env, na
|
||||
it = NAccessibilityClient::captionListeners_.erase(it);
|
||||
HILOG_DEBUG("captionListeners_ size = %{public}d", captionListeners_.size());
|
||||
HILOG_INFO("unregister result%{public}d", callbackInfo->result_);
|
||||
retValue = retValue & callbackInfo->result_;
|
||||
retValue = retValue && callbackInfo->result_;
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
@ -1597,7 +1597,7 @@ napi_value NAccessibilityClient::DeregisterCaptionStateCallback(napi_env env, na
|
||||
it != NAccessibilityClient::captionListeners_.end();) {
|
||||
std::shared_ptr<CaptionListener> observer= *it;
|
||||
if (observer->GetEnv() == env && !strcmp(observer->GetEventType().c_str(), eventType.c_str())) {
|
||||
retValue = retValue &
|
||||
retValue = retValue &&
|
||||
AccessibilitySystemAbilityClient::GetInstance()->DeleteCaptionListener(observer, type);
|
||||
it = NAccessibilityClient::captionListeners_.erase(it);
|
||||
HILOG_INFO("unregister result%{public}d", retValue);
|
||||
|
@ -1536,13 +1536,13 @@ static void ConvertGesturePathJSToNAPI(napi_env env, napi_value object, GestureP
|
||||
gesturePath.SetEndPosition(gesturePathPosition);
|
||||
}
|
||||
|
||||
uint32_t durationTime = 0;
|
||||
int64_t durationTime = 0;
|
||||
napi_create_string_utf8(env, "durationTime", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_uint32(env, value, &durationTime);
|
||||
napi_get_value_int64(env, value, &durationTime);
|
||||
gesturePath.SetDurationTime(durationTime);
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ private:
|
||||
bool isDoubleTap_ = false;
|
||||
bool isRecognizingGesture_ = false;
|
||||
bool isGestureStarted_ = false;
|
||||
unsigned int startTime_ = 0;
|
||||
int64_t startTime_ = 0;
|
||||
float xMinPixels_ = 0;
|
||||
float yMinPixels_ = 0;
|
||||
float threshold_ = 0;
|
||||
@ -343,7 +343,7 @@ private:
|
||||
MMI::PointerEvent::PointerItem prePointer_ = {};
|
||||
MMI::PointerEvent::PointerItem startPointer_ = {};
|
||||
std::vector<Pointer> pointerRoute_ {};
|
||||
AccessibilityGestureRecognizeListener *listener_;
|
||||
AccessibilityGestureRecognizeListener *listener_ = nullptr;
|
||||
std::unique_ptr<MMI::PointerEvent> pPreUp_ = nullptr;
|
||||
std::shared_ptr<MMI::PointerEvent> pCurDown_ = nullptr;
|
||||
std::shared_ptr<GestureHandler> handler_ = nullptr;
|
||||
|
@ -155,21 +155,21 @@ private:
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void GetTapsEvents(long startTime);
|
||||
void GetTapsEvents(int64_t startTime);
|
||||
|
||||
/**
|
||||
* @brief Get move events.
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void GetMovesEvents(long startTime);
|
||||
void GetMovesEvents(int64_t startTime);
|
||||
|
||||
/**
|
||||
* @brief Get touchevents from gesturepath.
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void GetTouchEventsFromGesturePath(long startTime);
|
||||
void GetTouchEventsFromGesturePath(int64_t startTime);
|
||||
|
||||
/**
|
||||
* @brief create touchevent.
|
||||
@ -178,14 +178,14 @@ private:
|
||||
* @return the created touchevent
|
||||
*/
|
||||
std::shared_ptr<MMI::PointerEvent> obtainTouchEvent(int action,
|
||||
MMI::PointerEvent::PointerItem point, long actionTime);
|
||||
MMI::PointerEvent::PointerItem point, int64_t actionTime);
|
||||
|
||||
/**
|
||||
* @brief Get the number of milliseconds elapsed since the system was booted.
|
||||
* @param
|
||||
* @return the number of milliseconds elapsed since the system was booted
|
||||
*/
|
||||
long getSystemTime();
|
||||
int64_t getSystemTime();
|
||||
|
||||
int sequence_ = -1;
|
||||
bool isGestureUnderway_ = false;
|
||||
|
@ -61,7 +61,7 @@ enum ClickLocation : int {
|
||||
struct InjectedEventRecorder {
|
||||
int downPointers;
|
||||
int downPointerNum;
|
||||
long lastDownTime;
|
||||
int64_t lastDownTime;
|
||||
std::shared_ptr<MMI::PointerEvent> lastHoverEvent;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
private:
|
||||
int distance_ = 0;
|
||||
unsigned long timeout_ = 0;
|
||||
int64_t timeout_ = 0;
|
||||
int upCount_ = 0;
|
||||
int downCount_ = 0;
|
||||
std::shared_ptr<MMI::PointerEvent> pLastDown_ = nullptr;
|
||||
@ -58,7 +58,7 @@ private:
|
||||
* @brief Gets the effective time interval between two pointer events
|
||||
* set by the system.
|
||||
*/
|
||||
int GetSysTimeout() const;
|
||||
int64_t GetSysTimeout() const;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -148,14 +148,13 @@ private:
|
||||
bool IsWantedEvent(int eventType);
|
||||
bool IsAllowedListEvent(EventType eventType);
|
||||
|
||||
sptr<IRemoteObject::DeathRecipient> deathRecipient_ {};
|
||||
int connectionId_ = -1;
|
||||
sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
|
||||
sptr<IAccessibleAbilityClient> proxy_ = nullptr;
|
||||
sptr<AccessibleAbilityChannelStubImpl> stub_ = nullptr;
|
||||
AccessibilityAbilityInfo abilityInfo_;
|
||||
AppExecFwk::ElementName elementName_;
|
||||
sptr<AccessibilityAccountData> accountData_;
|
||||
|
||||
int connectionId_;
|
||||
AccessibilityAbilityInfo abilityInfo_ {};
|
||||
AppExecFwk::ElementName elementName_ {};
|
||||
sptr<AccessibilityAccountData> accountData_ = nullptr;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -59,7 +59,8 @@ public:
|
||||
uint32_t RegisterCaptionPropertyCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& callback, const int accountId) override;
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType) override;
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const uint32_t abilityTypes,
|
||||
const int32_t stateType) override;
|
||||
|
||||
void RegisterElementOperator(
|
||||
const int windowId, const sptr<IAccessibilityElementOperator>& operation, const int accountId) override;
|
||||
|
@ -653,7 +653,8 @@ bool AccessibilityAccountData::GetInstalledAbilitiesFromBMS()
|
||||
bms->QueryExtensionAbilityInfos(AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, id_, extensionInfos);
|
||||
HILOG_DEBUG("query extensionAbilityInfos' size is %{public}d.", extensionInfos.size());
|
||||
for (auto& info : extensionInfos) {
|
||||
AccessibilityAbilityInfo* accessibilityInfo = new AccessibilityAbilityInfo(info);
|
||||
std::shared_ptr<AccessibilityAbilityInfo> accessibilityInfo =
|
||||
std::make_shared<AccessibilityAbilityInfo>(info);
|
||||
AddInstalledAbility(*accessibilityInfo);
|
||||
}
|
||||
return true;
|
||||
@ -771,7 +772,7 @@ void AccessibilityAccountData::EnabledListInit(const std::shared_ptr<NativePrefe
|
||||
void AccessibilityAccountData::StringToVector(std::string &stringIn, std::vector<std::string> &vectorResult)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
int strLength = stringIn.size();
|
||||
int strLength = (int)stringIn.size();
|
||||
std::vector<int> position;
|
||||
int wrodCount = 0;
|
||||
|
||||
@ -785,7 +786,7 @@ void AccessibilityAccountData::StringToVector(std::string &stringIn, std::vector
|
||||
}
|
||||
}
|
||||
|
||||
wrodCount = position.size();
|
||||
wrodCount = (int)position.size();
|
||||
if ((wrodCount == 0) && (strLength > 0)) {
|
||||
vectorResult.push_back(stringIn);
|
||||
} else {
|
||||
|
@ -145,8 +145,8 @@ void AccessibilityGestureRecognizer::HandleTouchDownEvent(MMI::PointerEvent &eve
|
||||
if (!event.GetPointerItem(event.GetPointerId(), pointerIterm)) {
|
||||
HILOG_ERROR("get GetPointerItem(%d) failed", event.GetPointerId());
|
||||
}
|
||||
mp.px_ = pointerIterm.GetGlobalX();
|
||||
mp.py_ = pointerIterm.GetGlobalY();
|
||||
mp.px_ = static_cast<float>(pointerIterm.GetGlobalX());
|
||||
mp.py_ = static_cast<float>(pointerIterm.GetGlobalY());
|
||||
isDoubleTap_ = false;
|
||||
isRecognizingGesture_ = true;
|
||||
isGestureStarted_ = false;
|
||||
@ -166,7 +166,7 @@ bool AccessibilityGestureRecognizer::HandleTouchMoveEvent(MMI::PointerEvent &eve
|
||||
if (!event.GetPointerItem(event.GetPointerId(), pointerIterm)) {
|
||||
HILOG_ERROR("get GetPointerItem(%d) failed", event.GetPointerId());
|
||||
}
|
||||
unsigned int eventTime = event.GetActionTime() / US_TO_MS;
|
||||
int64_t eventTime = event.GetActionTime() / US_TO_MS;
|
||||
float offsetX = startPointer_.GetGlobalX() - pointerIterm.GetGlobalX();
|
||||
float offsetY = startPointer_.GetGlobalY() - pointerIterm.GetGlobalY();
|
||||
double duration = hypot(offsetX, offsetY);
|
||||
@ -181,8 +181,8 @@ bool AccessibilityGestureRecognizer::HandleTouchMoveEvent(MMI::PointerEvent &eve
|
||||
return listener_->OnStarted();
|
||||
}
|
||||
} else if (!isFirstTapUp_) {
|
||||
unsigned int durationTime = eventTime - startTime_;
|
||||
unsigned int thresholdTime = isGestureStarted_ ?
|
||||
int64_t durationTime = eventTime - startTime_;
|
||||
int64_t thresholdTime = isGestureStarted_ ?
|
||||
GESTURE_STARTED_TIME_THRESHOLD : GESTURE_NOT_STARTED_TIME_THRESHOLD;
|
||||
if (durationTime > thresholdTime) {
|
||||
isRecognizingGesture_ = false;
|
||||
@ -404,7 +404,7 @@ std::vector<Pointer> AccessibilityGestureRecognizer::GetPointerPath(std::vector<
|
||||
bool AccessibilityGestureRecognizer::isDoubleTap(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
int durationTime = (event.GetActionTime() - pPreUp_->GetActionTime()) / US_TO_MS;
|
||||
int64_t durationTime = (event.GetActionTime() - pPreUp_->GetActionTime()) / US_TO_MS;
|
||||
if (!(durationTime <= DOUBLE_TAP_TIMEOUT && durationTime >= MIN_DOUBLE_TAP_TIME)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -82,13 +82,13 @@ void TouchEventInjector::DestroyEvents()
|
||||
EventTransmission::DestroyEvents();
|
||||
}
|
||||
|
||||
void TouchEventInjector::GetTapsEvents(long startTime)
|
||||
void TouchEventInjector::GetTapsEvents(int64_t startTime)
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::GetTapsEvents: start");
|
||||
std::shared_ptr<MMI::PointerEvent> event;
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
long downTime = startTime;
|
||||
long nowTime = startTime;
|
||||
int64_t downTime = startTime;
|
||||
int64_t nowTime = startTime;
|
||||
pointer.SetPointerId(1);
|
||||
for (unsigned int i = 0; i < gesturePath_.size(); i++) {
|
||||
/* append down event */
|
||||
@ -116,13 +116,13 @@ void TouchEventInjector::GetTapsEvents(long startTime)
|
||||
}
|
||||
}
|
||||
|
||||
void TouchEventInjector::GetMovesEvents(long startTime)
|
||||
void TouchEventInjector::GetMovesEvents(int64_t startTime)
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::GetTapsEvents: start");
|
||||
std::shared_ptr<MMI::PointerEvent> event;
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
long downTime = startTime;
|
||||
long nowTime = startTime;
|
||||
int64_t downTime = startTime;
|
||||
int64_t nowTime = startTime;
|
||||
/* append down event */
|
||||
float px = gesturePath_[0].GetStartPosition().GetPositionX();
|
||||
float py = gesturePath_[0].GetStartPosition().GetPositionY();
|
||||
@ -168,7 +168,7 @@ void TouchEventInjector::InjectEventsInner()
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::InjectEventsInner: start");
|
||||
|
||||
long curTime = getSystemTime();
|
||||
int64_t curTime = getSystemTime();
|
||||
if (isDestroyEvent_ || !GetNext()) {
|
||||
currentGestureService_->OnGestureSimulateResult(sequence_, false);
|
||||
return;
|
||||
@ -213,8 +213,8 @@ void TouchEventInjector::CancelGesture()
|
||||
std::shared_ptr<MMI::PointerEvent> event;
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
pointer.SetPointerId(1);
|
||||
long time = getSystemTime();
|
||||
pointer.SetDownTime((int32_t)time * MS_TO_US);
|
||||
int64_t time = getSystemTime();
|
||||
pointer.SetDownTime(time * MS_TO_US);
|
||||
pointer.SetPointerId(1);
|
||||
if (GetNext() != nullptr && isGestureUnderway_) {
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_CANCEL, pointer, time);
|
||||
@ -233,7 +233,7 @@ void TouchEventInjector::CancelInjectedEvents()
|
||||
}
|
||||
}
|
||||
|
||||
void TouchEventInjector::GetTouchEventsFromGesturePath(long startTime)
|
||||
void TouchEventInjector::GetTouchEventsFromGesturePath(int64_t startTime)
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::GetTouchEventsFromGesturePath: start");
|
||||
if (gesturePath_[0].GetStartPosition().GetPositionX() == gesturePath_[0].GetEndPosition().GetPositionX() &&
|
||||
@ -245,7 +245,7 @@ void TouchEventInjector::GetTouchEventsFromGesturePath(long startTime)
|
||||
}
|
||||
|
||||
std::shared_ptr<MMI::PointerEvent> TouchEventInjector::obtainTouchEvent(int action,
|
||||
MMI::PointerEvent::PointerItem point, long actionTime)
|
||||
MMI::PointerEvent::PointerItem point, int64_t actionTime)
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::obtainTouchEvent: start");
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
|
||||
@ -258,12 +258,12 @@ std::shared_ptr<MMI::PointerEvent> TouchEventInjector::obtainTouchEvent(int acti
|
||||
return pointerEvent;
|
||||
}
|
||||
|
||||
long TouchEventInjector::getSystemTime()
|
||||
int64_t TouchEventInjector::getSystemTime()
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::getSystemTime: start");
|
||||
struct timespec times = {0, 0};
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
long millisecond = times.tv_sec * value_1000 + times.tv_nsec / value_1000000;
|
||||
int64_t millisecond = (int64_t)(times.tv_sec * value_1000 + times.tv_nsec / value_1000000);
|
||||
|
||||
return millisecond;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ int AccessibilityZoomGesture::GetSysDistance() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AccessibilityZoomGesture::GetSysTimeout() const
|
||||
int64_t AccessibilityZoomGesture::GetSysTimeout() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -281,10 +281,8 @@ void AccessibleAbilityChannelStubImpl::SendSimulateGesture(const int requestId,
|
||||
|
||||
AccessibleAbilityConnection::AccessibleAbilityConnection(const sptr<AccessibilityAccountData> &accountData,
|
||||
int connectionId, AccessibilityAbilityInfo &abilityInfo)
|
||||
: connectionId_(connectionId), abilityInfo_(abilityInfo), accountData_(accountData)
|
||||
{
|
||||
connectionId_ = connectionId;
|
||||
abilityInfo_ = abilityInfo;
|
||||
accountData_ = accountData;
|
||||
}
|
||||
|
||||
AccessibleAbilityConnection::~AccessibleAbilityConnection()
|
||||
|
@ -229,7 +229,7 @@ uint32_t AccessibleAbilityManagerService::RegisterStateCallback(
|
||||
}
|
||||
|
||||
vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList(
|
||||
const int abilityTypes, const int stateType)
|
||||
const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
HILOG_DEBUG("abilityTypes(%{public}d) stateType(%{public}d)", abilityTypes, stateType);
|
||||
vector<AccessibilityAbilityInfo> infoList;
|
||||
@ -248,8 +248,8 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
vector<AccessibilityAbilityInfo> abilities = accountData->GetAbilitiesByState(state);
|
||||
HILOG_DEBUG("abilityes count is %{public}d", abilities.size());
|
||||
for (auto& ability : abilities) {
|
||||
if (static_cast<uint32_t>(abilityTypes) == AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_ALL ||
|
||||
(ability.GetAccessibilityAbilityType() & static_cast<uint32_t>(abilityTypes))) {
|
||||
if (abilityTypes == AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_ALL ||
|
||||
(ability.GetAccessibilityAbilityType() & abilityTypes)) {
|
||||
infoList.push_back(ability);
|
||||
}
|
||||
}
|
||||
@ -598,7 +598,8 @@ void AccessibleAbilityManagerService::PackageChanged(std::string& bundleName)
|
||||
if (changedAbility.bundleName == bundleName) {
|
||||
HILOG_DEBUG("The package changed is an extension ability and\
|
||||
extension ability's name is %{public}s", changedAbility.name.c_str());
|
||||
AccessibilityAbilityInfo* accessibilityInfo = new AccessibilityAbilityInfo(changedAbility);
|
||||
std::shared_ptr<AccessibilityAbilityInfo> accessibilityInfo =
|
||||
std::make_shared<AccessibilityAbilityInfo>(changedAbility);
|
||||
GetCurrentAccountData()->AddInstalledAbility(*accessibilityInfo);
|
||||
HILOG_DEBUG("update new extension ability successfully and installed abilities's size is %{public}d",
|
||||
GetCurrentAccountData()->GetInstalledAbilities().size());
|
||||
@ -747,7 +748,7 @@ void AccessibleAbilityManagerService::UpdateInputFilter()
|
||||
return;
|
||||
}
|
||||
|
||||
int flag = 0;
|
||||
uint32_t flag = 0;
|
||||
if (accountData->GetScreenMagnificationFlag()) {
|
||||
flag |= AccessibilityInputInterceptor::FEATURE_SCREEN_MAGNIFICATION;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ AccessibilityEventInfo::AccessibilityEventInfo(EventType eventType)
|
||||
eventType_ = eventType;
|
||||
}
|
||||
|
||||
void AccessibilityEventInfo::SetTimeStamp(const long long eventTime)
|
||||
void AccessibilityEventInfo::SetTimeStamp(const int64_t eventTime)
|
||||
{
|
||||
timeStamp_ = eventTime;
|
||||
}
|
||||
|
@ -254,10 +254,10 @@ void AccessibilityElementInfo::SetEnabled(const bool enabled)
|
||||
|
||||
bool AccessibilityElementInfo::IsPassword() const
|
||||
{
|
||||
return password_;
|
||||
return isPassword_;
|
||||
}
|
||||
|
||||
void AccessibilityElementInfo::SetPassword(const bool password)
|
||||
void AccessibilityElementInfo::SetPassword(const bool type)
|
||||
{
|
||||
}
|
||||
|
||||
|
6
services/aams/test/mock/accessible_ability_manager_service_mock.cpp
Normal file → Executable file
6
services/aams/test/mock/accessible_ability_manager_service_mock.cpp
Normal file → Executable file
@ -133,8 +133,8 @@ uint32_t AccessibleAbilityManagerService::RegisterStateCallback(
|
||||
return accountData->GetAccessibilityState();
|
||||
}
|
||||
|
||||
vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList(const int abilityTypes,
|
||||
const int stateType)
|
||||
vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList(const uint32_t abilityTypes,
|
||||
const int32_t stateType)
|
||||
{
|
||||
vector<AccessibilityAbilityInfo> infoList;
|
||||
if ((stateType > ABILITY_STATE_INSTALLED) || (stateType < ABILITY_STATE_ENABLE)) {
|
||||
@ -152,7 +152,7 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
AbilityStateType state = static_cast<AbilityStateType>(stateType);
|
||||
vector<AccessibilityAbilityInfo> abilities = accountData->GetAbilitiesByState(state);
|
||||
for (auto &ability : abilities) {
|
||||
if (ability.GetAccessibilityAbilityType() & static_cast<uint32_t>(abilityTypes)) {
|
||||
if (ability.GetAccessibilityAbilityType() & abilityTypes) {
|
||||
infoList.push_back(ability);
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ GesturePathPositionDefine *GesturePathPositionDefine::Unmarshalling(Parcel &parc
|
||||
}
|
||||
|
||||
GesturePathDefine::GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
GesturePathPositionDefine &endPosition, uint32_t durationTime)
|
||||
GesturePathPositionDefine &endPosition, int64_t durationTime)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetDurationTime()
|
||||
int64_t GesturePathDefine::GetDurationTime()
|
||||
{
|
||||
return durationTime_;
|
||||
}
|
||||
@ -76,7 +76,7 @@ GesturePathPositionDefine &GesturePathDefine::GetEndPosition()
|
||||
return endPosition_;
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
int64_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
{
|
||||
return MAX_STROKE_DURATION;
|
||||
}
|
||||
@ -91,7 +91,7 @@ GesturePathPositionDefine &GesturePathDefine::GetStartPosition()
|
||||
return startPosition_;
|
||||
}
|
||||
|
||||
void GesturePathDefine::SetDurationTime(uint32_t durationTime)
|
||||
void GesturePathDefine::SetDurationTime(int64_t durationTime)
|
||||
{
|
||||
durationTime_ = durationTime;
|
||||
}
|
||||
|
5
services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp
Normal file → Executable file
5
services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp
Normal file → Executable file
@ -43,7 +43,8 @@ public:
|
||||
sptr<TouchEventInjector> touchEventInjector_ = nullptr;
|
||||
sptr<AccessibilityInputInterceptor> inputInterceptor_ = nullptr;
|
||||
protected:
|
||||
void CreateGesturePath(GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime);
|
||||
void CreateGesturePath(GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint,
|
||||
int64_t durationTime);
|
||||
sptr<IAccessibleAbilityClient> service = nullptr;
|
||||
MMI::PointerEvent CreateTouchEvent(int action);
|
||||
int pointId_ = -1;
|
||||
@ -85,7 +86,7 @@ void TouchEventInjectorTest::TearDown()
|
||||
}
|
||||
|
||||
void TouchEventInjectorTest::CreateGesturePath(
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime)
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int64_t durationTime)
|
||||
{
|
||||
GesturePathDefine gesturePathDefine = GesturePathDefine(startpoint, endpoint, durationTime);
|
||||
gesturePathDefine.SetStartPosition(startpoint);
|
||||
|
@ -50,7 +50,7 @@ AccessibilityEventInfo::AccessibilityEventInfo(EventType eventType)
|
||||
eventType_ = eventType;
|
||||
}
|
||||
|
||||
void AccessibilityEventInfo::SetTimeStamp(const long long eventTime)
|
||||
void AccessibilityEventInfo::SetTimeStamp(const int64_t eventTime)
|
||||
{
|
||||
timeStamp_ = eventTime;
|
||||
}
|
||||
|
@ -235,10 +235,10 @@ void AccessibilityElementInfo::SetEnabled(const bool enabled)
|
||||
|
||||
bool AccessibilityElementInfo::IsPassword() const
|
||||
{
|
||||
return password_;
|
||||
return isPassword_;
|
||||
}
|
||||
|
||||
void AccessibilityElementInfo::SetPassword(const bool password)
|
||||
void AccessibilityElementInfo::SetPassword(const bool type)
|
||||
{}
|
||||
|
||||
bool AccessibilityElementInfo::IsScrollable() const
|
||||
|
@ -122,8 +122,8 @@ uint32_t AccessibleAbilityManagerService::RegisterStateCallback(
|
||||
return accountData->GetAccessibilityState();
|
||||
}
|
||||
|
||||
vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList(const int abilityTypes,
|
||||
const int stateType)
|
||||
vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList(const uint32_t abilityTypes,
|
||||
const int32_t stateType)
|
||||
{
|
||||
vector<AccessibilityAbilityInfo> infoList;
|
||||
if ((stateType > ABILITY_STATE_INSTALLED) || (stateType < ABILITY_STATE_ENABLE)) {
|
||||
@ -141,7 +141,7 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
AbilityStateType state = static_cast<AbilityStateType>(stateType);
|
||||
vector<AccessibilityAbilityInfo> abilities = accountData->GetAbilitiesByState(state);
|
||||
for (auto &ability : abilities) {
|
||||
if (ability.GetAccessibilityAbilityType() & static_cast<uint32_t>(abilityTypes)) {
|
||||
if (ability.GetAccessibilityAbilityType() & abilityTypes) {
|
||||
infoList.push_back(ability);
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +61,10 @@ GesturePathPositionDefine *GesturePathPositionDefine::Unmarshalling(Parcel &parc
|
||||
}
|
||||
|
||||
GesturePathDefine::GesturePathDefine(GesturePathPositionDefine &startPosition,
|
||||
GesturePathPositionDefine &endPosition, uint32_t durationTime)
|
||||
GesturePathPositionDefine &endPosition, int64_t durationTime)
|
||||
{}
|
||||
|
||||
uint32_t GesturePathDefine::GetDurationTime()
|
||||
int64_t GesturePathDefine::GetDurationTime()
|
||||
{
|
||||
return durationTime_;
|
||||
}
|
||||
@ -74,7 +74,7 @@ GesturePathPositionDefine &GesturePathDefine::GetEndPosition()
|
||||
return endPosition_;
|
||||
}
|
||||
|
||||
uint32_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
int64_t GesturePathDefine::GetMaxStrokeDuration()
|
||||
{
|
||||
return MAX_STROKE_DURATION;
|
||||
}
|
||||
@ -89,7 +89,7 @@ GesturePathPositionDefine &GesturePathDefine::GetStartPosition()
|
||||
return startPosition_;
|
||||
}
|
||||
|
||||
void GesturePathDefine::SetDurationTime(uint32_t durationTime)
|
||||
void GesturePathDefine::SetDurationTime(int64_t durationTime)
|
||||
{
|
||||
durationTime_ = durationTime;
|
||||
}
|
||||
|
4
services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp
Normal file → Executable file
4
services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp
Normal file → Executable file
@ -55,7 +55,7 @@ public:
|
||||
|
||||
sptr<AccessibilityInputInterceptor> inputInterceptor_ = nullptr;
|
||||
void CreateGesturePath(
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime);
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int64_t durationTime);
|
||||
std::vector<GesturePathDefine> getGesturePath {};
|
||||
sptr<AccessibleAbilityChannelStubImpl> aacs_ = nullptr;
|
||||
sptr<OHOS::AppExecFwk::BundleMgrService> mock_ = nullptr;
|
||||
@ -128,7 +128,7 @@ void AamsInjectorTest::TearDown()
|
||||
}
|
||||
|
||||
void AamsInjectorTest::CreateGesturePath(
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime)
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int64_t durationTime)
|
||||
{
|
||||
GesturePathDefine gesturePathDefine = GesturePathDefine(startpoint, endpoint, durationTime);
|
||||
gesturePathDefine.SetStartPosition(startpoint);
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
void AddAccessibleAbilityConnection();
|
||||
void AddAccessibilityWindowConnection();
|
||||
void CreateGesturePath(
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime);
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int64_t durationTime);
|
||||
std::vector<GesturePathDefine> gestureSteps_ {};
|
||||
sptr<OHOS::AppExecFwk::BundleMgrService> mock_ = nullptr;
|
||||
shared_ptr<OHOS::Accessibility::AccessibleAbilityManagerService> aams_ = nullptr;
|
||||
@ -248,7 +248,7 @@ void AamsAccessibleAbilityChannelTest::AddAccessibilityWindowConnection()
|
||||
}
|
||||
|
||||
void AamsAccessibleAbilityChannelTest::CreateGesturePath(
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int durationTime)
|
||||
GesturePathPositionDefine startpoint, GesturePathPositionDefine endpoint, int64_t durationTime)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AamsAccessibleAbilityChannelTest CreateGesturePath";
|
||||
// create gesture
|
||||
|
@ -264,7 +264,7 @@ HWTEST_F(AAMSServerTest, GetAbilityList_003, TestSize.Level1)
|
||||
EXPECT_EQ(2, (int)accountData->GetInstalledAbilities().size());
|
||||
|
||||
/* ABILITY_STATE_DISABLE */
|
||||
int stateType = AbilityStateType::ABILITY_STATE_DISABLE;
|
||||
int32_t stateType = AbilityStateType::ABILITY_STATE_DISABLE;
|
||||
auto ret = aams_->GetAbilityList(AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_SPOKEN, stateType);
|
||||
EXPECT_EQ(int(ret.size()), 1);
|
||||
|
||||
@ -284,7 +284,7 @@ HWTEST_F(AAMSServerTest, GetAbilityList_004, TestSize.Level1)
|
||||
GTEST_LOG_(INFO) << "AAMSServerTest GetAbilityList_004 start";
|
||||
|
||||
AddAccessibleAbilityConnection();
|
||||
int stateType = AbilityStateType::ABILITY_STATE_DISABLE;
|
||||
int32_t stateType = AbilityStateType::ABILITY_STATE_DISABLE;
|
||||
auto ret = aams_->GetAbilityList(AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_SPOKEN, stateType);
|
||||
EXPECT_EQ(int(ret.size()), 0);
|
||||
|
||||
|
@ -167,7 +167,7 @@ void AamsStAbilityB1::GetAbilityList()
|
||||
{
|
||||
HILOG_INFO("AamsStAbilityB1::GetAbilityList");
|
||||
AbilityContext context;
|
||||
int accessibilityAbilityTypes = Accessibility::AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_SPOKEN;
|
||||
uint32_t accessibilityAbilityTypes = Accessibility::AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_SPOKEN;
|
||||
auto stateType = Accessibility::AbilityStateType::ABILITY_STATE_ENABLE;
|
||||
AccessibilitySystemAbilityClient::GetInstance(context)->GetAbilityList(accessibilityAbilityTypes, stateType);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Accessibility {
|
||||
template<class T>
|
||||
std::vector<T> TranslateListToVector(const std::list<T> &originList)
|
||||
{
|
||||
int len = originList.size();
|
||||
std::size_t len = originList.size();
|
||||
std::vector<T> destVector(len);
|
||||
std::copy(originList.begin(), originList.end(), destVector.begin());
|
||||
return destVector;
|
||||
|
@ -84,8 +84,15 @@ const std::string CAPABILITIES_JSON_VALUE_GESTURE = "gesture";
|
||||
bool JsonUtils::GetJsonObjFromJson(nlohmann::json &jsonObj, const std::string &jsonPath)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
|
||||
char realPath[PATH_MAX + 1] = { 0 };
|
||||
if (realpath(jsonPath.c_str(), realPath) == nullptr) {
|
||||
HILOG_ERROR("Fail to get realpath of %{public}s", jsonPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ifstream jsonFileStream;
|
||||
jsonFileStream.open(jsonPath.c_str(), std::ios::in);
|
||||
jsonFileStream.open(realPath, std::ios::in);
|
||||
if (!jsonFileStream.is_open()) {
|
||||
HILOG_ERROR("Open json file failed.");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user