1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#ifndef INTERFACE_ACCESSIBLE_ABILITY_CHANNEL_H 17885b47fbSopenharmony_ci#define INTERFACE_ACCESSIBLE_ABILITY_CHANNEL_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include <string> 20885b47fbSopenharmony_ci#include <vector> 21885b47fbSopenharmony_ci#include <map> 22885b47fbSopenharmony_ci 23885b47fbSopenharmony_ci#include "accessibility_gesture_inject_path.h" 24885b47fbSopenharmony_ci#include "accessibility_window_info.h" 25885b47fbSopenharmony_ci#include "i_accessibility_element_operator_callback.h" 26885b47fbSopenharmony_ci#include "iremote_broker.h" 27885b47fbSopenharmony_ci 28885b47fbSopenharmony_cinamespace OHOS { 29885b47fbSopenharmony_cinamespace Accessibility { 30885b47fbSopenharmony_ciclass IAccessibleAbilityChannel : public IRemoteBroker { 31885b47fbSopenharmony_cipublic: 32885b47fbSopenharmony_ci DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibleAbilityChannel"); 33885b47fbSopenharmony_ci 34885b47fbSopenharmony_ci /** 35885b47fbSopenharmony_ci * @brief Searches elementInfo by accessibility id and set the result by callback. 36885b47fbSopenharmony_ci * @param accessibilityWindowId The id of accessibility window. 37885b47fbSopenharmony_ci * @param elementId The unique id of the component ID. 38885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 39885b47fbSopenharmony_ci * @param callback To transfer the element info to ASAC. 40885b47fbSopenharmony_ci * @param mode PREFETCH_PREDECESSORS: Need to make the parent element info also. 41885b47fbSopenharmony_ci * PREFETCH_SIBLINGS: Need to make the sister/brothers element info also. 42885b47fbSopenharmony_ci * PREFETCH_CHILDREN: Need to make the child element info also. 43885b47fbSopenharmony_ci * otherwise: Make the element information by elementId only. 44885b47fbSopenharmony_ci * @return Return RET_OK if search elementInfo successfully, otherwise refer to the RetError for the failure. 45885b47fbSopenharmony_ci */ 46885b47fbSopenharmony_ci virtual RetError SearchElementInfoByAccessibilityId(const ElementBasicInfo elementBasicInfo, 47885b47fbSopenharmony_ci const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, 48885b47fbSopenharmony_ci const int32_t mode, bool isFilter = false) = 0; 49885b47fbSopenharmony_ci 50885b47fbSopenharmony_ci /** 51885b47fbSopenharmony_ci * @brief Make the child element information by accessibility ID and filtered by text and 52885b47fbSopenharmony_ci * set the result by callback. 53885b47fbSopenharmony_ci * @param accessibilityWindowId The id of accessibility window. 54885b47fbSopenharmony_ci * @param elementId: The unique id of the component ID. 55885b47fbSopenharmony_ci * @param text Filter for the child components to matched with the text 56885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 57885b47fbSopenharmony_ci * @param callback To transfer the element info to ASAC and it defined by ASAC. 58885b47fbSopenharmony_ci * @return Return RET_OK if search elementInfo successfully, otherwise refer to the RetError for the failure. 59885b47fbSopenharmony_ci */ 60885b47fbSopenharmony_ci virtual RetError SearchElementInfosByText(const int32_t accessibilityWindowId, const int64_t elementId, 61885b47fbSopenharmony_ci const std::string &text, const int32_t requestId, 62885b47fbSopenharmony_ci const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 63885b47fbSopenharmony_ci 64885b47fbSopenharmony_ci /** 65885b47fbSopenharmony_ci * @brief Make the element information of the component focused by the focus type specified. 66885b47fbSopenharmony_ci * @param accessibilityWindowId The id of accessibility window. 67885b47fbSopenharmony_ci * @param elementId: The unique id of the component ID. 68885b47fbSopenharmony_ci * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus 69885b47fbSopenharmony_ci * FOCUS_TYPE_INPUT: text input focus 70885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 71885b47fbSopenharmony_ci * @param callback To transfer the element info to ASAC and it defined by ASAC. 72885b47fbSopenharmony_ci * @return Return RET_OK if find elementInfo successfully, otherwise refer to the RetError for the failure. 73885b47fbSopenharmony_ci */ 74885b47fbSopenharmony_ci virtual RetError FindFocusedElementInfo(const int32_t accessibilityWindowId, const int64_t elementId, 75885b47fbSopenharmony_ci const int32_t focusType, const int32_t requestId, 76885b47fbSopenharmony_ci const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 77885b47fbSopenharmony_ci 78885b47fbSopenharmony_ci /** 79885b47fbSopenharmony_ci * @brief Make the element info by current focus move direction. 80885b47fbSopenharmony_ci * @param accessibilityWindowId The id of accessibility window. 81885b47fbSopenharmony_ci * @param elementId: The unique id of the component ID. 82885b47fbSopenharmony_ci * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) 83885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 84885b47fbSopenharmony_ci * @param callback To transfer the element info to ASAC and it defined by ASAC. 85885b47fbSopenharmony_ci * @return Return RET_OK if search elementInfo successfully, otherwise refer to the RetError for the failure. 86885b47fbSopenharmony_ci */ 87885b47fbSopenharmony_ci virtual RetError FocusMoveSearch(const int32_t accessibilityWindowId, const int64_t elementId, 88885b47fbSopenharmony_ci const int32_t direction, const int32_t requestId, 89885b47fbSopenharmony_ci const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 90885b47fbSopenharmony_ci 91885b47fbSopenharmony_ci /** 92885b47fbSopenharmony_ci * @brief To perform action. 93885b47fbSopenharmony_ci * @param accessibilityWindowId The id of accessibility window. 94885b47fbSopenharmony_ci * @param elementId: The unique id of the component ID. 95885b47fbSopenharmony_ci * @param action Refer to [AccessibilityElementInfo.ActionType] 96885b47fbSopenharmony_ci * @param actionArguments The parameter for action type. 97885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 98885b47fbSopenharmony_ci * @param callback To transfer the node info to ASAC and it defined by ASAC. 99885b47fbSopenharmony_ci * @return Return RET_OK if perform action successfully, otherwise refer to the RetError for the failure. 100885b47fbSopenharmony_ci */ 101885b47fbSopenharmony_ci virtual RetError ExecuteAction(const int32_t accessibilityWindowId, const int64_t elementId, const int32_t action, 102885b47fbSopenharmony_ci const std::map<std::string, std::string> &actionArguments, const int32_t requestId, 103885b47fbSopenharmony_ci const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 104885b47fbSopenharmony_ci 105885b47fbSopenharmony_ci /** 106885b47fbSopenharmony_ci * @brief Get the result of Cursor Position through the proxy object. 107885b47fbSopenharmony_ci * @param accessibilityWindowId The target winid. 108885b47fbSopenharmony_ci * @param elementId The element Id. 109885b47fbSopenharmony_ci * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 110885b47fbSopenharmony_ci * @param callback To transfer the node info to ASAC and it defined by ASAC. 111885b47fbSopenharmony_ci * @return Return RET_OK if Cursor Position successfully, otherwise refer to the RetError for the failure. 112885b47fbSopenharmony_ci */ 113885b47fbSopenharmony_ci virtual RetError GetCursorPosition(const int32_t accessibilityWindowId, const int64_t elementId, 114885b47fbSopenharmony_ci const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 115885b47fbSopenharmony_ci 116885b47fbSopenharmony_ci /** 117885b47fbSopenharmony_ci * @brief Get the window information related with the event 118885b47fbSopenharmony_ci * @param windowId The window id. 119885b47fbSopenharmony_ci * @param windowInfo The window information. 120885b47fbSopenharmony_ci * @return Return RET_OK if obtains windowInfo successfully, otherwise refer to the RetError for the failure. 121885b47fbSopenharmony_ci */ 122885b47fbSopenharmony_ci virtual RetError GetWindow(const int32_t windowId, AccessibilityWindowInfo &windowInfo) = 0; 123885b47fbSopenharmony_ci 124885b47fbSopenharmony_ci /** 125885b47fbSopenharmony_ci * @brief Send switch information. 126885b47fbSopenharmony_ci * @param isEnable The switch info. 127885b47fbSopenharmony_ci * @return Return RET_OK if obtains windowInfo successfully, otherwise refer to the RetError for the failure. 128885b47fbSopenharmony_ci */ 129885b47fbSopenharmony_ci virtual RetError EnableScreenCurtain(bool isEnable) = 0; 130885b47fbSopenharmony_ci 131885b47fbSopenharmony_ci /** 132885b47fbSopenharmony_ci * @brief Obtains the list of interactive windows on the device, in the layers they are visible to users. 133885b47fbSopenharmony_ci * @param windows The information of windows. 134885b47fbSopenharmony_ci * @return Return RET_OK if obtains windowInfo successfully, otherwise refer to the RetError for the failure. 135885b47fbSopenharmony_ci */ 136885b47fbSopenharmony_ci virtual RetError GetWindows(std::vector<AccessibilityWindowInfo> &windows) = 0; 137885b47fbSopenharmony_ci 138885b47fbSopenharmony_ci /** 139885b47fbSopenharmony_ci * @brief Obtains the list of interactive windows on the device, in the layers they are visible to users. 140885b47fbSopenharmony_ci * @param displayId the id of display 141885b47fbSopenharmony_ci * @param windows The information of windows. 142885b47fbSopenharmony_ci * @return Return RET_OK if obtains windowInfo successfully, otherwise refer to the RetError for the failure. 143885b47fbSopenharmony_ci */ 144885b47fbSopenharmony_ci virtual RetError GetWindowsByDisplayId(const uint64_t displayId, 145885b47fbSopenharmony_ci std::vector<AccessibilityWindowInfo> &windows) = 0; 146885b47fbSopenharmony_ci 147885b47fbSopenharmony_ci /** 148885b47fbSopenharmony_ci * @brief Set the result of key press event. 149885b47fbSopenharmony_ci * @param handled The result of key press event, true if the event has been consumed, otherwise false. 150885b47fbSopenharmony_ci * @param sequence The sequence of key press event result. 151885b47fbSopenharmony_ci */ 152885b47fbSopenharmony_ci virtual void SetOnKeyPressEventResult(const bool handled, const int32_t sequence) = 0; 153885b47fbSopenharmony_ci 154885b47fbSopenharmony_ci /** 155885b47fbSopenharmony_ci * @brief Send simulation gesture. 156885b47fbSopenharmony_ci * @param gesturePath The gesture path to send. 157885b47fbSopenharmony_ci * @return Return RET_OK if gesture injection is successfully, otherwise refer to the RetError for the failure. 158885b47fbSopenharmony_ci */ 159885b47fbSopenharmony_ci virtual RetError SendSimulateGesture(const std::shared_ptr<AccessibilityGestureInjectPath>& gesturePath) = 0; 160885b47fbSopenharmony_ci 161885b47fbSopenharmony_ci /** 162885b47fbSopenharmony_ci * @brief Set target bundle names. 163885b47fbSopenharmony_ci * @param targetBundleNames The target bundle name 164885b47fbSopenharmony_ci * @return Return RET_OK if sets target bundle names successfully, otherwise refer to the RetError for the failure. 165885b47fbSopenharmony_ci */ 166885b47fbSopenharmony_ci virtual RetError SetTargetBundleName(const std::vector<std::string> &targetBundleNames) = 0; 167885b47fbSopenharmony_ci}; 168885b47fbSopenharmony_ci} // namespace Accessibility 169885b47fbSopenharmony_ci} // namespace OHOS 170885b47fbSopenharmony_ci#endif // INTERFACE_ACCESSIBLE_ABILITY_CHANNEL_H