1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ACCESSIBILITY_ABILITY_MANAGER_SERVICE_CLIENT_INTERFACE_H 17 #define ACCESSIBILITY_ABILITY_MANAGER_SERVICE_CLIENT_INTERFACE_H 18 19 #include <cstdint> 20 #include <list> 21 #include <vector> 22 #include "accessibility_ability_info.h" 23 #include "accessible_ability_manager_service_state_interface.h" 24 #include "accessible_ability_manager_service_caption_property_interface.h" 25 #include "accessibility_event_info.h" 26 #include "accessibility_element_operator_interface.h" 27 #include "iremote_broker.h" 28 #include "iremote_object.h" 29 #include "accessibility_caption.h" 30 #include "element_name.h" 31 32 namespace OHOS { 33 namespace Accessibility { 34 /* 35 * The class define the interface to call ABMS API. 36 */ 37 class IAccessibleAbilityManagerServiceClient : public IRemoteBroker { 38 public: 39 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibleAbilityManagerServiceClient"); 40 41 /** 42 * @brief Sends information about an accessibility event. 43 * @param uiEvent Indicates the accessibility event information specified by AccessibilityEventInfo. 44 * @param accountId The user id. 45 * @return true: send ok; otherwise is refused. 46 */ 47 virtual void SendEvent(const AccessibilityEventInfo& uiEvent, const int accountId) = 0; 48 49 /** 50 * @brief Register the state observer of AAMS. 51 * @param callback state observer 52 * @param accountId The user id. 53 * @return 0: Register ok; otherwise is refused. 54 */ 55 virtual uint32_t RegisterStateCallback( 56 const sptr<IAccessibleAbilityManagerServiceState>& callback, const int accountId) = 0; 57 58 virtual uint32_t RegisterCaptionPropertyCallback( 59 const sptr<IAccessibleAbilityManagerServiceCaptionProperty>& callback, const int accountId) = 0; 60 61 /** 62 * @brief Queries the list of accessibility abilities. 63 * @param accessibilityAbilityTypes Indicates the accessibility type specified by 64 * AccessibilityAbilityInfo#ACCESSIBILITY_ABILITY_TYPE_SPOKEN. 65 * @param stateType Indicates the accessibility ability status. 1 indicates that the ability is enabled; 66 * 2 indicates that the ability is disabled; 4 indicates that the ability has been installed. 67 * @return 68 */ 69 virtual std::vector<AccessibilityAbilityInfo> GetAbilityList(const uint32_t abilityTypes, 70 const int32_t stateType) = 0; 71 72 /** 73 * @brief Register the interaction operation, so the AA can get node info from ACE. 74 * @param windowId Window ID 75 * @param operation The callback object. 76 * @param accountId User ID 77 * @return 0: Succeed ; otherwise is failed. 78 */ 79 virtual void RegisterElementOperator( 80 const int windowId, const sptr<IAccessibilityElementOperator>& operation, const int accountId) = 0; 81 82 /** 83 * @brief Deregister the interaction operation. 84 * @param windowId Window ID 85 * @return 86 */ 87 virtual void DeregisterElementOperator(const int windowId) = 0; 88 89 virtual CaptionProperty GetCaptionProperty() = 0; 90 virtual bool GetEnabledState() = 0; 91 virtual bool GetCaptionState() = 0; 92 virtual bool GetTouchGuideState() = 0; 93 virtual bool GetGestureState() = 0; 94 virtual bool GetKeyEventObserverState() = 0; 95 96 virtual bool SetCaptionProperty(const CaptionProperty& caption) = 0; 97 virtual bool SetCaptionState(const bool state) = 0; 98 virtual bool SetEnabled(const bool state) = 0; 99 virtual bool SetTouchGuideState(const bool state) = 0; 100 virtual bool SetGestureState(const bool state) = 0; 101 virtual bool SetKeyEventObserverState(const bool state) = 0; 102 103 virtual bool SetEnabledObj(std::map<std::string, AppExecFwk::ElementName> it) = 0; 104 virtual std::map<std::string, AppExecFwk::ElementName> GetEnabledAbilities() = 0; 105 virtual std::vector<AccessibilityAbilityInfo> GetInstalledAbilities() = 0; 106 107 virtual bool DisableAbilities(std::map<std::string, AppExecFwk::ElementName> it) =0; 108 virtual int GetActiveWindow() = 0; 109 110 virtual bool RegisterUITestAbilityConnectionClient(const sptr<IRemoteObject>& obj) = 0; 111 virtual bool DeregisterUITestAbilityConnectionClient() = 0; 112 113 enum class Message { 114 SEND_EVENT = 0, 115 REGISTER_STATE_CALLBACK, 116 GET_ABILITYLIST, 117 REGISTER_INTERACTION_CONNECTION, 118 DEREGISTER_INTERACTION_CONNECTION, 119 GET_CAPTION_PROPERTY, 120 SET_CAPTION_PROPERTY, 121 SET_CAPTION_STATE, 122 SET_ENABLED, 123 REGISTER_CAPTION_PROPERTY_CALLBACK, 124 GET_ENABLED, 125 GET_CAPTION_STATE, 126 SET_TOUCH_GUIDE_STATE, 127 SET_GESTURE_STATE, 128 SET_KEY_EVENT_OBSERVE_STATE, 129 GET_TOUCH_GUIDE_STATE, 130 GET_GESTURE_STATE, 131 GET_KEY_EVENT_OBSERVE_STATE, 132 SET_ENABLED_OBJECT, 133 GET_ENABLED_OBJECT, 134 GET_INSTALLED, 135 DISABLE_ABILITIES, 136 REGISTER_UITEST_ABILITY_CONNECTION_CLIENT, 137 DEREGISTER_UITEST_ABILITY_CONNECTION_CLIENT, 138 GET_ACTIVE_WINDOW, 139 }; 140 }; 141 } // namespace Accessibility 142 } // namespace OHOS 143 #endif