mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-23 15:01:17 +00:00
!1398 焦点查询需判断window是否在窗口列表
Merge pull request !1398 from 姚子鹏/focusIsInWindow
This commit is contained in:
commit
6287e39880
@ -72,6 +72,7 @@ private:
|
|||||||
static sptr<AccessibleAbilityConnection> GetConnection(int32_t accountId, const std::string &clientName);
|
static sptr<AccessibleAbilityConnection> GetConnection(int32_t accountId, const std::string &clientName);
|
||||||
static RetError GetElementOperator(int32_t accountId, int32_t windowId, int32_t focusType,
|
static RetError GetElementOperator(int32_t accountId, int32_t windowId, int32_t focusType,
|
||||||
const std::string &clientName, sptr<IAccessibilityElementOperator> &elementOperator, const int32_t treeId);
|
const std::string &clientName, sptr<IAccessibilityElementOperator> &elementOperator, const int32_t treeId);
|
||||||
|
static bool CheckWinFromAwm(const int32_t windowId);
|
||||||
RetError GetWindows(uint64_t displayId, std::vector<AccessibilityWindowInfo> &windows) const;
|
RetError GetWindows(uint64_t displayId, std::vector<AccessibilityWindowInfo> &windows) const;
|
||||||
RetError TransmitActionToMmi(const int32_t action);
|
RetError TransmitActionToMmi(const int32_t action);
|
||||||
static void SetKeyCodeToMmi(std::shared_ptr<MMI::KeyEvent>& keyEvent, const bool isPress,
|
static void SetKeyCodeToMmi(std::shared_ptr<MMI::KeyEvent>& keyEvent, const bool isPress,
|
||||||
|
@ -74,7 +74,7 @@ RetError AccessibleAbilityChannel::SearchElementInfoByAccessibilityId(const Elem
|
|||||||
sptr<IAccessibilityElementOperator> elementOperator = nullptr;
|
sptr<IAccessibilityElementOperator> elementOperator = nullptr;
|
||||||
RetError ret = GetElementOperator(accountId, windowId, FOCUS_TYPE_INVALID, clientName,
|
RetError ret = GetElementOperator(accountId, windowId, FOCUS_TYPE_INVALID, clientName,
|
||||||
elementOperator, treeId);
|
elementOperator, treeId);
|
||||||
if (ret != RET_OK) {
|
if (ret != RET_OK || !CheckWinFromAwm(windowId)) {
|
||||||
HILOG_ERROR("Get elementOperator failed! accessibilityWindowId[%{public}d]", windowId);
|
HILOG_ERROR("Get elementOperator failed! accessibilityWindowId[%{public}d]", windowId);
|
||||||
std::vector<AccessibilityElementInfo> infos = {};
|
std::vector<AccessibilityElementInfo> infos = {};
|
||||||
callback->SetSearchElementInfoByAccessibilityIdResult(infos, requestId);
|
callback->SetSearchElementInfoByAccessibilityIdResult(infos, requestId);
|
||||||
@ -717,5 +717,19 @@ RetError AccessibleAbilityChannel::GetElementOperator(
|
|||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AccessibleAbilityChannel::CheckWinFromAwm(const int32_t windowId)
|
||||||
|
{
|
||||||
|
std::vector<AccessibilityWindowInfo> windowsFromAwm =
|
||||||
|
Singleton<AccessibilityWindowManager>::GetInstance().GetAccessibilityWindows();
|
||||||
|
if (!windowsFromAwm.empty()) {
|
||||||
|
for (const auto& window: windowsFromAwm) {
|
||||||
|
if (windowId == window.GetWindowId()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} // namespace Accessibility
|
} // namespace Accessibility
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user