From 7751c43726dc06c9d38faa78aa7109224ce2dd34 Mon Sep 17 00:00:00 2001 From: wwwyyyhhhh Date: Thu, 28 May 2026 16:04:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=82=B9=E5=87=BB=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?click=E4=BA=8B=E4=BB=B6arkweb=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?=E4=B8=BAtrue=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wwwyyyhhhh Co-authored-by: OpenCode+GLM5 --- ...accessibility_element_operator_manager.cpp | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/services/aams/src/accessibility_element_operator_manager.cpp b/services/aams/src/accessibility_element_operator_manager.cpp index f3b062e5c..11eb438ae 100644 --- a/services/aams/src/accessibility_element_operator_manager.cpp +++ b/services/aams/src/accessibility_element_operator_manager.cpp @@ -904,30 +904,11 @@ bool ElementOperatorManager::ExecuteActionOnAccessibilityFocused(ActionType acti actionArguments = AccessibilitySecurityComponentManager::GenerateActionArgumentsWithHMAC( action, focusedElementInfo.GetUniqueId(), focusedElementInfo.GetBundleName(), actionArguments); } - - sptr actionCallback = new(std::nothrow) ElementOperatorCallbackImpl(accountId_); - if (actionCallback == nullptr) { - HILOG_ERROR("Failed to create actionCallback."); - return false; - } - ffrt::future actionFuture = actionCallback->promise_.get_future(); - sptr elementOperator = nullptr; - GetElementOperatorConnection(connection, elementId, elementOperator, displayId); - RETURN_FALSE_IF_NULL(elementOperator); - elementOperator->ExecuteAction(elementId, action, actionArguments, GenerateRequestId(), actionCallback); - ffrt::future_status waitAction = actionFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR)); - if (waitAction != ffrt::future_status::ready) { - HILOG_ERROR("ExecuteAction Failed to wait result"); - return false; - } - HILOG_INFO("windowId[%{public}d], elementId[%{public}" PRId64 "], action[%{public}d, result: %{public}d", - windowId, elementId, action, actionCallback->executeActionResult_); - - if (!actionCallback->executeActionResult_ && (action == ActionType::ACCESSIBILITY_ACTION_CLICK)) { + + auto injectClickGesture = [&focusedElementInfo, &windowId, this]() -> bool { int32_t xPos = 0; int32_t yPos = 0; const Rect rect = focusedElementInfo.GetRectInScreen(); - int32_t windowId = focusWindowId_.load(); if (!CalculateClickPosition(rect, xPos, yPos, windowId)) { HILOG_ERROR("CalculateClickPosition failed, element is out of window bounds"); return false; @@ -950,6 +931,33 @@ bool ElementOperatorManager::ExecuteActionOnAccessibilityFocused(ActionType acti pointerEvent->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_UP); MMI::InputManager::GetInstance()->SimulateInputEvent(pointerEvent); return true; + }; + + if (action == ActionType::ACCESSIBILITY_ACTION_CLICK && !focusedElementInfo.IsClickable()) { + HILOG_DEBUG("ExecuteActionOnAccessibilityFocused, action is click, but element is not clickable"); + return injectClickGesture(); + } + + sptr actionCallback = new(std::nothrow) ElementOperatorCallbackImpl(accountId_); + if (actionCallback == nullptr) { + HILOG_ERROR("Failed to create actionCallback."); + return false; + } + ffrt::future actionFuture = actionCallback->promise_.get_future(); + sptr elementOperator = nullptr; + GetElementOperatorConnection(connection, elementId, elementOperator, displayId); + RETURN_FALSE_IF_NULL(elementOperator); + elementOperator->ExecuteAction(elementId, action, actionArguments, GenerateRequestId(), actionCallback); + ffrt::future_status waitAction = actionFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR)); + if (waitAction != ffrt::future_status::ready) { + HILOG_ERROR("ExecuteAction Failed to wait result"); + return false; + } + HILOG_INFO("windowId[%{public}d], elementId[%{public}" PRId64 "], action[%{public}d, result: %{public}d", + windowId, elementId, action, actionCallback->executeActionResult_); + + if (action == ActionType::ACCESSIBILITY_ACTION_CLICK && !actionCallback->executeActionResult_) { + return injectClickGesture(); } return actionCallback->executeActionResult_; } From 77ea88857ddcd611b5d32d722b64119b0b274b80 Mon Sep 17 00:00:00 2001 From: wwwyyyhhhh Date: Thu, 28 May 2026 20:23:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E5=85=A5pointer?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wwwyyyhhhh Co-authored-by: OpenCode+GLM5 --- services/aams/src/accessibility_element_operator_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/aams/src/accessibility_element_operator_manager.cpp b/services/aams/src/accessibility_element_operator_manager.cpp index 11eb438ae..753e7fe52 100644 --- a/services/aams/src/accessibility_element_operator_manager.cpp +++ b/services/aams/src/accessibility_element_operator_manager.cpp @@ -923,9 +923,9 @@ bool ElementOperatorManager::ExecuteActionOnAccessibilityFocused(ActionType acti item.SetDisplayY(yPos); item.SetRawDisplayX(xPos); item.SetRawDisplayY(yPos); - item.SetPointerId(1); + item.SetPointerId(0); pointerEvent->AddPointerItem(item); - pointerEvent->SetPointerId(1); + pointerEvent->SetPointerId(0); MMI::InputManager::GetInstance()->SimulateInputEvent(pointerEvent); pointerEvent->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_UP);