mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
视检问题修正
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
3d9dfab539
commit
4279fada9b
1
OAT.xml
1
OAT.xml
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2022 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
|
||||
|
@ -81,6 +81,17 @@ public:
|
||||
virtual void OnGestureSimulateResult(const int sequence, const bool completedSuccessfully) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Send the command data from proxy to stub in IPC mechanism.
|
||||
* @param code The code matched the function called.
|
||||
* @param data Serializable data
|
||||
* @param reply The response of IPC
|
||||
* @param option The option parameter of IPC,such as: async,sync
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool SendTransactCmd(IAccessibleAbilityClient::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
|
||||
static inline BrokerDelegator<AccessibleAbilityClientProxy> delegator;
|
||||
|
@ -29,7 +29,7 @@ bool AccessibilityExtensionContext::GetFocusElementInfo(
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
if ((focusType != FOCUS_TYPE_INPUT) && (focusType != FOCUS_TYPE_ACCESSIBILITY)) {
|
||||
HILOG_DEBUG("focusType is not allowed.");
|
||||
HILOG_ERROR("focusType is not allowed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,26 @@ bool AccessibleAbilityClientProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityClientProxy::SendTransactCmd(IAccessibleAbilityClient::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd %{public}d due to remote object", code);
|
||||
return false;
|
||||
}
|
||||
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
if (result != NO_ERROR) {
|
||||
HILOG_ERROR("receive error transact code %{public}d in transact cmd %{public}d", result, code);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::Init(const sptr<IAccessibleAbilityChannel> &channel, const int channelId)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -60,15 +77,14 @@ void AccessibleAbilityClientProxy::Init(const sptr<IAccessibleAbilityChannel> &c
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::INIT), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Init fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::INIT, data, reply, option)) {
|
||||
HILOG_ERROR("Init fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::Disconnect(const int channelId)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -84,16 +100,14 @@ void AccessibleAbilityClientProxy::Disconnect(const int channelId)
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::DISCONNECT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Disconnect fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::DISCONNECT, data, reply, option)) {
|
||||
HILOG_ERROR("Disconnect fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -107,16 +121,14 @@ void AccessibleAbilityClientProxy::OnAccessibilityEvent(const AccessibilityEvent
|
||||
HILOG_ERROR("fail, eventInfo write parcelable error");
|
||||
return;
|
||||
}
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::ON_ACCESSIBILITY_EVENT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("OnAccessibilityEvent fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::ON_ACCESSIBILITY_EVENT, data, reply, option)) {
|
||||
HILOG_ERROR("OnAccessibilityEvent fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int sequence)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -136,17 +148,15 @@ void AccessibleAbilityClientProxy::OnKeyPressEvent(const MMI::KeyEvent &keyEvent
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::ON_KEY_PRESS_EVENT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("OnKeyPressEvent fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::ON_KEY_PRESS_EVENT, data, reply, option)) {
|
||||
HILOG_ERROR("OnKeyPressEvent fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::OnDisplayResized(const int displayId, const Rect &rect, const float scale,
|
||||
const float centerX, const float centerY)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -177,16 +187,14 @@ void AccessibleAbilityClientProxy::OnDisplayResized(const int displayId, const R
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::ON_DISPALYRESIZE_CHANGED),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("OnDisplayResized fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::ON_DISPALYRESIZE_CHANGED, data, reply, option)) {
|
||||
HILOG_ERROR("OnDisplayResized fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityClientProxy::OnGestureSimulateResult(const int sequence, const bool completedSuccessfully)
|
||||
{
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -204,10 +212,10 @@ void AccessibleAbilityClientProxy::OnGestureSimulateResult(const int sequence, c
|
||||
HILOG_ERROR("fail, completedSuccessfully write bool error");
|
||||
return;
|
||||
}
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(IAccessibleAbilityClient::Message::ON_GESTURE_SIMULATE_RESULT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("OnGestureSimulateResult fail, error: %d", error);
|
||||
|
||||
if (!SendTransactCmd(IAccessibleAbilityClient::Message::ON_GESTURE_SIMULATE_RESULT, data, reply, option)) {
|
||||
HILOG_ERROR("OnGestureSimulateResult fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // namespace Accessibility
|
||||
|
@ -48,7 +48,7 @@ int AccessibleAbilityClientStub::OnRemoteRequest(uint32_t code,
|
||||
std::u16string descriptor = AccessibleAbilityClientStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
HILOG_INFO("local descriptor is not equal to remote");
|
||||
HILOG_ERROR("local descriptor is not equal to remote");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
|
@ -102,10 +102,10 @@ void AccessibleAbilityClientStubImpl::Init(const sptr<IAccessibleAbilityChannel>
|
||||
deathRecipient_ = new AccessibleAbilityDeathRecipient(channelId_, channel_);
|
||||
}
|
||||
|
||||
auto object = channel_->AsObject();
|
||||
if (object) {
|
||||
auto uiTestObject = channel_->AsObject();
|
||||
if (uiTestObject) {
|
||||
HILOG_DEBUG("Add death recipient");
|
||||
object->AddDeathRecipient(deathRecipient_);
|
||||
uiTestObject->AddDeathRecipient(deathRecipient_);
|
||||
}
|
||||
|
||||
uiTestListener_->OnAbilityConnected();
|
||||
@ -134,8 +134,10 @@ void AccessibleAbilityClientStubImpl::Disconnect(const int channelId)
|
||||
}
|
||||
} else {
|
||||
AccessibilityUITestAbility::GetInstance()->SetChannelId(channelId_);
|
||||
uiTestListener_->OnAbilityDisconnected();
|
||||
uiTestListener_ = nullptr;
|
||||
if (uiTestListener_) {
|
||||
uiTestListener_->OnAbilityDisconnected();
|
||||
uiTestListener_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,8 +165,8 @@ void AccessibleAbilityClientStubImpl::OnKeyPressEvent(const MMI::KeyEvent &keyEv
|
||||
|
||||
if (uiTestListener_) {
|
||||
std::shared_ptr<MMI::KeyEvent> tmp = std::make_shared<MMI::KeyEvent>(keyEvent);
|
||||
bool handled = uiTestListener_->OnKeyPressEvent(tmp, sequence);
|
||||
AccessibilityOperator::GetInstance().SetOnKeyPressEventResult(channelId_, handled, sequence);
|
||||
bool uiTestHandled = uiTestListener_->OnKeyPressEvent(tmp, sequence);
|
||||
AccessibilityOperator::GetInstance().SetOnKeyPressEventResult(channelId_, uiTestHandled, sequence);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ void AccessibleAbilityClientStubImpl::AccessibleAbilityDeathRecipient::OnRemoteD
|
||||
return;
|
||||
}
|
||||
|
||||
if (!recipientchannel_ && (recipientchannel_->AsObject() != remote)) {
|
||||
if (!recipientchannel_ || (recipientchannel_->AsObject() != remote)) {
|
||||
HILOG_ERROR("recipientchannel_ is nullptr or remote is wrong.");
|
||||
return;
|
||||
}
|
||||
|
@ -109,7 +109,9 @@ void DisplayResizeController::DispatchOnDisplayResized(const Rect& rect,
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
for (auto listener : displayResizeListeners_) {
|
||||
listener->OnDisplayResized(*this, rect, scale, centerX, centerY);
|
||||
if (listener) {
|
||||
listener->OnDisplayResized(*this, rect, scale, centerX, centerY);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Accessibility
|
||||
|
@ -41,8 +41,7 @@ JsAccessibilityExtension::~JsAccessibilityExtension() = default;
|
||||
|
||||
void JsAccessibilityExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record,
|
||||
const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
|
||||
std::shared_ptr<AppExecFwk::AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
std::shared_ptr<AppExecFwk::AbilityHandler> &handler, const sptr<IRemoteObject> &token)
|
||||
{
|
||||
HILOG_INFO("JsAccessibilityExtension::Init begin.");
|
||||
AccessibilityExtension::Init(record, application, handler, token);
|
||||
@ -53,10 +52,13 @@ void JsAccessibilityExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLoc
|
||||
return;
|
||||
}
|
||||
|
||||
if (!abilityInfo_) {
|
||||
HILOG_ERROR("abilityInfo_ is nullptr.");
|
||||
return;
|
||||
}
|
||||
std::string moduleName(Extension::abilityInfo_->moduleName);
|
||||
moduleName.append("::").append(abilityInfo_->name);
|
||||
HILOG_INFO("JsAccessibilityExtension::Init moduleName:%{public}s, srcPath:%{public}s.",
|
||||
moduleName.c_str(), srcPath.c_str());
|
||||
HILOG_INFO("moduleName:%{public}s, srcPath:%{public}s.", moduleName.c_str(), srcPath.c_str());
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto& engine = jsRuntime_.GetNativeEngine();
|
||||
|
||||
@ -65,7 +67,6 @@ void JsAccessibilityExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLoc
|
||||
HILOG_ERROR("Failed to get jsObj_");
|
||||
return;
|
||||
}
|
||||
HILOG_INFO("JsAccessibilityExtension::Init ConvertNativeValueTo.");
|
||||
NativeObject* obj = ConvertNativeValueTo<NativeObject>(jsObj_->Get());
|
||||
if (!obj) {
|
||||
HILOG_ERROR("Failed to get JsAccessibilityExtension object");
|
||||
@ -77,13 +78,14 @@ void JsAccessibilityExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLoc
|
||||
HILOG_ERROR("Failed to get context");
|
||||
return;
|
||||
}
|
||||
HILOG_INFO("JsAccessibilityExtension::Init CreateJsAccessibilityExtensionContext.");
|
||||
NativeValue* contextObj = CreateJsAccessibilityExtensionContext(engine, context);
|
||||
auto shellContextRef = jsRuntime_.LoadSystemModule("application.AccessibilityExtensionContext", &contextObj, 1);
|
||||
if (!shellContextRef) {
|
||||
HILOG_ERROR("shellContextRef is nullptr.");
|
||||
return;
|
||||
}
|
||||
contextObj = shellContextRef->Get();
|
||||
HILOG_INFO("JsAccessibilityExtension::Init Bind.");
|
||||
context->Bind(jsRuntime_, shellContextRef.release());
|
||||
HILOG_INFO("JsAccessibilityExtension::SetProperty.");
|
||||
obj->SetProperty("context", contextObj);
|
||||
|
||||
auto nativeObj = ConvertNativeValueTo<NativeObject>(contextObj);
|
||||
@ -91,16 +93,10 @@ void JsAccessibilityExtension::Init(const std::shared_ptr<AppExecFwk::AbilityLoc
|
||||
HILOG_ERROR("Failed to get accessibility extension native object");
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set accessibility extension context pointer: %{public}p", context.get());
|
||||
|
||||
nativeObj->SetNativePointer(new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
[](NativeEngine*, void* data, void*) {
|
||||
HILOG_INFO("Finalizer for weak_ptr accessibility extension context is called");
|
||||
delete static_cast<std::weak_ptr<AbilityRuntime::Context>*>(data);
|
||||
}, nullptr);
|
||||
|
||||
HILOG_INFO("JsAccessibilityExtension::Init end.");
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> JsAccessibilityExtension::OnConnect(const AAFwk::Want &want)
|
||||
@ -182,7 +178,7 @@ NativeValue* JsAccessibilityExtension::CallObjectMethod(const char* name, Native
|
||||
{
|
||||
HILOG_INFO("JsAccessibilityExtension::CallObjectMethod(%{public}s), begin", name);
|
||||
if (!jsObj_) {
|
||||
HILOG_WARN("jsObj_ is nullptr");
|
||||
HILOG_ERROR("jsObj_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -207,6 +203,10 @@ NativeValue* JsAccessibilityExtension::CallObjectMethod(const char* name, Native
|
||||
|
||||
void JsAccessibilityExtension::GetSrcPath(std::string &srcPath)
|
||||
{
|
||||
if (!Extension::abilityInfo_) {
|
||||
HILOG_ERROR("abilityInfo_ is nullptr");
|
||||
return;
|
||||
}
|
||||
if (!Extension::abilityInfo_->isModuleJson) {
|
||||
/* temporary compatibility api8 + config.json */
|
||||
srcPath.append(Extension::abilityInfo_->package);
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
HILOG_INFO("GetFocusElementInfo begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
HILOG_WARN("context is released");
|
||||
HILOG_ERROR("context is released");
|
||||
task.Reject(engine, CreateJsError(engine, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@ -121,8 +121,8 @@ private:
|
||||
NativeValue* nativeElementInfo = reinterpret_cast<NativeValue*>(napiElementInfo);
|
||||
task.Resolve(engine, nativeElementInfo);
|
||||
} else {
|
||||
HILOG_ERROR("Get focus elementInfo failed.\
|
||||
ret: %{public}d, elementInfo.has_value(): %{public}d", ret, elementInfo.has_value());
|
||||
HILOG_ERROR("Get focus elementInfo failed. ret: %{public}d, elementInfo.has_value(): %{public}d",
|
||||
ret, elementInfo.has_value());
|
||||
task.Reject(engine, CreateJsError(engine, false, "Get focus elementInfo failed."));
|
||||
}
|
||||
};
|
||||
@ -148,7 +148,7 @@ private:
|
||||
HILOG_INFO("GetRootElementInfo begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
HILOG_WARN("context is released");
|
||||
HILOG_ERROR("context is released");
|
||||
task.Reject(engine, CreateJsError(engine, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@ -193,7 +193,7 @@ private:
|
||||
HILOG_INFO("GetWindows begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
HILOG_WARN("context is released");
|
||||
HILOG_ERROR("context is released");
|
||||
task.Reject(engine, CreateJsError(engine, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@ -247,7 +247,7 @@ private:
|
||||
HILOG_INFO("ExecuteCommonAction begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
HILOG_WARN("context is released");
|
||||
HILOG_ERROR("context is released");
|
||||
task.Reject(engine, CreateJsError(engine, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@ -304,7 +304,7 @@ private:
|
||||
HILOG_INFO("GestureSimulate begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
HILOG_WARN("context is released");
|
||||
HILOG_ERROR("context is released");
|
||||
task.Reject(engine, CreateJsError(engine, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@ -336,6 +336,10 @@ NativeValue* CreateJsAccessibilityExtensionContext(
|
||||
|
||||
std::unique_ptr<JsAccessibilityExtensionContext> jsContext =
|
||||
std::make_unique<JsAccessibilityExtensionContext>(context);
|
||||
if (!object) {
|
||||
HILOG_ERROR("object is nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
object->SetNativePointer(jsContext.release(), JsAccessibilityExtensionContext::Finalizer, nullptr);
|
||||
|
||||
BindNativeFunction(engine, *object, "getFocusElementInfo", JsAccessibilityExtensionContext::GetFocusElementInfo);
|
||||
|
@ -74,7 +74,9 @@ bool AccessibilityWindowInfo::GetRootAccessibilityInfo(AccessibilityElementInfo
|
||||
}
|
||||
|
||||
void AccessibilityWindowInfo::SetAnchorId(const int anchorId)
|
||||
{}
|
||||
{
|
||||
(void)anchorId;
|
||||
}
|
||||
|
||||
bool AccessibilityWindowInfo::GetAnchor(AccessibilityElementInfo &elementInfo)
|
||||
{
|
||||
|
@ -36,6 +36,11 @@ public:
|
||||
const long elementId, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback,
|
||||
const int mode)
|
||||
{
|
||||
(void)accessibilityWindowId;
|
||||
(void)elementId;
|
||||
(void)requestId;
|
||||
(void)callback;
|
||||
(void)mode;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock SearchElementInfoByAccessibilityId";
|
||||
return true;
|
||||
}
|
||||
@ -43,6 +48,11 @@ public:
|
||||
virtual bool SearchElementInfosByText(const int accessibilityWindowId, const long elementId,
|
||||
const std::string &text, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
(void)accessibilityWindowId;
|
||||
(void)elementId;
|
||||
(void)text;
|
||||
(void)requestId;
|
||||
(void)callback;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock SearchElementInfosByText";
|
||||
return true;
|
||||
}
|
||||
@ -50,6 +60,11 @@ public:
|
||||
virtual bool FindFocusedElementInfo(const int accessibilityWindowId, const long elementId,
|
||||
const int focusType, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
(void)accessibilityWindowId;
|
||||
(void)elementId;
|
||||
(void)focusType;
|
||||
(void)requestId;
|
||||
(void)callback;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock FindFocusedElementInfo";
|
||||
return true;
|
||||
}
|
||||
@ -57,6 +72,11 @@ public:
|
||||
virtual bool FocusMoveSearch(const int accessibilityWindowId, const long elementId,
|
||||
const int direction, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
(void)accessibilityWindowId;
|
||||
(void)elementId;
|
||||
(void)direction;
|
||||
(void)requestId;
|
||||
(void)callback;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock FocusMoveSearch";
|
||||
return true;
|
||||
}
|
||||
@ -65,6 +85,12 @@ public:
|
||||
std::map<std::string, std::string> &actionArguments, const int requestId,
|
||||
const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
(void)accessibilityWindowId;
|
||||
(void)elementId;
|
||||
(void)action;
|
||||
(void)actionArguments;
|
||||
(void)requestId;
|
||||
(void)callback;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock ExecuteAction";
|
||||
return true;
|
||||
}
|
||||
@ -78,35 +104,42 @@ public:
|
||||
|
||||
virtual bool ExecuteCommonAction(const int action)
|
||||
{
|
||||
(void)action;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock ExecuteCommonAction";
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void SetOnKeyPressEventResult(const bool handled, const int sequence)
|
||||
{
|
||||
(void)handled;
|
||||
(void)sequence;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock SetOnKeyPressEventResult";
|
||||
}
|
||||
|
||||
virtual float GetDisplayResizeScale(const int displayId)
|
||||
{
|
||||
(void)displayId;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock GetDisplayResizeScale";
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual float GetDisplayResizeCenterX(const int displayId)
|
||||
{
|
||||
(void)displayId;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock GetDisplayResizeCenterX";
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual float GetDisplayResizeCenterY(const int displayId)
|
||||
{
|
||||
(void)displayId;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock GetDisplayResizeCenterY";
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual Rect GetDisplayResizeRect(const int displayId)
|
||||
{
|
||||
(void)displayId;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock GetDisplayResizeRect";
|
||||
Rect rect {};
|
||||
return rect;
|
||||
@ -114,6 +147,8 @@ public:
|
||||
|
||||
virtual bool ResetDisplayResize(const int displayId, const bool animate)
|
||||
{
|
||||
(void)displayId;
|
||||
(void)animate;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock ResetDisplayResize";
|
||||
return true;
|
||||
}
|
||||
@ -121,12 +156,19 @@ public:
|
||||
virtual bool SetDisplayResizeScaleAndCenter(const int displayId, const float scale, const float centerX,
|
||||
const float centerY, const bool animate)
|
||||
{
|
||||
(void)displayId;
|
||||
(void)scale;
|
||||
(void)centerX;
|
||||
(void)centerY;
|
||||
(void)animate;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock SetDisplayResizeScaleAndCenter";
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void SendSimulateGesture(const int requestId, const std::vector<GesturePathDefine> &gestureSteps)
|
||||
{
|
||||
(void)requestId;
|
||||
(void)gestureSteps;
|
||||
GTEST_LOG_(INFO) << "MOCK AccessibleAbilityChannelStubMock SendSimulateGesture";
|
||||
}
|
||||
};
|
||||
|
@ -94,6 +94,17 @@ private:
|
||||
*/
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
|
||||
/**
|
||||
* @brief Send the command data from proxy to stub in IPC mechanism.
|
||||
* @param code The code matched the function called.
|
||||
* @param data Serializable data
|
||||
* @param reply The response of IPC
|
||||
* @param option The option parameter of IPC,such as: async,sync
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool SendTransactCmd(IAccessibilityElementOperatorCallback::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
|
||||
/**
|
||||
* @brief Write the serializable data
|
||||
* @param parcelableVector The communication data of IPC
|
||||
|
@ -145,6 +145,17 @@ private:
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
|
||||
/**
|
||||
* @brief Send the command data from proxy to stub in IPC mechanism.
|
||||
* @param code The code matched the function called.
|
||||
* @param data Serializable data
|
||||
* @param reply The response of IPC
|
||||
* @param option The option parameter of IPC,such as: async,sync
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool SendTransactCmd(IAccessibilityElementOperator::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
static inline BrokerDelegator<AccessibilityElementOperatorProxy> delegator;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
|
@ -132,6 +132,17 @@ private:
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool WriteInterfaceToken(MessageParcel& data);
|
||||
|
||||
/**
|
||||
* @brief Send the command data from proxy to stub in IPC mechanism.
|
||||
* @param code The code matched the function called.
|
||||
* @param data Serializable data
|
||||
* @param reply The response of IPC
|
||||
* @param option The option parameter of IPC,such as: async,sync
|
||||
* @return true: Write the descriptor successfully; otherwise is not.
|
||||
*/
|
||||
bool SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
static inline BrokerDelegator<AccessibleAbilityManagerServiceClientProxy> delegator;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
|
@ -216,8 +216,8 @@ void AccessibilityElementInfo::SetComponentId(const int componentId)
|
||||
|
||||
bool AccessibilityElementInfo::GetFocus(const int focus, AccessibilityElementInfo &elementInfo)
|
||||
{
|
||||
HILOG_INFO("channelId_[%{public}d], windowId_[%{public}d],\
|
||||
elementId_[%{public}d], focus[%{public}d]", channelId_, windowId_, elementId_, focus);
|
||||
HILOG_INFO("channelId_[%{public}d], windowId_[%{public}d], elementId_[%{public}d], focus[%{public}d]",
|
||||
channelId_, windowId_, elementId_, focus);
|
||||
AccessibilityOperator *instance = &AccessibilityOperator::GetInstance();
|
||||
bool result = false;
|
||||
if (instance != nullptr) {
|
||||
@ -230,8 +230,8 @@ bool AccessibilityElementInfo::GetFocus(const int focus, AccessibilityElementInf
|
||||
|
||||
bool AccessibilityElementInfo::GetNext(const FocusMoveDirection direction, AccessibilityElementInfo &elementInfo)
|
||||
{
|
||||
HILOG_INFO("channelId_[%{public}d], windowId_[%{public}d],\
|
||||
elementId_[%{public}d], direction[%{public}d]", channelId_, windowId_, elementId_, direction);
|
||||
HILOG_INFO("channelId_[%{public}d], windowId_[%{public}d], elementId_[%{public}d], direction[%{public}d]",
|
||||
channelId_, windowId_, elementId_, direction);
|
||||
AccessibilityOperator *instance = &AccessibilityOperator::GetInstance();
|
||||
bool result = false;
|
||||
if (instance != nullptr) {
|
||||
@ -383,7 +383,7 @@ bool AccessibilityElementInfo::ExecuteAction(const ActionType &action,
|
||||
return instance->ExecuteAction(channelId_, windowId_, elementId_, action,
|
||||
const_cast<std::map<std::string, std::string> &>(actionArguments));
|
||||
} else {
|
||||
HILOG_INFO("Can't get AccessibilityOperator instance");
|
||||
HILOG_ERROR("Can't get AccessibilityOperator instance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -391,8 +391,8 @@ bool AccessibilityElementInfo::ExecuteAction(const ActionType &action,
|
||||
bool AccessibilityElementInfo::GetByContent(const std::string &text,
|
||||
std::vector<AccessibilityElementInfo> &elementInfos)
|
||||
{
|
||||
HILOG_INFO("called channelId_[%{public}d], windowId_[%{public}d],\
|
||||
elementId_[%{public}d], text[%{public}s]", channelId_, windowId_, elementId_, text.c_str());
|
||||
HILOG_INFO("called channelId_[%{public}d], windowId_[%{public}d], elementId_[%{public}d], text[%{public}s]",
|
||||
channelId_, windowId_, elementId_, text.c_str());
|
||||
AccessibilityOperator *instance = &AccessibilityOperator::GetInstance();
|
||||
bool result = false;
|
||||
if (instance != nullptr) {
|
||||
@ -447,7 +447,7 @@ bool AccessibilityElementInfo::GetParent(AccessibilityElementInfo &elementInfo)
|
||||
elementInfo = elementInfos.front();
|
||||
}
|
||||
} else {
|
||||
HILOG_INFO("Can't get AccessibilityOperator instance");
|
||||
HILOG_ERROR("Can't get AccessibilityOperator instance");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ bool AccessibilityElementAsyncOperatorMng::SearchElementResultTimer(const int se
|
||||
}
|
||||
gettimeofday(&getTime, NULL);
|
||||
uint64_t endTime = (uint64_t)(getTime.tv_sec * SECOND_TO_MILLIS + getTime.tv_usec);
|
||||
if (endTime < startTime) {
|
||||
HILOG_ERROR("timer is wrong.");
|
||||
return false;
|
||||
}
|
||||
uint64_t waitTime = (uint64_t)(endTime - startTime);
|
||||
if (TIMEOUT_OPERATOR_MILLIS < waitTime) {
|
||||
completed_ = true;
|
||||
|
@ -37,12 +37,28 @@ bool AccessibilityElementOperatorCallbackProxy::WriteInterfaceToken(MessageParce
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibilityElementOperatorCallbackProxy::SendTransactCmd(IAccessibilityElementOperatorCallback::Message code,
|
||||
MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd %{public}d due to remote object", code);
|
||||
return false;
|
||||
}
|
||||
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
if (result != NO_ERROR) {
|
||||
HILOG_ERROR("receive error transact code %{public}d in transact cmd %{public}d", result, code);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibilityElementOperatorCallbackProxy::SetSearchElementInfoByAccessibilityIdResult(
|
||||
const std::vector<AccessibilityElementInfo> &infos, const int requestId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -62,11 +78,10 @@ void AccessibilityElementOperatorCallbackProxy::SetSearchElementInfoByAccessibil
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibilityElementOperatorCallback::Message::SET_RESULT_BY_ACCESSIBILITY_ID),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SearchAccessibilityInfoByAccessibility fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibilityElementOperatorCallback::Message::SET_RESULT_BY_ACCESSIBILITY_ID,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetSearchElementInfoByAccessibilityIdResult failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,8 +89,6 @@ void AccessibilityElementOperatorCallbackProxy::SetSearchElementInfoByTextResult
|
||||
const std::vector<AccessibilityElementInfo> &infos, const int requestId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -95,11 +108,10 @@ void AccessibilityElementOperatorCallbackProxy::SetSearchElementInfoByTextResult
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibilityElementOperatorCallback::Message::SET_RESULT_BY_TEXT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SearchAccessibilityInfoByAccessibility fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibilityElementOperatorCallback::Message::SET_RESULT_BY_TEXT,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetSearchElementInfoByTextResult failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,8 +119,6 @@ void AccessibilityElementOperatorCallbackProxy::SetFindFocusedElementInfoResult(
|
||||
const AccessibilityElementInfo &info, const int requestId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -127,11 +137,10 @@ void AccessibilityElementOperatorCallbackProxy::SetFindFocusedElementInfoResult(
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibilityElementOperatorCallback::Message::SET_RESULT_FOCUSED_INFO),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetFindFocusedElementInfo fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibilityElementOperatorCallback::Message::SET_RESULT_FOCUSED_INFO,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetFindFocusedElementInfoResult failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,8 +148,6 @@ void AccessibilityElementOperatorCallbackProxy::SetFocusMoveSearchResult(const A
|
||||
const int requestId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -160,19 +167,16 @@ void AccessibilityElementOperatorCallbackProxy::SetFocusMoveSearchResult(const A
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibilityElementOperatorCallback::Message::SET_RESULT_FOCUS_MOVE),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetFocusMoveSearchResult fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibilityElementOperatorCallback::Message::SET_RESULT_FOCUS_MOVE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetFocusMoveSearchResult failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityElementOperatorCallbackProxy::SetExecuteActionResult(const bool succeeded, const int requestId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -192,11 +196,10 @@ void AccessibilityElementOperatorCallbackProxy::SetExecuteActionResult(const boo
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibilityElementOperatorCallback::Message::SET_RESULT_PERFORM_ACTION),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetExecuteActionResult fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibilityElementOperatorCallback::Message::SET_RESULT_PERFORM_ACTION,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetExecuteActionResult failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ AccessibilityElementOperatorCallbackStub::~AccessibilityElementOperatorCallbackS
|
||||
int AccessibilityElementOperatorCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("AccessibilityElementOperatorCallbackStub::OnRemoteRequest, cmd = %d, flags= %d",
|
||||
HILOG_DEBUG("AccessibilityElementOperatorCallbackStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d",
|
||||
code, option.GetFlags());
|
||||
std::u16string descriptor = AccessibilityElementOperatorCallbackStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
HILOG_INFO("local descriptor is not equal to remote");
|
||||
HILOG_ERROR("local descriptor is not equal to remote");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,27 @@ bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibilityElementOperatorProxy::SendTransactCmd(IAccessibilityElementOperator::Message code,
|
||||
MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd %{public}d due to remote object", code);
|
||||
return false;
|
||||
}
|
||||
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
if (result != NO_ERROR) {
|
||||
HILOG_ERROR("receive error transact code %{public}d in transact cmd %{public}d", result, code);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const long elementId,
|
||||
const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int mode)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -63,6 +78,10 @@ void AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("fail, connection write parcelable callback error");
|
||||
return;
|
||||
@ -73,11 +92,9 @@ void AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::SEARCH_BY_ACCESSIBILITY_ID),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SearchAccessibilityInfo fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::SEARCH_BY_ACCESSIBILITY_ID,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SearchElementInfoByAccessibilityId failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -87,8 +104,6 @@ void AccessibilityElementOperatorProxy::SearchElementInfosByText(const long elem
|
||||
const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -112,16 +127,17 @@ void AccessibilityElementOperatorProxy::SearchElementInfosByText(const long elem
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("fail, connection write callback error");
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::SEARCH_BY_TEXT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SearchElementInfosByText fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::SEARCH_BY_TEXT, data, reply, option)) {
|
||||
HILOG_ERROR("SearchElementInfosByText failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -130,8 +146,6 @@ void AccessibilityElementOperatorProxy::FindFocusedElementInfo(const long elemen
|
||||
const int focusType, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -156,16 +170,17 @@ void AccessibilityElementOperatorProxy::FindFocusedElementInfo(const long elemen
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("fail, connection write callback error");
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::FIND_FOCUSED_INFO),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("FindFocusedElementInfo fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::FIND_FOCUSED_INFO, data, reply, option)) {
|
||||
HILOG_ERROR("FindFocusedElementInfo failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -174,8 +189,6 @@ void AccessibilityElementOperatorProxy::FocusMoveSearch(const long elementId,
|
||||
const int direction, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -200,15 +213,17 @@ void AccessibilityElementOperatorProxy::FocusMoveSearch(const long elementId,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("fail, connection write callback error");
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::FOCUS_FIND),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("FindFocusedElementInfo fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::FOCUS_FIND, data, reply, option)) {
|
||||
HILOG_ERROR("FocusMoveSearch failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -218,8 +233,6 @@ void AccessibilityElementOperatorProxy::ExecuteAction(const long elementId, cons
|
||||
const sptr<IAccessibilityElementOperatorCallback> &callback)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -263,16 +276,17 @@ void AccessibilityElementOperatorProxy::ExecuteAction(const long elementId, cons
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("fail, connection write callback error");
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(
|
||||
AccessibilityElementOperatorProxy::Message::PERFORM_ACTION),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("ExecuteAction fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::PERFORM_ACTION, data, reply, option)) {
|
||||
HILOG_ERROR("ExecuteAction failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,8 +294,6 @@ void AccessibilityElementOperatorProxy::ExecuteAction(const long elementId, cons
|
||||
void AccessibilityElementOperatorProxy::ClearFocus()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -290,10 +302,8 @@ void AccessibilityElementOperatorProxy::ClearFocus()
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::CLEAR_FOCUS),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("ExecuteAction fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::CLEAR_FOCUS, data, reply, option)) {
|
||||
HILOG_ERROR("ClearFocus failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -301,8 +311,6 @@ void AccessibilityElementOperatorProxy::ClearFocus()
|
||||
void AccessibilityElementOperatorProxy::OutsideTouch()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -311,11 +319,8 @@ void AccessibilityElementOperatorProxy::OutsideTouch()
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(AccessibilityElementOperatorProxy::Message::OUTSIDE_TOUCH),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("ExecuteAction fail, error: %d", error);
|
||||
if (!SendTransactCmd(AccessibilityElementOperatorProxy::Message::OUTSIDE_TOUCH, data, reply, option)) {
|
||||
HILOG_ERROR("OutsideTouch failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ AccessibilityElementOperatorStub::~AccessibilityElementOperatorStub()
|
||||
int AccessibilityElementOperatorStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("AccessibilityElementOperatorStub::OnRemoteRequest,cmd = %d,flags= %d", code, option.GetFlags());
|
||||
HILOG_DEBUG("AccessibilityElementOperatorStub::OnRemoteRequest,cmd = %{public}u, flags = %{public}d",
|
||||
code, option.GetFlags());
|
||||
std::u16string descriptor = AccessibilityElementOperatorStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
@ -200,7 +201,7 @@ void AccessibilityElementOperatorStub::SearchElementInfoByAccessibilityId(const
|
||||
if (obj != nullptr) {
|
||||
obj->SearchElementInfoByAccessibilityId(elementId, requestId, *tempCallback, mode);
|
||||
} else {
|
||||
HILOG_DEBUG("Can not find interaction object");
|
||||
HILOG_ERROR("Can not find interaction object");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,15 +100,14 @@ bool AccessibilityMemo::GetSource(AccessibilityElementInfo &elementInfo) const
|
||||
bool result = false;
|
||||
if (instance != nullptr) {
|
||||
result = instance->SearchElementInfosByAccessibilityId(channelId_, windowId_, elementId_, 0, elementInfos);
|
||||
for (auto& info : elementInfos) {
|
||||
HILOG_DEBUG("elementInfos' size is [%{public}d]", elementInfos.size());
|
||||
if (!elementInfos.empty()) {
|
||||
HILOG_INFO("called] GetSource OK");
|
||||
result = true;
|
||||
elementInfo = info;
|
||||
break;
|
||||
elementInfo = elementInfos[0];
|
||||
}
|
||||
HILOG_INFO("called] GetSource is null");
|
||||
} else {
|
||||
HILOG_INFO("called] Can't get AccessibilityOperator instance");
|
||||
HILOG_ERROR("called] Can't get AccessibilityOperator instance");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -304,7 +303,7 @@ bool AccessibilityEventInfo::ReadFromParcel(Parcel &parcel)
|
||||
int32_t contentSize = 0;
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, contentSize);
|
||||
std::string content;
|
||||
for (auto i = 0 ; i < contentSize; i++) {
|
||||
for (auto j = 0 ; j < contentSize; j++) {
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, content);
|
||||
AddContent(content);
|
||||
}
|
||||
|
@ -99,10 +99,9 @@ bool AccessibilityOperator::GetRoot(int channelId, AccessibilityElementInfo &ele
|
||||
int activeWindow = AccessibilitySystemAbilityClient::GetInstance()->GetActiveWindow();
|
||||
HILOG_DEBUG("activeWindow is %{public}d", activeWindow);
|
||||
bool result = SearchElementInfosByAccessibilityId(channelId, activeWindow, NONE_ID, 0, elementInfos);
|
||||
for (auto& info : elementInfos) {
|
||||
HILOG_DEBUG("element [elementSize:%{public}d]", elementInfosResult_.size());
|
||||
elementInfo = info;
|
||||
break;
|
||||
HILOG_DEBUG("element [elementSize:%{public}d]", elementInfos.size());
|
||||
if (!elementInfos.empty()) {
|
||||
elementInfo = elementInfos[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -198,9 +197,7 @@ bool AccessibilityOperator::FindFocusedElementInfo(int channelId, int accessibil
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
HILOG_DEBUG("FindFocusedElementInfo channelId[%{public}d] elementId[%{public}d],\
|
||||
focusType[%{public}d] sequenceNum[%{public}d]",
|
||||
HILOG_DEBUG("channelId[%{public}d], elementId[%{public}d], focusType[%{public}d], sequenceNum[%{public}d]",
|
||||
channelId, accessibilityWindowId, elementId, focusType);
|
||||
if (!asyncElementOperatorMng_.SearchElementResultTimer(sequenceNum)) {
|
||||
HILOG_ERROR("Failed to wait result");
|
||||
|
@ -208,7 +208,7 @@ shared_ptr<AccessibilityElementOperator> AccessibilitySystemAbilityClient::GetOp
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
HILOG_DEBUG("Failed to get interaction");
|
||||
HILOG_ERROR("Failed to get interaction");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -518,33 +518,36 @@ bool AccessibilitySystemAbilityClient::UnsubscribeStateObserver(const shared_ptr
|
||||
return false;
|
||||
}
|
||||
bool result = false;
|
||||
for (auto it = observersAccessibilityState_.begin(); it != observersAccessibilityState_.end(); it++) {
|
||||
if (*it == observer) {
|
||||
observersAccessibilityState_.erase(it);
|
||||
for (auto accessibilityState = observersAccessibilityState_.begin();
|
||||
accessibilityState != observersAccessibilityState_.end(); accessibilityState++) {
|
||||
if (*accessibilityState == observer) {
|
||||
observersAccessibilityState_.erase(accessibilityState);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = observersTouchState_.begin(); it != observersTouchState_.end(); it++) {
|
||||
if (*it == observer) {
|
||||
observersTouchState_.erase(it);
|
||||
for (auto touchState = observersTouchState_.begin(); touchState != observersTouchState_.end(); touchState++) {
|
||||
if (*touchState == observer) {
|
||||
observersTouchState_.erase(touchState);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = observersKeyEventState_.begin(); it != observersKeyEventState_.end(); it++) {
|
||||
if (*it == observer) {
|
||||
observersKeyEventState_.erase(it);
|
||||
for (auto keyEventState = observersKeyEventState_.begin(); keyEventState != observersKeyEventState_.end();
|
||||
keyEventState++) {
|
||||
if (*keyEventState == observer) {
|
||||
observersKeyEventState_.erase(keyEventState);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = observersGestureState_.begin(); it != observersGestureState_.end(); it++) {
|
||||
if (*it == observer) {
|
||||
observersGestureState_.erase(it);
|
||||
for (auto gestureState = observersGestureState_.begin(); gestureState != observersGestureState_.end();
|
||||
gestureState++) {
|
||||
if (*gestureState == observer) {
|
||||
observersGestureState_.erase(gestureState);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
@ -663,17 +666,18 @@ bool AccessibilitySystemAbilityClient::DeleteCaptionListener(
|
||||
HILOG_DEBUG("start");
|
||||
bool result = false;
|
||||
if (type == CaptionObserverType::CAPTION_ENABLE) {
|
||||
for (auto it = observersCaptionEnable_.begin(); it != observersCaptionEnable_.end(); ++it) {
|
||||
if (*it == ob) {
|
||||
observersCaptionEnable_.erase(it);
|
||||
for (auto enable = observersCaptionEnable_.begin(); enable != observersCaptionEnable_.end(); ++enable) {
|
||||
if (*enable == ob) {
|
||||
observersCaptionEnable_.erase(enable);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type == CaptionObserverType::CAPTION_PROPERTY) {
|
||||
for (auto it = observersCaptionProperty_.begin(); it != observersCaptionProperty_.end(); ++it) {
|
||||
if (*it == ob) {
|
||||
observersCaptionProperty_.erase(it);
|
||||
for (auto property = observersCaptionProperty_.begin(); property != observersCaptionProperty_.end();
|
||||
++property) {
|
||||
if (*property == ob) {
|
||||
observersCaptionProperty_.erase(property);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ bool AccessibleAbilityChannelProxy::SearchElementInfoByAccessibilityId(const int
|
||||
HILOG_ERROR("requestId write error: %{public}d, ", requestId);
|
||||
return false;
|
||||
}
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("callback write error");
|
||||
return false;
|
||||
@ -126,6 +130,10 @@ bool AccessibleAbilityChannelProxy::SearchElementInfosByText(const int accessibi
|
||||
HILOG_ERROR("requestId write error: %{public}d, ", requestId);
|
||||
return false;
|
||||
}
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("callback write error");
|
||||
return false;
|
||||
@ -168,6 +176,10 @@ bool AccessibleAbilityChannelProxy::FindFocusedElementInfo(const int accessibili
|
||||
HILOG_ERROR("requestId write error: %{public}d, ", requestId);
|
||||
return false;
|
||||
}
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("callback write error");
|
||||
return false;
|
||||
@ -208,6 +220,10 @@ bool AccessibleAbilityChannelProxy::FocusMoveSearch(const int accessibilityWindo
|
||||
HILOG_ERROR("requestId write error: %{public}d, ", requestId);
|
||||
return false;
|
||||
}
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is nullptr.");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("callback write error");
|
||||
return false;
|
||||
@ -265,7 +281,7 @@ bool AccessibleAbilityChannelProxy::ExecuteAction(const int accessibilityWindowI
|
||||
HILOG_ERROR("requestId write error: %{public}d, ", requestId);
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
if (!callback || !data.WriteRemoteObject(callback->AsObject())) {
|
||||
HILOG_ERROR("callback write error");
|
||||
return false;
|
||||
}
|
||||
|
@ -55,7 +55,13 @@ void AccessibleAbilityManagerServiceCaptionPropertyProxy::OnCaptionPropertyChang
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd due to remote object");
|
||||
return;
|
||||
}
|
||||
|
||||
error = remote->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceCaptionProperty::Message::ON_CAPTION_PROPERTY_CHANGED),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
|
@ -64,7 +64,7 @@ void AccessibleAbilityManagerServiceCaptionPropertyStub::OnCaptionPropertyChange
|
||||
HILOG_DEBUG("start");
|
||||
std::shared_ptr<AccessibilitySystemAbilityClient> instance = AccessibilitySystemAbilityClient::GetInstance();
|
||||
if (!instance) {
|
||||
HILOG_DEBUG("Can't get asac instance");
|
||||
HILOG_ERROR("Can't get asac instance");
|
||||
return;
|
||||
}
|
||||
instance->UpdatecaptionProperty(caption);
|
||||
|
@ -39,11 +39,27 @@ bool AccessibleAbilityManagerServiceClientProxy::WriteInterfaceToken(MessageParc
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message code,
|
||||
MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd %{public}d due to remote object", code);
|
||||
return false;
|
||||
}
|
||||
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
if (result != NO_ERROR) {
|
||||
HILOG_ERROR("receive error transact code %{public}d in transact cmd %{public}d", result, code);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerServiceClientProxy::SendEvent(const AccessibilityEventInfo& uiEvent, const int userId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -63,10 +79,8 @@ void AccessibleAbilityManagerServiceClientProxy::SendEvent(const AccessibilityEv
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SEND_EVENT), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SendEvent fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SEND_EVENT, data, reply, option)) {
|
||||
HILOG_ERROR("SendEvent fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -74,8 +88,6 @@ void AccessibleAbilityManagerServiceClientProxy::SendEvent(const AccessibilityEv
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetCaptionProperty(const CaptionProperty& caption)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -90,13 +102,8 @@ bool AccessibleAbilityManagerServiceClientProxy::SetCaptionProperty(const Captio
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_CAPTION_PROPERTY),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetCaptionProperty fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_CAPTION_PROPERTY, data, reply, option)) {
|
||||
HILOG_ERROR("SetCaptionProperty fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -105,8 +112,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetCaptionProperty(const Captio
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetCaptionState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -121,10 +126,8 @@ bool AccessibleAbilityManagerServiceClientProxy::SetCaptionState(const bool stat
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_CAPTION_STATE), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetCaptionState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_CAPTION_STATE, data, reply, option)) {
|
||||
HILOG_ERROR("SetCaptionState fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -133,8 +136,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetCaptionState(const bool stat
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetEnabled(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -149,10 +150,8 @@ bool AccessibleAbilityManagerServiceClientProxy::SetEnabled(const bool state)
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_ENABLED), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetEnabled fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_ENABLED, data, reply, option)) {
|
||||
HILOG_ERROR("SetEnabled fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -162,8 +161,6 @@ uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterStateCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceState>& client, const int userId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
@ -188,16 +185,11 @@ uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterStateCallback(
|
||||
return ErrCode::ERROR;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::REGISTER_STATE_CALLBACK),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SendEvent fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::REGISTER_STATE_CALLBACK,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("RegisterStateCallback fail");
|
||||
return ErrCode::ERROR;
|
||||
}
|
||||
|
||||
return reply.ReadUint32();
|
||||
}
|
||||
|
||||
@ -205,8 +197,6 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
const uint32_t abilityTypes, const int32_t stateType)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -227,10 +217,9 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
return errorList;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_ABILITYLIST), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SendEvent fail, error: %d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_ABILITYLIST,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetAbilityList fail");
|
||||
return errorList;
|
||||
}
|
||||
// read result
|
||||
@ -251,8 +240,6 @@ void AccessibleAbilityManagerServiceClientProxy::RegisterElementOperator(
|
||||
int windowId, const sptr<IAccessibilityElementOperator>& operation, const int userId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -282,13 +269,9 @@ void AccessibleAbilityManagerServiceClientProxy::RegisterElementOperator(
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::REGISTER_INTERACTION_CONNECTION),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Register fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::REGISTER_INTERACTION_CONNECTION,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("RegisterElementOperator fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -296,8 +279,6 @@ void AccessibleAbilityManagerServiceClientProxy::RegisterElementOperator(
|
||||
void AccessibleAbilityManagerServiceClientProxy::DeregisterElementOperator(const int windowId)
|
||||
{
|
||||
HILOG_DEBUG("windowId(%{public}d)", windowId);
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -312,13 +293,9 @@ void AccessibleAbilityManagerServiceClientProxy::DeregisterElementOperator(const
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::DEREGISTER_INTERACTION_CONNECTION),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Deregister fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::DEREGISTER_INTERACTION_CONNECTION,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("DeregisterElementOperator fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -326,8 +303,6 @@ void AccessibleAbilityManagerServiceClientProxy::DeregisterElementOperator(const
|
||||
CaptionProperty AccessibleAbilityManagerServiceClientProxy::GetCaptionProperty()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -336,24 +311,25 @@ CaptionProperty AccessibleAbilityManagerServiceClientProxy::GetCaptionProperty()
|
||||
HILOG_ERROR("fail, connection write Token error");
|
||||
return property;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_CAPTION_PROPERTY),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_CAPTION_PROPERTY,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetCaptionProperty fail");
|
||||
return property;
|
||||
}
|
||||
return *reply.ReadParcelable<CaptionProperty>();
|
||||
|
||||
std::unique_ptr<CaptionProperty> captionProperty(reply.ReadParcelable<CaptionProperty>());
|
||||
if (!captionProperty) {
|
||||
HILOG_ERROR("ReadParcelable<CaptionProperty> failed");
|
||||
return property;
|
||||
}
|
||||
return *captionProperty;
|
||||
}
|
||||
|
||||
uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterCaptionPropertyCallback(
|
||||
const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& client, const int userId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@ -378,16 +354,11 @@ uint32_t AccessibleAbilityManagerServiceClientProxy::RegisterCaptionPropertyCall
|
||||
return ErrCode::ERROR;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::REGISTER_CAPTION_PROPERTY_CALLBACK),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SendEvent fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::REGISTER_CAPTION_PROPERTY_CALLBACK,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("RegisterCaptionPropertyCallback fail");
|
||||
return ErrCode::ERROR;
|
||||
}
|
||||
|
||||
return reply.ReadUint32();
|
||||
}
|
||||
|
||||
@ -399,8 +370,6 @@ sptr<IRemoteObject> AccessibleAbilityManagerServiceClientProxy::GetObject()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::GetEnabledState()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -409,10 +378,9 @@ bool AccessibleAbilityManagerServiceClientProxy::GetEnabledState()
|
||||
HILOG_ERROR("fail, connection write Token");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_ENABLED), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetEnabled fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_ENABLED,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetEnabledState fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -421,8 +389,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetEnabledState()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::GetCaptionState()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -431,10 +397,9 @@ bool AccessibleAbilityManagerServiceClientProxy::GetCaptionState()
|
||||
HILOG_ERROR("fail, connection write Token");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_CAPTION_STATE), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetCaptionState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_CAPTION_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetCaptionState fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -443,8 +408,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetCaptionState()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::GetTouchGuideState()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -453,13 +416,9 @@ bool AccessibleAbilityManagerServiceClientProxy::GetTouchGuideState()
|
||||
HILOG_ERROR("fail, connection write Token");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_TOUCH_GUIDE_STATE),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetTouchGuideState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_TOUCH_GUIDE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetTouchGuideState fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -468,8 +427,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetTouchGuideState()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::GetGestureState()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -478,10 +435,9 @@ bool AccessibleAbilityManagerServiceClientProxy::GetGestureState()
|
||||
HILOG_ERROR("fail, connection write Token");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_GESTURE_STATE), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetGestureState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_GESTURE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetGestureState fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -490,8 +446,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetGestureState()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::GetKeyEventObserverState()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -500,13 +454,9 @@ bool AccessibleAbilityManagerServiceClientProxy::GetKeyEventObserverState()
|
||||
HILOG_ERROR("fail, connection write Token");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_KEY_EVENT_OBSERVE_STATE),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetKeyEventObserverState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_KEY_EVENT_OBSERVE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetKeyEventObserverState fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -515,8 +465,6 @@ bool AccessibleAbilityManagerServiceClientProxy::GetKeyEventObserverState()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetTouchGuideState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -531,13 +479,9 @@ bool AccessibleAbilityManagerServiceClientProxy::SetTouchGuideState(const bool s
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_TOUCH_GUIDE_STATE),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetTouchGuideState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_TOUCH_GUIDE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetTouchGuideState fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -546,8 +490,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetTouchGuideState(const bool s
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetGestureState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -562,10 +504,9 @@ bool AccessibleAbilityManagerServiceClientProxy::SetGestureState(const bool stat
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_GESTURE_STATE), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetGestureState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_GESTURE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetGestureState fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -574,8 +515,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetGestureState(const bool stat
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetKeyEventObserverState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -590,13 +529,9 @@ bool AccessibleAbilityManagerServiceClientProxy::SetKeyEventObserverState(const
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_KEY_EVENT_OBSERVE_STATE),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetKeyEventObserverState fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_KEY_EVENT_OBSERVE_STATE,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetKeyEventObserverState fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -605,8 +540,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetKeyEventObserverState(const
|
||||
bool AccessibleAbilityManagerServiceClientProxy::SetEnabledObj(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -626,13 +559,9 @@ bool AccessibleAbilityManagerServiceClientProxy::SetEnabledObj(std::map<std::str
|
||||
}
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::SET_ENABLED_OBJECT),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetEnabledObj fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::SET_ENABLED_OBJECT,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("SetEnabledObj fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -641,8 +570,6 @@ bool AccessibleAbilityManagerServiceClientProxy::SetEnabledObj(std::map<std::str
|
||||
std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerServiceClientProxy::GetEnabledAbilities()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -652,13 +579,9 @@ std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerServiceCl
|
||||
HILOG_ERROR("fail, connection write Token error");
|
||||
return it;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_ENABLED_OBJECT),
|
||||
data,
|
||||
reply,
|
||||
option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_ENABLED_OBJECT,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetEnabledAbilities fail");
|
||||
return it;
|
||||
}
|
||||
|
||||
@ -673,8 +596,8 @@ std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerServiceCl
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
it.insert(make_pair(temp[i].GetURI(), temp[i]));
|
||||
for (int j = 0; j < dev_num; j++) {
|
||||
it.insert(make_pair(temp[j].GetURI(), temp[j]));
|
||||
}
|
||||
return it;
|
||||
}
|
||||
@ -682,8 +605,6 @@ std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerServiceCl
|
||||
std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy::GetInstalledAbilities()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -693,12 +614,12 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
HILOG_ERROR("fail, connection write Token error");
|
||||
return it;
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::GET_INSTALLED), data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_INSTALLED,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetInstalledAbilities fail");
|
||||
return it;
|
||||
}
|
||||
|
||||
int dev_num = reply.ReadInt32();
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AccessibilityAbilityInfo> dev(reply.ReadParcelable<AccessibilityAbilityInfo>());
|
||||
@ -714,8 +635,6 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
bool AccessibleAbilityManagerServiceClientProxy::DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -733,11 +652,9 @@ bool AccessibleAbilityManagerServiceClientProxy::DisableAbilities(std::map<std::
|
||||
return false;
|
||||
}
|
||||
}
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceClient::Message::DISABLE_ABILITIES),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("SetEnabledObj fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::DISABLE_ABILITIES,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("DisableAbilities fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -746,8 +663,6 @@ bool AccessibleAbilityManagerServiceClientProxy::DisableAbilities(std::map<std::
|
||||
int AccessibleAbilityManagerServiceClientProxy::GetActiveWindow()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -757,12 +672,9 @@ int AccessibleAbilityManagerServiceClientProxy::GetActiveWindow()
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
static_cast<uint32_t>(
|
||||
IAccessibleAbilityManagerServiceClient::Message::GET_ACTIVE_WINDOW),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("GetActiveWindow fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::GET_ACTIVE_WINDOW,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("GetActiveWindow fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@ -771,8 +683,6 @@ int AccessibleAbilityManagerServiceClientProxy::GetActiveWindow()
|
||||
bool AccessibleAbilityManagerServiceClientProxy::RegisterUITestAbilityConnectionClient(const sptr<IRemoteObject>& obj)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -787,11 +697,9 @@ bool AccessibleAbilityManagerServiceClientProxy::RegisterUITestAbilityConnection
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>
|
||||
(IAccessibleAbilityManagerServiceClient::Message::REGISTER_UITEST_ABILITY_CONNECTION_CLIENT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::REGISTER_UITEST_ABILITY_CONNECTION_CLIENT,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("RegisterUITestAbilityConnectionClient fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
@ -800,8 +708,6 @@ bool AccessibleAbilityManagerServiceClientProxy::RegisterUITestAbilityConnection
|
||||
bool AccessibleAbilityManagerServiceClientProxy::DeregisterUITestAbilityConnectionClient()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
|
||||
int error = NO_ERROR;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -811,11 +717,9 @@ bool AccessibleAbilityManagerServiceClientProxy::DeregisterUITestAbilityConnecti
|
||||
return false;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(static_cast<uint32_t>
|
||||
(IAccessibleAbilityManagerServiceClient::Message::DEREGISTER_UITEST_ABILITY_CONNECTION_CLIENT),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Interrupt fail, error: %{public}d", error);
|
||||
if (!SendTransactCmd(IAccessibleAbilityManagerServiceClient::Message::DEREGISTER_UITEST_ABILITY_CONNECTION_CLIENT,
|
||||
data, reply, option)) {
|
||||
HILOG_ERROR("DeregisterUITestAbilityConnectionClient fail");
|
||||
return false;
|
||||
}
|
||||
return reply.ReadBool();
|
||||
|
@ -56,7 +56,13 @@ void AccessibleAbilityManagerServiceStateProxy::OnStateChanged(const uint32_t st
|
||||
return;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (!remote) {
|
||||
HILOG_ERROR("fail to send transact cmd due to remote object");
|
||||
return;
|
||||
}
|
||||
|
||||
error = remote->SendRequest(
|
||||
static_cast<uint32_t>(IAccessibleAbilityManagerServiceState::Message::ON_STATE_CHANGED),
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
|
@ -30,7 +30,7 @@ AccessibleAbilityManagerServiceStateStub::AccessibleAbilityManagerServiceStateSt
|
||||
int AccessibleAbilityManagerServiceStateStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
HILOG_DEBUG("AccessibleAbilityManagerServiceStateStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d",
|
||||
HILOG_DEBUG("AccessibleAbilityManagerServiceStateStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d",
|
||||
code, option.GetFlags());
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStateStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
|
@ -97,13 +97,13 @@ AccessibleAbilityManagerServiceClientStub::~AccessibleAbilityManagerServiceClien
|
||||
int AccessibleAbilityManagerServiceClientStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
HILOG_DEBUG("AccessibleAbilityManagerServiceClientStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d",
|
||||
HILOG_DEBUG("AccessibleAbilityManagerServiceClientStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d",
|
||||
code,
|
||||
option.GetFlags());
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceClientStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
HILOG_INFO("local descriptor is not equal to remote");
|
||||
HILOG_ERROR("local descriptor is not equal to remote");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@ -354,8 +354,8 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleSetEnabledObj(MessagePa
|
||||
}
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
it.insert(make_pair(temp[i].GetURI(), temp[i]));
|
||||
for (int j = 0; j < dev_num; j++) {
|
||||
it.insert(make_pair(temp[j].GetURI(), temp[j]));
|
||||
}
|
||||
SetEnabledObj(it);
|
||||
|
||||
@ -417,8 +417,8 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleDisableAbilities(Messag
|
||||
}
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
it.insert(make_pair(temp[i].GetURI(), temp[i]));
|
||||
for (int j = 0; j < dev_num; j++) {
|
||||
it.insert(make_pair(temp[j].GetURI(), temp[j]));
|
||||
}
|
||||
DisableAbilities(it);
|
||||
|
||||
|
@ -44,7 +44,7 @@ napi_value NGesturePos::JSPosConstructor(napi_env env, napi_callback_info info)
|
||||
uint32_t x = 0, y = 0;
|
||||
ParseUint32(env, x, argv[PARAM0]);
|
||||
ParseUint32(env, y, argv[PARAM1]);
|
||||
HILOG_INFO("JSPosConstructor, x:%{public}d, y:%{public}d", x, y);
|
||||
HILOG_INFO("JSPosConstructor, x:%{public}u, y:%{public}u", x, y);
|
||||
napi_set_named_property(env, jsthis, "posX", argv[PARAM0]);
|
||||
napi_set_named_property(env, jsthis, "posY", argv[PARAM1]);
|
||||
|
||||
|
@ -127,6 +127,7 @@ napi_value NElementInfo::ExecuteAction(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -208,6 +209,7 @@ napi_value NElementInfo::GetByContent(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -297,6 +299,7 @@ napi_value NElementInfo::GetFocus(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -403,6 +406,7 @@ napi_value NElementInfo::GetNext(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -484,6 +488,7 @@ napi_value NElementInfo::GetChild(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -562,6 +567,7 @@ napi_value NElementInfo::GetParent(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
|
@ -79,6 +79,7 @@ napi_value NAccessibilityClient::IsOpenAccessibility(napi_env env, napi_callback
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -106,10 +107,7 @@ napi_value NAccessibilityClient::IsOpenTouchExploration(napi_env env, napi_callb
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "IsOpenTouchExploration", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env,
|
||||
nullptr,
|
||||
resource,
|
||||
napi_create_async_work(env, nullptr, resource,
|
||||
// execute async to call c++ function
|
||||
[](napi_env env, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
@ -138,6 +136,7 @@ napi_value NAccessibilityClient::IsOpenTouchExploration(napi_env env, napi_callb
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -200,6 +199,7 @@ napi_value NAccessibilityClient::GetAbilityList(napi_env env, napi_callback_info
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -269,6 +269,7 @@ napi_value NAccessibilityClient::SendEvent(napi_env env, napi_callback_info info
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -443,6 +444,7 @@ napi_value NAccessibilityClient::GetCaptionProperty(napi_env env, napi_callback_
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -502,6 +504,7 @@ napi_value NAccessibilityClient::SetCaptionProperty(napi_env env, napi_callback_
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -561,6 +564,7 @@ napi_value NAccessibilityClient::GetCaptionState(napi_env env, napi_callback_inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -589,10 +593,7 @@ napi_value NAccessibilityClient::SetCaptionState(napi_env env, napi_callback_inf
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "SetCaptionState", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env,
|
||||
nullptr,
|
||||
resource,
|
||||
napi_create_async_work(env, nullptr, resource,
|
||||
// execute async to call c++ function
|
||||
[](napi_env env, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
@ -621,6 +622,7 @@ napi_value NAccessibilityClient::SetCaptionState(napi_env env, napi_callback_inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -680,6 +682,7 @@ napi_value NAccessibilityClient::GetEnabled(napi_env env, napi_callback_info inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -739,6 +742,7 @@ napi_value NAccessibilityClient::SetEnabled(napi_env env, napi_callback_info inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -798,6 +802,7 @@ napi_value NAccessibilityClient::GetTouchGuideState(napi_env env, napi_callback_
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -857,6 +862,7 @@ napi_value NAccessibilityClient::SetTouchGuideState(napi_env env, napi_callback_
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -916,6 +922,7 @@ napi_value NAccessibilityClient::GetGestureState(napi_env env, napi_callback_inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -975,6 +982,7 @@ napi_value NAccessibilityClient::SetGestureState(napi_env env, napi_callback_inf
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1035,6 +1043,7 @@ napi_value NAccessibilityClient::GetKeyEventObserverState(napi_env env, napi_cal
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1094,6 +1103,7 @@ napi_value NAccessibilityClient::SetKeyEventObserverState(napi_env env, napi_cal
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1123,10 +1133,7 @@ napi_value NAccessibilityClient::GetInstalled(napi_env env, napi_callback_info i
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetInstalled", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env,
|
||||
nullptr,
|
||||
resource,
|
||||
napi_create_async_work(env, nullptr, resource,
|
||||
// execute async to call c++ function
|
||||
[](napi_env env, void* data) {
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = (NAccessibilitySystemAbilityClient*)data;
|
||||
@ -1155,6 +1162,7 @@ napi_value NAccessibilityClient::GetInstalled(napi_env env, napi_callback_info i
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1215,6 +1223,7 @@ napi_value NAccessibilityClient::GetExtensionEnabled(napi_env env, napi_callback
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1274,6 +1283,7 @@ napi_value NAccessibilityClient::ExtensionEnabled(napi_env env, napi_callback_in
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1333,6 +1343,7 @@ napi_value NAccessibilityClient::ExtensionDisabled(napi_env env, napi_callback_i
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
},
|
||||
(void*)callbackInfo,
|
||||
&callbackInfo->work_);
|
||||
@ -1391,6 +1402,7 @@ napi_value NAccessibilityClient::GetCaptionsManager(napi_env env, napi_callback_
|
||||
napi_set_named_property(env, result, "style", keyCode);
|
||||
|
||||
delete callbackInfo;
|
||||
callbackInfo = nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ bool ParseUint32(napi_env env, uint32_t& param, napi_value args)
|
||||
napi_valuetype valuetype;
|
||||
status = napi_typeof(env, args, &valuetype);
|
||||
if (status != napi_ok) {
|
||||
HILOG_INFO("napi_typeof error and status is %{public}d", status);
|
||||
HILOG_ERROR("napi_typeof error and status is %{public}d", status);
|
||||
return false;
|
||||
}
|
||||
HILOG_INFO("param=%{public}d.", valuetype);
|
||||
@ -258,10 +258,11 @@ static void ConvertAccessibleAbilityInfoToJS(napi_env env, napi_value& result, A
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nAbilityType));
|
||||
uint32_t abilityTypesValue = info.GetAccessibilityAbilityType();
|
||||
std::vector<std::string> abilityTypes = ParseAbilityTypesToVec(abilityTypesValue);
|
||||
for (size_t idx = 0; idx < abilityTypes.size(); idx++) {
|
||||
for (size_t idxType = 0; idxType < abilityTypes.size(); idxType++) {
|
||||
napi_value nType;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, abilityTypes[idx].c_str(), NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nAbilityType, idx, nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, abilityTypes[idxType].c_str(),
|
||||
NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nAbilityType, idxType, nType));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "abilityTypes", nAbilityType));
|
||||
|
||||
@ -269,10 +270,11 @@ static void ConvertAccessibleAbilityInfoToJS(napi_env env, napi_value& result, A
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nCapabilities));
|
||||
uint32_t capabilitiesValue = info.GetCapabilityValues();
|
||||
std::vector<std::string> capabilities = ParseCapabilitiesToVec(capabilitiesValue);
|
||||
for (size_t idx = 0; idx < capabilities.size(); idx++) {
|
||||
napi_value nType;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, capabilities[idx].c_str(), NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nCapabilities, idx, nType));
|
||||
for (size_t idxCap = 0; idxCap < capabilities.size(); idxCap++) {
|
||||
napi_value nCap;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, capabilities[idxCap].c_str(),
|
||||
NAPI_AUTO_LENGTH, &nCap));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nCapabilities, idxCap, nCap));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "capabilities", nCapabilities));
|
||||
|
||||
@ -285,10 +287,10 @@ static void ConvertAccessibleAbilityInfoToJS(napi_env env, napi_value& result, A
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nEventTypes));
|
||||
uint32_t eventTypesValue = info.GetEventTypes();
|
||||
std::vector<std::string> eventTypes = ParseEventTypesToVec(eventTypesValue);
|
||||
for (size_t idx = 0; idx < eventTypes.size(); idx++) {
|
||||
napi_value nType;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, eventTypes[idx].c_str(), NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nEventTypes, idx, nType));
|
||||
for (size_t idxEve = 0; idxEve < eventTypes.size(); idxEve++) {
|
||||
napi_value nEve;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, eventTypes[idxEve].c_str(), NAPI_AUTO_LENGTH, &nEve));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nEventTypes, idxEve, nEve));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "eventTypes", nEventTypes));
|
||||
|
||||
@ -847,11 +849,11 @@ void ConvertElementInfoToJS(napi_env env, napi_value result, const Accessibility
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nOperations));
|
||||
std::vector<AccessibleAction> operations = elementInfo.GetActionList();
|
||||
size_t operationCount = operations.size();
|
||||
for (size_t idx = 0; idx < operationCount; idx++) {
|
||||
for (size_t i = 0; i < operationCount; i++) {
|
||||
napi_value nOp;
|
||||
napi_create_object(env, &nOp);
|
||||
ConvertOperationToJS(env, nOp, operations[idx]);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nOperations, idx, nOp));
|
||||
ConvertOperationToJS(env, nOp, operations[i]);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nOperations, i, nOp));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "operations", nOperations));
|
||||
|
||||
@ -1238,9 +1240,9 @@ void ConvertActionArgsJSToNAPI(
|
||||
napi_create_string_utf8(env, "htmlItem", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value htmlItemValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &htmlItemValue);
|
||||
str = GetStringFromNAPI(env, htmlItemValue);
|
||||
args.insert(std::pair<std::string, std::string>("htmlItem", str.c_str()));
|
||||
}
|
||||
break;
|
||||
@ -1249,9 +1251,9 @@ void ConvertActionArgsJSToNAPI(
|
||||
napi_create_string_utf8(env, "textMoveUnit", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value textMoveUnitValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &textMoveUnitValue);
|
||||
str = GetStringFromNAPI(env, textMoveUnitValue);
|
||||
args.insert(std::pair<std::string, std::string>("textMoveUnit", str.c_str()));
|
||||
}
|
||||
break;
|
||||
@ -1259,17 +1261,17 @@ void ConvertActionArgsJSToNAPI(
|
||||
napi_create_string_utf8(env, "selectTextBegin", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value selectTextBeginValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &selectTextBeginValue);
|
||||
str = GetStringFromNAPI(env, selectTextBeginValue);
|
||||
args.insert(std::pair<std::string, std::string>("selectTextBegin", str.c_str()));
|
||||
}
|
||||
napi_create_string_utf8(env, "selectTextEnd", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value selectTextEndValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &selectTextEndValue);
|
||||
str = GetStringFromNAPI(env, selectTextEndValue);
|
||||
args.insert(std::pair<std::string, std::string>("selectTextEnd", str.c_str()));
|
||||
}
|
||||
break;
|
||||
@ -1277,9 +1279,9 @@ void ConvertActionArgsJSToNAPI(
|
||||
napi_create_string_utf8(env, "setText", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value setTextValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &setTextValue);
|
||||
str = GetStringFromNAPI(env, setTextValue);
|
||||
args.insert(std::pair<std::string, std::string>("setText", str.c_str()));
|
||||
}
|
||||
break;
|
||||
@ -1311,18 +1313,18 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
napi_create_string_utf8(env, "windowUpdateType", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value windowUpdateTypeValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &windowUpdateTypeValue);
|
||||
str = GetStringFromNAPI(env, windowUpdateTypeValue);
|
||||
eventInfo.SetWindowChangeTypes(ConvertStringToWindowUpdateTypes(str));
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "bundleName", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value bundleNameValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &bundleNameValue);
|
||||
str = GetStringFromNAPI(env, bundleNameValue);
|
||||
if (str == "") {
|
||||
return false;
|
||||
}
|
||||
@ -1334,9 +1336,9 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
napi_create_string_utf8(env, "componentType", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value componentTypeValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &componentTypeValue);
|
||||
str = GetStringFromNAPI(env, componentTypeValue);
|
||||
eventInfo.SetComponentType(str);
|
||||
}
|
||||
|
||||
@ -1344,54 +1346,54 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
napi_create_string_utf8(env, "timeStamp", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int64(env, value, ×tamp);
|
||||
napi_value timeStampValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &timeStampValue);
|
||||
napi_get_value_int64(env, timeStampValue, ×tamp);
|
||||
eventInfo.SetTimeStamp(timestamp);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "windowId", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value windowIdValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &windowIdValue);
|
||||
napi_get_value_int32(env, windowIdValue, &dataValue);
|
||||
eventInfo.SetWindowId(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "pageId", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value pageIdValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &pageIdValue);
|
||||
napi_get_value_int32(env, pageIdValue, &dataValue);
|
||||
eventInfo.SetPageId(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "componentId", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value componentIdValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &componentIdValue);
|
||||
napi_get_value_int32(env, componentIdValue, &dataValue);
|
||||
eventInfo.SetSource(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "description", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value descriptionValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &descriptionValue);
|
||||
str = GetStringFromNAPI(env, descriptionValue);
|
||||
eventInfo.SetDescription(str);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "triggerAction", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value triggerActionValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &triggerActionValue);
|
||||
str = GetStringFromNAPI(env, triggerActionValue);
|
||||
eventInfo.SetTriggerAction(ConvertStringToAccessibleOperationType(str));
|
||||
if (eventInfo.GetTriggerAction() == ACCESSIBILITY_ACTION_INVALID) {
|
||||
return false;
|
||||
@ -1403,22 +1405,22 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
napi_create_string_utf8(env, "textMoveUnit", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value textMoveUnitValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &textMoveUnitValue);
|
||||
str = GetStringFromNAPI(env, textMoveUnitValue);
|
||||
eventInfo.SetTextMovementStep(ConvertStringToTextMoveStep(str));
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "contents", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_value contentsValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &contentsValue);
|
||||
napi_value data = nullptr;
|
||||
size_t dataLen = 0;
|
||||
napi_get_array_length(env, value, &dataLen);
|
||||
napi_get_array_length(env, contentsValue, &dataLen);
|
||||
for (int i = 0; i < int(dataLen); i++) {
|
||||
napi_get_element(env, value, i, &data);
|
||||
napi_get_element(env, contentsValue, i, &data);
|
||||
str = GetStringFromNAPI(env, data);
|
||||
eventInfo.AddContent(str);
|
||||
}
|
||||
@ -1427,63 +1429,63 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
napi_create_string_utf8(env, "lastContent", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value lastContentValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &lastContentValue);
|
||||
str = GetStringFromNAPI(env, lastContentValue);
|
||||
eventInfo.SetLatestContent(str);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "beginIndex", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value beginIndexValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &beginIndexValue);
|
||||
napi_get_value_int32(env, beginIndexValue, &dataValue);
|
||||
eventInfo.SetBeginIndex(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "currentIndex", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value currentIndexValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, ¤tIndexValue);
|
||||
napi_get_value_int32(env, currentIndexValue, &dataValue);
|
||||
eventInfo.SetCurrentIndex(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "endIndex", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value endIndexValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &endIndexValue);
|
||||
napi_get_value_int32(env, endIndexValue, &dataValue);
|
||||
eventInfo.SetEndIndex(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "itemCount", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &dataValue);
|
||||
napi_value itemCountValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &itemCountValue);
|
||||
napi_get_value_int32(env, itemCountValue, &dataValue);
|
||||
eventInfo.SetItemCounts(dataValue);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "categoryNotification", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value categoryNotificationValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &categoryNotificationValue);
|
||||
str = GetStringFromNAPI(env, categoryNotificationValue);
|
||||
eventInfo.SetNotificationInfo(ConvertStringToNotificationCategory(str));
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "gestureType", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
str = GetStringFromNAPI(env, value);
|
||||
napi_value gestureTypeValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &gestureTypeValue);
|
||||
str = GetStringFromNAPI(env, gestureTypeValue);
|
||||
eventInfo.SetGestureType(ConvertStringToGestureType(str));
|
||||
}
|
||||
return true;
|
||||
@ -1499,18 +1501,18 @@ static void ConvertGesturePathPositionJSToNAPI(
|
||||
napi_create_string_utf8(env, "posX", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_double(env, value, &position);
|
||||
napi_value valueX = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &valueX);
|
||||
napi_get_value_double(env, valueX, &position);
|
||||
gesturePathPosition.SetPositionX((float)position);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "posY", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_double(env, value, &position);
|
||||
napi_value valueY = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &valueY);
|
||||
napi_get_value_double(env, valueY, &position);
|
||||
gesturePathPosition.SetPositionY((float)position);
|
||||
}
|
||||
}
|
||||
@ -1524,18 +1526,18 @@ static void ConvertGesturePathJSToNAPI(napi_env env, napi_value object, GestureP
|
||||
napi_create_string_utf8(env, "startPos", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
ConvertGesturePathPositionJSToNAPI(env, value, gesturePathPosition);
|
||||
napi_value startValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &startValue);
|
||||
ConvertGesturePathPositionJSToNAPI(env, startValue, gesturePathPosition);
|
||||
gesturePath.SetStartPosition(gesturePathPosition);
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "endPos", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
ConvertGesturePathPositionJSToNAPI(env, value, gesturePathPosition);
|
||||
napi_value endValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &endValue);
|
||||
ConvertGesturePathPositionJSToNAPI(env, endValue, gesturePathPosition);
|
||||
gesturePath.SetEndPosition(gesturePathPosition);
|
||||
}
|
||||
|
||||
@ -1543,9 +1545,9 @@ static void ConvertGesturePathJSToNAPI(napi_env env, napi_value object, GestureP
|
||||
napi_create_string_utf8(env, "durationTime", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int64(env, value, &durationTime);
|
||||
napi_value timeValue = nullptr;
|
||||
napi_get_property(env, object, propertyNameValue, &timeValue);
|
||||
napi_get_value_int64(env, timeValue, &durationTime);
|
||||
gesturePath.SetDurationTime(durationTime);
|
||||
}
|
||||
}
|
||||
@ -1610,9 +1612,9 @@ void ConvertKeyEventToJS(napi_env env, napi_value result, OHOS::MMI::KeyEvent& k
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_boolean(env, key.GetDeviceId(), &deviceId));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, keyItem, "deviceId", deviceId));
|
||||
|
||||
napi_value keyCode;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_boolean(env, key.GetKeyCode(), &keyCode));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, keyItem, "keyCode", keyCode));
|
||||
napi_value itemKeyCode;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_boolean(env, key.GetKeyCode(), &itemKeyCode));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, keyItem, "keyCode", itemKeyCode));
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, keys, idx, keyItem));
|
||||
idx++;
|
||||
@ -1710,16 +1712,16 @@ uint32_t ConvertColorStringToNumer(std::string colorStr)
|
||||
newColorStr += c;
|
||||
newColorStr += c;
|
||||
}
|
||||
auto value = stoul(newColorStr, nullptr, COLOR_STRING_BASE);
|
||||
auto valueMini = stoul(newColorStr, nullptr, COLOR_STRING_BASE);
|
||||
if (newColorStr.length() < COLOR_STRING_SIZE_STANDARD) {
|
||||
// no alpha specified, set alpha to 0xff
|
||||
value |= COLOR_ALPHA_MASK;
|
||||
valueMini |= COLOR_ALPHA_MASK;
|
||||
} else {
|
||||
auto alpha = value << ALPHA_MOVE;
|
||||
auto rgb = value >> COLOR_MOVE;
|
||||
value = alpha | rgb;
|
||||
auto alphaMini = valueMini << ALPHA_MOVE;
|
||||
auto rgbMini = valueMini >> COLOR_MOVE;
|
||||
valueMini = alphaMini | rgbMini;
|
||||
}
|
||||
color = value;
|
||||
color = valueMini;
|
||||
return color;
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,9 @@ config("aams_service_config") {
|
||||
|
||||
if (target_cpu == "arm") {
|
||||
cflags = [ "-DBINDER_IPC_32BIT" ]
|
||||
# cflags_cc = ["-frtti"]
|
||||
}
|
||||
}
|
||||
|
||||
# remove_configs = [ "//build/config/compiler:no_rtti" ]
|
||||
|
||||
ohos_shared_library("accessibleabilityms") {
|
||||
install_enable = true
|
||||
|
||||
|
@ -214,6 +214,12 @@ public:
|
||||
*/
|
||||
const std::vector<AccessibilityAbilityInfo> GetAbilitiesByState(AbilityStateType state);
|
||||
|
||||
/**
|
||||
* @brief Get the accessibility ability info of the disabled ability.
|
||||
* @return
|
||||
*/
|
||||
const std::vector<AccessibilityAbilityInfo> GetDisableAbilities();
|
||||
|
||||
/**
|
||||
* @brief Get enable accessibility list.
|
||||
* @param
|
||||
|
@ -29,6 +29,7 @@ using EventHandle = std::function<void(const OHOS::AAFwk::Want&)>;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
#define RETRY_SUBSCRIBER 3
|
||||
class AccessibilityCommonEventSubscriber : public EventFwk::CommonEventSubscriber {
|
||||
public:
|
||||
AccessibilityCommonEventSubscriber(const EventFwk::CommonEventSubscribeInfo &subscriberInfo,
|
||||
|
@ -376,22 +376,30 @@ const std::vector<AccessibilityAbilityInfo> AccessibilityAccountData::GetAbiliti
|
||||
connectedA11yAbilities_.size(), enabledAbilities.size());
|
||||
return enabledAbilities;
|
||||
} else if (state == ABILITY_STATE_DISABLE) {
|
||||
std::vector<AccessibilityAbilityInfo> disabledAbilities = installedAbilities_;
|
||||
for (auto enabledAbility : connectedA11yAbilities_) {
|
||||
for (auto itr = disabledAbilities.begin(); itr != disabledAbilities.end();) {
|
||||
if (itr->GetId() == enabledAbility.second->GetAbilityInfo().GetId()) {
|
||||
disabledAbilities.erase(itr);
|
||||
} else {
|
||||
itr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<AccessibilityAbilityInfo> disabledAbilities = GetDisableAbilities();
|
||||
HILOG_DEBUG("the size of disable abilities is %{public}d", disabledAbilities.size());
|
||||
return disabledAbilities;
|
||||
} else {
|
||||
return installedAbilities_;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<AccessibilityAbilityInfo> AccessibilityAccountData::GetDisableAbilities()
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
std::vector<AccessibilityAbilityInfo> disabledAbilities = installedAbilities_;
|
||||
for (auto enabledAbility : connectedA11yAbilities_) {
|
||||
for (auto itr = disabledAbilities.begin(); itr != disabledAbilities.end();) {
|
||||
if (itr->GetId() == enabledAbility.second->GetAbilityInfo().GetId()) {
|
||||
disabledAbilities.erase(itr);
|
||||
} else {
|
||||
itr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return disabledAbilities;
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::UpdateAccountCapabilities()
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
@ -774,19 +782,18 @@ void AccessibilityAccountData::StringToVector(std::string &stringIn, std::vector
|
||||
HILOG_DEBUG("start.");
|
||||
int strLength = (int)stringIn.size();
|
||||
std::vector<int> position;
|
||||
int wrodCount = 0;
|
||||
|
||||
if (strLength == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < strLength; i++) {
|
||||
if (stringIn[i] == ',') {
|
||||
position.push_back(i);
|
||||
for (int j = 0; j < strLength; j++) {
|
||||
if (stringIn[j] == ',') {
|
||||
position.push_back(j);
|
||||
}
|
||||
}
|
||||
|
||||
wrodCount = (int)position.size();
|
||||
int wrodCount = (int)position.size();
|
||||
if ((wrodCount == 0) && (strLength > 0)) {
|
||||
vectorResult.push_back(stringIn);
|
||||
} else {
|
||||
@ -794,7 +801,6 @@ void AccessibilityAccountData::StringToVector(std::string &stringIn, std::vector
|
||||
int length = 0;
|
||||
for (int i = 0; i <= wrodCount; i++) {
|
||||
if (i == 0) {
|
||||
startWrod = 0;
|
||||
length = position[i];
|
||||
vectorResult.push_back(stringIn.substr(startWrod, length)); // first string
|
||||
} else if (i < wrodCount) {
|
||||
|
@ -74,7 +74,7 @@ bool AccessibilityCommonEventRegistry::RegisterSubscriber()
|
||||
accessibilityCommonEventSubscriber_ =
|
||||
std::make_shared<AccessibilityCommonEventSubscriber>(subscribeInfo, eventHandles_);
|
||||
|
||||
int retry = 3;
|
||||
int retry = RETRY_SUBSCRIBER;
|
||||
do {
|
||||
subscribeResult = CommonEventManager::SubscribeCommonEvent(accessibilityCommonEventSubscriber_);
|
||||
if (subscribeResult) {
|
||||
|
@ -57,6 +57,7 @@ void AccessibilityDisplayManager::OnCreate(Rosen::DisplayId did)
|
||||
void AccessibilityDisplayManager::OnDestroy(Rosen::DisplayId did)
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityDisplayManager::OnChange(Rosen::DisplayId dId)
|
||||
{
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ GestureHandler::GestureHandler(const std::shared_ptr<AppExecFwk::EventRunner> &r
|
||||
void GestureHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
if (!event) {
|
||||
HILOG_ERROR("event is null");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->GetInnerEventId()) {
|
||||
case AccessibilityGestureRecognizer::LONG_PRESS_MSG:
|
||||
@ -179,7 +183,8 @@ bool AccessibilityGestureRecognizer::HandleTouchMoveEvent(MMI::PointerEvent &eve
|
||||
isDoubleTap_ = false;
|
||||
if (!isGestureStarted_) {
|
||||
isGestureStarted_ = true;
|
||||
return listener_->OnStarted();
|
||||
listener_->OnStarted();
|
||||
return false;
|
||||
}
|
||||
} else if (!isFirstTapUp_) {
|
||||
int64_t durationTime = eventTime - startTime_;
|
||||
|
@ -49,7 +49,8 @@ AccessibilityInputInterceptor::AccessibilityInputInterceptor()
|
||||
keyEventTransmitters_ = nullptr;
|
||||
aams_ = DelayedSingleton<AccessibleAbilityManagerService>::GetInstance();
|
||||
if (!aams_) {
|
||||
HILOG_DEBUG("aams_ is null.");
|
||||
HILOG_ERROR("aams_ is null.");
|
||||
return;
|
||||
}
|
||||
inputManager_ = MMI::InputManager::GetInstance();
|
||||
eventHandler_ = std::make_shared<AppExecFwk::EventHandler>(aams_->GetMainRunner());
|
||||
@ -113,7 +114,7 @@ void AccessibilityInputInterceptor::SetAvailableFunctions(uint32_t availableFunc
|
||||
|
||||
void AccessibilityInputInterceptor::CreateTransmitters()
|
||||
{
|
||||
HILOG_DEBUG("function[%{public}d].", availableFunctions_);
|
||||
HILOG_DEBUG("function[%{public}u].", availableFunctions_);
|
||||
|
||||
if (!availableFunctions_) {
|
||||
DestroyInterceptor();
|
||||
@ -201,6 +202,7 @@ void AccessibilityInputInterceptor::InterceptKeyEventCallback(std::shared_ptr<MM
|
||||
|
||||
if (!instance_ || !instance_->eventHandler_) {
|
||||
HILOG_ERROR("eventHandler is nullptr.");
|
||||
return;
|
||||
}
|
||||
auto task = std::bind(&AccessibilityInputInterceptor::ProcessKeyEvent, instance_, keyEvent);
|
||||
instance_->eventHandler_->PostTask(task, AppExecFwk::EventQueue::Priority::LOW);
|
||||
|
@ -92,7 +92,7 @@ bool Intersect(Rect& focus, Rect source)
|
||||
int maxx = std::min(focus.GetRightBottomXScreenPostion(), source.GetRightBottomXScreenPostion());
|
||||
int maxy = std::min(focus.GetRightBottomYScreenPostion(), source.GetRightBottomYScreenPostion());
|
||||
if ((minx > maxx) || (miny > maxy)) {
|
||||
HILOG_DEBUG("The two Rects do not intersect");
|
||||
HILOG_ERROR("The two Rects do not intersect");
|
||||
return false;
|
||||
}
|
||||
focus.SetLeftTopScreenPostion(minx, miny);
|
||||
@ -125,7 +125,7 @@ bool AccessibilityInteractionBridge::GetPointerItermOfAccessibilityFocusClick(MM
|
||||
auto focus = FindFocusedElementInfo();
|
||||
auto focusRect = focus.GetRectInScreen();
|
||||
float denominator = 2.0;
|
||||
/* Apply magnification if needed. */
|
||||
// Apply magnification if needed.
|
||||
|
||||
// Intersect with window
|
||||
auto& windowManager = AccessibilityWindowInfoManager::GetInstance();
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
const int value_1000 = 1000;
|
||||
const int value_1000000 = 1000000;
|
||||
const int MS_TO_US = 1000;
|
||||
const int g_value_1000 = 1000;
|
||||
const int g_value_1000000 = 1000000;
|
||||
const int g_msToUs = 1000;
|
||||
TouchInjectHandler::TouchInjectHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
|
||||
TouchEventInjector &server) : AppExecFwk::EventHandler(runner), server_(server)
|
||||
{
|
||||
@ -96,7 +96,7 @@ void TouchEventInjector::GetTapsEvents(int64_t startTime)
|
||||
float py = gesturePath_[i].GetStartPosition().GetPositionY();
|
||||
pointer.SetGlobalX(px);
|
||||
pointer.SetGlobalY(py);
|
||||
pointer.SetDownTime(downTime * MS_TO_US);
|
||||
pointer.SetDownTime(downTime * g_msToUs);
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, pointer, downTime);
|
||||
HILOG_INFO("append down event");
|
||||
injectedEvents_.push_back(event);
|
||||
@ -107,7 +107,7 @@ void TouchEventInjector::GetTapsEvents(int64_t startTime)
|
||||
py = gesturePath_[i].GetEndPosition().GetPositionY();
|
||||
pointer.SetGlobalX(px);
|
||||
pointer.SetGlobalY(py);
|
||||
pointer.SetDownTime(downTime * MS_TO_US);
|
||||
pointer.SetDownTime(downTime * g_msToUs);
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, pointer, nowTime);
|
||||
HILOG_INFO("append up event");
|
||||
injectedEvents_.push_back(event);
|
||||
@ -118,7 +118,7 @@ void TouchEventInjector::GetTapsEvents(int64_t startTime)
|
||||
|
||||
void TouchEventInjector::GetMovesEvents(int64_t startTime)
|
||||
{
|
||||
HILOG_INFO("TouchEventInjector::GetTapsEvents: start");
|
||||
HILOG_INFO("TouchEventInjector::GetMovesEvents: start");
|
||||
std::shared_ptr<MMI::PointerEvent> event;
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
int64_t downTime = startTime;
|
||||
@ -129,7 +129,7 @@ void TouchEventInjector::GetMovesEvents(int64_t startTime)
|
||||
pointer.SetPointerId(1);
|
||||
pointer.SetGlobalX(px);
|
||||
pointer.SetGlobalY(py);
|
||||
pointer.SetDownTime(downTime * MS_TO_US);
|
||||
pointer.SetDownTime(downTime * g_msToUs);
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, pointer, downTime);
|
||||
HILOG_INFO("append down event");
|
||||
injectedEvents_.push_back(event);
|
||||
@ -138,7 +138,7 @@ void TouchEventInjector::GetMovesEvents(int64_t startTime)
|
||||
py = gesturePath_[i].GetEndPosition().GetPositionY();
|
||||
pointer.SetGlobalX(px);
|
||||
pointer.SetGlobalY(py);
|
||||
pointer.SetDownTime(downTime * MS_TO_US);
|
||||
pointer.SetDownTime(downTime * g_msToUs);
|
||||
HILOG_INFO("append move event");
|
||||
nowTime += gesturePath_[i].GetDurationTime();
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, pointer, nowTime);
|
||||
@ -149,7 +149,7 @@ void TouchEventInjector::GetMovesEvents(int64_t startTime)
|
||||
py = gesturePath_[gesturePath_.size() - 1].GetEndPosition().GetPositionY();
|
||||
pointer.SetGlobalX(px);
|
||||
pointer.SetGlobalY(py);
|
||||
pointer.SetDownTime(downTime * MS_TO_US);
|
||||
pointer.SetDownTime(downTime * g_msToUs);
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, pointer, nowTime);
|
||||
HILOG_INFO("append up event");
|
||||
injectedEvents_.push_back(event);
|
||||
@ -186,9 +186,10 @@ void TouchEventInjector::InjectEventsInner()
|
||||
std::shared_ptr<SendEventArgs> parameters = std::make_shared<SendEventArgs>();
|
||||
parameters->isLastEvent_ = (i == injectedEvents_.size() - 1) ? true : false;
|
||||
parameters->event_ = injectedEvents_[i];
|
||||
int64_t timeout = injectedEvents_[i]->GetActionTime() / MS_TO_US - curTime;
|
||||
|
||||
handler_->SendEvent(SEND_TOUCH_EVENT_MSG, parameters, timeout);
|
||||
if (g_msToUs - curTime != 0) {
|
||||
int64_t timeout = injectedEvents_[i]->GetActionTime() / g_msToUs - curTime;
|
||||
handler_->SendEvent(SEND_TOUCH_EVENT_MSG, parameters, timeout);
|
||||
}
|
||||
}
|
||||
injectedEvents_.clear();
|
||||
}
|
||||
@ -214,7 +215,7 @@ void TouchEventInjector::CancelGesture()
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
pointer.SetPointerId(1);
|
||||
int64_t time = getSystemTime();
|
||||
pointer.SetDownTime(time * MS_TO_US);
|
||||
pointer.SetDownTime(time * g_msToUs);
|
||||
pointer.SetPointerId(1);
|
||||
if (GetNext() != nullptr && isGestureUnderway_) {
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_CANCEL, pointer, time);
|
||||
@ -251,7 +252,7 @@ std::shared_ptr<MMI::PointerEvent> TouchEventInjector::obtainTouchEvent(int acti
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
|
||||
pointerEvent->SetPointerId(point.GetPointerId());
|
||||
pointerEvent->SetPointerAction(action);
|
||||
pointerEvent->SetActionTime(actionTime * MS_TO_US);
|
||||
pointerEvent->SetActionTime(actionTime * g_msToUs);
|
||||
pointerEvent->SetActionStartTime(point.GetDownTime());
|
||||
pointerEvent->AddPointerItem(point);
|
||||
pointerEvent->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
@ -263,7 +264,7 @@ int64_t TouchEventInjector::getSystemTime()
|
||||
HILOG_INFO("TouchEventInjector::getSystemTime: start");
|
||||
struct timespec times = {0, 0};
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
int64_t millisecond = (int64_t)(times.tv_sec * value_1000 + times.tv_nsec / value_1000000);
|
||||
int64_t millisecond = (int64_t)(times.tv_sec * g_value_1000 + times.tv_nsec / g_value_1000000);
|
||||
|
||||
return millisecond;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ bool TouchGuider::TouchGuideListener::OnStarted()
|
||||
server_.CancelPostEventIfNeed(SEND_HOVER_EXIT_MSG);
|
||||
server_.PostGestureRecognizeExit();
|
||||
server_.SendAccessibilityEventToAA(EventType::TYPE_TOUCH_GUIDE_GESTURE_BEGIN);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TouchGuider::TouchGuideListener::OnCompleted(GestureType gestureId)
|
||||
@ -590,7 +590,7 @@ void TouchGuider::HandleDraggingStateInnerMove(MMI::PointerEvent &event)
|
||||
if (pointCount == POINTER_COUNT_1) {
|
||||
HILOG_INFO("Only two pointers can be received in the dragging state");
|
||||
} else if (pointCount == POINTER_COUNT_2 && IsDragGestureAccept(event)) {
|
||||
/* get densityPixels from WMS */
|
||||
// get densityPixels from WMS
|
||||
AccessibilityDisplayManager &displayMgr = AccessibilityDisplayManager::GetInstance();
|
||||
auto display = displayMgr.GetDefaultDisplay();
|
||||
float densityPixels = display->GetVirtualPixelRatio();
|
||||
@ -629,7 +629,7 @@ float TouchGuider::GetAngleCos(float offsetX, float offsetY, bool isGetX)
|
||||
|
||||
float ret = isGetX ? offsetX : offsetY;
|
||||
double duration = hypot(offsetX, offsetY);
|
||||
if (duration == 0) {
|
||||
if ((int)duration == 0) {
|
||||
return ret;
|
||||
}
|
||||
ret = ret / duration;
|
||||
@ -733,9 +733,9 @@ void TouchGuider::ClearReceivedEventRecorder()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
memset_s(receivedRecorder_.pointerDownX, sizeof(receivedRecorder_.pointerDownX),
|
||||
(void)memset_s(receivedRecorder_.pointerDownX, sizeof(receivedRecorder_.pointerDownX),
|
||||
0, sizeof(receivedRecorder_.pointerDownX));
|
||||
memset_s(receivedRecorder_.pointerDownY, sizeof(receivedRecorder_.pointerDownY),
|
||||
(void)memset_s(receivedRecorder_.pointerDownY, sizeof(receivedRecorder_.pointerDownY),
|
||||
0, sizeof(receivedRecorder_.pointerDownY));
|
||||
receivedRecorder_.lastEvent = nullptr;
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::Accessibility
|
||||
auto& winMgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
switch (type) {
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_ADDED: {
|
||||
auto a11yWindowInfo = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfo);
|
||||
AccessibilityEventInfo evtInf(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_ADDED);
|
||||
aams->SendEvent(evtInf, aams->GetCurrentAccountId());
|
||||
if (a11yWindowInfo.IsFocused()) {
|
||||
auto a11yWindowInfoAdded = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfoAdded);
|
||||
AccessibilityEventInfo evtInfAdded(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_ADDED);
|
||||
aams->SendEvent(evtInfAdded, aams->GetCurrentAccountId());
|
||||
if (a11yWindowInfoAdded.IsFocused()) {
|
||||
winMgr.SetActiveWindow(windowInfo->currentWindowInfo_->wid_);
|
||||
}
|
||||
break;
|
||||
@ -51,30 +51,30 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::Accessibility
|
||||
winMgr.SetInputFocusedWindow(INVALID_WINDOW_ID);
|
||||
}
|
||||
winMgr.a11yWindows_.erase(windowInfo->currentWindowInfo_->wid_);
|
||||
AccessibilityEventInfo evtInf(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_REMOVED);
|
||||
aams->SendEvent(evtInf, aams->GetCurrentAccountId());
|
||||
AccessibilityEventInfo evtInfRemoved(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_REMOVED);
|
||||
aams->SendEvent(evtInfRemoved, aams->GetCurrentAccountId());
|
||||
break;
|
||||
}
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_BOUNDS: {
|
||||
AccessibilityEventInfo evtInf(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_BOUNDS);
|
||||
aams->SendEvent(evtInf, aams->GetCurrentAccountId());
|
||||
AccessibilityEventInfo evtInfBounds(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_BOUNDS);
|
||||
aams->SendEvent(evtInfBounds, aams->GetCurrentAccountId());
|
||||
break;
|
||||
}
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_ACTIVE:
|
||||
if (!winMgr.a11yWindows_.count(windowInfo->currentWindowInfo_->wid_)) {
|
||||
auto a11yWindowInfo = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfo);
|
||||
auto a11yWindowInfoActive = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfoActive);
|
||||
}
|
||||
winMgr.SetActiveWindow(windowInfo->currentWindowInfo_->wid_);
|
||||
break;
|
||||
case Rosen::WindowUpdateType::WINDOW_UPDATE_FOCUSED: {
|
||||
if (!winMgr.a11yWindows_.count(windowInfo->currentWindowInfo_->wid_)) {
|
||||
auto a11yWindowInfo = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfo);
|
||||
auto a11yWindowInfoFocused = winMgr.CreateAccessibilityWindowInfo(*windowInfo);
|
||||
winMgr.a11yWindows_.emplace(windowInfo->currentWindowInfo_->wid_, a11yWindowInfoFocused);
|
||||
}
|
||||
winMgr.SetActiveWindow(windowInfo->currentWindowInfo_->wid_);
|
||||
AccessibilityEventInfo evtInf(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_FOCUSED);
|
||||
aams->SendEvent(evtInf, aams->GetCurrentAccountId());
|
||||
AccessibilityEventInfo evtInfFocused(windowInfo->currentWindowInfo_->wid_, WINDOW_UPDATE_FOCUSED);
|
||||
aams->SendEvent(evtInfFocused, aams->GetCurrentAccountId());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -208,7 +208,7 @@ void AccessibilityWindowInfoManager::SetAccessibilityFocusedWindow(int windowId)
|
||||
}
|
||||
|
||||
if (!a11yWindows_.count(windowId)) {
|
||||
HILOG_WARN("Window id is not found");
|
||||
HILOG_ERROR("Window id is not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ bool AccessibleAbilityChannelStubImpl::SearchElementInfoByAccessibilityId(const
|
||||
return false;
|
||||
}
|
||||
connection->GetProxy()->SearchElementInfoByAccessibilityId(elementId, requestId, callback, mode);
|
||||
HILOG_ERROR("AccessibleAbilityChannelStubImpl::SearchElementInfoByAccessibilityId successfully");
|
||||
HILOG_DEBUG("AccessibleAbilityChannelStubImpl::SearchElementInfoByAccessibilityId successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -84,6 +84,10 @@ bool AccessibleAbilityChannelStubImpl::SearchElementInfosByText(const int access
|
||||
HILOG_ERROR("AccessibleAbilityChannelStubImpl::SearchElementInfosByText failed: no capability");
|
||||
return false;
|
||||
}
|
||||
if (!connection->GetProxy()) {
|
||||
HILOG_ERROR("get proxy failed");
|
||||
return false;
|
||||
}
|
||||
connection->GetProxy()->SearchElementInfosByText(elementId, text, requestId, callback);
|
||||
return true;
|
||||
}
|
||||
@ -106,6 +110,10 @@ bool AccessibleAbilityChannelStubImpl::FindFocusedElementInfo(const int accessib
|
||||
HILOG_ERROR("AccessibleAbilityChannelStubImpl::FindFocusedElementInfo failed: no capability");
|
||||
return false;
|
||||
}
|
||||
if (!connection->GetProxy()) {
|
||||
HILOG_ERROR("get proxy failed");
|
||||
return false;
|
||||
}
|
||||
connection->GetProxy()->FindFocusedElementInfo(elementId, focusType, requestId, callback);
|
||||
return true;
|
||||
}
|
||||
@ -303,7 +311,7 @@ void AccessibleAbilityConnection::OnAbilityConnectDone(const AppExecFwk::Element
|
||||
elementName_ = element;
|
||||
|
||||
if (resultCode != NO_ERROR) {
|
||||
HILOG_DEBUG("Connect failed!");
|
||||
HILOG_ERROR("Connect failed!");
|
||||
accountData_->RemoveEnabledAbility(elementName_);
|
||||
accountData_->RemoveConnectingA11yAbility(elementName_);
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->UpdateAbilities();
|
||||
@ -499,15 +507,10 @@ AAFwk::Want CreateWant(AppExecFwk::ElementName& element)
|
||||
void AccessibleAbilityConnection::Disconnect()
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
// temp deal:
|
||||
#if 1
|
||||
if (AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(this) != ERR_OK) {
|
||||
HILOG_ERROR("Disconnect failed!");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
OnAbilityDisconnectDone(elementName_, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AccessibleAbilityConnection::Connect(const AppExecFwk::ElementName &element)
|
||||
|
@ -200,11 +200,18 @@ uint32_t AccessibleAbilityManagerService::RegisterCaptionPropertyCallback(
|
||||
}
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is null");
|
||||
return 0;
|
||||
}
|
||||
if (!callback->AsObject()) {
|
||||
HILOG_ERROR("object is null");
|
||||
return 0;
|
||||
}
|
||||
callback->AsObject()->AddDeathRecipient(captionPropertyCallbackDeathRecipient_);
|
||||
accountData->AddCaptionPropertyCallback(callback);
|
||||
printf("accountData AddCaptionPropertyCallback %d\n", accountData->GetCaptionPropertyCallbacks().size());
|
||||
HILOG_INFO("AccessibleAbilityManagerService::RegisterCaptionPropertyCallback successfully");
|
||||
|
||||
HILOG_DEBUG("the size of caption property callbacks is %{public}d",
|
||||
accountData->GetCaptionPropertyCallbacks().size());
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
@ -230,6 +237,14 @@ uint32_t AccessibleAbilityManagerService::RegisterStateCallback(
|
||||
}
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
HILOG_ERROR("callback is null");
|
||||
return 0;
|
||||
}
|
||||
if (!callback->AsObject()) {
|
||||
HILOG_ERROR("object is null");
|
||||
return 0;
|
||||
}
|
||||
callback->AsObject()->AddDeathRecipient(stateCallbackDeathRecipient_);
|
||||
accountData->AddStateCallback(callback);
|
||||
HILOG_INFO("AccessibleAbilityManagerService::RegisterStateCallback successfully");
|
||||
@ -449,14 +464,18 @@ void AccessibleAbilityManagerService::ClearFocus(int windowId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
sptr<AccessibilityWindowConnection> connection = GetAccessibilityWindowConnection(windowId);
|
||||
connection->GetProxy()->ClearFocus();
|
||||
if (connection && connection->GetProxy()) {
|
||||
connection->GetProxy()->ClearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::OutsideTouch(int windowId)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
sptr<AccessibilityWindowConnection> connection = GetAccessibilityWindowConnection(windowId);
|
||||
connection->GetProxy()->OutsideTouch();
|
||||
if (connection && connection->GetProxy()) {
|
||||
connection->GetProxy()->OutsideTouch();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::OnChanging(bool selfChange, Uri& uri)
|
||||
@ -569,6 +588,10 @@ void AccessibleAbilityManagerService::PackageRemoved(std::string& bundleName)
|
||||
for (auto& connectedAbility : connectedAbilities) {
|
||||
std::size_t firstPos = connectedAbility.first.find_first_of('/') + 1;
|
||||
std::size_t endPos = connectedAbility.first.find_last_of('/');
|
||||
if (endPos <= firstPos) {
|
||||
HILOG_ERROR("it's a wrong ability and the uri is %{public}s", connectedAbility.first.c_str());
|
||||
continue;
|
||||
}
|
||||
std::string connectedBundleName = connectedAbility.first.substr(firstPos, endPos - firstPos);
|
||||
if (connectedBundleName == bundleName) {
|
||||
HILOG_DEBUG("Remove connected ability and it's bundle name is %{public}s", connectedBundleName.c_str());
|
||||
@ -734,10 +757,9 @@ void AccessibleAbilityManagerService::UpdateAbilities()
|
||||
if (!connection) {
|
||||
connection = new(std::nothrow) AccessibleAbilityConnection(accountData,
|
||||
connectCounter_++, installAbility);
|
||||
if (!connection) {
|
||||
HILOG_ERROR("connection is null");
|
||||
if (connection) {
|
||||
connection->Connect(element);
|
||||
}
|
||||
connection->Connect(element);
|
||||
}
|
||||
} else {
|
||||
HILOG_DEBUG("not in enabledAbilites list .");
|
||||
@ -804,15 +826,12 @@ void AccessibleAbilityManagerService::UpdateInputFilter()
|
||||
}
|
||||
HILOG_DEBUG("InputInterceptor flag is %{public}d", flag);
|
||||
|
||||
if (flag) {
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
} else if (inputInterceptor_ != nullptr) {
|
||||
HILOG_DEBUG("Has InputInterceptor before.");
|
||||
inputInterceptor_->SetAvailableFunctions(0);
|
||||
} else {
|
||||
HILOG_DEBUG("InputInterceptor is null.");
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
if (!inputInterceptor_) {
|
||||
HILOG_ERROR("inputInterceptor_ is null.");
|
||||
return;
|
||||
}
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
@ -828,12 +847,12 @@ void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
std::vector<sptr<Rosen::Display>> displays = AccessibilityDisplayManager::GetInstance().GetDisplays();
|
||||
|
||||
if (accountData->GetScreenMagnificationFlag()) {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(display->GetId());
|
||||
for (sptr<Rosen::Display> displayReg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(displayReg->GetId());
|
||||
}
|
||||
} else {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(display->GetId());
|
||||
for (sptr<Rosen::Display> displayUnreg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(displayUnreg->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ AAMSEventHandler::~AAMSEventHandler()
|
||||
|
||||
void AAMSEventHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
if (!event) {
|
||||
HILOG_ERROR("event is null");
|
||||
return;
|
||||
}
|
||||
HILOG_DEBUG("the eventId is %{public}d", event->GetInnerEventId());
|
||||
}
|
||||
} // namespace Accessibility
|
||||
|
@ -339,15 +339,12 @@ void AccessibleAbilityManagerService::UpdateInputFilter()
|
||||
}
|
||||
HILOG_DEBUG("InputFilter flag is %{public}d", flag);
|
||||
|
||||
if (flag) {
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
} else if (inputInterceptor_ != nullptr) {
|
||||
HILOG_DEBUG("Has InputInterceptor before.");
|
||||
inputInterceptor_->SetAvailableFunctions(0);
|
||||
} else {
|
||||
HILOG_DEBUG("InputInterceptor is null.");
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
if (!inputInterceptor_) {
|
||||
HILOG_ERROR("inputInterceptor_ is null.");
|
||||
return;
|
||||
}
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
@ -363,12 +360,12 @@ void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
std::vector<sptr<Rosen::Display>> displays = AccessibilityDisplayManager::GetInstance().GetDisplays();
|
||||
|
||||
if (accountData->GetScreenMagnificationFlag()) {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(display->GetId());
|
||||
for (sptr<Rosen::Display> displayReg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(displayReg->GetId());
|
||||
}
|
||||
} else {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(display->GetId());
|
||||
for (sptr<Rosen::Display> displayUnreg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(displayUnreg->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,15 +320,12 @@ void AccessibleAbilityManagerService::UpdateInputFilter()
|
||||
}
|
||||
HILOG_DEBUG("InputFilter flag is %{public}d", flag);
|
||||
|
||||
if (flag) {
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
} else if (inputInterceptor_ != nullptr) {
|
||||
HILOG_DEBUG("Has InputInterceptor before.");
|
||||
inputInterceptor_->SetAvailableFunctions(0);
|
||||
} else {
|
||||
HILOG_DEBUG("InputInterceptor is null.");
|
||||
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
|
||||
if (!inputInterceptor_) {
|
||||
HILOG_ERROR("inputInterceptor_ is null.");
|
||||
return;
|
||||
}
|
||||
inputInterceptor_->SetAvailableFunctions(flag);
|
||||
}
|
||||
|
||||
void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
@ -344,12 +341,12 @@ void AccessibleAbilityManagerService::UpdateMagnification()
|
||||
std::vector<sptr<Rosen::Display>> displays = AccessibilityDisplayManager::GetInstance().GetDisplays();
|
||||
|
||||
if (accountData->GetScreenMagnificationFlag()) {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(display->GetId());
|
||||
for (sptr<Rosen::Display> displayReg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Register(displayReg->GetId());
|
||||
}
|
||||
} else {
|
||||
for (sptr<Rosen::Display> display : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(display->GetId());
|
||||
for (sptr<Rosen::Display> displayUnreg : displays) {
|
||||
AccessibilityZoomProxy::GetInstance().Unregister(displayUnreg->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ const std::string CommonEventSupport::COMMON_EVENT_HWID_LOGOUT = "common.event.H
|
||||
const std::string CommonEventSupport::COMMON_EVENT_HWID_TOKEN_INVALID = "common.event.HWID_TOKEN_INVALID";
|
||||
|
||||
/**
|
||||
* Indicate the action of a common event about a logoff of a account ID.
|
||||
* Indicate the action of a common event about a logoff of an account ID.
|
||||
* This is a protected common event, which can be sent only by the system.
|
||||
*/
|
||||
const std::string CommonEventSupport::COMMON_EVENT_HWID_LOGOFF = "common.event.HWID_LOGOFF";
|
||||
|
@ -39,7 +39,7 @@ void AccessibleAbilityListenerTest::OnAbilityConnected()
|
||||
|
||||
void AccessibleAbilityListenerTest::OnAccessibilityEvent(const AccessibilityEventInfo& eventInfo)
|
||||
{
|
||||
HILOG_INFO("##############AamsStAbilityB1: An Accessibility event is received and eventType is %{public}d",
|
||||
HILOG_INFO("##############AamsStAbilityB1: An Accessibility event is received and eventType is %{public}u",
|
||||
eventInfo.GetEventType());
|
||||
std::optional<AccessibilityElementInfo> elementInfo;
|
||||
Accessibility::AccessibleAbility::GetInstance().GetRootElementInfo(elementInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user