mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-23 15:01:17 +00:00
release 20220222
Signed-off-by: yichengzhao <yichengzhao1@huawei.com>
This commit is contained in:
parent
501a877c0e
commit
f7490a9b84
@ -34,8 +34,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
// The global action types
|
||||
enum GlobalAction : uint32_t {
|
||||
GLOBAL_ACTION_INVALID = 0x0000,
|
||||
GLOBAL_ACTION_BACK = 0x0001,
|
||||
@ -56,7 +54,7 @@ public:
|
||||
/**
|
||||
* @brief Obtains elementInfo of focus.
|
||||
* @param focusType The type of focus. It contains FOCUS_TYPE_INPUT and FOCUS_TYPE_ACCESSIBILITY.
|
||||
* @param elementInfo The elementInfo of focus.
|
||||
* @param elementInfo The accessibilityElementInfo of focus.
|
||||
* @return Return true if obtains elementInfo successfully, else return false.
|
||||
*/
|
||||
bool GetFocusElementInfo(uint32_t focusType, std::optional<AccessibilityElementInfo>& elementInfo);
|
||||
@ -101,7 +99,7 @@ public:
|
||||
/**
|
||||
* @brief Executes a specified action.
|
||||
* @param action The action of OHOS::Accessibility::GlobalAction.
|
||||
* @return Return true if performs action successfully, else return false.
|
||||
* @return Return true if executes action successfully, else return false.
|
||||
*/
|
||||
bool ExecuteCommonAction(uint32_t action);
|
||||
|
||||
@ -133,8 +131,6 @@ private:
|
||||
std::map<uint32_t, std::shared_ptr<DisplayResizeController>> displayResizeControllers_ {};
|
||||
uint32_t channelId_ = 0xFFFFFFFF;
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ACCESSIBILITY_EXTENSION_CONTEXT_H
|
||||
#endif // ACCESSIBILITY_EXTENSION_CONTEXT_H
|
@ -21,11 +21,15 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
std::shared_ptr<AccessibilityUITestAbility> AccessibilityUITestAbility::instance_ = nullptr;
|
||||
AccessibilityUITestAbility& AccessibilityUITestAbility::GetInstance()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
static AccessibilityUITestAbility instance;
|
||||
return instance;
|
||||
if (instance_ == nullptr) {
|
||||
std::shared_ptr<AccessibilityUITestAbility> temp(new AccessibilityUITestAbility);
|
||||
instance_ = temp;
|
||||
}
|
||||
return *instance_;
|
||||
}
|
||||
|
||||
AccessibilityUITestAbility::AccessibilityUITestAbility()
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include "js_accessibility_extension_context.h"
|
||||
|
||||
#include "hilog_wrapper.h"
|
||||
#include "napi_accessibility_window_info.h"
|
||||
#include "js_extension_context.h"
|
||||
#include "js_runtime_utils.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "napi_accessibility_info.h"
|
||||
#include "napi_accessibility_utils.h"
|
||||
#include "napi_accessibility_window_info.h"
|
||||
|
||||
using namespace OHOS::AbilityRuntime;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace {
|
||||
constexpr int32_t ERROR_CODE_ONE = 1;
|
||||
class JsAccessibilityExtensionContext final {
|
||||
public:
|
||||
JsAccessibilityExtensionContext(
|
||||
explicit JsAccessibilityExtensionContext(
|
||||
const std::shared_ptr<AccessibilityExtensionContext>& context) : context_(context) {}
|
||||
~JsAccessibilityExtensionContext() = default;
|
||||
|
||||
|
@ -30,15 +30,13 @@ int AccessibilityElementOperatorCallbackStub::OnRemoteRequest(uint32_t code, Mes
|
||||
}
|
||||
|
||||
ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByAccessibilityIdResult(
|
||||
MessageParcel &data,
|
||||
MessageParcel &reply)
|
||||
MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByTextResult(
|
||||
MessageParcel &data,
|
||||
MessageParcel &reply)
|
||||
MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -184,8 +184,7 @@ bool AccessibilityOperator::ResetDisplayResize(const int channelId, const int di
|
||||
}
|
||||
|
||||
bool AccessibilityOperator::SetDisplayResizeScaleAndCenter(const int channelId,
|
||||
const int displayId, const float scale, const float centerX,
|
||||
const float centerY, const bool animate)
|
||||
const int displayId, const float scale, const float centerX, const float centerY, const bool animate)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibilityOperator SetDisplayResizeScaleAndCenter";
|
||||
return true;
|
||||
|
@ -24,50 +24,39 @@ namespace Accessibility {
|
||||
AccessibleAbilityManagerServiceClientProxy::AccessibleAbilityManagerServiceClientProxy(
|
||||
const sptr<IRemoteObject> &impl) : IRemoteProxy<IAccessibleAbilityManagerServiceClient>(impl)
|
||||
{}
|
||||
|
||||
AccessibleAbilityManagerServiceClientProxy::~AccessibleAbilityManagerServiceClientProxy()
|
||||
{}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerServiceClientProxy::SendEvent(const AccessibilityEventInfo &uiEvent, const int userId)
|
||||
{}
|
||||
|
||||
uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterStateCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceState> &client, const int userId)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy::GetAbilityList(const int abilityTypes,
|
||||
const int stateType)
|
||||
{
|
||||
std::vector<AccessibilityAbilityInfo> abilityInfos {};
|
||||
return abilityInfos;
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerServiceClientProxy::RegisterElementOperator(int windowId,
|
||||
const sptr <IAccessibilityElementOperator> &operation, const int userId)
|
||||
{}
|
||||
|
||||
void AccessibleAbilityManagerServiceClientProxy::DeregisterElementOperator(const int windowId)
|
||||
{}
|
||||
|
||||
sptr<IRemoteObject> AccessibleAbilityManagerServiceClientProxy::GetObject()
|
||||
{
|
||||
return this->AsObject();
|
||||
}
|
||||
|
||||
uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterCaptionPropertyCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& callback, const int accountId)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
CaptionProperty AccessibleAbilityManagerServiceClientProxy::GetCaptionProperty()
|
||||
{
|
||||
CaptionProperty cap;
|
||||
@ -105,7 +94,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetKeyEventObserverState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetTouchGuideState(const bool state)
|
||||
{
|
||||
return true;
|
||||
@ -118,7 +106,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetKeyEventObserverState(const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetEnabledObj(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
return true;
|
||||
@ -133,22 +120,18 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
std::vector<AccessibilityAbilityInfo> test;
|
||||
return test;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::RegisterUITestAbilityConnectionClient(const sptr<IRemoteObject>& obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::DeregisterUITestAbilityConnectionClient()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int AccessibleAbilityManagerServiceClientProxy::GetActiveWindow()
|
||||
{
|
||||
return 0;
|
||||
|
@ -28,10 +28,8 @@ namespace OHOS {
|
||||
namespace Accessibility {
|
||||
/*
|
||||
* The class supply the callback to feedback the result from UI to AA.
|
||||
|
||||
*/
|
||||
class IAccessibilityElementOperatorCallback : public IRemoteBroker
|
||||
{
|
||||
class IAccessibilityElementOperatorCallback : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibilityElementOperatorCallback");
|
||||
|
||||
@ -85,7 +83,6 @@ public:
|
||||
SET_RESULT_PERFORM_ACTION,
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -308,15 +308,14 @@ public:
|
||||
*/
|
||||
void SendSimulateGesture(const int channelId, const int sequenceNum,
|
||||
const std::vector<GesturePathDefine> &gestureSteps);
|
||||
|
||||
private:
|
||||
static const uint32_t MAX_REQUEST = 0x7FFFFFFF;
|
||||
static std::vector<sptr<AccessibilityOperator>> instances_;
|
||||
static std::map<int, sptr<IAccessibleAbilityChannel>> channels_;
|
||||
AccessibilityElementAsyncOperatorMng asyncElementOperatorMng_ {};
|
||||
AccessibilityElementInfo accessibilityInfoResult_{};
|
||||
std::vector<AccessibilityElementInfo> accessibilityInfosResult_{};
|
||||
std::vector<AccessibilityWindowInfo> windows_{};
|
||||
AccessibilityElementAsyncOperatorMng asyncElementOperatorMng_ = {};
|
||||
AccessibilityElementInfo accessibilityInfoResult_ = {};
|
||||
std::vector<AccessibilityElementInfo> accessibilityInfosResult_ = {};
|
||||
std::vector<AccessibilityWindowInfo> windows_ = {};
|
||||
bool executeActionResult_ = false;
|
||||
static std::recursive_mutex mutex_;
|
||||
};
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 ACCESSIBLE_ABILITY_MANAGER_SERVICE_CAPTION_PROPERTY_INTERFACE_H
|
||||
#define ACCESSIBLE_ABILITY_MANAGER_SERVICE_CAPTION_PROPERTY_INTERFACE_H
|
||||
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 ACCESSIBILE_ABILITY_MANAMGER_SERVICE_CAPTION_PROPERTY_PROXY_H
|
||||
#define ACCESSIBILE_ABILITY_MANAMGER_SERVICE_CAPTION_PROPERTY_PROXY_H
|
||||
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_ABILITY_MANAGER_SERVICE_CAPTION_PROPERTY_STUB_H
|
||||
#define ACCESSIBILITY_ABILITY_MANAGER_SERVICE_CAPTION_PROPERTY_STUB_H
|
||||
|
||||
|
@ -134,11 +134,9 @@ public:
|
||||
DISABLE_ABILITIES,
|
||||
REGISTER_UITEST_ABILITY_CONNECTION_CLIENT,
|
||||
DEREGISTER_UITEST_ABILITY_CONNECTION_CLIENT,
|
||||
GET_ACTIVE_WINDOW
|
||||
|
||||
GET_ACTIVE_WINDOW,
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -124,7 +124,6 @@ public:
|
||||
* @return IPC object
|
||||
*/
|
||||
sptr<IRemoteObject> GetObject();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Write the descriptor of IPC.
|
||||
@ -134,7 +133,6 @@ private:
|
||||
bool WriteInterfaceToken(MessageParcel& data);
|
||||
static inline BrokerDelegator<AccessibleAbilityManagerServiceClientProxy> delegator;
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -59,7 +59,6 @@ public:
|
||||
*/
|
||||
virtual int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Handle the IPC request for the function:HandleSendEvent.
|
||||
@ -133,7 +132,6 @@ private:
|
||||
|
||||
DISALLOW_COPY_AND_MOVE(AccessibleAbilityManagerServiceClientStub);
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -99,6 +99,7 @@ bool AccessibilityOperator::GetRoot(int channelId, AccessibilityElementInfo &ele
|
||||
AccessibilityElementInfo element {};
|
||||
std::vector<AccessibilityElementInfo> elementInfos {};
|
||||
int activeWindow = AccessibilitySystemAbilityClient::GetInstance()->GetActiveWindow();
|
||||
HILOG_DEBUG("[%{public}s] activeWindow is %{public}d", __func__, activeWindow);
|
||||
bool result = SearchElementInfosByAccessibilityId(channelId, activeWindow, NONE_ID, 0, elementInfos);
|
||||
for (auto& info : elementInfos) {
|
||||
HILOG_DEBUG("[%{public}s] element [elementSize:%{public}d]", __func__, accessibilityInfosResult_.size());
|
||||
@ -193,13 +194,15 @@ bool AccessibilityOperator::FindFocusedElementInfo(int channelId, int accessibil
|
||||
HILOG_DEBUG("[%{public}s] [channelId:%{public}d]", __func__, channelId);
|
||||
bool result = false;
|
||||
auto channelService = GetChannel(channelId);
|
||||
|
||||
if (channelService != nullptr) {
|
||||
int sequenceNum = asyncElementOperatorMng_.RecordSearchSequence();
|
||||
result = channelService->FindFocusedElementInfo(accessibilityWindowId, elementId, focusType, sequenceNum,
|
||||
this);
|
||||
result = channelService->FindFocusedElementInfo(accessibilityWindowId, elementId,
|
||||
focusType, sequenceNum, this);
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
HILOG_DEBUG(
|
||||
"FindFocusedElementInfo channelId[%{public}d] elementId[%{public}d],\
|
||||
focusType[%{public}d] sequenceNum[%{public}d]",
|
||||
@ -218,8 +221,8 @@ bool AccessibilityOperator::FindFocusedElementInfo(int channelId, int accessibil
|
||||
HILOG_DEBUG("[%{public}s] Can't find the component info", __func__);
|
||||
result = false;
|
||||
} else {
|
||||
elementInfo = accessibilityInfoResult_;
|
||||
result = true;
|
||||
elementInfo = accessibilityInfoResult_;
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -260,7 +260,7 @@ shared_ptr<AccessibilitySystemAbilityClient> AccessibilitySystemAbilityClient::G
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
if (instance_ == nullptr) {
|
||||
int accountId = 100; //TBD
|
||||
int accountId = 100; // temp deal
|
||||
instance_ = std::make_shared<AccessibilitySystemAbilityClient>(abilityContext, accountId);
|
||||
} else {
|
||||
HILOG_DEBUG("IAccessibleAbilityManagerServiceClient had construct instance");
|
||||
@ -274,7 +274,7 @@ shared_ptr<AccessibilitySystemAbilityClient> AccessibilitySystemAbilityClient::G
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
AbilityContext abilityContext{};
|
||||
if (instance_ == nullptr) {
|
||||
int accountId = 100; //TBD
|
||||
int accountId = 100; // temp deal
|
||||
instance_ = std::make_shared<AccessibilitySystemAbilityClient>(abilityContext, accountId);
|
||||
} else {
|
||||
HILOG_DEBUG("IAccessibleAbilityManagerServiceClient had construct instance");
|
||||
@ -360,7 +360,6 @@ bool AccessibilitySystemAbilityClient::SetCaptionStateTojson(const bool state)
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
bool ret = false;
|
||||
if (isCaptionEnabled_ != state) {
|
||||
|
||||
auto proxyService = pimpl->GetService();
|
||||
if (proxyService == nullptr) {
|
||||
HILOG_ERROR("[%{public}s] Failed to get aams service", __func__);
|
||||
@ -439,7 +438,7 @@ bool AccessibilitySystemAbilityClient::SendEvent(const AccessibilityEventInfo& e
|
||||
HILOG_ERROR("[%{public}s] bundleName is invalid", __func__);
|
||||
return false;
|
||||
}
|
||||
if(!CheckActionType(event.GetTriggerAction())) {
|
||||
if (!CheckActionType(event.GetTriggerAction())) {
|
||||
return false;
|
||||
}
|
||||
auto proxyService = pimpl->GetService();
|
||||
@ -459,7 +458,7 @@ bool AccessibilitySystemAbilityClient::SubscribeStateObserver(
|
||||
eventType != AccessibilityStateEventType::EVENT_TOUCH_GUIDE_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_CAPTION_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_KEVEVENT_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_GESTURE_STATE_CHANGED ) {
|
||||
eventType != AccessibilityStateEventType::EVENT_GESTURE_STATE_CHANGED) {
|
||||
HILOG_ERROR("[%{public}s] Input eventType is out of scope", __func__);
|
||||
return false;
|
||||
}
|
||||
@ -497,8 +496,8 @@ bool AccessibilitySystemAbilityClient::UnsubscribeStateObserver(
|
||||
if (eventType != AccessibilityStateEventType::EVENT_ACCESSIBILITY_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_TOUCH_GUIDE_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_CAPTION_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_KEVEVENT_STATE_CHANGED&&
|
||||
eventType != AccessibilityStateEventType::EVENT_GESTURE_STATE_CHANGED ) {
|
||||
eventType != AccessibilityStateEventType::EVENT_KEVEVENT_STATE_CHANGED &&
|
||||
eventType != AccessibilityStateEventType::EVENT_GESTURE_STATE_CHANGED) {
|
||||
HILOG_ERROR("[%{public}s] Input eventType is out of scope", __func__);
|
||||
return false;
|
||||
}
|
||||
@ -670,11 +669,17 @@ void AccessibilitySystemAbilityClient::NotifyCaptionStateChanged()
|
||||
|
||||
bool AccessibilitySystemAbilityClient::AddCaptionListener(const std::shared_ptr<CaptionObserver>& ob, const int type)
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
bool result = true;
|
||||
if (type == CaptionObserverType::CAPTION_ENABLE) {
|
||||
observersCaptionEnable_.push_back(ob);
|
||||
if (observersCaptionEnable_.size() == 0) {
|
||||
observersCaptionEnable_.push_back(ob);
|
||||
}
|
||||
|
||||
} else if (type == CaptionObserverType::CAPTION_PROPERTY) {
|
||||
observersCaptionProperty_.push_back(ob);
|
||||
if (observersCaptionProperty_.size() == 0) {
|
||||
observersCaptionProperty_.push_back(ob);
|
||||
}
|
||||
} else {
|
||||
result = false;
|
||||
HILOG_ERROR("%{public}s Type Error ", __func__);
|
||||
@ -685,6 +690,7 @@ bool AccessibilitySystemAbilityClient::AddCaptionListener(const std::shared_ptr<
|
||||
|
||||
bool AccessibilitySystemAbilityClient::DeleteCaptionListener(const std::shared_ptr<CaptionObserver>& ob, const int type)
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
bool result = false;
|
||||
if (type == CaptionObserverType::CAPTION_ENABLE) {
|
||||
for (auto it = observersCaptionEnable_.begin(); it != observersCaptionEnable_.end(); it++) {
|
||||
@ -795,8 +801,7 @@ bool AccessibilitySystemAbilityClient::GetKeyEventObserverState()
|
||||
bool AccessibilitySystemAbilityClient::SetTouchGuideState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
if (isTouchExplorationEnabled_ != state)
|
||||
{
|
||||
if (isTouchExplorationEnabled_ != state) {
|
||||
isTouchExplorationEnabled_ = state;
|
||||
NotifyTouchExplorationStateChanged();
|
||||
}
|
||||
@ -806,10 +811,8 @@ bool AccessibilitySystemAbilityClient::SetTouchGuideState(const bool state)
|
||||
bool AccessibilitySystemAbilityClient::SetGestureState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
if (isGesturesSimulationEnabled_ != state)
|
||||
{
|
||||
if (isGesturesSimulationEnabled_ != state) {
|
||||
isGesturesSimulationEnabled_ = state;
|
||||
|
||||
NotifyGestureStateChanged();
|
||||
}
|
||||
return true;
|
||||
@ -818,8 +821,7 @@ bool AccessibilitySystemAbilityClient::SetGestureState(const bool state)
|
||||
bool AccessibilitySystemAbilityClient::SetKeyEventObserverState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
if (isFilteringKeyEventsEnabled_ != state)
|
||||
{
|
||||
if (isFilteringKeyEventsEnabled_ != state) {
|
||||
isFilteringKeyEventsEnabled_ = state;
|
||||
NotifyKeyEventStateChanged();
|
||||
}
|
||||
@ -853,10 +855,10 @@ std::map<std::string, AppExecFwk::ElementName> AccessibilitySystemAbilityClient:
|
||||
std::vector<AccessibilityAbilityInfo> AccessibilitySystemAbilityClient::GetInstalledAbilities()
|
||||
{
|
||||
HILOG_DEBUG("[%{public}s]", __func__);
|
||||
std::vector<AccessibilityAbilityInfo> it{};
|
||||
auto proxyService = pimpl->GetService();
|
||||
if (proxyService == nullptr) {
|
||||
HILOG_ERROR("[%{public}s] Failed to get aams service", __func__);
|
||||
std::vector<AccessibilityAbilityInfo> it;
|
||||
return it;
|
||||
}
|
||||
return proxyService->GetInstalledAbilities();
|
||||
|
@ -631,12 +631,11 @@ bool AccessibleAbilityManagerServiceClientProxy::SetEnabledObj(std::map<std::str
|
||||
data.WriteInt32(it.size());
|
||||
std::map<std::string, AppExecFwk::ElementName>::iterator iter;
|
||||
|
||||
for (iter = it.begin(); iter != it.end();) {
|
||||
for (iter = it.begin(); iter != it.end(); ++iter) {
|
||||
bool ret = data.WriteParcelable(&iter->second);
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
@ -696,7 +695,6 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> it{};
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
@ -709,7 +707,6 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
return it;
|
||||
}
|
||||
|
||||
int dev_num = reply.ReadInt32();
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AccessibilityAbilityInfo> dev(reply.ReadParcelable<AccessibilityAbilityInfo>());
|
||||
@ -731,22 +728,18 @@ bool AccessibleAbilityManagerServiceClientProxy::DisableAbilities(std::map<std::
|
||||
HILOG_ERROR("%{public}s fail, connection write Token", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
data.WriteInt32(it.size());
|
||||
std::map<std::string, AppExecFwk::ElementName>::iterator iter;
|
||||
|
||||
for (iter = it.begin(); iter != it.end(); iter++) {
|
||||
for (iter = it.begin(); iter != it.end(); ++iter) {
|
||||
bool ret = data.WriteParcelable(&iter->second);
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::DISABLE_ABILITIES),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetEnabledObj fail, error: %{public}d", error);
|
||||
return false;
|
||||
|
@ -350,16 +350,15 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleSetEnabledObj(MessagePa
|
||||
HILOG_DEBUG("ReadParcelable failed");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
std::vector<AppExecFwk::ElementName> temp{};
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AppExecFwk::ElementName> iter(data.ReadParcelable<AppExecFwk::ElementName>());
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
it.insert(make_pair(temp[i].GetURI(), temp[i]));
|
||||
}
|
||||
|
||||
SetEnabledObj(it);
|
||||
|
||||
return ErrCode::NO_ERROR;
|
||||
@ -370,17 +369,14 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleGetEnabledAbilities(Mes
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
|
||||
std::map<std::string, AppExecFwk::ElementName> it = GetEnabledAbilities();
|
||||
|
||||
reply.WriteInt32(it.size());
|
||||
|
||||
std::map<std::string, AppExecFwk::ElementName>::iterator iter;
|
||||
|
||||
for (iter = it.begin(); iter != it.end();) {
|
||||
reply.WriteInt32(it.size());
|
||||
for (iter = it.begin(); iter != it.end(); ++iter) {
|
||||
bool ret = reply.WriteParcelable(&iter->second);
|
||||
if (!ret) {
|
||||
return ERROR;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
return ErrCode::NO_ERROR;
|
||||
@ -392,10 +388,9 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleGetInstalledAbilities(
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> it = GetInstalledAbilities();
|
||||
int num = it.size();
|
||||
|
||||
reply.WriteInt32(it.size());
|
||||
|
||||
int num = it.size();
|
||||
for (int i = 0; i < num; i++) {
|
||||
bool ret = reply.WriteParcelable(&it[i]);
|
||||
if (!ret) {
|
||||
@ -411,21 +406,19 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleDisableAbilities(Messag
|
||||
|
||||
std::map<std::string, AppExecFwk::ElementName> it{};
|
||||
int dev_num = data.ReadInt32();
|
||||
|
||||
if (dev_num == 0) {
|
||||
HILOG_DEBUG("ReadParcelable failed");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
std::vector<AppExecFwk::ElementName> temp{};
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AppExecFwk::ElementName> iter(data.ReadParcelable<AppExecFwk::ElementName>());
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
it.insert(make_pair(temp[i].GetURI(), temp[i]));
|
||||
}
|
||||
|
||||
DisableAbilities(it);
|
||||
|
||||
return ErrCode::NO_ERROR;
|
||||
|
@ -25,25 +25,33 @@ namespace Accessibility {
|
||||
*/
|
||||
class MockAccessibleAbilityManagerServiceStub : public AccessibleAbilityManagerServiceClientStub {
|
||||
public:
|
||||
MockAccessibleAbilityManagerServiceStub() {}
|
||||
~MockAccessibleAbilityManagerServiceStub() {}
|
||||
MockAccessibleAbilityManagerServiceStub()
|
||||
{}
|
||||
~MockAccessibleAbilityManagerServiceStub()
|
||||
{}
|
||||
|
||||
void SendEvent(const AccessibilityEventInfo &uiEvent, const int accountId) {}
|
||||
void SendEvent(const AccessibilityEventInfo &uiEvent, const int accountId)
|
||||
{}
|
||||
|
||||
uint32_t RegisterStateCallback(const sptr<IAccessibleAbilityManagerServiceState> &callback, const int accountId) {
|
||||
uint32_t RegisterStateCallback(const sptr<IAccessibleAbilityManagerServiceState> &callback, const int accountId)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType) {
|
||||
std::vector<AccessibilityAbilityInfo> GetAbilityList(const int abilityTypes, const int stateType)
|
||||
{
|
||||
std::vector<AccessibilityAbilityInfo> infos;
|
||||
return infos;
|
||||
}
|
||||
void RegisterElementOperator(const int windowId,
|
||||
const sptr<IAccessibilityElementOperator> &operation,
|
||||
const int accountId) {}
|
||||
void DeregisterElementOperator(const int windowId) {}
|
||||
const int accountId)
|
||||
{}
|
||||
void DeregisterElementOperator(const int windowId)
|
||||
{}
|
||||
|
||||
uint32_t RegisterCaptionPropertyCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& callback, const int accountId) {
|
||||
const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& callback, const int accountId)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
CaptionProperty GetCaptionProperty()
|
||||
@ -51,54 +59,69 @@ public:
|
||||
CaptionProperty cap;
|
||||
return cap;
|
||||
}
|
||||
bool GetEnabledState() {
|
||||
bool GetEnabledState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetCaptionState() {
|
||||
bool GetCaptionState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetTouchGuideState() {
|
||||
bool GetTouchGuideState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetGestureState() {
|
||||
bool GetGestureState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetKeyEventObserverState() {
|
||||
bool GetKeyEventObserverState()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetCaptionProperty(const CaptionProperty& caption) {
|
||||
bool SetCaptionProperty(const CaptionProperty& caption)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool SetCaptionState(const bool state) {
|
||||
bool SetCaptionState(const bool state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool SetEnabled(const bool state) {
|
||||
bool SetEnabled(const bool state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool SetTouchGuideState(const bool state) {
|
||||
bool SetTouchGuideState(const bool state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool SetGestureState(const bool state) {
|
||||
bool SetGestureState(const bool state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool SetKeyEventObserverState(const bool state) {
|
||||
bool SetKeyEventObserverState(const bool state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetEnabledObj(std::map<std::string, AppExecFwk::ElementName> it) {
|
||||
bool SetEnabledObj(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
std::map<std::string, AppExecFwk::ElementName> GetEnabledAbilities() {
|
||||
std::map<std::string, AppExecFwk::ElementName> GetEnabledAbilities()
|
||||
{
|
||||
std::map<std::string, AppExecFwk::ElementName> test;
|
||||
return test;
|
||||
}
|
||||
std::vector<AccessibilityAbilityInfo> GetInstalledAbilities() {
|
||||
std::vector<AccessibilityAbilityInfo> GetInstalledAbilities()
|
||||
{
|
||||
std::vector<AccessibilityAbilityInfo> test;
|
||||
return test;
|
||||
}
|
||||
|
||||
bool DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it) {
|
||||
bool DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -73,45 +73,6 @@ ohos_systemtest("asac_system_test") {
|
||||
"ability_runtime:ability_manager",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_systemtest("ui_test_ability_test") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"./uiTestAbilityTest.cpp",
|
||||
]
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"//base/accessibility/interfaces/innerkits/aafwk/include",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
|
||||
"//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
|
||||
"//third_party/googletest:gtest_main",
|
||||
"//utils/native/base:utils",
|
||||
"//base/miscservices/time/services:time_service",
|
||||
"//base/accessibility/interfaces/innerkits/asacfwk:accessibilityclient",
|
||||
"//base/accessibility/frameworks/aafwk:accessibleability",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ipc:ipc_core",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"multimodalinput_base:libmmi-client",
|
||||
"samgr_standard:samgr_proxy",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:runtime",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
group("systemtest") {
|
||||
@ -120,7 +81,6 @@ group("systemtest") {
|
||||
|
||||
deps += [
|
||||
":asac_system_test",
|
||||
":ui_test_ability_test",
|
||||
]
|
||||
}
|
||||
###############################################################################
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 <future>
|
||||
#include <memory>
|
||||
|
||||
#include "accessibility_ui_test_ability.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class UITestAbilityTest : public testing::Test {
|
||||
public:
|
||||
|
||||
UITestAbilityTest() {}
|
||||
~UITestAbilityTest() {}
|
||||
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
public:
|
||||
class UITestAbilityListenerImpl : public IAccessibleUITestAbilityListener {
|
||||
public:
|
||||
virtual ~UITestAbilityListenerImpl() = default;
|
||||
|
||||
virtual void OnAbilityConnected() override
|
||||
{
|
||||
std::printf("%s \n", __FUNCTION__);
|
||||
connected_ = true;
|
||||
// promise_.set_value();
|
||||
}
|
||||
virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override
|
||||
{
|
||||
std::printf("%s \n", __FUNCTION__);
|
||||
}
|
||||
virtual bool OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int sequence) override
|
||||
{
|
||||
std::printf("%s \n", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
virtual void OnGestureSimulateResult(const int sequence, const bool completedSuccessfully) override
|
||||
{
|
||||
std::printf("%s \n", __FUNCTION__);
|
||||
}
|
||||
|
||||
bool connected_ = false;
|
||||
// std::promise<void> promise_;
|
||||
};
|
||||
|
||||
public:
|
||||
std::shared_ptr<UITestAbilityListenerImpl> listener_ = nullptr;
|
||||
};
|
||||
|
||||
void UITestAbilityTest::SetUp()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "UITestAbilityTest SetUp";
|
||||
|
||||
listener_ = std::make_shared<UITestAbilityListenerImpl>();
|
||||
}
|
||||
|
||||
void UITestAbilityTest::TearDown()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "UITestAbilityTest TearDown";
|
||||
listener_ = nullptr;
|
||||
}
|
||||
|
||||
HWTEST_F(UITestAbilityTest, Extension_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "UITestAbilityTest Extension_001 start";
|
||||
|
||||
bool ret = AccessibilityUITestAbility::GetInstance().RegisterListener(listener_);
|
||||
EXPECT_EQ(ret, true);
|
||||
|
||||
ret = AccessibilityUITestAbility::GetInstance().Connect();
|
||||
EXPECT_EQ(ret, true);
|
||||
|
||||
// std::promise<void> connectPromise;
|
||||
// std::future<void> connectFuture = connectPromise.get_future();
|
||||
// listener_->promise_ = std::move(connectPromise);
|
||||
// connectFuture.wait();
|
||||
sleep(3);
|
||||
|
||||
EXPECT_EQ(listener_->connected_, true);
|
||||
|
||||
ret = AccessibilityUITestAbility::GetInstance().Disconnect();
|
||||
EXPECT_EQ(ret, true);
|
||||
|
||||
GTEST_LOG_(INFO) << "UITestAbilityTest Extension_001 end";
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -26,6 +26,8 @@ namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class AccessibilityUITestAbility final : public AccessibilityExtensionContext {
|
||||
public:
|
||||
~AccessibilityUITestAbility() = default;
|
||||
|
||||
/**
|
||||
* @brief Gets an instance of AccessibleAbility.
|
||||
* @param
|
||||
@ -56,12 +58,12 @@ public:
|
||||
|
||||
private:
|
||||
AccessibilityUITestAbility();
|
||||
~AccessibilityUITestAbility() = default;
|
||||
|
||||
void GetService();
|
||||
|
||||
sptr<AccessibleAbilityClientStubImpl> stub_ = nullptr;
|
||||
sptr<AccessibleAbilityManagerServiceClientProxy> serviceProxy_ = nullptr;
|
||||
static std::shared_ptr<AccessibilityUITestAbility> instance_;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -1,187 +1,200 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_ABILILTY_INFO_H
|
||||
#define ACCESSIBILITY_ABILILTY_INFO_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "accessibility_event_info.h"
|
||||
#include "extension_ability_info.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
// The capability types of the accessible ability.
|
||||
enum Capability : uint32_t {
|
||||
CAPABILITY_RETRIEVE = 0x0001,
|
||||
CAPABILITY_TOUCH_GUIDE = 0x0002,
|
||||
CAPABILITY_KEY_EVENT_OBSERVER = 0x0008,
|
||||
CAPABILITY_ZOOM = 0x0010,
|
||||
CAPABILITY_GESTURE = 0x0020,
|
||||
};
|
||||
|
||||
// The accessibility ability types for feedbacks.
|
||||
enum AccessibilityAbilityTypes : uint32_t {
|
||||
ACCESSIBILITY_ABILITY_TYPE_INVALID = 0x00000000,
|
||||
ACCESSIBILITY_ABILITY_TYPE_SPOKEN = 0x00000001,
|
||||
ACCESSIBILITY_ABILITY_TYPE_HAPTIC = 0x00000002,
|
||||
ACCESSIBILITY_ABILITY_TYPE_AUDIBLE = 0x00000004,
|
||||
ACCESSIBILITY_ABILITY_TYPE_VISUAL = 0x00000008,
|
||||
ACCESSIBILITY_ABILITY_TYPE_GENERIC = 0x00000010,
|
||||
ACCESSIBILITY_ABILITY_TYPE_ALL = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
// The interception types of key event.
|
||||
// enum KeyEventInterceptionTypes : uint32_t{
|
||||
// INTERCEPT_KEY_POWER = 0x001,
|
||||
// INTERCEPT_KEY_VOLUME_UP = 0x002,
|
||||
// INTERCEPT_KEY_VOLUME_DOWN = 0x004,
|
||||
// INETRCEPT_KEY_ALL = 0xFFFFFFFF,
|
||||
// };
|
||||
|
||||
class AccessibilityAbilityInfo : public Parcelable {
|
||||
public:
|
||||
|
||||
AccessibilityAbilityInfo() = default;
|
||||
~AccessibilityAbilityInfo() = default;
|
||||
|
||||
AccessibilityAbilityInfo(AppExecFwk::ExtensionAbilityInfo abilityInfo);
|
||||
|
||||
/**
|
||||
* @brief Obtains the types of the accessible ability.
|
||||
* @param
|
||||
* @return Return the type of the accessible ability.
|
||||
*/
|
||||
uint32_t GetAccessibilityAbilityType();
|
||||
|
||||
/**
|
||||
* @brief Obtains the types of the capabilities.
|
||||
* @param
|
||||
* @return Return the types of the capabilities.
|
||||
*/
|
||||
uint32_t GetCapabilityValues();
|
||||
|
||||
/**
|
||||
* @brief Obtains the description of the accessible ability.
|
||||
* @param
|
||||
* @return Return the description of the accessible ability.
|
||||
*/
|
||||
std::string GetDescription();
|
||||
|
||||
/**
|
||||
* @brief Obtains the type of the accessible events.
|
||||
* @param
|
||||
* @return Return the type of the accessible events.
|
||||
*/
|
||||
uint32_t GetEventTypes();
|
||||
|
||||
/**
|
||||
* @brief Obtains the id of the accessible ability.
|
||||
* @param
|
||||
* @return Return the id of the accessible ability.
|
||||
*/
|
||||
std::string GetId();
|
||||
|
||||
/**
|
||||
* @brief Obtains the name of the accessible ability.
|
||||
* @param
|
||||
* @return Return the name of the accessible ability.
|
||||
*/
|
||||
std::string GetName();
|
||||
|
||||
/**
|
||||
* @brief Obtains the package name of the accessible ability.
|
||||
* @param
|
||||
* @return Return the package name of the accessible ability.
|
||||
*/
|
||||
std::string GetPackageName();
|
||||
|
||||
void SetPackageName(std::string bundleName);
|
||||
|
||||
/**
|
||||
* @brief Obtains the target bundles's name that you are listening on.
|
||||
* @param
|
||||
* @return Return the target bundles's name that you are listening on.
|
||||
*/
|
||||
std::vector<std::string> GetFilterBundleNames();
|
||||
|
||||
/**
|
||||
* @brief Obtains the setting ability of the accessible ability.
|
||||
* @param
|
||||
* @return Return the setting ability of the accessible ability.
|
||||
*/
|
||||
std::string GetSettingsAbility();
|
||||
|
||||
/**
|
||||
* @brief read this sequenceable object from a Parcel.
|
||||
* @param parcel Indicates the Parcel object into which the sequenceable object has been marshaled.
|
||||
* @return Return true if read successfully, else return false.
|
||||
*/
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
/**
|
||||
* @brief Marshals this sequenceable object into a Parcel.
|
||||
* @param parcel Indicates the Parcel object to which the sequenceable object will be marshaled.
|
||||
* @return Return true if Marshal successfully, else return false.
|
||||
*/
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
/**
|
||||
* @brief Unmarshals this sequenceable object from a Parcel.
|
||||
* @param parcel Indicates the Parcel object into which the sequenceable object has been marshaled.
|
||||
* @return Return a sequenceable object of AccessibilityAbilityInfo.
|
||||
*/
|
||||
static AccessibilityAbilityInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
/**
|
||||
* @brief Set the types of the capabilities.
|
||||
* @param capabilities the capabilities to set.
|
||||
* @return
|
||||
*/
|
||||
inline void SetCapabilityValues(uint32_t capabilities) {capabilities_ = capabilities;};
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Parse config files of the accessible ability.
|
||||
* @param
|
||||
* @return Return true if parses config files successfully, else return false.
|
||||
*/
|
||||
bool ParseAAConfig(nlohmann::json sourceJson);
|
||||
|
||||
std::string bundleName_;
|
||||
std::string moduleName_;
|
||||
std::string name_;
|
||||
std::string description_;
|
||||
|
||||
uint32_t capabilities_ = CAPABILITY_RETRIEVE | CAPABILITY_TOUCH_GUIDE |
|
||||
CAPABILITY_KEY_EVENT_OBSERVER | CAPABILITY_ZOOM | CAPABILITY_GESTURE;
|
||||
std::string rationale_ = "on";
|
||||
|
||||
uint32_t abilityTypes_ = ACCESSIBILITY_ABILITY_TYPE_ALL;
|
||||
uint32_t eventTypes_ = EventType::TYPES_ALL_MASK;
|
||||
std::string settingsAbility_;
|
||||
std::vector<std::string> targetBundleNames_;
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 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_ABILILTY_INFO_H
|
||||
#define ACCESSIBILITY_ABILILTY_INFO_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "accessibility_event_info.h"
|
||||
#include "extension_ability_info.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
// The capability types of the accessible ability.
|
||||
enum Capability : uint32_t {
|
||||
CAPABILITY_RETRIEVE = 0x0001,
|
||||
CAPABILITY_TOUCH_GUIDE = 0x0002,
|
||||
CAPABILITY_KEY_EVENT_OBSERVER = 0x0008,
|
||||
CAPABILITY_ZOOM = 0x0010,
|
||||
CAPABILITY_GESTURE = 0x0020,
|
||||
};
|
||||
|
||||
// The accessibility ability types for feedbacks.
|
||||
enum AccessibilityAbilityTypes : uint32_t {
|
||||
ACCESSIBILITY_ABILITY_TYPE_INVALID = 0x00000000,
|
||||
ACCESSIBILITY_ABILITY_TYPE_SPOKEN = 0x00000001,
|
||||
ACCESSIBILITY_ABILITY_TYPE_HAPTIC = 0x00000002,
|
||||
ACCESSIBILITY_ABILITY_TYPE_AUDIBLE = 0x00000004,
|
||||
ACCESSIBILITY_ABILITY_TYPE_VISUAL = 0x00000008,
|
||||
ACCESSIBILITY_ABILITY_TYPE_GENERIC = 0x00000010,
|
||||
ACCESSIBILITY_ABILITY_TYPE_ALL = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
// The interception types of key event.
|
||||
// enum KeyEventInterceptionTypes : uint32_t{
|
||||
// INTERCEPT_KEY_POWER = 0x001,
|
||||
// INTERCEPT_KEY_VOLUME_UP = 0x002,
|
||||
// INTERCEPT_KEY_VOLUME_DOWN = 0x004,
|
||||
// INETRCEPT_KEY_ALL = 0xFFFFFFFF,
|
||||
// };
|
||||
|
||||
class AccessibilityAbilityInfo : public Parcelable {
|
||||
public:
|
||||
|
||||
AccessibilityAbilityInfo() = default;
|
||||
~AccessibilityAbilityInfo() = default;
|
||||
|
||||
AccessibilityAbilityInfo(AppExecFwk::ExtensionAbilityInfo abilityInfo);
|
||||
|
||||
/**
|
||||
* @brief Obtains the types of the accessible ability.
|
||||
* @param
|
||||
* @return Return the type of the accessible ability.
|
||||
*/
|
||||
uint32_t GetAccessibilityAbilityType();
|
||||
|
||||
/**
|
||||
* @brief Obtains the types of the capabilities.
|
||||
* @param
|
||||
* @return Return the types of the capabilities.
|
||||
*/
|
||||
uint32_t GetCapabilityValues();
|
||||
|
||||
/**
|
||||
* @brief Obtains the description of the accessible ability.
|
||||
* @param
|
||||
* @return Return the description of the accessible ability.
|
||||
*/
|
||||
std::string GetDescription();
|
||||
|
||||
/**
|
||||
* @brief Obtains the type of the accessible events.
|
||||
* @param
|
||||
* @return Return the type of the accessible events.
|
||||
*/
|
||||
uint32_t GetEventTypes();
|
||||
|
||||
/**
|
||||
* @brief Obtains the id of the accessible ability.
|
||||
* @param
|
||||
* @return Return the id of the accessible ability.
|
||||
*/
|
||||
std::string GetId();
|
||||
|
||||
/**
|
||||
* @brief Obtains the name of the accessible ability.
|
||||
* @param
|
||||
* @return Return the name of the accessible ability.
|
||||
*/
|
||||
std::string GetName();
|
||||
|
||||
/**
|
||||
* @brief Obtains the package name of the accessible ability.
|
||||
* @param
|
||||
* @return Return the package name of the accessible ability.
|
||||
*/
|
||||
std::string GetPackageName();
|
||||
|
||||
void SetPackageName(std::string bundleName);
|
||||
|
||||
/**
|
||||
* @brief Obtains the target bundles's name that you are listening on.
|
||||
* @param
|
||||
* @return Return the target bundles's name that you are listening on.
|
||||
*/
|
||||
std::vector<std::string> GetFilterBundleNames();
|
||||
|
||||
/**
|
||||
* @brief Obtains the setting ability of the accessible ability.
|
||||
* @param
|
||||
* @return Return the setting ability of the accessible ability.
|
||||
*/
|
||||
std::string GetSettingsAbility();
|
||||
|
||||
/**
|
||||
* @brief read this sequenceable object from a Parcel.
|
||||
* @param parcel Indicates the Parcel object into which the sequenceable object has been marshaled.
|
||||
* @return Return true if read successfully, else return false.
|
||||
*/
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
/**
|
||||
* @brief Marshals this sequenceable object into a Parcel.
|
||||
* @param parcel Indicates the Parcel object to which the sequenceable object will be marshaled.
|
||||
* @return Return true if Marshal successfully, else return false.
|
||||
*/
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
/**
|
||||
* @brief Unmarshals this sequenceable object from a Parcel.
|
||||
* @param parcel Indicates the Parcel object into which the sequenceable object has been marshaled.
|
||||
* @return Return a sequenceable object of AccessibilityAbilityInfo.
|
||||
*/
|
||||
static AccessibilityAbilityInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
/**
|
||||
* @brief Set the types of the capabilities.
|
||||
* @param capabilities the capabilities to set.
|
||||
* @return
|
||||
*/
|
||||
inline void SetCapabilityValues(uint32_t capabilities) {capabilities_ = capabilities;}
|
||||
|
||||
/**
|
||||
* @brief Set the types of the ability.
|
||||
* @param abilityTypes the ability to set.
|
||||
* @return
|
||||
*/
|
||||
inline void SetAccessibilityAbilityType(uint32_t abilityTypes) {abilityTypes_ = abilityTypes;}
|
||||
|
||||
/**
|
||||
* @brief Set the types of the event.
|
||||
* @param eventTypes the event to set.
|
||||
* @return
|
||||
*/
|
||||
inline void SetEventTypes(uint32_t eventTypes) {eventTypes_ = eventTypes;}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Parse config files of the accessible ability.
|
||||
* @param
|
||||
* @return Return true if parses config files successfully, else return false.
|
||||
*/
|
||||
bool ParseAAConfig(nlohmann::json sourceJson);
|
||||
|
||||
std::string bundleName_;
|
||||
std::string moduleName_;
|
||||
std::string name_;
|
||||
std::string description_;
|
||||
|
||||
uint32_t capabilities_ = 0;
|
||||
std::string rationale_ = "";
|
||||
|
||||
uint32_t abilityTypes_ = ACCESSIBILITY_ABILITY_TYPE_INVALID;
|
||||
uint32_t eventTypes_ = EventType::TYPE_VIEW_INVALID;
|
||||
std::string settingsAbility_;
|
||||
std::vector<std::string> targetBundleNames_;
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ACCESSIBILITY_ABILITY_INFO_H
|
@ -337,10 +337,10 @@ private:
|
||||
void NotifyGestureStateChanged();
|
||||
|
||||
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersAccessibilityState_{};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersTouchState_{};
|
||||
std::vector<std::shared_ptr<CaptionObserver>> observersCaptionProperty_{};
|
||||
std::vector<std::shared_ptr<CaptionObserver>> observersCaptionEnable_{};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersAccessibilityState_ = {};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersTouchState_ = {};
|
||||
std::vector<std::shared_ptr<CaptionObserver>> observersCaptionProperty_ = {};
|
||||
std::vector<std::shared_ptr<CaptionObserver>> observersCaptionEnable_ = {};
|
||||
|
||||
CaptionProperty captionProperty_;
|
||||
int accountId_ = 0;
|
||||
@ -349,18 +349,18 @@ private:
|
||||
bool isCaptionEnabled_ = 0;
|
||||
std::recursive_mutex asacProxyLock_;
|
||||
static std::shared_ptr<AccessibilitySystemAbilityClient> instance_;
|
||||
std::shared_ptr<AccessibilityElementOperator> interactionOperator_;
|
||||
std::map<int, std::shared_ptr<AccessibilityElementOperator>> interactionOperators_{};
|
||||
std::shared_ptr<AccessibilityElementOperator> interactionOperator_ = nullptr;
|
||||
std::map<int, std::shared_ptr<AccessibilityElementOperator>> interactionOperators_ = {};
|
||||
int connectionWindowId_ = 0;
|
||||
ACCESSIBILITY_DECLARE_IMPL();
|
||||
|
||||
std::vector<AccessibilityAbilityInfo> installedAbilities_{};
|
||||
std::map<std::string, AppExecFwk::ElementName> enabledAbilities_{};
|
||||
std::vector<AccessibilityAbilityInfo> installedAbilities_ = {};
|
||||
std::map<std::string, AppExecFwk::ElementName> enabledAbilities_ = {};
|
||||
|
||||
bool isFilteringKeyEventsEnabled_ = 0;
|
||||
bool isGesturesSimulationEnabled_ = 0;
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersKeyEventState_{};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersGestureState_{};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersKeyEventState_ = {};
|
||||
std::vector<std::shared_ptr<AccessibilityStateObserver>> observersGestureState_ = {};
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
|
2
interfaces/kits/js/@ohos.accessibility.d.ts
vendored
2
interfaces/kits/js/@ohos.accessibility.d.ts
vendored
@ -30,7 +30,7 @@ declare namespace accessibility {
|
||||
* @syscap SystemCapability.Barrierfree.Accessibility.Core
|
||||
* @since 7
|
||||
*/
|
||||
type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual';
|
||||
type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all';
|
||||
|
||||
/**
|
||||
* The action that the ability can execute.
|
||||
|
@ -54,12 +54,12 @@ private:
|
||||
std::string description_ = "";
|
||||
};
|
||||
|
||||
|
||||
class CaptionListener : public OHOS::Accessibility::CaptionObserver {
|
||||
public:
|
||||
CaptionListener();
|
||||
static void NotifyStateChangedJS(napi_env env, bool enabled, std::string eventType, napi_ref handlerRef);
|
||||
static void NotifyPropertyChangedJS(napi_env env, OHOS::Accessibility::CaptionProperty caption, std::string eventType, napi_ref handlerRef);
|
||||
static void NotifyPropertyChangedJS(
|
||||
napi_env env, OHOS::Accessibility::CaptionProperty caption, std::string eventType, napi_ref handlerRef);
|
||||
napi_value StartWork(napi_env env, size_t functionIndex, napi_value (&args)[START_WORK_ARGS_SIZE]);
|
||||
void OnCaptionStateChanged(const bool& enable) override;
|
||||
void OnCaptionPropertyChanged(const OHOS::Accessibility::CaptionProperty& caption) override;
|
||||
@ -154,7 +154,24 @@ public:
|
||||
static napi_value RegisterCaptionStateCallback(napi_env env, napi_callback_info info);
|
||||
static napi_value DeregisterCaptionStateCallback(napi_env env, napi_callback_info info);
|
||||
|
||||
static napi_value aaCons_;
|
||||
static void DefineJSCaptionsStyle(napi_env env);
|
||||
static napi_value AccessibleAbilityConstructorStyle(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionsFontFamily(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionsFontFamily(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionsFontScale(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionsFontScale(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionFrontColor(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionFrontColor(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionFontEdgeType(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionFontEdgeType(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionBackgroundColor(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionBackgroundColor(napi_env env, napi_callback_info info);
|
||||
static napi_value GetCaptionWindowColor(napi_env env, napi_callback_info info);
|
||||
static napi_value SetCaptionWindowColor(napi_env env, napi_callback_info info);
|
||||
|
||||
|
||||
static napi_value aaCons_; // CaptionsManager
|
||||
static napi_value aaStyleCons_; // CaptionsStyle
|
||||
|
||||
static std::vector<std::shared_ptr<StateListener>> listeners_;
|
||||
static std::vector<std::shared_ptr<CaptionListener>> captionListeners_;
|
||||
|
@ -56,80 +56,57 @@ napi_value NAccessibilityEventInfo::JSConstructor(napi_env env, napi_callback_in
|
||||
|
||||
napi_value NAccessibilityEventInfo::GetSource(napi_env env, napi_callback_info info)
|
||||
{
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv[ARGS_SIZE_ONE] = {0};
|
||||
napi_status status;
|
||||
napi_value thisVar;
|
||||
void* data = nullptr;
|
||||
AccessibilityEventInfo* eventInfo = nullptr;
|
||||
|
||||
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, &data));
|
||||
HILOG_DEBUG("argc = %{public}d", (int)argc);
|
||||
|
||||
status = napi_unwrap(env, thisVar, (void**)&eventInfo);
|
||||
HILOG_DEBUG("napi_unwrap status: %{public}d", (int)status);
|
||||
if (!eventInfo) {
|
||||
HILOG_DEBUG("eventInfo is null!!");
|
||||
}
|
||||
|
||||
napi_unwrap(env, thisVar, (void**)&eventInfo);
|
||||
NAccessibilityEventInfoData *callbackInfo = new NAccessibilityEventInfoData();
|
||||
callbackInfo->eventInfo_ = *eventInfo;
|
||||
|
||||
napi_value promise = nullptr;
|
||||
if (argc > 0) {
|
||||
HILOG_DEBUG("GetSource callback mode");
|
||||
napi_create_reference(env, argv[PARAM0], 1, &callbackInfo->callback_);
|
||||
napi_get_undefined(env, &promise);
|
||||
} else {
|
||||
HILOG_DEBUG("GetSource promise mode");
|
||||
napi_create_promise(env, &callbackInfo->deferred_, &promise);
|
||||
}
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetSource", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource,
|
||||
// execute async to call c++ function
|
||||
[](napi_env env, void* data) {
|
||||
NAccessibilityEventInfoData *callbackInfo = (NAccessibilityEventInfoData*)data;
|
||||
AccessibilityEventInfo eventInfo = callbackInfo->eventInfo_;
|
||||
callbackInfo->result_ = eventInfo.GetSource(callbackInfo->nodeInfo_);
|
||||
},
|
||||
// execute the complete function
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
HILOG_DEBUG("GetSource execute back");
|
||||
NAccessibilityEventInfoData* callbackInfo = (NAccessibilityEventInfoData*)data;
|
||||
napi_value jsReturnValue = 0;
|
||||
napi_value argv[ARGS_SIZE_TWO] = {0};
|
||||
napi_value callback = 0;
|
||||
napi_value undefined = 0;
|
||||
napi_get_undefined(env, &undefined);
|
||||
|
||||
napi_new_instance(env, NElementInfo::cons_, 0, nullptr, &argv[PARAM1]);
|
||||
ConvertElementInfoToJS(env, argv[PARAM1], callbackInfo->nodeInfo_);
|
||||
|
||||
argv[PARAM0] = GetErrorValue(env, callbackInfo->result_ ? CODE_SUCCESS : CODE_FAILED);
|
||||
if (callbackInfo->callback_) {
|
||||
// Callback mode
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, argv, &jsReturnValue);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
// Promise mode
|
||||
if (callbackInfo->result_) {
|
||||
napi_resolve_deferred(env, callbackInfo->deferred_, argv[PARAM1]);
|
||||
} else {
|
||||
napi_reject_deferred(env, callbackInfo->deferred_, argv[PARAM0]);
|
||||
}
|
||||
}
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
napi_queue_async_work(env, callbackInfo->work_);
|
||||
|
||||
return promise;
|
||||
}
|
@ -22,6 +22,7 @@ using namespace OHOS;
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
napi_value NAccessibilityClient::aaCons_;
|
||||
napi_value NAccessibilityClient::aaStyleCons_;
|
||||
|
||||
std::vector<std::shared_ptr<StateListener>> NAccessibilityClient::listeners_ = {};
|
||||
std::vector<std::shared_ptr<CaptionListener>> NAccessibilityClient::captionListeners_ = {};
|
||||
@ -553,9 +554,8 @@ napi_value NAccessibilityClient::SetCaptionProperty(napi_env env, napi_callback_
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("SetCaptionProperty complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("SetCaptionProperty complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -643,10 +643,9 @@ napi_value NAccessibilityClient::SetCaptionState(napi_env env, napi_callback_inf
|
||||
napi_get_undefined(env, &promise);
|
||||
} else {
|
||||
HILOG_DEBUG("SetCaptionState promise mode");
|
||||
napi_status status;
|
||||
status = napi_create_promise(env, &callbackInfo->deferred_, &promise);
|
||||
napi_status retStatus = napi_create_promise(env, &callbackInfo->deferred_, &promise);
|
||||
|
||||
HILOG_DEBUG("napi_create_promise return: %{public}d", status);
|
||||
HILOG_DEBUG("napi_create_promise return: %{public}d", retStatus);
|
||||
}
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "SetCaptionState", NAPI_AUTO_LENGTH, &resource);
|
||||
@ -673,12 +672,12 @@ napi_value NAccessibilityClient::SetCaptionState(napi_env env, napi_callback_inf
|
||||
result[PARAM0] = GetErrorValue(env, CODE_SUCCESS);
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_status status;
|
||||
status = napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_status retStatus = napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("napi_call_function return: %{public}d", retStatus);
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -797,9 +796,8 @@ napi_value NAccessibilityClient::SetEnabled(napi_env env, napi_callback_info inf
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("SetEnabled complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("SetEnabled complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -918,9 +916,8 @@ napi_value NAccessibilityClient::SetTouchGuideState(napi_env env, napi_callback_
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("SetTouchGuideState complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("SetTouchGuideState complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -1039,9 +1036,8 @@ napi_value NAccessibilityClient::SetGestureState(napi_env env, napi_callback_inf
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("SetGestureState complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("SetGestureState complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -1161,9 +1157,8 @@ napi_value NAccessibilityClient::SetKeyEventObserverState(napi_env env, napi_cal
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("SetKeyEventObserverState complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("SetKeyEventObserverState complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -1274,13 +1269,13 @@ napi_value NAccessibilityClient::GetExtentionEnabled(napi_env env, napi_callback
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
napi_value result[ARGS_SIZE_TWO] = {0};
|
||||
napi_value callback = 0;
|
||||
napi_value undefined = 0;
|
||||
napi_get_undefined(env, &undefined);
|
||||
napi_create_array(env, &result[PARAM1]);
|
||||
HILOG_INFO("GetExtentionEnabled ENTER ConvertAccessibleAbilityInfosToJS");
|
||||
ConvertEnabledAbilitiesToJS(env, result[PARAM1], callbackInfo->enabledAbilities_);
|
||||
if (callbackInfo->callback_) {
|
||||
napi_value callback = 0;
|
||||
result[PARAM0] = GetErrorValue(env, CODE_SUCCESS);
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
@ -1347,9 +1342,8 @@ napi_value NAccessibilityClient::ExtentionEnabled(napi_env env, napi_callback_in
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("ExtentionEnabled complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("ExtentionEnabled complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -1397,11 +1391,11 @@ napi_value NAccessibilityClient::ExtentionDisabled(napi_env env, napi_callback_i
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
napi_value result[ARGS_SIZE_TWO] = {0};
|
||||
napi_value callback = 0;
|
||||
napi_value undefined = 0;
|
||||
napi_get_undefined(env, &undefined);
|
||||
napi_get_boolean(env, callbackInfo->setExtentionReturn_, &result[PARAM1]);
|
||||
if (callbackInfo->callback_) {
|
||||
napi_value callback = 0;
|
||||
result[PARAM0] = GetErrorValue(env, CODE_SUCCESS);
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
@ -1409,9 +1403,8 @@ napi_value NAccessibilityClient::ExtentionDisabled(napi_env env, napi_callback_i
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("ExtentionDisabled complete function callback mode");
|
||||
} else {
|
||||
napi_status status;
|
||||
status = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("ExtentionDisabled complete function promise mode");
|
||||
napi_status retStatus = napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]);
|
||||
HILOG_DEBUG("napi_resolve_deferred return: %{public}d", retStatus);
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
@ -1465,7 +1458,9 @@ napi_value NAccessibilityClient::GetCaptionsManager(napi_env env, napi_callback_
|
||||
napi_get_boolean(env, callbackInfo->captionState_, &keyCode);
|
||||
napi_set_named_property(env, result, "enabled", keyCode);
|
||||
|
||||
napi_create_object(env, &keyCode);
|
||||
// napi_create_object(env, &keyCode);
|
||||
napi_status status = napi_new_instance(env, NAccessibilityClient::aaStyleCons_, 0, nullptr, &keyCode);
|
||||
HILOG_INFO("%{public}s napi_new_instance() = %{public}d ", __func__, (int32_t)status);
|
||||
ConvertCaptionPropertyToJS(env, keyCode, callbackInfo->captionProperty_);
|
||||
napi_set_named_property(env, result, "style", keyCode);
|
||||
|
||||
@ -1482,12 +1477,12 @@ napi_value NAccessibilityClient::SetCaptionStateEnabled(napi_env env, napi_callb
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
napi_get_value_bool(env, parameters[PARAM0], &captionState);
|
||||
HILOG_INFO("%{public}s captionState = %{public}s", __func__, captionState?"True":"False");
|
||||
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionStateTojson(captionState);
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
bool returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionStateTojson(captionState);
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s",
|
||||
__func__, returnVal ? "True" : "False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
@ -1500,13 +1495,12 @@ napi_value NAccessibilityClient::SetCaptionStateEnabled(napi_env env, napi_callb
|
||||
napi_value NAccessibilityClient::GetCaptionStateEnabled(napi_env env, napi_callback_info info)
|
||||
{
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
bool captionState = false;
|
||||
napi_value captionStateEnabled = nullptr;
|
||||
|
||||
captionState = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionState();
|
||||
bool captionState = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionState();
|
||||
napi_get_boolean(env, captionState, &captionStateEnabled);
|
||||
|
||||
HILOG_INFO("%{public}s captionState = %{public}s", __func__, captionState?"True":"False");
|
||||
HILOG_INFO("%{public}s captionState = %{public}s", __func__, captionState ? "True" : "False");
|
||||
|
||||
return captionStateEnabled;
|
||||
}
|
||||
@ -1519,13 +1513,11 @@ napi_value NAccessibilityClient::SetCaptionStyle(napi_env env, napi_callback_inf
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
ConvertObjToCaptionProperty(env, parameters[PARAM0], &captionProperty);
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
bool returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s",
|
||||
__func__, returnVal ? "True" : "False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
@ -1543,7 +1535,9 @@ napi_value NAccessibilityClient::GetCaptionStyle(napi_env env, napi_callback_inf
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_object(env, &captionStyle);
|
||||
// napi_create_object(env, &captionStyle);
|
||||
napi_status status = napi_new_instance(env, NAccessibilityClient::aaStyleCons_, 0, nullptr, &captionStyle);
|
||||
HILOG_INFO("%{public}s napi_new_instance() = %{public}d ", __func__, (int32_t)status);
|
||||
ConvertCaptionPropertyToJS(env, captionStyle, captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
@ -1756,4 +1750,315 @@ void CaptionListener::OnCaptionPropertyChanged(const CaptionProperty& caption)
|
||||
observer->GetHandler());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NAccessibilityClient::DefineJSCaptionsStyle(napi_env env)
|
||||
{
|
||||
napi_property_descriptor captionsStyleDesc[] = {
|
||||
DECLARE_NAPI_GETTER_SETTER("fontFamily", NAccessibilityClient::GetCaptionsFontFamily,NAccessibilityClient::SetCaptionsFontFamily),
|
||||
DECLARE_NAPI_GETTER_SETTER("fontScale", NAccessibilityClient::GetCaptionsFontScale,NAccessibilityClient::SetCaptionsFontScale),
|
||||
DECLARE_NAPI_GETTER_SETTER("fontColor", NAccessibilityClient::GetCaptionFrontColor,NAccessibilityClient::SetCaptionFrontColor),
|
||||
DECLARE_NAPI_GETTER_SETTER("fontEdgeType", NAccessibilityClient::GetCaptionFontEdgeType,NAccessibilityClient::SetCaptionFontEdgeType),
|
||||
DECLARE_NAPI_GETTER_SETTER("backgroundColor", NAccessibilityClient::GetCaptionBackgroundColor,NAccessibilityClient::SetCaptionBackgroundColor),
|
||||
DECLARE_NAPI_GETTER_SETTER("windowColor", NAccessibilityClient::GetCaptionWindowColor,NAccessibilityClient::SetCaptionWindowColor),
|
||||
};
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_define_class(env,
|
||||
"NAccessibilityClientStyle",
|
||||
NAPI_AUTO_LENGTH,
|
||||
NAccessibilityClient::AccessibleAbilityConstructorStyle,
|
||||
nullptr,
|
||||
sizeof(captionsStyleDesc) / sizeof(captionsStyleDesc[0]),
|
||||
captionsStyleDesc,
|
||||
&NAccessibilityClient::aaStyleCons_));
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::AccessibleAbilityConstructorStyle(napi_env env, napi_callback_info info)
|
||||
{
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
napi_value jsthis = nullptr;
|
||||
NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &jsthis, nullptr));
|
||||
return jsthis;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionsFontFamily(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionsFontFamily(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input FontFamily
|
||||
char outBuffer[CHAE_BUFFER_MAX + 1] = {0};
|
||||
size_t outSize = 0;
|
||||
napi_get_value_string_utf8(env, parameters[PARAM0], outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
HILOG_INFO("%{public}s FontFamily = %{public}s", __func__, outBuffer);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontFamily(std::string(outBuffer));
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionsFontScale(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_int32(env, captionProperty.GetFontScale(), &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionsFontScale(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input FontScale
|
||||
int32_t num = 0;
|
||||
napi_get_value_int32(env, parameters[PARAM0], &num);
|
||||
HILOG_INFO("%{public}s FontScale = %{public}d", __func__, num);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontScale(num);
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionFrontColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_string_utf8(env, captionProperty.GetFontColor().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionFrontColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input frontColor
|
||||
char outBuffer[CHAE_BUFFER_MAX + 1] = {0};
|
||||
size_t outSize = 0;
|
||||
napi_get_value_string_utf8(env, parameters[PARAM0], outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
HILOG_INFO("%{public}s frontColor = %{public}s", __func__, outBuffer);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontColor(std::string(outBuffer));
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionFontEdgeType(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_string_utf8(env, captionProperty.GetFontEdgeType().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionFontEdgeType(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input FontEdgeType
|
||||
char outBuffer[CHAE_BUFFER_MAX + 1] = {0};
|
||||
size_t outSize = 0;
|
||||
napi_get_value_string_utf8(env, parameters[PARAM0], outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
HILOG_INFO("%{public}s FontEdgeType = %{public}s", __func__, outBuffer);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontEdgeType(std::string(outBuffer));
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionBackgroundColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_string_utf8(env, captionProperty.GetBackgroundColor().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionBackgroundColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input BackgroundColor
|
||||
char outBuffer[CHAE_BUFFER_MAX + 1] = {0};
|
||||
size_t outSize = 0;
|
||||
napi_get_value_string_utf8(env, parameters[PARAM0], outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
HILOG_INFO("%{public}s BackgroundColor = %{public}s", __func__, outBuffer);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetBackgroundColor(std::string(outBuffer));
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::GetCaptionWindowColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
|
||||
OHOS::Accessibility::CaptionProperty captionProperty{};
|
||||
napi_value returnValue = nullptr;
|
||||
|
||||
captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
napi_create_string_utf8(env, captionProperty.GetWindowColor().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
|
||||
HILOG_INFO("%{public}s end", __func__);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
napi_value NAccessibilityClient::SetCaptionWindowColor(napi_env env, napi_callback_info info){
|
||||
HILOG_INFO("%{public}s start", __func__);
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, parameters, nullptr, nullptr);
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
bool returnVal = false;
|
||||
|
||||
// get input WindowColor
|
||||
char outBuffer[CHAE_BUFFER_MAX + 1] = {0};
|
||||
size_t outSize = 0;
|
||||
napi_get_value_string_utf8(env, parameters[PARAM0], outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
HILOG_INFO("%{public}s WindowColor = %{public}s", __func__, outBuffer);
|
||||
|
||||
//get CaptionProperty
|
||||
OHOS::Accessibility::CaptionProperty captionProperty = AccessibilitySystemAbilityClient::GetInstance()->GetCaptionProperty();
|
||||
|
||||
// change the input info and then set the CaptionProperty
|
||||
captionProperty.SetWindowColor(std::string(outBuffer));
|
||||
returnVal = AccessibilitySystemAbilityClient::GetInstance()->SetCaptionPropertyTojson(captionProperty);
|
||||
|
||||
HILOG_INFO("%{public}s SetCaptionPropertyTojson() return = %{public}s", __func__, returnVal?"True":"False");
|
||||
} else {
|
||||
HILOG_INFO("%{public}s argc size Error", __func__);
|
||||
}
|
||||
|
||||
napi_value ret = nullptr;
|
||||
napi_get_undefined(env, &ret);
|
||||
return ret;
|
||||
}
|
@ -185,11 +185,10 @@ static std::vector<std::string> ParseEventTypesToVec(uint32_t eventTypesValue)
|
||||
{EventType::TYPE_GESTURE_EVENT, "gesture"}};
|
||||
|
||||
for (std::map<EventType, std::string>::iterator itr = accessibilityEventTable.begin();
|
||||
itr != accessibilityEventTable.end();) {
|
||||
itr != accessibilityEventTable.end(); ++itr) {
|
||||
if (eventTypesValue & itr->first) {
|
||||
result.push_back(itr->second);
|
||||
}
|
||||
itr++;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1604,22 +1603,27 @@ void ConvertCaptionPropertyToJS(napi_env env, napi_value& result, OHOS::Accessib
|
||||
|
||||
napi_value value;
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "fontFamily", value));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, captionProperty.GetFontScale(), &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "fontScale", value));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, captionProperty.GetFontColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetFontColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "fontColor", value));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, captionProperty.GetFontEdgeType().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetFontEdgeType().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "fontEdgeType", value));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, captionProperty.GetBackgroundColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetBackgroundColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "backgroundColor", value));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, captionProperty.GetWindowColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetWindowColor().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "windowColor", value));
|
||||
|
||||
HILOG_DEBUG("%{public}s end", __func__);
|
||||
@ -1713,7 +1717,7 @@ void ConvertJSToAccessibleAbilityInfos(napi_env env, napi_value arrayValue,
|
||||
napi_value value = nullptr;
|
||||
napi_get_element(env, arrayValue, i, &value);
|
||||
|
||||
AccessibilityAbilityInfo info{};
|
||||
AccessibilityAbilityInfo info = {};
|
||||
ConvertJSToAccessibleAbilityInfo(env, value, info);
|
||||
accessibleAbilityInfos.push_back(info);
|
||||
HILOG_DEBUG("%{public}s size = %{public}d ", __func__, accessibleAbilityInfos.size());
|
||||
@ -1784,7 +1788,6 @@ void ConvertJSToEnabledAbilities(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConvertEnabledToJS(napi_env env, napi_value& captionsManager, bool value)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -1795,22 +1798,6 @@ void ConvertEnabledToJS(napi_env env, napi_value& captionsManager, bool value)
|
||||
HILOG_DEBUG("%{public}s END.", __func__);
|
||||
}
|
||||
|
||||
|
||||
// void ConvertJSToEnabled(napi_env env, napi_value captionsManager, bool& result)
|
||||
// {
|
||||
// napi_value propertyNameValue = nullptr;
|
||||
// bool hasProperty = false;
|
||||
|
||||
// napi_create_string_utf8(env, "enabled", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
// napi_has_property(env, captionsManager, propertyNameValue, &hasProperty);
|
||||
// if (hasProperty) {
|
||||
// napi_value value = nullptr;
|
||||
// napi_get_property(env, captionsManager, propertyNameValue, &value);
|
||||
// napi_get_value_bool(env, value, &result);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
void ConvertStyleToJS(napi_env env, napi_value& captionsManager, OHOS::Accessibility::CaptionProperty captionProperty_)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -1823,18 +1810,3 @@ void ConvertStyleToJS(napi_env env, napi_value& captionsManager, OHOS::Accessibi
|
||||
|
||||
HILOG_DEBUG("%{public}s END.", __func__);
|
||||
}
|
||||
|
||||
|
||||
// void ConvertJSToStyle(napi_env env, napi_value captionsManager, bool& result)
|
||||
// {
|
||||
// napi_value propertyNameValue = nullptr;
|
||||
// bool hasProperty = false;
|
||||
|
||||
// napi_create_string_utf8(env, "enabled", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
// napi_has_property(env, captionsManager, propertyNameValue, &hasProperty);
|
||||
// if (hasProperty) {
|
||||
// napi_value value = nullptr;
|
||||
// napi_get_property(env, captionsManager, propertyNameValue, &value);
|
||||
// napi_get_value_bool(env, value, &result);
|
||||
// }
|
||||
// }
|
@ -58,6 +58,7 @@ static napi_value Init(napi_env env, napi_value exports)
|
||||
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc));
|
||||
|
||||
NAccessibilityClient::DefineJSCaptionsManager(env);
|
||||
NAccessibilityClient::DefineJSCaptionsStyle(env);
|
||||
NElementInfo::DefineJSElementInfo(env);
|
||||
NAccessibilityWindowInfo::DefineJSAccessibilityWindowInfo(env);
|
||||
NAccessibilityEventInfo::DefineJSAccessibilityEventInfo(env);
|
||||
@ -71,13 +72,15 @@ EXTERN_C_END
|
||||
/*
|
||||
* Module define
|
||||
*/
|
||||
static napi_module _module = {.nm_version = 1,
|
||||
static napi_module _module = {
|
||||
.nm_version = 1,
|
||||
.nm_flags = 0,
|
||||
.nm_filename = nullptr,
|
||||
.nm_register_func = Init,
|
||||
.nm_modname = "accessibility",
|
||||
.nm_priv = ((void*)0),
|
||||
.reserved = {0}};
|
||||
.reserved = {0},
|
||||
};
|
||||
/*
|
||||
* Module register function
|
||||
*/
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
using CaptionPropertyCallbacks = std::vector<sptr<IAccessibleAbilityManagerServiceCaptionProperty>>;
|
||||
class AccessibleAbilityConnection;
|
||||
|
||||
class IAccessibleAbilityManagerServiceState;
|
||||
@ -165,7 +166,7 @@ public:
|
||||
*/
|
||||
const std::vector<sptr<IAccessibleAbilityManagerServiceState>> GetStateCallbacks();
|
||||
|
||||
const std::vector<sptr<IAccessibleAbilityManagerServiceCaptionProperty>> GetCaptionPropertyCallbacks();
|
||||
const CaptionPropertyCallbacks GetCaptionPropertyCallbacks();
|
||||
|
||||
/**
|
||||
* @brief Get interface operation interactive connection list.
|
||||
@ -361,6 +362,9 @@ private:
|
||||
* @return
|
||||
*/
|
||||
void UpdateMagnificationCapability();
|
||||
void CaptionInit(nlohmann::json jsonObj);
|
||||
void CapbilityInit(nlohmann::json jsonObj);
|
||||
void EnabledListInit(nlohmann::json jsonObj);
|
||||
|
||||
int id_;
|
||||
bool isEnabled_ = false;
|
||||
@ -374,7 +378,7 @@ private:
|
||||
// ElementName.
|
||||
std::vector<sptr<IAccessibleAbilityManagerServiceState>> stateCallbacks_{};
|
||||
std::map<int, sptr<AccessibilityWindowConnection>> asacConnections_{}; // key: windowId
|
||||
std::vector<sptr<IAccessibleAbilityManagerServiceCaptionProperty>> captionPropertyCallbacks_{};
|
||||
CaptionPropertyCallbacks captionPropertyCallbacks_{};
|
||||
std::vector<AccessibilityAbilityInfo> installedAbilities_{};
|
||||
std::map<std::string, AppExecFwk::ElementName> enabledAbilities_{}; // key: The URI of the ElementName.
|
||||
std::map<std::string, AppExecFwk::ElementName> connectingA11yAbilities_{}; // key: The URI of the ElementName.
|
||||
|
@ -62,6 +62,7 @@ private:
|
||||
void HandlePackageRemoved(const AAFwk::Want &want) const;
|
||||
void HandlePackageUpdateFinished(const AAFwk::Want &want) const;
|
||||
void HandlePackageChanged(const AAFwk::Want &want) const;
|
||||
void HandlePackageAdd(const AAFwk::Want &want) const;
|
||||
|
||||
typedef void (AccessibilityCommonEventRegistry::*HandleEventFunc)(const AAFwk::Want&) const;
|
||||
std::map<std::string, HandleEventFunc> handleEventFunc_;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "accessibility_event_transmission.h"
|
||||
#include "i_input_event_consumer.h"
|
||||
#include "input_manager.h"
|
||||
#include "key_event.h"
|
||||
#include "pointer_event.h"
|
||||
|
||||
@ -31,6 +32,17 @@ namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class AccessibleAbilityManagerService;
|
||||
|
||||
class AccessibilityInputEventConsumer : public MMI::IInputEventConsumer {
|
||||
public:
|
||||
AccessibilityInputEventConsumer();
|
||||
~AccessibilityInputEventConsumer();
|
||||
void OnInputEvent(std::shared_ptr<MMI::KeyEvent> keyEvent) const override;
|
||||
void OnInputEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent) const override;
|
||||
void OnInputEvent(std::shared_ptr<MMI::AxisEvent> axisEvent) const override {};
|
||||
private:
|
||||
std::shared_ptr<AppExecFwk::EventHandler> eventHandler_ = nullptr;
|
||||
};
|
||||
|
||||
class AccessibilityInputInterceptor : public EventTransmission {
|
||||
public:
|
||||
// Feature flag for screen magnification.
|
||||
@ -47,40 +59,31 @@ public:
|
||||
|
||||
static sptr<AccessibilityInputInterceptor> GetInstance();
|
||||
~AccessibilityInputInterceptor();
|
||||
static void InterceptPointerEventCallBack(std::shared_ptr<OHOS::MMI::PointerEvent> pointerEvent);
|
||||
static void InterceptKeyEventCallBack(std::shared_ptr<OHOS::MMI::KeyEvent> keyEvent);
|
||||
void ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event) const;
|
||||
void ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event) const;
|
||||
void OnKeyEvent(MMI::KeyEvent &event) override;
|
||||
void OnPointerEvent(MMI::PointerEvent &event) override;
|
||||
void SetAvailableFunctions(uint32_t availableFunctions);
|
||||
void NotifyAccessibilityEvent(AccessibilityEventInfo &event) const;
|
||||
|
||||
private:
|
||||
enum InterceptSourceType {
|
||||
MOUSE = 1,
|
||||
TOUCHSCREEN,
|
||||
TOUCHPAD,
|
||||
KEY
|
||||
};
|
||||
|
||||
AccessibilityInputInterceptor();
|
||||
static sptr<AccessibilityInputInterceptor> instance_;
|
||||
void ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event);
|
||||
void ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event);
|
||||
void CreateTransmitters();
|
||||
void DestroyTransmitters();
|
||||
void SetNextEventTransmitter(sptr<EventTransmission> &header, sptr<EventTransmission> ¤t,
|
||||
const sptr<EventTransmission> &next);
|
||||
void CreateInterceptors(bool isInterceptPointEvent, bool isInterceptKeyEvent);
|
||||
void RemoveAllInterceptors();
|
||||
void CreateInterceptor();
|
||||
void DestroyInterceptor();
|
||||
|
||||
std::shared_ptr<AccessibleAbilityManagerService> ams_ = nullptr;
|
||||
sptr<EventTransmission> pointerEventTransmitters_ = nullptr;
|
||||
sptr<EventTransmission> keyEventTransmitters_ = nullptr;
|
||||
std::shared_ptr<AppExecFwk::EventHandler> eventHandler_ = nullptr;
|
||||
uint32_t availableFunctions_ = 0;
|
||||
std::map<InterceptSourceType, int32_t> interceptorId_ = {};
|
||||
int32_t interceptorId_ = -1;
|
||||
MMI::InputManager *inputManager_ = nullptr;
|
||||
std::shared_ptr<AccessibilityInputEventConsumer> inputEventConsumer_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif // ACCESSIBILITY_INPUT_INTERCEPTOR_H
|
||||
|
@ -21,11 +21,10 @@
|
||||
#include "accessibility_operator.h"
|
||||
#include "accessibility_element_operator_interface.h"
|
||||
#include "mmi_point.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility{
|
||||
|
||||
class AccessibilityInteractionBridge
|
||||
{
|
||||
class AccessibilityInteractionBridge {
|
||||
public:
|
||||
/**
|
||||
* @brief Get the instance of Interaction Bridge.
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "accessibility_window_info.h"
|
||||
#include "singleton.h"
|
||||
#include "window_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -59,6 +60,7 @@ public:
|
||||
|
||||
private:
|
||||
AccessibilityWindowInfoManager() : windowListener_(new AccessibilityWindowListener()) {}
|
||||
DISALLOW_COPY_AND_MOVE(AccessibilityWindowInfoManager);
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -29,6 +29,8 @@
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
||||
#define UID_MASK 200000
|
||||
|
||||
class AccessibilityAccountData;
|
||||
class AccessibleAbilityManagerService;
|
||||
class AccessibleAbilityConnection;
|
||||
|
@ -122,8 +122,9 @@ public:
|
||||
/* For common event */
|
||||
void RemovedUser(int32_t accountId);
|
||||
void PresentUser();
|
||||
void PackageChanged();
|
||||
void PackageChanged(std::string& bundleName);
|
||||
void PackageRemoved(std::string& bundleName);
|
||||
void PackageAdd(std::string& bundleName);
|
||||
void PackageUpdateFinished(std::string& bundleName);
|
||||
|
||||
void UpdateAccessibilityManagerService();
|
||||
|
@ -155,7 +155,7 @@ void AccessibilityAccountData::RemoveCaptionPropertyCallback(const wptr<IRemoteO
|
||||
void AccessibilityAccountData::AddAccessibilityWindowConnection(
|
||||
const int windowId, const sptr<AccessibilityWindowConnection>& interactionConnection)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
HILOG_DEBUG("%{public}s start.windowId(%{public}d)", __func__, windowId);
|
||||
if (!asacConnections_.count(windowId)) {
|
||||
asacConnections_.insert(std::make_pair(windowId, interactionConnection));
|
||||
}
|
||||
@ -164,7 +164,7 @@ void AccessibilityAccountData::AddAccessibilityWindowConnection(
|
||||
// remove AccessibilityWindowConnection
|
||||
void AccessibilityAccountData::RemoveAccessibilityWindowConnection(const int windowId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
HILOG_DEBUG("%{public}s start.windowId(%{public}d)", __func__, windowId);
|
||||
std::map<int, sptr<AccessibilityWindowConnection>>::iterator it = asacConnections_.find(windowId);
|
||||
if (it != asacConnections_.end()) {
|
||||
asacConnections_.erase(it);
|
||||
@ -211,7 +211,7 @@ void AccessibilityAccountData::RemoveEnabledAbility(const AppExecFwk::ElementNam
|
||||
if (it != enabledAbilities_.end()) {
|
||||
enabledAbilities_.erase(it);
|
||||
}
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -272,7 +272,8 @@ const sptr<AccessibleAbilityConnection> AccessibilityAccountData::GetAccessibleA
|
||||
}
|
||||
|
||||
// get AccessibilityWindowConnection.
|
||||
const sptr<AccessibilityWindowConnection> AccessibilityAccountData::GetAccessibilityWindowConnection(const int windowId)
|
||||
const sptr<AccessibilityWindowConnection> AccessibilityAccountData::GetAccessibilityWindowConnection(
|
||||
const int windowId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
if (asacConnections_.count(windowId) > 0) {
|
||||
@ -302,12 +303,12 @@ const std::map<int, sptr<AccessibilityWindowConnection>> AccessibilityAccountDat
|
||||
return asacConnections_;
|
||||
}
|
||||
|
||||
const std::vector<sptr<IAccessibleAbilityManagerServiceCaptionProperty>>
|
||||
AccessibilityAccountData::GetCaptionPropertyCallbacks()
|
||||
const CaptionPropertyCallbacks AccessibilityAccountData::GetCaptionPropertyCallbacks()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
return captionPropertyCallbacks_;
|
||||
}
|
||||
|
||||
// get connectingA11yAbilities_.
|
||||
const std::map<std::string, AppExecFwk::ElementName> AccessibilityAccountData::GetConnectingA11yAbilities()
|
||||
{
|
||||
@ -377,7 +378,7 @@ void AccessibilityAccountData::UpdateEventTouchGuideCapability()
|
||||
return;
|
||||
}
|
||||
}
|
||||
isEventTouchGuideState_ = true; // TBD
|
||||
isEventTouchGuideState_ = false; // temp deal
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::UpdateGesturesSimulationCapability()
|
||||
@ -420,7 +421,7 @@ bool AccessibilityAccountData::SetCaptionState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
isCaptionState_ = state;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -444,7 +445,7 @@ bool AccessibilityAccountData::SetCaptionProperty(const CaptionProperty& caption
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
captionProperty_ = caption;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -472,7 +473,7 @@ bool AccessibilityAccountData::SetEnabled(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
isEnabled_ = state;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -498,7 +499,7 @@ bool AccessibilityAccountData::SetTouchGuideState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
isEventTouchGuideState_ = state;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -522,7 +523,7 @@ bool AccessibilityAccountData::SetGestureState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
isGesturesSimulation_ = state;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -546,7 +547,7 @@ bool AccessibilityAccountData::SetKeyEventObserverState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
isFilteringKeyEvents_ = state;
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -596,7 +597,7 @@ bool AccessibilityAccountData::SetEnabledObj(std::map<std::string, AppExecFwk::E
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
|
||||
// add ability to the last of enabledAbilities_
|
||||
for(auto& ability : it){
|
||||
for (auto& ability : it) {
|
||||
enabledAbilities_.insert(std::pair<std::string, AppExecFwk::ElementName>(ability.first, ability.second));
|
||||
}
|
||||
|
||||
@ -605,7 +606,7 @@ bool AccessibilityAccountData::SetEnabledObj(std::map<std::string, AppExecFwk::E
|
||||
HILOG_DEBUG("bundleName = %{public}s ", bundleName.c_str());
|
||||
}
|
||||
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
@ -625,11 +626,12 @@ bool AccessibilityAccountData::SetEnabledObj(std::map<std::string, AppExecFwk::E
|
||||
bool AccessibilityAccountData::ReadConfigurationForAccountData()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
// TODO: read the user confige data.
|
||||
// temp deal: read the user confige data.
|
||||
return true;
|
||||
}
|
||||
|
||||
// get installedAbilities_.
|
||||
#define THREE_SECOND (3)
|
||||
void AccessibilityAccountData::GetInstalledAbilitiesFromBMS()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -642,13 +644,13 @@ void AccessibilityAccountData::GetInstalledAbilitiesFromBMS()
|
||||
bms = aams->GetBundleMgrProxy();
|
||||
if (!bms) {
|
||||
HILOG_ERROR("Get bms failed! sleep 3s and retry is %{public}d", retry);
|
||||
sleep(3);
|
||||
sleep(THREE_SECOND);
|
||||
retry ++;
|
||||
} else {
|
||||
HILOG_DEBUG("Get bms successful and retry is %{public}d", retry);
|
||||
break;
|
||||
}
|
||||
} while(1);
|
||||
} while (1);
|
||||
|
||||
bms->QueryExtensionAbilityInfos(
|
||||
AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, id_, extensionInfos);
|
||||
@ -659,19 +661,17 @@ void AccessibilityAccountData::GetInstalledAbilitiesFromBMS()
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::init()
|
||||
void AccessibilityAccountData::CaptionInit(nlohmann::json jsonObj)
|
||||
{
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
}
|
||||
|
||||
std::string FONTFAMILY = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_FONTFAMILY);
|
||||
int FONTSCALE = JsonUtils::GetIntValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_FONTSCALE);
|
||||
std::string FONTCOLOR = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_FONTCOLOR);
|
||||
std::string FONTEDGETYPE = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_FONTEDGETYPE);
|
||||
std::string BACKGROUNDCOLOR = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_BACKGROUNDCOLOR);
|
||||
std::string WINDOWCOLOR = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_WINDOWCOLOR);
|
||||
std::string FONTEDGETYPE = JsonUtils::GetStrValue(jsonObj,
|
||||
JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_FONTEDGETYPE);
|
||||
std::string BACKGROUNDCOLOR = JsonUtils::GetStrValue(jsonObj,
|
||||
JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_BACKGROUNDCOLOR);
|
||||
std::string WINDOWCOLOR = JsonUtils::GetStrValue(jsonObj,
|
||||
JSON_OBJECT_CAPTION_STYLE, CAPTION_JSON_VALUE_WINDOWCOLOR);
|
||||
|
||||
captionProperty_.SetFontFamily(FONTFAMILY);
|
||||
captionProperty_.SetFontScale(FONTSCALE);
|
||||
@ -680,7 +680,17 @@ void AccessibilityAccountData::init()
|
||||
captionProperty_.SetBackgroundColor(BACKGROUNDCOLOR);
|
||||
captionProperty_.SetWindowColor(WINDOWCOLOR);
|
||||
|
||||
std::string strValue = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STATE);
|
||||
HILOG_DEBUG("strValue = %{public}s", strValue.c_str());
|
||||
if (std::strcmp(strValue.c_str(), "on") == 0) {
|
||||
isCaptionState_ = true;
|
||||
} else {
|
||||
isCaptionState_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::CapbilityInit(nlohmann::json jsonObj)
|
||||
{
|
||||
std::string strValue = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPABILITY, CAPABILITY_JSON_VALUE_ACCESSIBLE);
|
||||
HILOG_DEBUG("strValue = %{public}s", strValue.c_str());
|
||||
if (std::strcmp(strValue.c_str(), "on") == 0) {
|
||||
@ -712,14 +722,10 @@ void AccessibilityAccountData::init()
|
||||
} else {
|
||||
isGesturesSimulation_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
strValue = JsonUtils::GetStrValue(jsonObj, JSON_OBJECT_CAPTION_STATE);
|
||||
HILOG_DEBUG("strValue = %{public}s", strValue.c_str());
|
||||
if (std::strcmp(strValue.c_str(), "on") == 0) {
|
||||
isCaptionState_ = true;
|
||||
} else {
|
||||
isCaptionState_ = false;
|
||||
}
|
||||
void AccessibilityAccountData::EnabledListInit(nlohmann::json jsonObj)
|
||||
{
|
||||
std::string BundleName = "";
|
||||
AccessibilityAbilityInfo abilityInfo;
|
||||
|
||||
@ -732,17 +738,27 @@ void AccessibilityAccountData::init()
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::init()
|
||||
{
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
}
|
||||
CaptionInit(jsonObj);
|
||||
CapbilityInit(jsonObj);
|
||||
EnabledListInit(jsonObj);
|
||||
}
|
||||
|
||||
bool AccessibilityAccountData::DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
for (auto &disAbilities : it){
|
||||
for (auto &disAbilities : it) {
|
||||
enabledAbilities_.erase(disAbilities.first);
|
||||
}
|
||||
|
||||
// todo write json config
|
||||
// temp deal: write json config
|
||||
nlohmann::json jsonObj;
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH))
|
||||
{
|
||||
if (!JsonUtils::GetJsonObjFromJson(jsonObj, AccessibleAbility_Config_JSON_FILE_PATH)) {
|
||||
HILOG_ERROR("Get JsonObj from json failed.");
|
||||
return false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ AccessibilityCommonEventRegistry::AccessibilityCommonEventRegistry()
|
||||
&AccessibilityCommonEventRegistry::HandlePresentUser;
|
||||
|
||||
handleEventFunc_[CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED] =
|
||||
&AccessibilityCommonEventRegistry::HandlePackageRemoved;
|
||||
&AccessibilityCommonEventRegistry::HandlePackageAdd;
|
||||
handleEventFunc_[CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED] =
|
||||
&AccessibilityCommonEventRegistry::HandlePackageRemoved;
|
||||
handleEventFunc_[CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED] =
|
||||
@ -49,8 +49,7 @@ bool AccessibilityCommonEventRegistry::StartRegister()
|
||||
eventHandles_.clear();
|
||||
}
|
||||
|
||||
for (auto it = handleEventFunc_.begin(); it != handleEventFunc_.end(); ++it)
|
||||
{
|
||||
for (auto it = handleEventFunc_.begin(); it != handleEventFunc_.end(); ++it) {
|
||||
HILOG_DEBUG("Add event: %{public}s", it->first.c_str());
|
||||
eventHandles_.emplace(it->first, bind(it->second, this, placeholders::_1));
|
||||
}
|
||||
@ -75,7 +74,6 @@ bool AccessibilityCommonEventRegistry::RegisterSubscriber()
|
||||
}
|
||||
|
||||
CommonEventSubscribeInfo subscribeInfo(matchingSkills);
|
||||
subscribeInfo.SetPermission("ohos.permission.MANAGE_USERS");
|
||||
accessibilityCommonEventSubscriber_ =
|
||||
std::make_shared<AccessibilityCommonEventSubscriber>(subscribeInfo, eventHandles_);
|
||||
|
||||
@ -146,6 +144,13 @@ void AccessibilityCommonEventRegistry::HandlePackageRemoved(const Want &want) co
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->PackageRemoved(bundleName);
|
||||
}
|
||||
|
||||
void AccessibilityCommonEventRegistry::HandlePackageAdd(const Want &want) const
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
string bundleName = want.GetBundle();
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->PackageAdd(bundleName);
|
||||
}
|
||||
|
||||
void AccessibilityCommonEventRegistry::HandlePackageUpdateFinished(const Want &want) const
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -156,8 +161,8 @@ void AccessibilityCommonEventRegistry::HandlePackageUpdateFinished(const Want &w
|
||||
void AccessibilityCommonEventRegistry::HandlePackageChanged(const Want &want) const
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->PackageChanged();
|
||||
string bundleName = want.GetBundle();
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->PackageChanged(bundleName);
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -24,7 +24,6 @@
|
||||
#include "accessible_ability_manager_service.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "power_mgr_client.h"
|
||||
#include "input_manager.h"
|
||||
#include "key_event.h"
|
||||
#include "input_event.h"
|
||||
|
||||
@ -46,72 +45,61 @@ AccessibilityInputInterceptor::AccessibilityInputInterceptor()
|
||||
HILOG_DEBUG();
|
||||
|
||||
ams_ = nullptr;
|
||||
eventHandler_ = nullptr;
|
||||
pointerEventTransmitters_ = nullptr;
|
||||
keyEventTransmitters_ = nullptr;
|
||||
ams_ = DelayedSingleton<AccessibleAbilityManagerService>::GetInstance();
|
||||
if (ams_ != nullptr) {
|
||||
eventHandler_ = std::make_shared<AppExecFwk::EventHandler>(ams_->GetMainRunner());
|
||||
if (ams_ == nullptr) {
|
||||
HILOG_DEBUG("ams_ is null.");
|
||||
}
|
||||
inputManager_ = MMI::InputManager::GetInstance();
|
||||
}
|
||||
|
||||
AccessibilityInputInterceptor::~AccessibilityInputInterceptor()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
RemoveAllInterceptors();
|
||||
DestroyInterceptor();
|
||||
DestroyTransmitters();
|
||||
ams_ = nullptr;
|
||||
eventHandler_ = nullptr;
|
||||
pointerEventTransmitters_ = nullptr;
|
||||
keyEventTransmitters_ = nullptr;
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::InterceptKeyEventCallBack(std::shared_ptr<MMI::KeyEvent> keyEvent)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
if ((nullptr == instance_) || (nullptr == instance_->eventHandler_)) {
|
||||
HILOG_DEBUG("eventHandler_ is empty.");
|
||||
return;
|
||||
}
|
||||
auto task = std::bind(&AccessibilityInputInterceptor::ProcessKeyEvent, instance_, keyEvent);
|
||||
instance_->eventHandler_->PostTask(task, AppExecFwk::EventQueue::Priority::LOW);
|
||||
return;
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::InterceptPointerEventCallBack(std::shared_ptr<MMI::PointerEvent> pointerEvent)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
if ((nullptr == instance_) || (nullptr == instance_->eventHandler_)) {
|
||||
HILOG_DEBUG("eventHandler_ is empty.");
|
||||
return;
|
||||
}
|
||||
auto task = std::bind(&AccessibilityInputInterceptor::ProcessPointerEvent, instance_, pointerEvent);
|
||||
instance_->eventHandler_->PostTask(task, AppExecFwk::EventQueue::Priority::LOW);
|
||||
return;
|
||||
interceptorId_ = -1;
|
||||
inputManager_ = nullptr;
|
||||
inputEventConsumer_ = nullptr;
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::OnKeyEvent(MMI::KeyEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
event.AddFlag(MMI::InputEvent::EVENT_FLAG_NO_INTERCEPT);
|
||||
std::shared_ptr<MMI::KeyEvent> keyEvent = std::make_shared<MMI::KeyEvent>(event);
|
||||
MMI::InputManager::GetInstance()->SimulateInputEvent(keyEvent);
|
||||
if (inputManager_ != nullptr) {
|
||||
inputManager_->SimulateInputEvent(keyEvent);
|
||||
} else {
|
||||
HILOG_DEBUG("inputManager_ is null.");
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::OnPointerEvent(MMI::PointerEvent &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
HILOG_DEBUG("PointerAction is %{public}d.", event.GetPointerAction());
|
||||
HILOG_DEBUG("SourceType is %{public}d.", event.GetSourceType());
|
||||
HILOG_DEBUG("PointerId is %{public}d.", event.GetPointerId());
|
||||
|
||||
event.AddFlag(MMI::InputEvent::EVENT_FLAG_NO_INTERCEPT);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent = std::make_shared<MMI::PointerEvent>(event);
|
||||
MMI::InputManager::GetInstance()->SimulateInputEvent(pointerEvent);
|
||||
if (inputManager_ != nullptr) {
|
||||
inputManager_->SimulateInputEvent(pointerEvent);
|
||||
} else {
|
||||
HILOG_DEBUG("inputManager_ is null.");
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::SetAvailableFunctions(uint32_t availableFunctions)
|
||||
{
|
||||
HILOG_DEBUG("function[%d].", availableFunctions);
|
||||
HILOG_DEBUG("function[%{public}d].", availableFunctions);
|
||||
|
||||
if (availableFunctions_ == availableFunctions) {
|
||||
return;
|
||||
@ -123,36 +111,31 @@ void AccessibilityInputInterceptor::SetAvailableFunctions(uint32_t availableFunc
|
||||
|
||||
void AccessibilityInputInterceptor::CreateTransmitters()
|
||||
{
|
||||
HILOG_DEBUG("function[%d].", availableFunctions_);
|
||||
HILOG_DEBUG("function[%{public}d].", availableFunctions_);
|
||||
|
||||
if (availableFunctions_ == 0) {
|
||||
RemoveAllInterceptors();
|
||||
DestroyInterceptor();
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<EventTransmission> header = nullptr;
|
||||
sptr<EventTransmission> current = nullptr;
|
||||
bool isInterceptPointerEvent = false;
|
||||
bool isInterceptKeyEvent = false;
|
||||
|
||||
if (availableFunctions_& FEATURE_INJECT_TOUCH_EVENTS) {
|
||||
sptr<TouchEventInjector> touchEventInjector = new TouchEventInjector();
|
||||
SetNextEventTransmitter(header, current, touchEventInjector);
|
||||
ams_->SetTouchEventInjector(touchEventInjector);
|
||||
isInterceptPointerEvent = true;
|
||||
}
|
||||
|
||||
if (availableFunctions_& FEATURE_SCREEN_MAGNIFICATION) {
|
||||
sptr<AccessibilityZoomHandler> zoomHandler = new AccessibilityZoomHandler(0);
|
||||
SetNextEventTransmitter(header, current, zoomHandler);
|
||||
isInterceptPointerEvent = true;
|
||||
}
|
||||
|
||||
if (availableFunctions_& FEATURE_TOUCH_EXPLORATION) {
|
||||
sptr<TouchGuider> touchGuider = new TouchGuider();
|
||||
touchGuider->StartUp();
|
||||
SetNextEventTransmitter(header, current, touchGuider);
|
||||
isInterceptPointerEvent = true;
|
||||
}
|
||||
|
||||
SetNextEventTransmitter(header, current, instance_);
|
||||
@ -163,94 +146,46 @@ void AccessibilityInputInterceptor::CreateTransmitters()
|
||||
ams_->SetKeyEventFilter(keyEventFilter);
|
||||
keyEventFilter->SetNext(instance_);
|
||||
keyEventTransmitters_ = keyEventFilter;
|
||||
isInterceptKeyEvent = true;
|
||||
}
|
||||
|
||||
CreateInterceptors(isInterceptPointerEvent, isInterceptKeyEvent);
|
||||
CreateInterceptor();
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::CreateInterceptors(bool isInterceptPointerEvent, bool isInterceptKeyEvent)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
MMI::InputManager* inputManager = MMI::InputManager::GetInstance();
|
||||
int32_t id = 0;
|
||||
if (interceptorId_.empty()) {
|
||||
if (isInterceptPointerEvent) {
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_MOUSE,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::MOUSE, id));
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::TOUCHSCREEN, id));
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_TOUCHPAD,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::TOUCHPAD, id));
|
||||
}
|
||||
if (isInterceptKeyEvent) {
|
||||
id = inputManager->AddInterceptor(InterceptKeyEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::KEY, id));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isInterceptPointerEvent) {
|
||||
if (interceptorId_.find(InterceptSourceType::MOUSE) == interceptorId_.end()) {
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_MOUSE,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::MOUSE, id));
|
||||
}
|
||||
if (interceptorId_.find(InterceptSourceType::TOUCHSCREEN) == interceptorId_.end()) {
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::TOUCHSCREEN, id));
|
||||
}
|
||||
if (interceptorId_.find(InterceptSourceType::TOUCHPAD) == interceptorId_.end()) {
|
||||
id = inputManager->AddInterceptor(MMI::PointerEvent::SOURCE_TYPE_TOUCHPAD,
|
||||
InterceptPointerEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::TOUCHPAD, id));
|
||||
}
|
||||
} else {
|
||||
if (interceptorId_.find(InterceptSourceType::MOUSE) != interceptorId_.end()) {
|
||||
id = interceptorId_.at(InterceptSourceType::MOUSE);
|
||||
inputManager->RemoveInterceptor(id);
|
||||
interceptorId_.erase(InterceptSourceType::MOUSE);
|
||||
}
|
||||
if (interceptorId_.find(InterceptSourceType::TOUCHSCREEN) != interceptorId_.end()) {
|
||||
id = interceptorId_.at(InterceptSourceType::TOUCHSCREEN);
|
||||
inputManager->RemoveInterceptor(id);
|
||||
interceptorId_.erase(InterceptSourceType::TOUCHSCREEN);
|
||||
}
|
||||
if (interceptorId_.find(InterceptSourceType::TOUCHPAD) != interceptorId_.end()) {
|
||||
id = interceptorId_.at(InterceptSourceType::TOUCHPAD);
|
||||
inputManager->RemoveInterceptor(id);
|
||||
interceptorId_.erase(InterceptSourceType::TOUCHPAD);
|
||||
}
|
||||
}
|
||||
if (isInterceptKeyEvent) {
|
||||
if (interceptorId_.find(InterceptSourceType::KEY) == interceptorId_.end()) {
|
||||
id = inputManager->AddInterceptor(InterceptKeyEventCallBack);
|
||||
interceptorId_.insert(std::make_pair(InterceptSourceType::KEY, id));
|
||||
}
|
||||
} else {
|
||||
if (interceptorId_.find(InterceptSourceType::KEY) != interceptorId_.end()) {
|
||||
id = interceptorId_.at(InterceptSourceType::KEY);
|
||||
inputManager->RemoveInterceptor(id);
|
||||
interceptorId_.erase(InterceptSourceType::KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::RemoveAllInterceptors()
|
||||
void AccessibilityInputInterceptor::CreateInterceptor()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
if (interceptorId_.empty()) {
|
||||
if (inputManager_ == nullptr) {
|
||||
HILOG_DEBUG("inputManger is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iter = interceptorId_.begin(); iter != interceptorId_.end(); iter++) {
|
||||
MMI::InputManager::GetInstance()->RemoveInterceptor(iter->second);
|
||||
if (interceptorId_ != -1) {
|
||||
HILOG_DEBUG("Interceptor is already added, id is %{public}d.", interceptorId_);
|
||||
return;
|
||||
}
|
||||
interceptorId_.clear();
|
||||
|
||||
inputEventConsumer_ = std::make_shared<AccessibilityInputEventConsumer>();
|
||||
interceptorId_ = inputManager_->AddInterceptor(inputEventConsumer_);
|
||||
|
||||
HILOG_DEBUG("interceptorId_ is %{public}d.", interceptorId_);
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::DestroyInterceptor()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
if (inputManager_ == nullptr) {
|
||||
HILOG_DEBUG("inputManager_ is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (interceptorId_ == -1) {
|
||||
HILOG_DEBUG("Interceptor is not added.");
|
||||
return;
|
||||
}
|
||||
|
||||
inputManager_->RemoveInterceptor(interceptorId_);
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::DestroyTransmitters()
|
||||
@ -281,7 +216,7 @@ void AccessibilityInputInterceptor::NotifyAccessibilityEvent(AccessibilityEventI
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event)
|
||||
void AccessibilityInputInterceptor::ProcessPointerEvent(std::shared_ptr<MMI::PointerEvent> event) const
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
@ -293,7 +228,7 @@ void AccessibilityInputInterceptor::ProcessPointerEvent(std::shared_ptr<MMI::Poi
|
||||
pointerEventTransmitters_->OnPointerEvent(*event);
|
||||
}
|
||||
|
||||
void AccessibilityInputInterceptor::ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event)
|
||||
void AccessibilityInputInterceptor::ProcessKeyEvent(std::shared_ptr<MMI::KeyEvent> event) const
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
@ -317,5 +252,66 @@ void AccessibilityInputInterceptor::SetNextEventTransmitter(sptr<EventTransmissi
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
|
||||
AccessibilityInputEventConsumer::AccessibilityInputEventConsumer()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
auto aams = DelayedSingleton<AccessibleAbilityManagerService>::GetInstance();
|
||||
if (aams != nullptr) {
|
||||
eventHandler_ = std::make_shared<AppExecFwk::EventHandler>(aams->GetMainRunner());
|
||||
}
|
||||
}
|
||||
|
||||
AccessibilityInputEventConsumer::~AccessibilityInputEventConsumer()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
eventHandler_ = nullptr;
|
||||
}
|
||||
|
||||
void AccessibilityInputEventConsumer::OnInputEvent(std::shared_ptr<MMI::KeyEvent> keyEvent) const
|
||||
{
|
||||
HILOG_DEBUG("OnInputEvent keyEvent start.");
|
||||
|
||||
auto interceptor = AccessibilityInputInterceptor::GetInstance();
|
||||
if (interceptor == nullptr) {
|
||||
HILOG_DEBUG("interceptor is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (nullptr == eventHandler_) {
|
||||
HILOG_DEBUG("eventHandler_ is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto task = std::bind(&AccessibilityInputInterceptor::ProcessKeyEvent, interceptor, keyEvent);
|
||||
eventHandler_->PostTask(task, AppExecFwk::EventQueue::Priority::LOW);
|
||||
HILOG_DEBUG("OnInputEvent keyEvent end.");
|
||||
return;
|
||||
}
|
||||
|
||||
void AccessibilityInputEventConsumer::OnInputEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent) const
|
||||
{
|
||||
HILOG_DEBUG("OnInputEvent pointerEvent start.");
|
||||
HILOG_DEBUG("PointerAction is %{public}d.", pointerEvent->GetPointerAction());
|
||||
HILOG_DEBUG("SourceType is %{public}d.", pointerEvent->GetSourceType());
|
||||
HILOG_DEBUG("PointerId is %{public}d.", pointerEvent->GetPointerId());
|
||||
|
||||
auto interceptor = AccessibilityInputInterceptor::GetInstance();
|
||||
if (interceptor == nullptr) {
|
||||
HILOG_DEBUG("interceptor is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (nullptr == eventHandler_) {
|
||||
HILOG_DEBUG("eventHandler_ is empty.");
|
||||
return;
|
||||
}
|
||||
auto task = std::bind(&AccessibilityInputInterceptor::ProcessPointerEvent, interceptor, pointerEvent);
|
||||
eventHandler_->PostTask(task, AppExecFwk::EventQueue::Priority::LOW);
|
||||
HILOG_DEBUG("OnInputEvent pointerEvent end.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // namespace Accessibility
|
||||
|
@ -112,7 +112,7 @@ bool AccessibilityInteractionBridge::GetPointerItermOfAccessibilityFocusClick(MM
|
||||
/* Apply magnification if needed. */
|
||||
|
||||
// Intersect with window
|
||||
auto windowManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
auto& windowManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo window;
|
||||
auto result = windowManager.GetAccessibilityWindow(windowManager.activeWindowId_, window);
|
||||
if (!result) {
|
||||
|
@ -116,6 +116,7 @@ void TouchGuider::OnAccessibilityEvent(AccessibilityEventInfo &event)
|
||||
HILOG_DEBUG();
|
||||
|
||||
int eventType = event.GetEventType();
|
||||
HILOG_DEBUG("EventType is %{public}x.", eventType);
|
||||
|
||||
if (eventType == EventType::TYPE_VIEW_HOVER_EXIT_EVENT) {
|
||||
if (HasEventPending(SEND_TOUCH_GUIDE_END_MSG)) {
|
||||
@ -150,7 +151,7 @@ void TouchGuider::DestroyEvents()
|
||||
|
||||
void TouchGuider::SendAccessibilityEventToAA(EventType eventType)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
HILOG_DEBUG("eventType is %{public}x.", eventType);
|
||||
|
||||
AccessibilityEventInfo eventInfo {};
|
||||
eventInfo.SetEventType(eventType);
|
||||
@ -166,7 +167,8 @@ void TouchGuider::SendAccessibilityEventToAA(EventType eventType)
|
||||
|
||||
void TouchGuider::SendEventToMultimodal(MMI::PointerEvent &event, int action)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
HILOG_DEBUG("action is %{public}d.", action);
|
||||
HILOG_DEBUG("SourceType is %{public}d.", event.GetSourceType());
|
||||
|
||||
switch(action){
|
||||
case HOVER_MOVE:
|
||||
|
@ -29,7 +29,7 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::WindowInfo>&
|
||||
return;
|
||||
}
|
||||
|
||||
auto winMgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
auto& winMgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
switch (type) {
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_ADDED:
|
||||
{
|
||||
@ -72,6 +72,7 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::WindowInfo>&
|
||||
break;
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_FOCUSED:
|
||||
{
|
||||
winMgr.SetActiveWindow(windowInfo->wid_);
|
||||
AccessibilityEventInfo evtInf(windowInfo->wid_, WINDOW_UPDATE_FOCUSED);
|
||||
aams->SendEvent(evtInf, aams->GetCurrentAccountId());
|
||||
}
|
||||
@ -79,6 +80,7 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::WindowInfo>&
|
||||
default:
|
||||
break;
|
||||
}
|
||||
HILOG_DEBUG("%{public}s: winMgr.a11yWindows[%{public}d]", __func__, winMgr.a11yWindows_.size());
|
||||
}
|
||||
|
||||
AccessibilityWindowInfoManager &AccessibilityWindowInfoManager::GetInstance()
|
||||
@ -158,7 +160,7 @@ void AccessibilityWindowInfoManager::DeregisterWindowChangeListener()
|
||||
|
||||
void AccessibilityWindowInfoManager::SetActiveWindow(int windowId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start", __func__);
|
||||
HILOG_DEBUG("%{public}s start windowId(%{public}d)", __func__, windowId);
|
||||
if (windowId == INVALID_WINDOW_ID) {
|
||||
if (a11yWindows_.count(activeWindowId_)) {
|
||||
a11yWindows_[activeWindowId_].SetActive(false);
|
||||
|
@ -210,7 +210,7 @@ bool AccessibleAbilityChannelStubImpl::ExecuteCommonAction(int action)
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: need external dependence
|
||||
// temp deal: need external dependence
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ void AccessibleAbilityConnection::OnAbilityConnectDone(const AppExecFwk::Element
|
||||
accountData_->RemoveEnabledAbility(elementName_);
|
||||
accountData_->RemoveConnectingA11yAbility(elementName_);
|
||||
|
||||
// TODO: Notify setting
|
||||
// temp deal: Notify setting
|
||||
return;
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ AAFwk::Want CreateWant(AppExecFwk::ElementName& element)
|
||||
void AccessibleAbilityConnection::Disconnect()
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s start", __func__);
|
||||
// TODO:
|
||||
// temp deal:
|
||||
#if 1
|
||||
if (AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(this) != ERR_OK) {
|
||||
HILOG_ERROR("Disconnect failed!");
|
||||
@ -513,9 +513,9 @@ void AccessibleAbilityConnection::Connect(const AppExecFwk::ElementName &element
|
||||
HILOG_DEBUG("uid is %{public}d ", uid);
|
||||
|
||||
if (AAFwk::AbilityManagerClient::GetInstance()->ConnectAbility(
|
||||
want, this, nullptr, uid / 200000) != ERR_OK) {
|
||||
want, this, nullptr, uid / UID_MASK) != ERR_OK) {
|
||||
HILOG_ERROR("ConnectAbility failed!");
|
||||
// TODO: Remove this enabled ability from Setting
|
||||
// temp deal: Remove this enabled ability from Setting
|
||||
return;
|
||||
}
|
||||
accountData_->AddConnectingA11yAbility(elementName_);
|
||||
@ -541,8 +541,7 @@ void AccessibleAbilityConnection::AccessibleAbilityConnectionDeathRecipient::OnR
|
||||
recipientAccountData_->RemoveConnectedAbility(connection);
|
||||
recipientAccountData_->RemoveEnabledAbility(recipientElementName_);
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->UpdateAccessibilityManagerService();
|
||||
// TODO: notify setting
|
||||
// temp deal: notify setting
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -137,30 +137,18 @@ bool AccessibleAbilityManagerService::Init()
|
||||
HILOG_ERROR("AccessibleAbilityManagerService::Init failed:Failed to subscribe common event");
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
std::vector<int> ids {};
|
||||
AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
HILOG_DEBUG("QueryActiveOsAccountIds ids.size() is %{public}d", ids.size());
|
||||
for (auto id : ids) {
|
||||
HILOG_DEBUG("QueryActiveOsAccountIds id is %{public}d", id);
|
||||
// Todo check active userid
|
||||
}
|
||||
//Get current accountId
|
||||
AccountSA::OsAccountInfo osAccountInfo;
|
||||
OHOS::ErrCode result = AccountSA::OsAccountManager::QueryCurrentOsAccount(osAccountInfo);
|
||||
HILOG_DEBUG(" the result of QueryCurrentOsAccount is %{public}d", result);
|
||||
currentAccountId_ = osAccountInfo.GetLocalId();
|
||||
#else // TBD set currentAccountId_ user 100
|
||||
|
||||
// temp deal: set current account Id to 100.
|
||||
// This is a temporary countermeasure, after which a formal countermeasure is required.
|
||||
currentAccountId_ = 100;
|
||||
HILOG_DEBUG("current accountId %{public}d", currentAccountId_);
|
||||
#endif
|
||||
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
|
||||
// Get ExtensionInfo from BMS
|
||||
accountData->GetInstalledAbilitiesFromBMS();
|
||||
|
||||
// TODO: [setting] Add listener of setting's URI.
|
||||
// temp deal: [setting] Add listener of setting's URI.
|
||||
|
||||
HILOG_INFO("AccessibleAbilityManagerService::Init OK");
|
||||
return true;
|
||||
@ -247,7 +235,7 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
const int abilityTypes, const int stateType)
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s abilityTypes(%{public}d) stateType(%{public}d)",
|
||||
__func__, abilityTypes, stateType);
|
||||
__func__, abilityTypes, stateType);
|
||||
vector<AccessibilityAbilityInfo> infoList;
|
||||
if ((stateType > ABILITY_STATE_INSTALLED) || (stateType < ABILITY_STATE_ENABLE)) {
|
||||
HILOG_ERROR("stateType is out of range!!");
|
||||
@ -255,7 +243,6 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
}
|
||||
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
|
||||
if (!accountData) {
|
||||
HILOG_ERROR("Get current account data failed!!");
|
||||
return infoList;
|
||||
@ -265,7 +252,7 @@ vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetAbilityList
|
||||
vector<AccessibilityAbilityInfo> abilities = accountData->GetAbilitiesByState(state);
|
||||
HILOG_DEBUG(" %{public}s:abilityes count is %{public}d", __func__, abilities.size());
|
||||
for (auto& ability : abilities) {
|
||||
if (abilityTypes == AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_ALL ||
|
||||
if (static_cast<uint32_t>(abilityTypes) == AccessibilityAbilityTypes::ACCESSIBILITY_ABILITY_TYPE_ALL ||
|
||||
(ability.GetAccessibilityAbilityType() & static_cast<uint32_t>(abilityTypes))) {
|
||||
infoList.push_back(ability);
|
||||
}
|
||||
@ -368,7 +355,7 @@ bool AccessibleAbilityManagerService::SetEnabled(const bool state)
|
||||
void AccessibleAbilityManagerService::PersistElementNamesToSetting(
|
||||
const std::string& bundleName, std::map<std::string, AppExecFwk::ElementName>& componentNames, int accountId)
|
||||
{
|
||||
// TODO: Update specified item to setting.
|
||||
// temp deal: Update specified item to setting.
|
||||
}
|
||||
|
||||
sptr<AccessibilityAccountData> AccessibleAbilityManagerService::GetCurrentAccountData()
|
||||
@ -436,7 +423,7 @@ sptr<AppExecFwk::IBundleMgr> AccessibleAbilityManagerService::GetBundleMgrProxy(
|
||||
sptr<AccessibilityWindowConnection> AccessibleAbilityManagerService::GetAccessibilityWindowConnection(
|
||||
int windowId)
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
HILOG_DEBUG(" %{public}s windowId(%{public}d)", __func__, windowId);
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
HILOG_ERROR("Get account data failed");
|
||||
@ -466,7 +453,7 @@ void AccessibleAbilityManagerService::OnChanging(bool selfChange, Uri& uri)
|
||||
if (!accountData) {
|
||||
return;
|
||||
}
|
||||
// TODO: Do something for Setting
|
||||
// temp deal: Do something for Setting
|
||||
UpdateAbilities();
|
||||
}
|
||||
|
||||
@ -525,7 +512,7 @@ void AccessibleAbilityManagerService::PresentUser()
|
||||
|
||||
void AccessibleAbilityManagerService::PackageRemoved(std::string& bundleName)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start", __func__);
|
||||
HILOG_DEBUG("%{public}s start bundleName(%{public}s)", __func__, bundleName.c_str());
|
||||
|
||||
sptr<AccessibilityAccountData> packageAccount = GetCurrentAccountData();
|
||||
if (packageAccount->GetEnabledAbilities().empty()) {
|
||||
@ -548,24 +535,74 @@ void AccessibleAbilityManagerService::PackageRemoved(std::string& bundleName)
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::PackageChanged()
|
||||
void AccessibleAbilityManagerService::PackageAdd(std::string& bundleName)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start", __func__);
|
||||
|
||||
sptr<AccessibilityAccountData> packageAccount = GetCurrentAccountData();
|
||||
if (packageAccount->GetInstalledAbilities().empty()) {
|
||||
return;
|
||||
HILOG_DEBUG("%{public}s start bundleName(%{public}s)", __func__, bundleName.c_str());
|
||||
bool hasNewExtensionAbility = false;
|
||||
std::vector<AppExecFwk::ExtensionAbilityInfo> extensionInfos;
|
||||
GetBundleMgrProxy()->QueryExtensionAbilityInfos(
|
||||
AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, GetCurrentAccountId(), extensionInfos);
|
||||
HILOG_DEBUG("query extensionAbilityInfos' size is %{public}d.", extensionInfos.size());
|
||||
for (auto newAbility : extensionInfos) {
|
||||
if (newAbility.bundleName == bundleName) {
|
||||
HILOG_DEBUG("The package added is an extension ability and\
|
||||
extension ability's name is %{public}s", newAbility.name.c_str());
|
||||
sptr<AccessibilityAbilityInfo> accessibilityInfo = new AccessibilityAbilityInfo(newAbility);
|
||||
GetCurrentAccountData()->AddInstalledAbility(*accessibilityInfo);
|
||||
HILOG_DEBUG("add new extension ability successfully and installed abilities's size is %{public}d",
|
||||
GetCurrentAccountData()->GetInstalledAbilities().size());
|
||||
hasNewExtensionAbility = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
packageAccount->ClearInstalledAbility();
|
||||
if (packageAccount->ReadConfigurationForAccountData()) {
|
||||
if (hasNewExtensionAbility) {
|
||||
HILOG_DEBUG("add new extension ability and update abilities.");
|
||||
UpdateAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::PackageChanged(std::string& bundleName)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start bundleName(%{public}s)", __func__, bundleName.c_str());
|
||||
|
||||
bool hasChanged = false;
|
||||
sptr<AccessibilityAccountData> packageAccount = GetCurrentAccountData();
|
||||
if (packageAccount->GetInstalledAbilities().empty()) {
|
||||
HILOG_DEBUG("There is no installed abilities.");
|
||||
return;
|
||||
}
|
||||
sptr<AccessibilityAbilityInfo> accessibilityInfo = new AccessibilityAbilityInfo();
|
||||
accessibilityInfo->SetPackageName(bundleName);
|
||||
packageAccount->RemoveInstalledAbility(*accessibilityInfo);
|
||||
|
||||
// add installed ability
|
||||
std::vector<AppExecFwk::ExtensionAbilityInfo> extensionInfos;
|
||||
GetBundleMgrProxy()->QueryExtensionAbilityInfos(
|
||||
AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, GetCurrentAccountId(), extensionInfos);
|
||||
HILOG_DEBUG("query extensionAbilityInfos' size is %{public}d.", extensionInfos.size());
|
||||
for (auto changedAbility : extensionInfos) {
|
||||
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);
|
||||
GetCurrentAccountData()->AddInstalledAbility(*accessibilityInfo);
|
||||
HILOG_DEBUG("update new extension ability successfully and installed abilities's size is %{public}d",
|
||||
GetCurrentAccountData()->GetInstalledAbilities().size());
|
||||
hasChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
HILOG_DEBUG("update new extension ability and update abilities.");
|
||||
UpdateAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::PackageUpdateFinished(std::string& bundleName)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start", __func__);
|
||||
HILOG_DEBUG("%{public}s start bundleName(%{public}s)", __func__, bundleName.c_str());
|
||||
sptr<AccessibilityAccountData> packageAccount = GetCurrentAccountData();
|
||||
if (packageAccount->GetConnectingA11yAbilities().empty()) {
|
||||
return;
|
||||
@ -630,15 +667,12 @@ void AccessibleAbilityManagerService::UpdateAbilities()
|
||||
vector<AccessibilityAbilityInfo> installedAbilities = accountData->GetInstalledAbilities();
|
||||
HILOG_DEBUG("installedAbilities is %{public}d.", installedAbilities.size());
|
||||
for (auto& installAbility : installedAbilities) {
|
||||
// TODO: deviceId
|
||||
// AppExecFwk::ElementName element(installAbility.GetAbilityInfo().deviceId,
|
||||
// installAbility.GetPackageName(),
|
||||
// installAbility.GetName());
|
||||
// temp deal: deviceId
|
||||
std::string deviceId;
|
||||
AppExecFwk::ElementName element(deviceId, installAbility.GetPackageName(), installAbility.GetName());
|
||||
HILOG_DEBUG("installAbility's packageName is %{public}s", installAbility.GetPackageName().c_str());
|
||||
HILOG_DEBUG("installAbility's abilityName is %{public}s", installAbility.GetName().c_str());
|
||||
std::string elementName = "/" + installAbility.GetPackageName() + "/"; // TODO
|
||||
std::string elementName = "/" + installAbility.GetPackageName() + "/"; // temp deal
|
||||
|
||||
// wait for the connecting ability.
|
||||
if (accountData->GetConnectingA11yAbilities().count(elementName)) {
|
||||
@ -648,6 +682,7 @@ void AccessibleAbilityManagerService::UpdateAbilities()
|
||||
sptr<AccessibleAbilityConnection> connection = accountData->GetAccessibleAbilityConnection(elementName);
|
||||
if (accountData->GetEnabledAbilities().count(elementName)) {
|
||||
if (!connection) {
|
||||
installAbility.SetCapabilityValues(Capability::CAPABILITY_RETRIEVE);// this is a temp deal for ace test
|
||||
connection = new AccessibleAbilityConnection(accountData, connectCounter_++, installAbility);
|
||||
connection->Connect(element);
|
||||
}
|
||||
@ -755,7 +790,7 @@ void AccessibleAbilityManagerService::UpdateWindowChangeListener()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
|
||||
bool isWindowRetrieve = true; // TBD for test
|
||||
bool isWindowRetrieve = true; // this is a temp deal for test
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
HILOG_ERROR("Account data is null");
|
||||
@ -854,17 +889,11 @@ bool AccessibleAbilityManagerService::SetEnabledObj(std::map<std::string, AppExe
|
||||
return result;
|
||||
}
|
||||
|
||||
// std::vector<WMDisplayInfo> AccessibleAbilityManagerService::GetDisplayList()
|
||||
// {
|
||||
// std::vector<WMDisplayInfo> displays = AccessibilityDisplayManager::GetInstance().GetDisplays();
|
||||
// return displays;
|
||||
// }
|
||||
|
||||
std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerService::GetEnabledAbilities()
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
std::map<std::string, AppExecFwk::ElementName> it{};
|
||||
std::map<std::string, AppExecFwk::ElementName> it {};
|
||||
it = accountData->GetEnabledAbilities();
|
||||
return it;
|
||||
}
|
||||
@ -873,17 +902,15 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetInstal
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
std::vector<AccessibilityAbilityInfo> it{};
|
||||
std::vector<AccessibilityAbilityInfo> it {};
|
||||
it = accountData->GetInstalledAbilities();
|
||||
return it;
|
||||
}
|
||||
|
||||
|
||||
bool AccessibleAbilityManagerService::DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
bool result = false;
|
||||
result = accountData->DisableAbilities(it);
|
||||
bool result = accountData->DisableAbilities(it);
|
||||
UpdateAbilities();
|
||||
return result;
|
||||
}
|
||||
@ -908,9 +935,18 @@ void AccessibleAbilityManagerService::AddUITestClient(const sptr<IRemoteObject>&
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
auto currentAccountData = GetCurrentAccountData();
|
||||
|
||||
// add installed ability
|
||||
sptr<AccessibilityAbilityInfo> abilityInfo = new AccessibilityAbilityInfo();
|
||||
abilityInfo->SetPackageName("com.example.uitest");
|
||||
uint32_t capabilities = CAPABILITY_RETRIEVE | CAPABILITY_TOUCH_GUIDE |
|
||||
CAPABILITY_KEY_EVENT_OBSERVER | CAPABILITY_ZOOM | CAPABILITY_GESTURE;
|
||||
abilityInfo->SetCapabilityValues(capabilities);
|
||||
abilityInfo->SetAccessibilityAbilityType(ACCESSIBILITY_ABILITY_TYPE_ALL);
|
||||
abilityInfo->SetEventTypes(EventType::TYPES_ALL_MASK);
|
||||
currentAccountData->AddInstalledAbility(*abilityInfo);
|
||||
|
||||
// add connected ability
|
||||
sptr<AppExecFwk::ElementName> elementName = new AppExecFwk::ElementName();
|
||||
elementName->SetBundleName("com.example.uitest");
|
||||
elementName->SetAbilityName("uitestability");
|
||||
@ -939,9 +975,13 @@ void AccessibleAbilityManagerService::RemoveUITestClient(sptr<AccessibleAbilityC
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
auto currentAccountData = GetCurrentAccountData();
|
||||
|
||||
// remove installed ability
|
||||
sptr<AccessibilityAbilityInfo> abilityInfo = new AccessibilityAbilityInfo();
|
||||
abilityInfo->SetPackageName("com.example.uitest");
|
||||
currentAccountData->RemoveInstalledAbility(*abilityInfo);
|
||||
|
||||
// remove connected ability
|
||||
currentAccountData->RemoveUITestConnectedAbility(connection);
|
||||
connection->OnAbilityDisconnectDone(connection->GetElementName(), 0);
|
||||
}
|
||||
@ -951,4 +991,4 @@ int AccessibleAbilityManagerService::GetActiveWindow()
|
||||
return AccessibilityWindowInfoManager::GetInstance().activeWindowId_;
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
@ -81,7 +81,7 @@ bool AccessibilityOperator::GetRoot(int channelId, AccessibilityElementInfo &ele
|
||||
|
||||
std::vector<AccessibilityWindowInfo> AccessibilityOperator::GetWindows(int channelId)
|
||||
{
|
||||
return windows_;
|
||||
return windows_;
|
||||
}
|
||||
|
||||
bool AccessibilityOperator::SearchElementInfosByAccessibilityId(int channelId,
|
||||
@ -190,6 +190,5 @@ void AccessibilityOperator::SendSimulateGesture(const int channelId,
|
||||
const int requestId, const std::vector<GesturePathDefine> &gestureSteps)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -1,61 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 "accessible_ability_client_stub.h"
|
||||
#include "parcel.h"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
AccessibleAbilityClientStub::AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
AccessibleAbilityClientStub::~AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
int AccessibleAbilityClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleInit(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleDisconnect(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnAccessibilityEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnKeyPressEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnDisplayResized(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnGestureSimulateResult(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
/*
|
||||
* Copyright (C) 2021 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 "accessible_ability_client_stub.h"
|
||||
#include "parcel.h"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
AccessibleAbilityClientStub::AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
AccessibleAbilityClientStub::~AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
int AccessibleAbilityClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleInit(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleDisconnect(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnAccessibilityEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnKeyPressEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnDisplayResized(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnGestureSimulateResult(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
12
services/aams/test/mock/accessible_ability_manager_service_mock.cpp
Normal file → Executable file
12
services/aams/test/mock/accessible_ability_manager_service_mock.cpp
Normal file → Executable file
@ -246,10 +246,7 @@ void AccessibleAbilityManagerService::UpdateAbilities()
|
||||
|
||||
vector<AccessibilityAbilityInfo> installedAbilities = accountData->GetInstalledAbilities();
|
||||
for (auto &installAbility : installedAbilities) {
|
||||
// TODO:
|
||||
// AppExecFwk::ElementName element(installAbility.GetAbilityInfo().deviceId,
|
||||
// installAbility.GetPackageName(),
|
||||
// installAbility.GetName());
|
||||
// temp deal
|
||||
std::string deviceId;
|
||||
AppExecFwk::ElementName element(deviceId,
|
||||
installAbility.GetPackageName(),
|
||||
@ -388,7 +385,7 @@ void AccessibleAbilityManagerService::StateCallbackDeathRecipient::OnRemoteDied(
|
||||
|
||||
void AccessibleAbilityManagerService::RemovedUser(int32_t accountId) {}
|
||||
void AccessibleAbilityManagerService::PresentUser() {}
|
||||
void AccessibleAbilityManagerService::PackageChanged() {}
|
||||
void AccessibleAbilityManagerService::PackageChanged(std::string& bundleName) {}
|
||||
void AccessibleAbilityManagerService::PackageRemoved(std::string &bundleName) {}
|
||||
void AccessibleAbilityManagerService::PackageUpdateFinished(std::string &bundleName) {}
|
||||
CaptionProperty AccessibleAbilityManagerService::GetCaptionProperty()
|
||||
@ -526,7 +523,7 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerService::GetInstal
|
||||
{
|
||||
HILOG_DEBUG(" %{public}s", __func__);
|
||||
sptr<AccessibilityAccountData> accountData = GetCurrentAccountData();
|
||||
std::vector<AccessibilityAbilityInfo> it{};
|
||||
std::vector<AccessibilityAbilityInfo> it {};
|
||||
it = accountData->GetInstalledAbilities();
|
||||
return it;
|
||||
}
|
||||
@ -593,5 +590,8 @@ int AccessibleAbilityManagerService::GetActiveWindow()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::PackageAdd(std::string& bundleName)
|
||||
{}
|
||||
} // namespace OHOS
|
||||
} // Accessibility
|
2
services/aams/test/mock/mock_input_manager.cpp
Normal file → Executable file
2
services/aams/test/mock/mock_input_manager.cpp
Normal file → Executable file
@ -20,6 +20,7 @@
|
||||
namespace OHOS {
|
||||
std::vector<int32_t> g_mtTouchAction;
|
||||
std::function<void(std::shared_ptr<MMI::PointerEvent>)> g_pointerCallback = nullptr;
|
||||
std::shared_ptr<MMI::IInputEventConsumer> g_inputEventConsumer = nullptr;
|
||||
namespace MMI {
|
||||
int MTtouchAction = -1;
|
||||
|
||||
@ -46,6 +47,7 @@ void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent
|
||||
|
||||
int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptorId)
|
||||
{
|
||||
g_inputEventConsumer = interceptorId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class AccessibilityAccountDataTest : public testing::Test {
|
||||
public:
|
||||
|
||||
AccessibilityAccountDataTest() {}
|
||||
~AccessibilityAccountDataTest() {}
|
||||
|
||||
@ -127,7 +126,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_GetAcce
|
||||
*abilityInfo);
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectingA11yAbilities().size());
|
||||
/* add connecting A11y ability */
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
accountData->AddConnectingA11yAbility(elementName);
|
||||
bool test = accountData->GetConnectingA11yAbilities().find(elementName.GetURI()) !=
|
||||
accountData->GetConnectingA11yAbilities().end();
|
||||
@ -158,7 +157,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_GetAcce
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
sptr<AccessibleAbilityConnection> connection = new AccessibleAbilityConnection(accountData, connectCounter++,
|
||||
*abilityInfo);
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
/* add connected ability */
|
||||
accountData->AddConnectedAbility(connection);
|
||||
/* add connecting A11y ability */
|
||||
@ -269,7 +268,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_RemoveC
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_RemoveConnectingA11yAbility001 start";
|
||||
const int accountId = 1;
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectingA11yAbilities().size());
|
||||
/* add connecting A11y ability */
|
||||
accountData->AddConnectingA11yAbility(elementName);
|
||||
@ -294,7 +293,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_AddEnab
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_AddEnabledAbility001 start";
|
||||
const int accountId = 1;
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
EXPECT_EQ(0, (int)accountData->GetEnabledAbilities().size());
|
||||
/* add */
|
||||
accountData->AddEnabledAbility(elementName);
|
||||
@ -688,7 +687,6 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_SetCapt
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_SetCaptionState end";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityAccountData_Unittest_OnAccountSwitched001
|
||||
* @tc.name: OnAccountSwitched
|
||||
@ -708,7 +706,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_OnAccou
|
||||
//new aastub
|
||||
sptr<AccessibleAbilityClientStubImpl> aastub = new AccessibleAbilityClientStubImpl();
|
||||
GTEST_LOG_(INFO) << "OnAbilityConnectDone start !!!!!";
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
AAConnection->OnAbilityConnectDone(elementName, aastub, 0);
|
||||
GTEST_LOG_(INFO) << "add connected A11y Ability";
|
||||
EXPECT_EQ(1, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
@ -748,7 +746,7 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_AddConn
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_AddConnectingA11yAbility001 start";
|
||||
const int accountId = 1;
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectingA11yAbilities().size());
|
||||
/* add connecting A11y ability */
|
||||
accountData->AddConnectingA11yAbility(elementName);
|
||||
@ -844,20 +842,19 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_RemoveE
|
||||
const int accountId = 1;
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "bbb", "ccc");
|
||||
accountData->RemoveEnabledAbility(elementName);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_RemoveEnabledAbility end";
|
||||
}
|
||||
|
||||
|
||||
HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_SetEnabledObj, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_SetEnabledObj start";
|
||||
const int accountId = 1;
|
||||
sptr<AccessibilityAccountData> accountData = new AccessibilityAccountData(accountId);
|
||||
|
||||
const AppExecFwk::ElementName elementName("aaa", "TEST_BUNDLE_NAME" , "ccc");
|
||||
const AppExecFwk::ElementName elementName("aaa", "TEST_BUNDLE_NAME", "ccc");
|
||||
|
||||
/* add */
|
||||
accountData->AddEnabledAbility(elementName);
|
||||
@ -869,6 +866,5 @@ HWTEST_F(AccessibilityAccountDataTest, AccessibilityAccountData_Unittest_SetEnab
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityAccountData_Unittest_SetEnabledObj end";
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -28,7 +28,7 @@ using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
extern std::function<void(std::shared_ptr<MMI::PointerEvent>)> g_pointerCallback;
|
||||
extern std::shared_ptr<MMI::IInputEventConsumer> g_inputEventConsumer;
|
||||
namespace Accessibility {
|
||||
class AccessibilityInputInterceptorTest : public testing::Test {
|
||||
public:
|
||||
@ -59,6 +59,7 @@ void AccessibilityInputInterceptorTest::TearDownTestCase()
|
||||
|
||||
void AccessibilityInputInterceptorTest::SetUp()
|
||||
{
|
||||
g_inputEventConsumer = nullptr;
|
||||
mock_ = new OHOS::AppExecFwk::BundleMgrService();
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
@ -171,8 +172,8 @@ HWTEST_F(AccessibilityInputInterceptorTest, AccessibilityInputInterceptorTest_Un
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
event->AddPointerItem(item);
|
||||
|
||||
if (g_pointerCallback != nullptr) {
|
||||
g_pointerCallback(event);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
}
|
||||
/* wait ProcessTouchEvent */
|
||||
sleep(3);
|
||||
@ -201,8 +202,8 @@ HWTEST_F(AccessibilityInputInterceptorTest, AccessibilityInputInterceptorTest_Un
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
event->AddPointerItem(item);
|
||||
|
||||
if (g_pointerCallback != nullptr) {
|
||||
g_pointerCallback(event);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
}
|
||||
/* wait ProcessTouchEvent */
|
||||
sleep(3);
|
||||
@ -250,8 +251,8 @@ HWTEST_F(AccessibilityInputInterceptorTest, AccessibilityInputInterceptorTest_Un
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
event->AddPointerItem(item);
|
||||
|
||||
if (g_pointerCallback != nullptr) {
|
||||
g_pointerCallback(event);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
}
|
||||
/* wait ProcessMouseEvent */
|
||||
sleep(3);
|
||||
@ -278,8 +279,8 @@ HWTEST_F(AccessibilityInputInterceptorTest, AccessibilityInputInterceptorTest_Un
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
event->AddPointerItem(item);
|
||||
|
||||
if (g_pointerCallback != nullptr) {
|
||||
g_pointerCallback(event);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
}
|
||||
/* wait ProcessMouseEvent */
|
||||
sleep(3);
|
||||
|
@ -85,7 +85,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Con
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_ConvertToRealWindowId001 start";
|
||||
int windowId = ACTIVE_WINDOW_ID;
|
||||
int focusType = 0;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
int realWindowId = mgr.ConvertToRealWindowId(windowId, focusType);
|
||||
|
||||
EXPECT_EQ(mgr.activeWindowId_, realWindowId);
|
||||
@ -102,8 +102,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Con
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_ConvertToRealWindowId002 start";
|
||||
int windowId = ANY_WINDOW_ID;
|
||||
int focusType = FOCUS_TYPE_ACCESSIBILITY;
|
||||
auto a11yWindowMgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
int realWindowId = mgr.ConvertToRealWindowId(windowId, focusType);
|
||||
|
||||
EXPECT_EQ(mgr.a11yFocusedWindowId_, realWindowId);
|
||||
@ -120,7 +119,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Con
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_ConvertToRealWindowId003 start";
|
||||
int windowId = ANY_WINDOW_ID;
|
||||
int focusType = FOCUS_TYPE_INPUT;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
int realWindowId = mgr.ConvertToRealWindowId(windowId, focusType);
|
||||
|
||||
EXPECT_EQ(mgr.inputFocusedWindowId_, realWindowId);
|
||||
@ -144,7 +143,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Cre
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
|
||||
auto windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = windowInfoManager.CreateAccessibilityWindowInfo(winInfo);
|
||||
|
||||
EXPECT_EQ(TYPE_APPLICATION, info.GetWindowType());
|
||||
@ -169,7 +168,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Cre
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
|
||||
auto windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = windowInfoManager.CreateAccessibilityWindowInfo(winInfo);
|
||||
|
||||
EXPECT_EQ(TYPE_SYSTEM, info.GetWindowType());
|
||||
@ -194,7 +193,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Cre
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
|
||||
auto windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = windowInfoManager.CreateAccessibilityWindowInfo(winInfo);
|
||||
|
||||
EXPECT_EQ(TYPE_WINDOW_INVALID, info.GetWindowType());
|
||||
@ -260,7 +259,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_OnW
|
||||
winInfo->windowRect_.posX_ = 1;
|
||||
winInfo->windowRect_.posY_ = 1;
|
||||
winInfo->focused_ = true;
|
||||
auto windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& windowInfoManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
|
||||
if (!windowInfoManager.a11yWindows_.empty()) {
|
||||
GTEST_LOG_(INFO) << "a11yWindows_ is empty";
|
||||
@ -297,7 +296,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_OnW
|
||||
winInfo->windowRect_.posY_ = 1;
|
||||
winInfo->focused_ = true;
|
||||
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(*winInfo);
|
||||
int id = 2;
|
||||
EXPECT_TRUE(mgr.a11yWindows_.size() == 0);
|
||||
@ -336,7 +335,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_OnW
|
||||
winInfo->windowRect_.posY_ = 1;
|
||||
winInfo->focused_ = true;
|
||||
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(*winInfo);
|
||||
int id = 2;
|
||||
EXPECT_TRUE(mgr.a11yWindows_.size() == 0);
|
||||
@ -376,7 +375,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_OnW
|
||||
winInfo->windowRect_.posY_ = 1;
|
||||
winInfo->focused_ = true;
|
||||
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(*winInfo);
|
||||
int id = -1;
|
||||
EXPECT_TRUE(mgr.a11yWindows_.size() == 0);
|
||||
@ -406,7 +405,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetActiveWindow001 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.activeWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -436,7 +435,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetActiveWindow002 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.activeWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -468,7 +467,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetActiveWindow003 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.activeWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -498,7 +497,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetActiveWindow004 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info1;
|
||||
AccessibilityWindowInfo info2;
|
||||
mgr.activeWindowId_ = ACTIVE_WINDOW_ID;
|
||||
@ -535,7 +534,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetAccessibilityFocusedWindow001 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.a11yFocusedWindowId_ = ANY_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -566,7 +565,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetAccessibilityFocusedWindow002 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.a11yFocusedWindowId_ = ANY_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -599,7 +598,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetAccessibilityFocusedWindow003 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.a11yFocusedWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -630,7 +629,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetAccessibilityFocusedWindow004 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info1;
|
||||
AccessibilityWindowInfo info2;
|
||||
mgr.a11yFocusedWindowId_ = ANY_WINDOW_ID;
|
||||
@ -666,7 +665,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetInputFocusedWindow001 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.inputFocusedWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -696,7 +695,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetInputFocusedWindow002 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.inputFocusedWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -729,7 +728,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetInputFocusedWindow003 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info;
|
||||
mgr.inputFocusedWindowId_ = ACTIVE_WINDOW_ID;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -759,7 +758,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetInputFocusedWindow004 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info1;
|
||||
AccessibilityWindowInfo info2;
|
||||
mgr.inputFocusedWindowId_ = ACTIVE_WINDOW_ID;
|
||||
@ -805,7 +804,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Get
|
||||
winInfo.windowRect_.posX_ = 1;
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(winInfo);
|
||||
info.SetWindowType(WindowType::TYPE_APPLICATION);
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -844,7 +843,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Get
|
||||
winInfo.windowRect_.posX_ = 1;
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(winInfo);
|
||||
info.SetWindowType(WindowType::TYPE_APPLICATION);
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -878,7 +877,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Get
|
||||
winInfo.windowRect_.posX_ = 1;
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(winInfo);
|
||||
info.SetWindowType(WindowType::TYPE_APPLICATION);
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -911,7 +910,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_IsV
|
||||
winInfo.windowRect_.posX_ = 1;
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(winInfo);
|
||||
info.SetWindowType(WindowType::TYPE_APPLICATION);
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -944,7 +943,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_IsV
|
||||
winInfo.windowRect_.posX_ = 1;
|
||||
winInfo.windowRect_.posY_ = 1;
|
||||
winInfo.focused_ = true;
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfo info = mgr.CreateAccessibilityWindowInfo(winInfo);
|
||||
info.SetWindowType(WindowType::TYPE_APPLICATION);
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
@ -968,7 +967,7 @@ HWTEST_F(AccessibilityWindowManagerTest, AccessibilityWindowManager_Unittest_Set
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityWindowManager_Unittest_SetWindowSize001 start";
|
||||
/* map insert value */
|
||||
auto mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
AccessibilityWindowInfoManager& mgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
int windowId = ANY_WINDOW_ID;
|
||||
AccessibilityWindowInfo info;
|
||||
EXPECT_EQ(0, (int)mgr.a11yWindows_.size());
|
||||
|
@ -295,14 +295,16 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, PackageChanged_001, TestSize.L
|
||||
GTEST_LOG_(INFO) << "GetInstalledAbilities start";
|
||||
EXPECT_EQ(0, int(accountData->GetInstalledAbilities().size()));
|
||||
GTEST_LOG_(INFO) << "PackageChanged start";
|
||||
ins_->PackageChanged();
|
||||
std::string bundleName = "bundleName1";
|
||||
ins_->PackageChanged(bundleName);
|
||||
GTEST_LOG_(INFO) << "PackageChanged end";
|
||||
EXPECT_EQ(0, int(accountData->GetInstalledAbilities().size()));
|
||||
GTEST_LOG_(INFO) << "GetInstalledAbilities end";
|
||||
/* add install ability */
|
||||
RegisterAbilityConnectionClient(stub_);
|
||||
EXPECT_EQ(1, int(accountData->GetInstalledAbilities().size()));
|
||||
ins_->PackageChanged();
|
||||
bundleName = "bundleName2";
|
||||
ins_->PackageChanged(bundleName);
|
||||
EXPECT_EQ(0, int(accountData->GetInstalledAbilities().size()));
|
||||
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_PackageChanged_001 end";
|
||||
}
|
||||
}
|
40
services/test/BUILD.gn
Normal file → Executable file
40
services/test/BUILD.gn
Normal file → Executable file
@ -26,6 +26,7 @@ config("module_private_config") {
|
||||
cflags_cc = [ "-fexceptions" ]
|
||||
}
|
||||
include_dirs = [
|
||||
#"mock/distributedschedule/include",
|
||||
"mock/multimodalinput/include",
|
||||
"mock/powermanager/include",
|
||||
"mock/aafwk/include",
|
||||
@ -53,8 +54,8 @@ config("module_private_config") {
|
||||
"//utils/native/base/include",
|
||||
"//foundation/appexecfwk/standard/kits/appkit/native/app/include",
|
||||
"//base/global/resmgr_standard/interfaces/innerkits/include",
|
||||
"//foundation/distributedschedule/samgr/services/samgr/native/include",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
#"//foundation/distributedschedule/samgr/services/samgr/native/include",
|
||||
#"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
|
||||
"//foundation/appexecfwk/standard/common/log/include",
|
||||
"//third_party/jsoncpp/include/json",
|
||||
@ -90,9 +91,13 @@ MockPowerManagerSrc = [
|
||||
]
|
||||
|
||||
MockAafwkSrc = [
|
||||
"mock/aafwk/src/mock_ability_manager_client.cpp"
|
||||
"mock/aafwk/src/mock_ability_manager_client.cpp",
|
||||
]
|
||||
|
||||
MockDistributedscheduleSrc = [
|
||||
#"mock/distributedschedule/src/iservice_registry.cpp",
|
||||
#"mock/distributedschedule/src/system_ability_manager.cpp",
|
||||
]
|
||||
|
||||
################################################################################
|
||||
ohos_moduletest("aams_accessibility_touch_guider_test") {
|
||||
@ -145,6 +150,7 @@ ohos_moduletest("aams_accessibility_touch_guider_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -230,6 +236,7 @@ ohos_moduletest("aams_accessibility_touchEvent_injector_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -262,7 +269,7 @@ ohos_moduletest("aams_accessibility_touchEvent_injector_test") {
|
||||
"//foundation/graphic/standard:libwmclient",
|
||||
"//foundation/windowmanager/wm:libwm",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@ -304,10 +311,9 @@ ohos_moduletest("aams_accessible_ability_channel_test") {
|
||||
"//base/accessibility/services/test/mock/accessibility_event_transmission_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/accessibility_operator_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/accessible_ability_manager_service_stub_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/iservice_registry.cpp",
|
||||
"//base/accessibility/services/test/mock/system_ability_manager.cpp",
|
||||
#"//base/accessibility/services/test/mock/system_ability_manager.cpp",
|
||||
"//base/accessibility/services/test/mock/mock_bundle_manager.cpp",
|
||||
"//base/accessibility/services/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
#"//base/accessibility/services/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
"//base/accessibility/services/test/mock/common_event_support_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/common_event_manager_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/matching_skill_mock.cpp",
|
||||
@ -326,6 +332,7 @@ ohos_moduletest("aams_accessible_ability_channel_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -341,7 +348,7 @@ ohos_moduletest("aams_accessible_ability_channel_test") {
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
#"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
"//foundation/windowmanager/utils:libwmutil",
|
||||
]
|
||||
|
||||
@ -398,10 +405,9 @@ ohos_moduletest("aams_server_test") {
|
||||
"../aams/test/mock/gesture_simulation_mock.cpp",
|
||||
"../aams/test/mock/accessibility_event_transmission_mock.cpp",
|
||||
"../aams/test/mock/accessibility_operator_mock.cpp",
|
||||
"../aams/test/mock/iservice_registry.cpp",
|
||||
"../aams/test/mock/system_ability_manager.cpp",
|
||||
#"../aams/test/mock/system_ability_manager.cpp",
|
||||
"../aams/test/mock/mock_bundle_manager.cpp",
|
||||
"../aams/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
#"../aams/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
"../aams/test/mock/common_event_support_mock.cpp",
|
||||
"../aams/test/mock/common_event_manager_mock.cpp",
|
||||
"../aams/test/mock/matching_skill_mock.cpp",
|
||||
@ -423,6 +429,7 @@ ohos_moduletest("aams_server_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -438,7 +445,7 @@ ohos_moduletest("aams_server_test") {
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
#"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
"//foundation/windowmanager/utils:libwmutil",
|
||||
]
|
||||
|
||||
@ -509,6 +516,7 @@ ohos_moduletest("aams_accessibility_keyevent_filter_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -581,10 +589,9 @@ ohos_moduletest("aams_common_event_registry_test") {
|
||||
"//base/accessibility/services/test/mock/accessibility_event_transmission_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/accessibility_operator_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/accessible_ability_manager_service_stub_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/iservice_registry.cpp",
|
||||
"//base/accessibility/services/test/mock/system_ability_manager.cpp",
|
||||
#"//base/accessibility/services/test/mock/system_ability_manager.cpp",
|
||||
"//base/accessibility/services/test/mock/mock_bundle_manager.cpp",
|
||||
"//base/accessibility/services/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
#"//base/accessibility/services/test/mock/mock_system_ability_manager_stub.cpp",
|
||||
"//base/accessibility/services/test/mock/common_event_support_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/common_event_manager_mock.cpp",
|
||||
"//base/accessibility/services/test/mock/matching_skill_mock.cpp",
|
||||
@ -603,6 +610,7 @@ ohos_moduletest("aams_common_event_registry_test") {
|
||||
sources += MockMultiModalInputSrc
|
||||
sources += MockPowerManagerSrc
|
||||
sources += MockAafwkSrc
|
||||
sources += MockDistributedscheduleSrc
|
||||
|
||||
configs = [
|
||||
":module_private_config",
|
||||
@ -617,7 +625,7 @@ ohos_moduletest("aams_common_event_registry_test") {
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
#"//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
|
||||
"//foundation/windowmanager/utils:libwmutil",
|
||||
]
|
||||
|
@ -16,9 +16,9 @@
|
||||
#ifndef OHOS_AAFWK_ABILITY_CONNECT_CALLBACK_STUB_H
|
||||
#define OHOS_AAFWK_ABILITY_CONNECT_CALLBACK_STUB_H
|
||||
|
||||
#include "ability_connect_callback_interface.h"
|
||||
#include <iremote_object.h>
|
||||
#include <iremote_stub.h>
|
||||
#include "ability_connect_callback_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@ -28,15 +28,9 @@ namespace AAFwk {
|
||||
*/
|
||||
class AbilityConnectionStub : public IRemoteStub<IAbilityConnection> {
|
||||
public:
|
||||
AbilityConnectionStub()
|
||||
{}
|
||||
virtual ~AbilityConnectionStub()
|
||||
{}
|
||||
|
||||
// virtual int OnRemoteRequest(
|
||||
// uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
AbilityConnectionStub() {}
|
||||
virtual ~AbilityConnectionStub() {}
|
||||
};
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_ABILITY_CONNECT_CALLBACK_STUB_H
|
2
services/test/mock/aafwk/include/ability_local_record.h
Normal file → Executable file
2
services/test/mock/aafwk/include/ability_local_record.h
Normal file → Executable file
@ -20,10 +20,8 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
|
||||
class AbilityLocalRecord {
|
||||
public:
|
||||
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -16,9 +16,11 @@
|
||||
#ifndef OHOS_AAFWK_ABILITY_MANAGER_CLIENT_H
|
||||
#define OHOS_AAFWK_ABILITY_MANAGER_CLIENT_H
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "ability_connect_callback_interface.h"
|
||||
#include "iremote_object.h"
|
||||
#include "want.h"
|
||||
#include "ability_connect_callback_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@ -28,23 +30,23 @@ namespace AAFwk {
|
||||
*/
|
||||
class AbilityManagerClient {
|
||||
public:
|
||||
AbilityManagerClient()
|
||||
{}
|
||||
virtual ~AbilityManagerClient()
|
||||
{}
|
||||
AbilityManagerClient() {}
|
||||
virtual ~AbilityManagerClient() {}
|
||||
ErrCode ConnectAbility(const Want &want, const sptr<IAbilityConnection> &connect,
|
||||
const sptr<IRemoteObject> &callerToken, int32_t userId)
|
||||
{return ERR_OK;}
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode DisconnectAbility(const sptr<IAbilityConnection> &connect)
|
||||
{return ERR_OK;}
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
static std::shared_ptr<AbilityManagerClient> GetInstance();
|
||||
|
||||
private:
|
||||
static std::shared_ptr<AbilityManagerClient> instance_;
|
||||
static std::mutex mutex_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_ABILITY_MANAGER_H
|
||||
|
@ -28,7 +28,6 @@ namespace AAFwk {
|
||||
*/
|
||||
class IAbilityManager : public OHOS::IRemoteBroker {
|
||||
public:
|
||||
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
3
services/test/mock/aafwk/include/extension.h
Normal file → Executable file
3
services/test/mock/aafwk/include/extension.h
Normal file → Executable file
@ -20,13 +20,11 @@
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
|
||||
namespace AbilityRuntime {
|
||||
class Extension : public std::enable_shared_from_this<Extension> {
|
||||
public:
|
||||
Extension() = default;
|
||||
virtual ~Extension() = default;
|
||||
|
||||
/**
|
||||
* @brief Called when this Service extension is connected for the first time.
|
||||
*
|
||||
@ -39,7 +37,6 @@ public:
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
1
services/test/mock/aafwk/include/js_runtime.h
Normal file → Executable file
1
services/test/mock/aafwk/include/js_runtime.h
Normal file → Executable file
@ -20,7 +20,6 @@ namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
class JsRuntime {
|
||||
public:
|
||||
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
28
services/test/mock/aafwk/include/want.h
Normal file → Executable file
28
services/test/mock/aafwk/include/want.h
Normal file → Executable file
@ -16,20 +16,32 @@
|
||||
#ifndef OHOS_AAFWK_WANT_H
|
||||
#define OHOS_AAFWK_WANT_H
|
||||
#include <string>
|
||||
#include "uri.h"
|
||||
#include <unistd.h>
|
||||
#include "uri.h"
|
||||
#include "element_name.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class Want{
|
||||
class Want {
|
||||
public:
|
||||
std::string GetBundle() const {return "1";}
|
||||
int GetIntParam(const std::string &key, int defaultValue) const{return 0;}
|
||||
std::string GetAction() const{return "1";}
|
||||
void SetElement(const AppExecFwk::ElementName &element){}
|
||||
Want(){}
|
||||
~Want(){}
|
||||
std::string GetBundle() const
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
|
||||
int GetIntParam(const std::string &key, int defaultValue) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetAction() const
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
|
||||
void SetElement(const AppExecFwk::ElementName &element) {}
|
||||
Want() {}
|
||||
~Want() {}
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -13,23 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ability_manager_client.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
std::shared_ptr<AbilityManagerClient> AbilityManagerClient::instance_ = nullptr;
|
||||
std::mutex AbilityManagerClient::mutex_;
|
||||
|
||||
std::shared_ptr<AbilityManagerClient> AbilityManagerClient::GetInstance()
|
||||
{
|
||||
if (instance_ == nullptr) {
|
||||
std::lock_guard<std::mutex> lock_l(mutex_);
|
||||
if (instance_ == nullptr) {
|
||||
instance_ = std::make_shared<AbilityManagerClient>();
|
||||
}
|
||||
}
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 "ability_manager_client.h"
|
||||
#include "string_ex.h"
|
||||
#include "ability_manager_interface.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "accessible_ability_client_stub_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
std::shared_ptr<AbilityManagerClient> AbilityManagerClient::instance_ = nullptr;
|
||||
std::mutex AbilityManagerClient::mutex_;
|
||||
|
||||
std::shared_ptr<AbilityManagerClient> AbilityManagerClient::GetInstance()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK AbilityManagerClient GetInstance";
|
||||
if (instance_ == nullptr) {
|
||||
std::lock_guard<std::mutex> lock_l(mutex_);
|
||||
if (instance_ == nullptr) {
|
||||
instance_ = std::make_shared<AbilityManagerClient>();
|
||||
}
|
||||
}
|
||||
return instance_;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr<IAbilityConnection> &connect,
|
||||
const sptr<IRemoteObject> &callerToken, int32_t userId)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK AbilityManagerClient ConnectAbility";
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::DisconnectAbility(const sptr<IAbilityConnection> &connect)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "MOCK AbilityManagerClient DisconnectAbility";
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
AbilityManagerClient::AbilityManagerClient()
|
||||
{}
|
||||
|
||||
AbilityManagerClient::~AbilityManagerClient()
|
||||
{}
|
||||
|
||||
ErrCode AbilityManagerClient::AttachAbilityThread(
|
||||
const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
ErrCode AbilityManagerClient::AbilityTransitionDone(const sptr<IRemoteObject> &token, int state,
|
||||
const PacMap &saveData)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ScheduleConnectAbilityDone(
|
||||
const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void AbilityManagerClient::AddWindowInfo(const sptr<IRemoteObject> &token, int32_t windowToken)
|
||||
{}
|
||||
|
||||
ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, int32_t userId)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::StartAbility(
|
||||
const Want &want, const sptr<IRemoteObject> &callerToken, int requestCode, int32_t userId)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::TerminateAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::TerminateAbility(const sptr<IRemoteObject> &callerToken, int requestCode)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::TerminateAbilityResult(const sptr<IRemoteObject> &token, int startId)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
sptr<IAbilityScheduler> AbilityManagerClient::AcquireDataAbility(
|
||||
const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ReleaseDataAbility(
|
||||
sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::DumpState(const std::string &args, std::vector<std::string> &state)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::Connect()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetAllStackInfo(StackInfo &stackInfo)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::StopServiceAbility(const Want &want)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetRecentMissions(
|
||||
const int32_t numMax, const int32_t flags, std::vector<AbilityMissionInfo> &recentList)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshot &snapshot)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::MoveMissionToTop(int32_t missionId)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::RemoveMissions(std::vector<int> missionId)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::RemoveStack(int id)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
} //namespace AAFwk
|
||||
} // namespace OHOS
|
@ -18,6 +18,9 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
const int LEFT_TOP_Y = 200;
|
||||
const int RIGHT_BOTTOM_X = 600;
|
||||
const int RIGHT_BOTTOM_Y = 800;
|
||||
std::map<int, sptr<IAccessibleAbilityChannel>> AccessibilityOperator::channels_ = {};
|
||||
std::vector<sptr<AccessibilityOperator>> AccessibilityOperator::instances_ = {};
|
||||
std::recursive_mutex AccessibilityOperator::mutex_ = {};
|
||||
@ -81,7 +84,7 @@ bool AccessibilityOperator::GetRoot(int channelId, AccessibilityElementInfo &ele
|
||||
|
||||
std::vector<AccessibilityWindowInfo> AccessibilityOperator::GetWindows(int channelId)
|
||||
{
|
||||
return windows_;
|
||||
return windows_;
|
||||
}
|
||||
|
||||
bool AccessibilityOperator::SearchElementInfosByAccessibilityId(int channelId,
|
||||
@ -90,8 +93,8 @@ bool AccessibilityOperator::SearchElementInfosByAccessibilityId(int channelId,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibilityOperator::SearchElementInfosByText(int channelId,
|
||||
int accessibilityWindowId, int elementId, const std::string &text, std::vector<AccessibilityElementInfo> &elementInfos)
|
||||
bool AccessibilityOperator::SearchElementInfosByText(int channelId, int accessibilityWindowId,
|
||||
int elementId, const std::string &text, std::vector<AccessibilityElementInfo> &elementInfos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -100,7 +103,7 @@ bool AccessibilityOperator::FindFocusedElementInfo(int channelId, int accessibil
|
||||
int elementId, int focusType, AccessibilityElementInfo &elementInfo)
|
||||
{
|
||||
AccessibilityElementInfo focus;
|
||||
Rect rect(0,200,600,800);
|
||||
Rect rect(0, LEFT_TOP_Y, RIGHT_BOTTOM_X, RIGHT_BOTTOM_Y);
|
||||
focus.SetRectInScreen(rect);
|
||||
elementInfo = focus;
|
||||
return true;
|
||||
@ -113,7 +116,7 @@ bool AccessibilityOperator::FocusMoveSearch(int channelId, int accessibilityWind
|
||||
}
|
||||
|
||||
bool AccessibilityOperator::ExecuteAction(int channelId, int accessibilityWindowId,
|
||||
int elementId, int action, std::map<std::string, std::string> &actionArguments)
|
||||
int elementId, int action, std::map<std::string, std::string> &actionArguments)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -186,6 +189,5 @@ void AccessibilityOperator::SendSimulateGesture(const int channelId,
|
||||
const int requestId, const std::vector<GesturePathDefine> &gestureSteps)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -1,61 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 "accessible_ability_client_stub.h"
|
||||
#include "parcel.h"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
AccessibleAbilityClientStub::AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
AccessibleAbilityClientStub::~AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
int AccessibleAbilityClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleInit(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleDisconnect(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnAccessibilityEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnKeyPressEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnDisplayResized(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnGestureSimulateResult(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2021 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 "accessible_ability_client_stub.h"
|
||||
#include "parcel.h"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
AccessibleAbilityClientStub::AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
AccessibleAbilityClientStub::~AccessibleAbilityClientStub()
|
||||
{}
|
||||
|
||||
int AccessibleAbilityClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleInit(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleDisconnect(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnAccessibilityEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnKeyPressEvent(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnDisplayResized(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ErrCode AccessibleAbilityClientStub::HandleOnGestureSimulateResult(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ void AccessibleAbilityManagerService::StateCallbackDeathRecipient::OnRemoteDied(
|
||||
|
||||
void AccessibleAbilityManagerService::RemovedUser(int32_t accountId) {}
|
||||
void AccessibleAbilityManagerService::PresentUser() {}
|
||||
void AccessibleAbilityManagerService::PackageChanged() {}
|
||||
void AccessibleAbilityManagerService::PackageChanged(std::string& bundleName) {}
|
||||
void AccessibleAbilityManagerService::PackageRemoved(std::string &bundleName) {}
|
||||
void AccessibleAbilityManagerService::PackageUpdateFinished(std::string &bundleName) {}
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 "iservice_registry.h"
|
||||
#include "system_ability_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
SystemAbilityManagerClient &SystemAbilityManagerClient::GetInstance()
|
||||
{
|
||||
static auto instance = new SystemAbilityManagerClient();
|
||||
return *instance;
|
||||
}
|
||||
|
||||
sptr<ISystemAbilityManager> SystemAbilityManagerClient::GetSystemAbilityManager()
|
||||
{
|
||||
return SystemAbilityManager::GetInstance();
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> SystemAbilityManagerClient::GetRegistryRemoteObject()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SystemAbilityManagerClient::DestroySystemAbilityManagerObject()
|
||||
{}
|
||||
} // namespace OHOS
|
@ -20,6 +20,7 @@ namespace OHOS {
|
||||
int g_mTkeyCode = -1;
|
||||
std::vector<int32_t> g_mtTouchAction;
|
||||
std::function<void(std::shared_ptr<MMI::PointerEvent>)> g_pointerCallback = nullptr;
|
||||
std::shared_ptr<MMI::IInputEventConsumer> g_inputEventConsumer = nullptr;
|
||||
namespace MMI {
|
||||
int MTtouchAction = -1;
|
||||
|
||||
@ -29,6 +30,7 @@ InputManager::~InputManager()
|
||||
{
|
||||
g_mtTouchAction.clear();
|
||||
g_pointerCallback = nullptr;
|
||||
g_inputEventConsumer = nullptr;
|
||||
}
|
||||
|
||||
InputManager *InputManager::GetInstance()
|
||||
@ -52,6 +54,7 @@ void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent
|
||||
|
||||
int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptorId)
|
||||
{
|
||||
g_inputEventConsumer = interceptorId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ class PowerMgrClient final : public DelayedRefSingleton<PowerMgrClient> {
|
||||
|
||||
public:
|
||||
void RefreshActivity(UserActivityType type = UserActivityType::USER_ACTIVITY_TYPE_OTHER);
|
||||
|
||||
};
|
||||
} // namespace PowerMgr
|
||||
} // namespace OHOS
|
||||
|
@ -1,8 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 "power_mgr_client.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace PowerMgr {
|
||||
|
||||
PowerMgrClient::PowerMgrClient()
|
||||
{}
|
||||
PowerMgrClient::~PowerMgrClient()
|
||||
@ -11,6 +25,5 @@ PowerMgrClient::~PowerMgrClient()
|
||||
void PowerMgrClient::RefreshActivity(UserActivityType type)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace PowerMgr
|
||||
} // namespace OHOS
|
@ -34,6 +34,7 @@ using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
extern int g_mTkeyCode;
|
||||
extern std::shared_ptr<MMI::IInputEventConsumer> g_inputEventConsumer;
|
||||
namespace Accessibility {
|
||||
extern int g_testKeyPressEvent;
|
||||
static constexpr uint8_t TEST_NUM_2 = 2;
|
||||
@ -207,7 +208,9 @@ HWTEST_F(AamsKeyEventFilterTest, AamsKeyEventFilterTest_Moduletest_OnKeyEvent001
|
||||
EXPECT_EQ((int)connectionMaps.size(), 1);
|
||||
GTEST_LOG_(INFO) << "AddConnection result end ----------";
|
||||
|
||||
AccessibilityInputInterceptor::InterceptKeyEventCallBack(keyEvent);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(keyEvent);
|
||||
}
|
||||
|
||||
bool handled = true;
|
||||
int sequence = 1;
|
||||
@ -241,7 +244,9 @@ HWTEST_F(AamsKeyEventFilterTest, AamsKeyEventFilterTest_Moduletest_OnKeyEvent002
|
||||
EXPECT_EQ((int)connectionMaps.size(), 1);
|
||||
GTEST_LOG_(INFO) << "AddConnection result end ----------";
|
||||
|
||||
AccessibilityInputInterceptor::InterceptKeyEventCallBack(keyEvent);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(keyEvent);
|
||||
}
|
||||
|
||||
bool handled = false;
|
||||
int sequence = TEST_NUM_2;
|
||||
@ -277,7 +282,9 @@ HWTEST_F(AamsKeyEventFilterTest, AamsKeyEventFilterTest_Moduletest_OnKeyEvent003
|
||||
EXPECT_EQ((int)connectionMaps.size(), 1);
|
||||
GTEST_LOG_(INFO) << "AddConnection result end ----------";
|
||||
|
||||
AccessibilityInputInterceptor::InterceptKeyEventCallBack(keyEvent);
|
||||
if (g_inputEventConsumer != nullptr) {
|
||||
g_inputEventConsumer->OnInputEvent(keyEvent);
|
||||
}
|
||||
sleep(1);
|
||||
WaitUntilTaskFinished();
|
||||
|
||||
|
@ -37,7 +37,7 @@ using namespace Json;
|
||||
|
||||
namespace OHOS {
|
||||
extern std::vector<int32_t> g_mtTouchAction;
|
||||
extern std::function<void(std::shared_ptr<MMI::PointerEvent>)> g_pointerCallback;
|
||||
extern std::shared_ptr<MMI::IInputEventConsumer> g_inputEventConsumer;
|
||||
namespace Accessibility {
|
||||
extern std::vector<EventType> g_mTeventType;
|
||||
extern int g_mTgestureId;
|
||||
@ -57,7 +57,7 @@ public:
|
||||
protected:
|
||||
std::shared_ptr<MMI::PointerEvent> CreateMoveEvent(int pointerCount, int pointId);
|
||||
std::shared_ptr<MMI::PointerEvent> CreateTouchEvent(int action, int pointId);
|
||||
std::shared_ptr<MMI::PointerEvent> CreateTouchEvent(int action, std::vector<MMI::PointerEvent::PointerItem> point, int pointerCount,
|
||||
std::shared_ptr<MMI::PointerEvent> CreateTouchEvent(int action, std::vector<MMI::PointerEvent::PointerItem> point,
|
||||
unsigned int occurredTime, unsigned int startTime, int pointId);
|
||||
|
||||
sptr<AccessibleAbilityClientStubImpl> stub_ = nullptr;
|
||||
@ -195,7 +195,8 @@ std::shared_ptr<MMI::PointerEvent> AamsTouchGuideTest::CreateMoveEvent(int point
|
||||
return touchEvent;
|
||||
}
|
||||
|
||||
std::shared_ptr<MMI::PointerEvent> AamsTouchGuideTest::CreateTouchEvent(int action, std::vector<MMI::PointerEvent::PointerItem> points, int pointerCount,
|
||||
std::shared_ptr<MMI::PointerEvent> AamsTouchGuideTest::CreateTouchEvent(int action,
|
||||
std::vector<MMI::PointerEvent::PointerItem> points,
|
||||
unsigned int occurredTime, unsigned int startTime, int pointId)
|
||||
{
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
|
||||
@ -255,35 +256,36 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent001, Test
|
||||
point4.SetPointerId(2);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent001 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent001 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 2, 0, 0, 2);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0, 0, 2);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0, 2);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 2);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 2);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 2);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -309,17 +311,17 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent002, Test
|
||||
g_mTeventType = {};
|
||||
g_mtTouchAction = {};
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent002 g_pointerCallback is null";
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent002 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
sleep(1);
|
||||
event = CreateMoveEvent(1, 1);
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, 1);
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -363,30 +365,31 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent004, Test
|
||||
point4.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent004 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent004 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -431,30 +434,31 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent005, Test
|
||||
point4.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent005 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent005 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -499,30 +503,31 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent006, Test
|
||||
point4.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent006 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent006 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -567,30 +572,31 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent007, Test
|
||||
point4.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent007 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent007 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point4);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -631,25 +637,26 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent008, Test
|
||||
point3.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent008 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent008 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point2);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
points.clear();
|
||||
points.emplace_back(point3);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -675,14 +682,14 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent009, Test
|
||||
g_mTeventType = {};
|
||||
g_mtTouchAction = {};
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent009 g_pointerCallback is null";
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent009 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, 1);
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
sleep(3);
|
||||
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -714,22 +721,23 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent010, Test
|
||||
point1.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent010 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent010 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 40, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 40, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 200, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 200, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
sleep(1);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
sleep(3);
|
||||
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
@ -758,21 +766,22 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnTouchEvent011, Test
|
||||
point1.SetPointerId(1);
|
||||
|
||||
points.emplace_back(point1);
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0, 1);
|
||||
if (g_pointerCallback == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent011 g_pointerCallback is null";
|
||||
std::shared_ptr<MMI::PointerEvent> event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN,
|
||||
points, 0, 0, 1);
|
||||
if (g_inputEventConsumer == nullptr) {
|
||||
GTEST_LOG_(INFO) << "AamsTouchGuideTest OnTouchEvent011 g_inputEventConsumer is null";
|
||||
return;
|
||||
}
|
||||
g_pointerCallback(event);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 100, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 100, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0, 1);
|
||||
g_pointerCallback(event);
|
||||
event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1);
|
||||
g_inputEventConsumer->OnInputEvent(event);
|
||||
|
||||
sleep(3);
|
||||
EXPECT_EQ(g_mTeventType[0], EventType::TYPE_TOUCH_BEGIN);
|
||||
|
@ -140,7 +140,8 @@ HWTEST_F(AccessibilityCommonEventRegistryTest, AccessibilityCommonEventRegistry_
|
||||
AddAccessibleAbilityConnection();
|
||||
EXPECT_EQ(1, int(accountData_->GetInstalledAbilities().size()));
|
||||
/* PackageChanged */
|
||||
aams_->PackageChanged();
|
||||
std::string bundleName = "bundleName";
|
||||
aams_->PackageChanged(bundleName);
|
||||
EXPECT_EQ(0, int(accountData_->GetInstalledAbilities().size()));
|
||||
|
||||
AAConnection_->OnAbilityDisconnectDone(*elementName_, 0);
|
||||
|
@ -24,6 +24,7 @@ using namespace std;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
const int NUM_4 = 4;
|
||||
bool JsonUtils::GetJsonObjFromJson(nlohmann::json &jsonObj, const std::string &jsonPath)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -210,7 +211,7 @@ bool JsonUtils::RemoveVecValue(nlohmann::json& json, const std::string& key, con
|
||||
HILOG_DEBUG("Find Size = %{public}d\n", json[key].size());
|
||||
std::string val = std::string(json[key][i]["BundleName"]);
|
||||
HILOG_DEBUG("Find key[%{public}s] successful.", val.c_str());
|
||||
if(strcmp(value.c_str(), val.c_str()) == 0){
|
||||
if (strcmp(value.c_str(), val.c_str()) == 0) {
|
||||
json[key].erase(i);
|
||||
HILOG_DEBUG("erase successful");
|
||||
}
|
||||
@ -342,7 +343,7 @@ bool JsonUtils::ToJson(const nlohmann::json& jsonObj, const std::string& jsonPat
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
std::ofstream ofs(jsonPath);
|
||||
ofs << jsonObj.dump(4) << std::endl;
|
||||
ofs << jsonObj.dump(NUM_4) << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -395,7 +396,6 @@ string JsonUtils::GetStrValue(nlohmann::json& json, const std::string& key)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
vector<std::string> JsonUtils::GetVecValue(nlohmann::json& json, const std::string& key)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s start.", __func__);
|
||||
@ -415,6 +415,5 @@ vector<std::string> JsonUtils::GetVecValue(nlohmann::json& json, const std::stri
|
||||
}
|
||||
return vecvalue;
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user