diff --git a/bundle.json b/bundle.json index 9a6d916ec..081d92547 100644 --- a/bundle.json +++ b/bundle.json @@ -44,24 +44,29 @@ "third_party": [] }, "build": { - "sub_component": [ - "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", - "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability", - "//foundation/barrierfree/accessibility/interfaces/innerkits/acfwk:accessibilityconfig", - "//foundation/barrierfree/accessibility/interfaces/innerkits/asacfwk:accessibilityclient", - "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/interfaces/kits/napi:napi_packages", - "//foundation/barrierfree/accessibility/sa_profile:aams_sa_profile", - "//foundation/barrierfree/accessibility/sa_profile:accessibility_cfg" - ], + "group_type": { + "base_group": [ + "//foundation/barrierfree/accessibility/interfaces/kits/napi:napi_packages" + ], + "fwk_group": [ + "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability", + "//foundation/barrierfree/accessibility/interfaces/innerkits/acfwk:accessibilityconfig", + "//foundation/barrierfree/accessibility/interfaces/innerkits/asacfwk:accessibilityclient", + "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface" + ], + "service_group": [ + "//foundation/barrierfree/accessibility/sa_profile:aams_sa_profile", + "//foundation/barrierfree/accessibility/sa_profile:accessibility_cfg", + "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms" + ] + }, "inner_kits": [ { "type": "so", "name": "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability", "header": { "header_files": [ - "accessibility_gesture_result_listener.h", "accessibility_ui_test_ability.h", "accessible_ability_client.h", "accessible_ability_listener.h" diff --git a/services/interface/BUILD.gn b/common/interface/BUILD.gn similarity index 83% rename from services/interface/BUILD.gn rename to common/interface/BUILD.gn index 6d0a98de2..43150581c 100644 --- a/services/interface/BUILD.gn +++ b/common/interface/BUILD.gn @@ -13,14 +13,14 @@ import("//build/ohos.gni") -config("aams_interface_private_config") { +config("accessibility_interface_private_config") { visibility = [ ":*" ] include_dirs = [ "//foundation/barrierfree/accessibility/common/log/include" ] defines = [ - "AAMS_LOG_TAG = \"aams_interface\"", - "AAMS_LOG_DOMAIN = 0xD005202", + "AAMS_LOG_TAG = \"accessibility_interface\"", + "AAMS_LOG_DOMAIN = 0xD001D02", ] if (target_cpu == "arm") { @@ -28,14 +28,14 @@ config("aams_interface_private_config") { } } -config("aams_interface_public_config") { +config("accessibility_interface_public_config") { include_dirs = [ "include", "include/parcel", ] } -aams_interface_src = [ +accessibility_interface_src = [ "src/accessibility_element_operator_callback_proxy.cpp", "src/accessibility_element_operator_callback_stub.cpp", "src/accessibility_element_operator_proxy.cpp", @@ -56,7 +56,7 @@ aams_interface_src = [ "src/accessible_ability_manager_config_observer_stub.cpp", ] -aams_data_parcel_src = [ +accessibility_data_parcel_src = [ "src/parcel/accessibility_ability_info_parcel.cpp", "src/parcel/accessibility_caption_parcel.cpp", "src/parcel/accessibility_element_info_parcel.cpp", @@ -65,13 +65,13 @@ aams_data_parcel_src = [ "src/parcel/accessibility_gesture_inject_path_parcel.cpp", ] -ohos_shared_library("aams_interface") { - sources = aams_interface_src - sources += aams_data_parcel_src +ohos_shared_library("accessibility_interface") { + sources = accessibility_interface_src + sources += accessibility_data_parcel_src - configs = [ ":aams_interface_private_config" ] + configs = [ ":accessibility_interface_private_config" ] - public_configs = [ ":aams_interface_public_config" ] + public_configs = [ ":accessibility_interface_public_config" ] deps = [ "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common" ] diff --git a/services/interface/include/accessibility_element_operator_callback_proxy.h b/common/interface/include/accessibility_element_operator_callback_proxy.h similarity index 97% rename from services/interface/include/accessibility_element_operator_callback_proxy.h rename to common/interface/include/accessibility_element_operator_callback_proxy.h index c4be48e41..03b5ac2f7 100644 --- a/services/interface/include/accessibility_element_operator_callback_proxy.h +++ b/common/interface/include/accessibility_element_operator_callback_proxy.h @@ -29,14 +29,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibilityElementOperatorCallbackProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityElementOperatorCallbackProxy() override; @@ -44,7 +41,6 @@ public: * @brief Set the element information by accessibility id to AA. * @param infos The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ void SetSearchElementInfoByAccessibilityIdResult(const std::vector &infos, const int32_t requestId) override; @@ -53,7 +49,6 @@ public: * @brief Set the element information matched with text to AA. * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ void SetSearchElementInfoByTextResult(const std::vector &infos, const int32_t requestId) override; @@ -62,7 +57,6 @@ public: * @brief Set the element information matched with focus type to AA. * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -70,7 +64,6 @@ public: * @brief Set the element information by focus direction to AA. * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -78,7 +71,6 @@ public: * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; diff --git a/services/interface/include/accessibility_element_operator_callback_stub.h b/common/interface/include/accessibility_element_operator_callback_stub.h similarity index 98% rename from services/interface/include/accessibility_element_operator_callback_stub.h rename to common/interface/include/accessibility_element_operator_callback_stub.h index b5e6740c9..88327196b 100644 --- a/services/interface/include/accessibility_element_operator_callback_stub.h +++ b/common/interface/include/accessibility_element_operator_callback_stub.h @@ -31,14 +31,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibilityElementOperatorCallbackStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityElementOperatorCallbackStub(); @@ -48,7 +45,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessibility_element_operator_proxy.h b/common/interface/include/accessibility_element_operator_proxy.h similarity index 97% rename from services/interface/include/accessibility_element_operator_proxy.h rename to common/interface/include/accessibility_element_operator_proxy.h index 56539ad74..2eda63985 100644 --- a/services/interface/include/accessibility_element_operator_proxy.h +++ b/common/interface/include/accessibility_element_operator_proxy.h @@ -30,14 +30,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibilityElementOperatorProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityElementOperatorProxy() override; @@ -50,7 +47,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - * @sysCap Accessibility */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, @@ -62,7 +58,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string &text, const int32_t requestId, const sptr &callback) override; @@ -74,7 +69,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr &callback) override; @@ -85,7 +79,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr &callback) override; @@ -110,7 +103,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, @@ -119,8 +111,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() override; @@ -128,8 +118,6 @@ public: * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() override; private: diff --git a/services/interface/include/accessibility_element_operator_stub.h b/common/interface/include/accessibility_element_operator_stub.h similarity index 98% rename from services/interface/include/accessibility_element_operator_stub.h rename to common/interface/include/accessibility_element_operator_stub.h index a4e9ffa8a..aabd92ae9 100644 --- a/services/interface/include/accessibility_element_operator_stub.h +++ b/common/interface/include/accessibility_element_operator_stub.h @@ -30,14 +30,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibilityElementOperatorStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityElementOperatorStub(); @@ -47,7 +44,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessibility_enable_ability_lists_observer_proxy.h b/common/interface/include/accessibility_enable_ability_lists_observer_proxy.h similarity index 97% rename from services/interface/include/accessibility_enable_ability_lists_observer_proxy.h rename to common/interface/include/accessibility_enable_ability_lists_observer_proxy.h index 95f750860..6e660a27a 100644 --- a/services/interface/include/accessibility_enable_ability_lists_observer_proxy.h +++ b/common/interface/include/accessibility_enable_ability_lists_observer_proxy.h @@ -26,20 +26,16 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibilityEnableAbilityListsObserverProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityEnableAbilityListsObserverProxy() override; /** * @brief Receive the state notify from AAMS and send it to the observer registered. - * @return */ virtual void OnAccessibilityEnableAbilityListsChanged() override; private: diff --git a/services/interface/include/accessibility_enable_ability_lists_observer_stub.h b/common/interface/include/accessibility_enable_ability_lists_observer_stub.h similarity index 97% rename from services/interface/include/accessibility_enable_ability_lists_observer_stub.h rename to common/interface/include/accessibility_enable_ability_lists_observer_stub.h index 5842f0880..b3deecee8 100644 --- a/services/interface/include/accessibility_enable_ability_lists_observer_stub.h +++ b/common/interface/include/accessibility_enable_ability_lists_observer_stub.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibilityEnableAbilityListsObserverStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibilityEnableAbilityListsObserverStub() = default; @@ -43,7 +40,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessible_ability_channel_proxy.h b/common/interface/include/accessible_ability_channel_proxy.h similarity index 97% rename from services/interface/include/accessible_ability_channel_proxy.h rename to common/interface/include/accessible_ability_channel_proxy.h index 393bad522..a37000307 100644 --- a/services/interface/include/accessible_ability_channel_proxy.h +++ b/common/interface/include/accessible_ability_channel_proxy.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibleAbilityChannelProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityChannelProxy() = default; @@ -144,18 +141,15 @@ public: * @brief Set the result of key press event through the proxy object. * @param handled The result of key press event, true if the event has been consumed, otherwise false. * @param sequence The sequence of key press event result. - * @return */ virtual void SetOnKeyPressEventResult(const bool handled, const int32_t sequence) override; /** * @brief Send simulation gesture through the proxy object. - * @param requestId The sequence of simulation gesture. * @param gesturePath The gesture path to send. - * @return + * @return Return true if gesture injection is successfully, otherwise return false. */ - virtual void SendSimulateGesture(const int32_t requestId, - const std::shared_ptr& gesturePath) override; + virtual bool SendSimulateGesture(const std::shared_ptr& gesturePath) override; /** * @brief Set event types to filter. diff --git a/services/interface/include/accessible_ability_channel_stub.h b/common/interface/include/accessible_ability_channel_stub.h similarity index 99% rename from services/interface/include/accessible_ability_channel_stub.h rename to common/interface/include/accessible_ability_channel_stub.h index 4b579d002..b66a758a5 100644 --- a/services/interface/include/accessible_ability_channel_stub.h +++ b/common/interface/include/accessible_ability_channel_stub.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibleAbilityChannelStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityChannelStub(); @@ -43,7 +40,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessible_ability_client_proxy.h b/common/interface/include/accessible_ability_client_proxy.h similarity index 87% rename from services/interface/include/accessible_ability_client_proxy.h rename to common/interface/include/accessible_ability_client_proxy.h index cce3972d1..748e26266 100644 --- a/services/interface/include/accessible_ability_client_proxy.h +++ b/common/interface/include/accessible_ability_client_proxy.h @@ -30,21 +30,18 @@ public: * @brief Init accessible ability through the proxy object. * @param channel The object of IAccessibleAbilityChannel. * @param channelId The id of channel. - * @return */ virtual void Init(const sptr &channel, const int32_t channelId) override; /** * @brief Disconnect accessible ability through the proxy object. * @param channelId The id of channel. - * @return */ virtual void Disconnect(const int32_t channelId) override; /** * @brief Called when an accessibility event occurs through the proxy object. * @param eventInfo The information of accessible event. - * @return */ virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override; @@ -52,18 +49,9 @@ public: * @brief Called when a key event occurs through the proxy object. * @param keyEvent Indicates the key event to send. * @param sequence The sequence of the key event. - * @return */ virtual void OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence) override; - /** - * @brief Called when need to notify the result of simulation gesture through the proxy object. - * @param sequence The sequence of gesture. - * @param completedSuccessfully The result of gesture completion. - * @return - */ - virtual void OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) override; - private: /** * @brief Send the command data from proxy to stub in IPC mechanism. diff --git a/services/interface/include/accessible_ability_client_stub.h b/common/interface/include/accessible_ability_client_stub.h similarity index 95% rename from services/interface/include/accessible_ability_client_stub.h rename to common/interface/include/accessible_ability_client_stub.h index 7e0576dd0..edddad557 100644 --- a/services/interface/include/accessible_ability_client_stub.h +++ b/common/interface/include/accessible_ability_client_stub.h @@ -35,7 +35,6 @@ private: ErrCode HandleDisconnect(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnAccessibilityEvent(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnKeyPressEvent(MessageParcel &data, MessageParcel &reply); - ErrCode HandleOnGestureInjectResult(MessageParcel &data, MessageParcel &reply); using AccessibleAbilityClientFunc = ErrCode (AccessibleAbilityClientStub::*)(MessageParcel &data, MessageParcel &reply); diff --git a/services/interface/include/accessible_ability_manager_caption_observer_proxy.h b/common/interface/include/accessible_ability_manager_caption_observer_proxy.h similarity index 97% rename from services/interface/include/accessible_ability_manager_caption_observer_proxy.h rename to common/interface/include/accessible_ability_manager_caption_observer_proxy.h index cb3b293b0..2bbf63efd 100644 --- a/services/interface/include/accessible_ability_manager_caption_observer_proxy.h +++ b/common/interface/include/accessible_ability_manager_caption_observer_proxy.h @@ -26,21 +26,17 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibleAbilityManagerCaptionObserverProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerCaptionObserverProxy() override; /** * @brief Receive the caption property notify from AAMS and send it to the observer registered. * @param caption the caption property - * @return */ virtual void OnPropertyChanged(const AccessibilityConfig::CaptionProperty &property) override; private: diff --git a/services/interface/include/accessible_ability_manager_caption_observer_stub.h b/common/interface/include/accessible_ability_manager_caption_observer_stub.h similarity index 97% rename from services/interface/include/accessible_ability_manager_caption_observer_stub.h rename to common/interface/include/accessible_ability_manager_caption_observer_stub.h index 1ab99273b..185ac79a9 100644 --- a/services/interface/include/accessible_ability_manager_caption_observer_stub.h +++ b/common/interface/include/accessible_ability_manager_caption_observer_stub.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibleAbilityManagerCaptionObserverStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerCaptionObserverStub() = default; @@ -43,7 +40,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessible_ability_manager_config_observer_proxy.h b/common/interface/include/accessible_ability_manager_config_observer_proxy.h similarity index 98% rename from services/interface/include/accessible_ability_manager_config_observer_proxy.h rename to common/interface/include/accessible_ability_manager_config_observer_proxy.h index 8695654b6..d910075c4 100644 --- a/services/interface/include/accessible_ability_manager_config_observer_proxy.h +++ b/common/interface/include/accessible_ability_manager_config_observer_proxy.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibleAbilityManagerConfigObserverProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerConfigObserverProxy() override; diff --git a/services/interface/include/accessible_ability_manager_config_observer_stub.h b/common/interface/include/accessible_ability_manager_config_observer_stub.h similarity index 97% rename from services/interface/include/accessible_ability_manager_config_observer_stub.h rename to common/interface/include/accessible_ability_manager_config_observer_stub.h index 5f3b9c657..1e9526a3f 100644 --- a/services/interface/include/accessible_ability_manager_config_observer_stub.h +++ b/common/interface/include/accessible_ability_manager_config_observer_stub.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibleAbilityManagerConfigObserverStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerConfigObserverStub() = default; @@ -43,7 +40,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessible_ability_manager_service_proxy.h b/common/interface/include/accessible_ability_manager_service_proxy.h similarity index 99% rename from services/interface/include/accessible_ability_manager_service_proxy.h rename to common/interface/include/accessible_ability_manager_service_proxy.h index 451ebc746..b053a4a7b 100644 --- a/services/interface/include/accessible_ability_manager_service_proxy.h +++ b/common/interface/include/accessible_ability_manager_service_proxy.h @@ -29,14 +29,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibleAbilityManagerServiceProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerServiceProxy() override; @@ -84,7 +81,6 @@ public: /** * @brief Deregister the element operator. * @param windowId Window ID - * @return */ virtual void DeregisterElementOperator(const int32_t windowId) override; diff --git a/services/interface/include/accessible_ability_manager_service_stub.h b/common/interface/include/accessible_ability_manager_service_stub.h similarity index 99% rename from services/interface/include/accessible_ability_manager_service_stub.h rename to common/interface/include/accessible_ability_manager_service_stub.h index bce56ad91..6ff98bbdd 100644 --- a/services/interface/include/accessible_ability_manager_service_stub.h +++ b/common/interface/include/accessible_ability_manager_service_stub.h @@ -30,14 +30,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibleAbilityManagerServiceStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerServiceStub(); @@ -47,7 +44,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ virtual int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/accessible_ability_manager_state_observer_proxy.h b/common/interface/include/accessible_ability_manager_state_observer_proxy.h similarity index 97% rename from services/interface/include/accessible_ability_manager_state_observer_proxy.h rename to common/interface/include/accessible_ability_manager_state_observer_proxy.h index 16f7ba794..d6c8a3855 100644 --- a/services/interface/include/accessible_ability_manager_state_observer_proxy.h +++ b/common/interface/include/accessible_ability_manager_state_observer_proxy.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit AccessibleAbilityManagerStateObserverProxy(const sptr &object); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerStateObserverProxy() override; @@ -43,7 +40,6 @@ public: * state type: Refer to AccessibilityStateEventType. * value: STATE_ACCESSIBILITY_ENABLED/STATE_EXPLORATION_ENABLED/ * STATE_ACCESSIBILITY_DISABLED/STATE_EXPLORATION_DISABLED - * @return */ virtual void OnStateChanged(const uint32_t stateType) override; private: diff --git a/services/interface/include/accessible_ability_manager_state_observer_stub.h b/common/interface/include/accessible_ability_manager_state_observer_stub.h similarity index 97% rename from services/interface/include/accessible_ability_manager_state_observer_stub.h rename to common/interface/include/accessible_ability_manager_state_observer_stub.h index c88e4bbce..515a2ac41 100644 --- a/services/interface/include/accessible_ability_manager_state_observer_stub.h +++ b/common/interface/include/accessible_ability_manager_state_observer_stub.h @@ -26,14 +26,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ AccessibleAbilityManagerStateObserverStub(); /** * @brief destruct function - * @param - * @return */ virtual ~AccessibleAbilityManagerStateObserverStub() = default; @@ -43,7 +40,6 @@ public: * @param data The data of process communication * @param reply The response of IPC request * @param option The option parameter of IPC,such as: async,sync - * @return */ int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/interface/include/i_accessibility_element_operator.h b/common/interface/include/i_accessibility_element_operator.h similarity index 97% rename from services/interface/include/i_accessibility_element_operator.h rename to common/interface/include/i_accessibility_element_operator.h index f8a2b352a..cc3ee83df 100644 --- a/services/interface/include/i_accessibility_element_operator.h +++ b/common/interface/include/i_accessibility_element_operator.h @@ -42,7 +42,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - * @sysCap Accessibility */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, @@ -54,7 +53,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string &text, const int32_t requestId, const sptr &callback) = 0; @@ -66,7 +64,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr &callback) = 0; @@ -77,7 +74,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr &callback) = 0; @@ -102,7 +98,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, @@ -111,8 +106,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() = 0; @@ -120,8 +113,6 @@ public: * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() = 0; diff --git a/services/interface/include/i_accessibility_element_operator_callback.h b/common/interface/include/i_accessibility_element_operator_callback.h similarity index 97% rename from services/interface/include/i_accessibility_element_operator_callback.h rename to common/interface/include/i_accessibility_element_operator_callback.h index 68e1525a3..e1fbf0635 100644 --- a/services/interface/include/i_accessibility_element_operator_callback.h +++ b/common/interface/include/i_accessibility_element_operator_callback.h @@ -35,7 +35,6 @@ public: * @brief Set the element information by accessibility id to AA. * @param infos The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByAccessibilityIdResult(const std::vector &infos, const int32_t requestId) = 0; @@ -44,7 +43,6 @@ public: * @brief Set the element information matched with text to AA. * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByTextResult(const std::vector &infos, const int32_t requestId) = 0; @@ -53,7 +51,6 @@ public: * @brief Set the element information matched with focus type to AA. * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; @@ -61,7 +58,6 @@ public: * @brief Set the element information by focus direction to AA. * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; @@ -69,7 +65,6 @@ public: * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0; diff --git a/services/interface/include/i_accessibility_enable_ability_lists_observer.h b/common/interface/include/i_accessibility_enable_ability_lists_observer.h similarity index 98% rename from services/interface/include/i_accessibility_enable_ability_lists_observer.h rename to common/interface/include/i_accessibility_enable_ability_lists_observer.h index 805357db3..a71a53a18 100644 --- a/services/interface/include/i_accessibility_enable_ability_lists_observer.h +++ b/common/interface/include/i_accessibility_enable_ability_lists_observer.h @@ -26,7 +26,6 @@ public: /** * @brief Receive the state notify from AAMS and send it to the observer registered. - * @return */ virtual void OnAccessibilityEnableAbilityListsChanged() = 0; diff --git a/services/interface/include/i_accessible_ability_channel.h b/common/interface/include/i_accessible_ability_channel.h similarity index 97% rename from services/interface/include/i_accessible_ability_channel.h rename to common/interface/include/i_accessible_ability_channel.h index 9cfaf466c..2e5cfc4f3 100644 --- a/services/interface/include/i_accessible_ability_channel.h +++ b/common/interface/include/i_accessible_ability_channel.h @@ -137,18 +137,15 @@ public: * @brief Set the result of key press event. * @param handled The result of key press event, true if the event has been consumed, otherwise false. * @param sequence The sequence of key press event result. - * @return */ virtual void SetOnKeyPressEventResult(const bool handled, const int32_t sequence) = 0; /** * @brief Send simulation gesture. - * @param requestId The sequence of simulation gesture. * @param gesturePath The gesture path to send. - * @return + * @return Return true if gesture injection is successfully, otherwise return false. */ - virtual void SendSimulateGesture(const int32_t requestId, - const std::shared_ptr& gesturePath) = 0; + virtual bool SendSimulateGesture(const std::shared_ptr& gesturePath) = 0; /** * @brief Set event types to filter. diff --git a/services/interface/include/i_accessible_ability_client.h b/common/interface/include/i_accessible_ability_client.h similarity index 83% rename from services/interface/include/i_accessible_ability_client.h rename to common/interface/include/i_accessible_ability_client.h index b59be2d99..5d6c75c7d 100644 --- a/services/interface/include/i_accessible_ability_client.h +++ b/common/interface/include/i_accessible_ability_client.h @@ -32,21 +32,18 @@ public: * @brief Init accessible ability. * @param channel The object of IAccessibleAbilityChannel. * @param channelId The id of channel. - * @return */ virtual void Init(const sptr &channel, const int32_t channelId) = 0; /** * @brief Disconnect accessible ability. * @param channelId The id of channel. - * @return */ virtual void Disconnect(const int32_t channelId) = 0; /** * @brief Called when an accessibility event occurs. * @param eventInfo The information of accessible event. - * @return */ virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) = 0; @@ -54,24 +51,14 @@ public: * @brief Called when a key event occurs. * @param keyEvent Indicates the key event to send. * @param sequence The sequence of the key event. - * @return */ virtual void OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence) = 0; - /** - * @brief Called when need to notify the result of simulation gesture. - * @param sequence The sequence of gesture. - * @param completedSuccessfully The result of gesture completion. - * @return - */ - virtual void OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) = 0; - enum class Message { INIT = 0, DISCONNECT, ON_ACCESSIBILITY_EVENT, ON_KEY_PRESS_EVENT, - ON_GESTURE_INJECT_RESULT, }; }; } // namespace Accessibility diff --git a/services/interface/include/i_accessible_ability_manager_caption_observer.h b/common/interface/include/i_accessible_ability_manager_caption_observer.h similarity index 98% rename from services/interface/include/i_accessible_ability_manager_caption_observer.h rename to common/interface/include/i_accessible_ability_manager_caption_observer.h index 97cf64249..7f95c7b51 100644 --- a/services/interface/include/i_accessible_ability_manager_caption_observer.h +++ b/common/interface/include/i_accessible_ability_manager_caption_observer.h @@ -28,7 +28,6 @@ public: /** * @brief Receive the state notify from AAMS and send it to the observer registered. * @param caption The caption properties. - * @return */ virtual void OnPropertyChanged(const AccessibilityConfig::CaptionProperty &property) = 0; diff --git a/services/interface/include/i_accessible_ability_manager_config_observer.h b/common/interface/include/i_accessible_ability_manager_config_observer.h similarity index 100% rename from services/interface/include/i_accessible_ability_manager_config_observer.h rename to common/interface/include/i_accessible_ability_manager_config_observer.h diff --git a/services/interface/include/i_accessible_ability_manager_service.h b/common/interface/include/i_accessible_ability_manager_service.h similarity index 99% rename from services/interface/include/i_accessible_ability_manager_service.h rename to common/interface/include/i_accessible_ability_manager_service.h index efe9f80c4..2bf07fc9b 100644 --- a/services/interface/include/i_accessible_ability_manager_service.h +++ b/common/interface/include/i_accessible_ability_manager_service.h @@ -81,7 +81,6 @@ public: /** * @brief Deregister the element operator. * @param windowId Window ID - * @return */ virtual void DeregisterElementOperator(const int32_t windowId) = 0; diff --git a/services/interface/include/i_accessible_ability_manager_state_observer.h b/common/interface/include/i_accessible_ability_manager_state_observer.h similarity index 99% rename from services/interface/include/i_accessible_ability_manager_state_observer.h rename to common/interface/include/i_accessible_ability_manager_state_observer.h index 637346a68..ddf84cce8 100644 --- a/services/interface/include/i_accessible_ability_manager_state_observer.h +++ b/common/interface/include/i_accessible_ability_manager_state_observer.h @@ -31,7 +31,6 @@ public: * state type: Refer to AccessibilityStateEventType. * value: STATE_ACCESSIBILITY_ENABLED/STATE_EXPLORATION_ENABLED/ * STATE_ACCESSIBILITY_DISABLED/STATE_EXPLORATION_DISABLED - * @return */ virtual void OnStateChanged(const uint32_t stateType) = 0; diff --git a/services/interface/include/parcel/accessibility_ability_info_parcel.h b/common/interface/include/parcel/accessibility_ability_info_parcel.h similarity index 100% rename from services/interface/include/parcel/accessibility_ability_info_parcel.h rename to common/interface/include/parcel/accessibility_ability_info_parcel.h diff --git a/services/interface/include/parcel/accessibility_caption_parcel.h b/common/interface/include/parcel/accessibility_caption_parcel.h similarity index 100% rename from services/interface/include/parcel/accessibility_caption_parcel.h rename to common/interface/include/parcel/accessibility_caption_parcel.h diff --git a/services/interface/include/parcel/accessibility_element_info_parcel.h b/common/interface/include/parcel/accessibility_element_info_parcel.h similarity index 92% rename from services/interface/include/parcel/accessibility_element_info_parcel.h rename to common/interface/include/parcel/accessibility_element_info_parcel.h index 33783e77f..c5d918d27 100644 --- a/services/interface/include/parcel/accessibility_element_info_parcel.h +++ b/common/interface/include/parcel/accessibility_element_info_parcel.h @@ -28,15 +28,12 @@ class AccessibleActionParcel : public AccessibleAction, public Parcelable { public: /** * @brief Construct - * @param - * @return */ AccessibleActionParcel() = default; /** * @brief Construct * @param action The object of AccessibleAction - * @return */ AccessibleActionParcel(const AccessibleAction &action); @@ -50,7 +47,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return */ virtual bool Marshalling(Parcel &parcel) const override; @@ -71,36 +67,30 @@ class RangeInfoParcel : public RangeInfo, public Parcelable { public: /** * @brief Construct - * @param - * @return */ RangeInfoParcel() = default; /** * @brief Construct * @param rangeInfo The object of RangeInfo. - * @return */ RangeInfoParcel(const RangeInfo &rangeInfo); /** * @brief Used for IPC communication * @param parcel - * @return */ bool ReadFromParcel(Parcel &parcel); /** * @brief Used for IPC communication * @param parcel - * @return */ virtual bool Marshalling(Parcel &parcel) const override; /** * @brief Used for IPC communication * @param parcel - * @return */ static sptr Unmarshalling(Parcel &parcel); }; @@ -114,8 +104,6 @@ class GridInfoParcel : public GridInfo, public Parcelable { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -124,7 +112,6 @@ public: /** * @brief Construct * @param gridInfo The object of GridInfo. - * @return * @since 3 * @sysCap Accessibility */ @@ -133,7 +120,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return * @since 3 * @sysCap Accessibility */ @@ -142,7 +128,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return * @since 3 * @sysCap Accessibility */ @@ -151,8 +136,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -163,8 +146,6 @@ class GridItemInfoParcel : public GridItemInfo, public Parcelable { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -173,7 +154,6 @@ public: /** * @brief Construct * @param itemInfo The object of GridItemInfo. - * @return * @since 3 * @sysCap Accessibility */ @@ -182,8 +162,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -192,8 +170,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -202,8 +178,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -214,8 +188,6 @@ class RectParcel : public Rect, public Parcelable { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -224,7 +196,6 @@ public: /** * @brief Construct * @param rect The object of Rect. - * @return * @since 3 * @sysCap Accessibility */ @@ -233,7 +204,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return * @since 3 * @sysCap Accessibility */ @@ -242,7 +212,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return * @since 3 * @sysCap Accessibility */ @@ -251,7 +220,6 @@ public: /** * @brief Used for IPC communication * @param parcel - * @return * @since 3 * @sysCap Accessibility */ @@ -265,8 +233,6 @@ class AccessibilityElementInfoParcel : public AccessibilityElementInfo, public P public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -275,7 +241,6 @@ public: /** * @brief Construct * @param elementInfo The object of AccessibilityElementInfo. - * @return * @since 3 * @sysCap Accessibility */ diff --git a/services/interface/include/parcel/accessibility_event_info_parcel.h b/common/interface/include/parcel/accessibility_event_info_parcel.h similarity index 97% rename from services/interface/include/parcel/accessibility_event_info_parcel.h rename to common/interface/include/parcel/accessibility_event_info_parcel.h index f9ea5fd88..274925391 100644 --- a/services/interface/include/parcel/accessibility_event_info_parcel.h +++ b/common/interface/include/parcel/accessibility_event_info_parcel.h @@ -25,8 +25,6 @@ class AccessibilityEventInfoParcel : public AccessibilityEventInfo, public Parce public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -35,7 +33,6 @@ public: /** * @brief Construct * @param eventInfo The object of AccessibilityEventInfo. - * @return * @since 3 * @sysCap Accessibility */ diff --git a/services/interface/include/parcel/accessibility_gesture_inject_path_parcel.h b/common/interface/include/parcel/accessibility_gesture_inject_path_parcel.h similarity index 100% rename from services/interface/include/parcel/accessibility_gesture_inject_path_parcel.h rename to common/interface/include/parcel/accessibility_gesture_inject_path_parcel.h diff --git a/services/interface/include/parcel/accessibility_window_info_parcel.h b/common/interface/include/parcel/accessibility_window_info_parcel.h similarity index 100% rename from services/interface/include/parcel/accessibility_window_info_parcel.h rename to common/interface/include/parcel/accessibility_window_info_parcel.h diff --git a/services/interface/include/parcel/parcel_util.h b/common/interface/include/parcel/parcel_util.h similarity index 100% rename from services/interface/include/parcel/parcel_util.h rename to common/interface/include/parcel/parcel_util.h diff --git a/services/interface/src/accessibility_element_operator_callback_proxy.cpp b/common/interface/src/accessibility_element_operator_callback_proxy.cpp similarity index 100% rename from services/interface/src/accessibility_element_operator_callback_proxy.cpp rename to common/interface/src/accessibility_element_operator_callback_proxy.cpp diff --git a/services/interface/src/accessibility_element_operator_callback_stub.cpp b/common/interface/src/accessibility_element_operator_callback_stub.cpp similarity index 100% rename from services/interface/src/accessibility_element_operator_callback_stub.cpp rename to common/interface/src/accessibility_element_operator_callback_stub.cpp diff --git a/services/interface/src/accessibility_element_operator_proxy.cpp b/common/interface/src/accessibility_element_operator_proxy.cpp similarity index 100% rename from services/interface/src/accessibility_element_operator_proxy.cpp rename to common/interface/src/accessibility_element_operator_proxy.cpp diff --git a/services/interface/src/accessibility_element_operator_stub.cpp b/common/interface/src/accessibility_element_operator_stub.cpp similarity index 100% rename from services/interface/src/accessibility_element_operator_stub.cpp rename to common/interface/src/accessibility_element_operator_stub.cpp diff --git a/services/interface/src/accessibility_enable_ability_lists_observer_proxy.cpp b/common/interface/src/accessibility_enable_ability_lists_observer_proxy.cpp similarity index 100% rename from services/interface/src/accessibility_enable_ability_lists_observer_proxy.cpp rename to common/interface/src/accessibility_enable_ability_lists_observer_proxy.cpp diff --git a/services/interface/src/accessibility_enable_ability_lists_observer_stub.cpp b/common/interface/src/accessibility_enable_ability_lists_observer_stub.cpp similarity index 100% rename from services/interface/src/accessibility_enable_ability_lists_observer_stub.cpp rename to common/interface/src/accessibility_enable_ability_lists_observer_stub.cpp diff --git a/services/interface/src/accessible_ability_channel_proxy.cpp b/common/interface/src/accessible_ability_channel_proxy.cpp similarity index 98% rename from services/interface/src/accessible_ability_channel_proxy.cpp rename to common/interface/src/accessible_ability_channel_proxy.cpp index 6c76957a2..af232ebad 100644 --- a/services/interface/src/accessible_ability_channel_proxy.cpp +++ b/common/interface/src/accessible_ability_channel_proxy.cpp @@ -442,7 +442,7 @@ void AccessibleAbilityChannelProxy::SetOnKeyPressEventResult(const bool handled, } } -void AccessibleAbilityChannelProxy::SendSimulateGesture(const int32_t requestId, +bool AccessibleAbilityChannelProxy::SendSimulateGesture( const std::shared_ptr& gesturePath) { HILOG_DEBUG(); @@ -450,29 +450,27 @@ void AccessibleAbilityChannelProxy::SendSimulateGesture(const int32_t requestId, new(std::nothrow) AccessibilityGestureInjectPathParcel(*gesturePath); if (!path) { HILOG_ERROR("Failed to create path."); - return; + return false; } MessageParcel data; MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); + MessageOption option(MessageOption::TF_SYNC); if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(requestId)) { - HILOG_ERROR("requestId write error: %{public}d, ", requestId); - return; + return false; } if (!data.WriteStrongParcelable(path)) { HILOG_ERROR("WriteStrongParcelable failed"); - return; + return false; } if (!SendTransactCmd(IAccessibleAbilityChannel::Message::SEND_SIMULATE_GESTURE_PATH, data, reply, option)) { HILOG_ERROR("fail to send simulation gesture path"); + return false; } + return reply.ReadBool(); } bool AccessibleAbilityChannelProxy::SetEventTypeFilter(const uint32_t filter) diff --git a/services/interface/src/accessible_ability_channel_stub.cpp b/common/interface/src/accessible_ability_channel_stub.cpp similarity index 99% rename from services/interface/src/accessible_ability_channel_stub.cpp rename to common/interface/src/accessible_ability_channel_stub.cpp index 80655f8c9..30865f246 100644 --- a/services/interface/src/accessible_ability_channel_stub.cpp +++ b/common/interface/src/accessible_ability_channel_stub.cpp @@ -311,8 +311,6 @@ ErrCode AccessibleAbilityChannelStub::HandleSendSimulateGesturePath(MessageParce { HILOG_DEBUG(); - int32_t requestId = data.ReadInt32(); - sptr positions = data.ReadStrongParcelable(); if (!positions) { @@ -322,7 +320,8 @@ ErrCode AccessibleAbilityChannelStub::HandleSendSimulateGesturePath(MessageParce std::shared_ptr gesturePath = std::make_shared(*positions); - SendSimulateGesture(requestId, gesturePath); + bool result = SendSimulateGesture(gesturePath); + reply.WriteBool(result); return NO_ERROR; } diff --git a/services/interface/src/accessible_ability_client_proxy.cpp b/common/interface/src/accessible_ability_client_proxy.cpp similarity index 86% rename from services/interface/src/accessible_ability_client_proxy.cpp rename to common/interface/src/accessible_ability_client_proxy.cpp index e313157db..9668c4cc3 100644 --- a/services/interface/src/accessible_ability_client_proxy.cpp +++ b/common/interface/src/accessible_ability_client_proxy.cpp @@ -155,31 +155,5 @@ void AccessibleAbilityClientProxy::OnKeyPressEvent(const MMI::KeyEvent &keyEvent return; } } - -void AccessibleAbilityClientProxy::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - - HILOG_DEBUG(); - - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(sequence)) { - HILOG_ERROR("fail, sequence write int32 error"); - return; - } - if (!data.WriteBool(completedSuccessfully)) { - HILOG_ERROR("fail, completedSuccessfully write bool error"); - return; - } - - if (!SendTransactCmd(IAccessibleAbilityClient::Message::ON_GESTURE_INJECT_RESULT, data, reply, option)) { - HILOG_ERROR("OnGestureInjectResult fail"); - return; - } -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/interface/src/accessible_ability_client_stub.cpp b/common/interface/src/accessible_ability_client_stub.cpp similarity index 87% rename from services/interface/src/accessible_ability_client_stub.cpp rename to common/interface/src/accessible_ability_client_stub.cpp index 34bd290cb..ed94bd10e 100644 --- a/services/interface/src/accessible_ability_client_stub.cpp +++ b/common/interface/src/accessible_ability_client_stub.cpp @@ -31,8 +31,6 @@ AccessibleAbilityClientStub::AccessibleAbilityClientStub() &AccessibleAbilityClientStub::HandleOnAccessibilityEvent; memberFuncMap_[static_cast(IAccessibleAbilityClient::Message::ON_KEY_PRESS_EVENT)] = &AccessibleAbilityClientStub::HandleOnKeyPressEvent; - memberFuncMap_[static_cast(IAccessibleAbilityClient::Message::ON_GESTURE_INJECT_RESULT)] = - &AccessibleAbilityClientStub::HandleOnGestureInjectResult; } AccessibleAbilityClientStub::~AccessibleAbilityClientStub() @@ -117,15 +115,5 @@ ErrCode AccessibleAbilityClientStub::HandleOnKeyPressEvent(MessageParcel &data, OnKeyPressEvent(*keyEvent, sequence); return NO_ERROR; } - -ErrCode AccessibleAbilityClientStub::HandleOnGestureInjectResult(MessageParcel &data, MessageParcel &reply) -{ - HILOG_DEBUG(); - int32_t sequence = data.ReadInt32(); - bool completedSuccessfully = data.ReadBool(); - - OnGestureInjectResult(sequence, completedSuccessfully); - return NO_ERROR; -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/interface/src/accessible_ability_manager_caption_observer_proxy.cpp b/common/interface/src/accessible_ability_manager_caption_observer_proxy.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_caption_observer_proxy.cpp rename to common/interface/src/accessible_ability_manager_caption_observer_proxy.cpp diff --git a/services/interface/src/accessible_ability_manager_caption_observer_stub.cpp b/common/interface/src/accessible_ability_manager_caption_observer_stub.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_caption_observer_stub.cpp rename to common/interface/src/accessible_ability_manager_caption_observer_stub.cpp diff --git a/services/interface/src/accessible_ability_manager_config_observer_proxy.cpp b/common/interface/src/accessible_ability_manager_config_observer_proxy.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_config_observer_proxy.cpp rename to common/interface/src/accessible_ability_manager_config_observer_proxy.cpp diff --git a/services/interface/src/accessible_ability_manager_config_observer_stub.cpp b/common/interface/src/accessible_ability_manager_config_observer_stub.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_config_observer_stub.cpp rename to common/interface/src/accessible_ability_manager_config_observer_stub.cpp diff --git a/services/interface/src/accessible_ability_manager_service_proxy.cpp b/common/interface/src/accessible_ability_manager_service_proxy.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_service_proxy.cpp rename to common/interface/src/accessible_ability_manager_service_proxy.cpp diff --git a/services/interface/src/accessible_ability_manager_service_stub.cpp b/common/interface/src/accessible_ability_manager_service_stub.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_service_stub.cpp rename to common/interface/src/accessible_ability_manager_service_stub.cpp diff --git a/services/interface/src/accessible_ability_manager_state_observer_proxy.cpp b/common/interface/src/accessible_ability_manager_state_observer_proxy.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_state_observer_proxy.cpp rename to common/interface/src/accessible_ability_manager_state_observer_proxy.cpp diff --git a/services/interface/src/accessible_ability_manager_state_observer_stub.cpp b/common/interface/src/accessible_ability_manager_state_observer_stub.cpp similarity index 100% rename from services/interface/src/accessible_ability_manager_state_observer_stub.cpp rename to common/interface/src/accessible_ability_manager_state_observer_stub.cpp diff --git a/services/interface/src/parcel/accessibility_ability_info_parcel.cpp b/common/interface/src/parcel/accessibility_ability_info_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_ability_info_parcel.cpp rename to common/interface/src/parcel/accessibility_ability_info_parcel.cpp diff --git a/services/interface/src/parcel/accessibility_caption_parcel.cpp b/common/interface/src/parcel/accessibility_caption_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_caption_parcel.cpp rename to common/interface/src/parcel/accessibility_caption_parcel.cpp diff --git a/services/interface/src/parcel/accessibility_element_info_parcel.cpp b/common/interface/src/parcel/accessibility_element_info_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_element_info_parcel.cpp rename to common/interface/src/parcel/accessibility_element_info_parcel.cpp diff --git a/services/interface/src/parcel/accessibility_event_info_parcel.cpp b/common/interface/src/parcel/accessibility_event_info_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_event_info_parcel.cpp rename to common/interface/src/parcel/accessibility_event_info_parcel.cpp diff --git a/services/interface/src/parcel/accessibility_gesture_inject_path_parcel.cpp b/common/interface/src/parcel/accessibility_gesture_inject_path_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_gesture_inject_path_parcel.cpp rename to common/interface/src/parcel/accessibility_gesture_inject_path_parcel.cpp diff --git a/services/interface/src/parcel/accessibility_window_info_parcel.cpp b/common/interface/src/parcel/accessibility_window_info_parcel.cpp similarity index 100% rename from services/interface/src/parcel/accessibility_window_info_parcel.cpp rename to common/interface/src/parcel/accessibility_window_info_parcel.cpp diff --git a/common/log/include/hilog_wrapper.h b/common/log/include/hilog_wrapper.h index 427647bc4..2f8a4c6f6 100644 --- a/common/log/include/hilog_wrapper.h +++ b/common/log/include/hilog_wrapper.h @@ -41,7 +41,7 @@ #endif #ifndef AAMS_LOG_DOMAIN -#define AAMS_LOG_DOMAIN 0xD005000 +#define AAMS_LOG_DOMAIN 0xD001D04 #endif #ifndef AAMS_LOG_TAG diff --git a/frameworks/aafwk/include/accessibility_element_operator_callback_impl.h b/frameworks/aafwk/include/accessibility_element_operator_callback_impl.h index af494c435..40811c714 100644 --- a/frameworks/aafwk/include/accessibility_element_operator_callback_impl.h +++ b/frameworks/aafwk/include/accessibility_element_operator_callback_impl.h @@ -32,13 +32,11 @@ class AccessibilityElementOperatorCallbackImpl : public AccessibilityElementOper public: /** * @brief construct function - * @return */ AccessibilityElementOperatorCallbackImpl() = default; /** * @brief deconstruct function - * @return */ ~AccessibilityElementOperatorCallbackImpl() = default; @@ -46,7 +44,6 @@ public: * @brief Save the elements information searched in ACE side * @param infos The elements info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByAccessibilityIdResult(const std::vector &infos, const int32_t requestId) override; @@ -55,7 +52,6 @@ public: * @brief Save the elements information searched in ACE side * @param infos The elements info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByTextResult(const std::vector &infos, const int32_t requestId) override; @@ -64,7 +60,6 @@ public: * @brief Save the element information searched in ACE side * @param info The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -73,7 +68,6 @@ public: * @brief Save the element information searched in ACE side * @param info The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -81,7 +75,6 @@ public: * @brief Save the result of action executed in ACE. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; diff --git a/frameworks/aafwk/include/accessibility_ui_test_ability_impl.h b/frameworks/aafwk/include/accessibility_ui_test_ability_impl.h index c1cdc0d37..4f8938109 100644 --- a/frameworks/aafwk/include/accessibility_ui_test_ability_impl.h +++ b/frameworks/aafwk/include/accessibility_ui_test_ability_impl.h @@ -17,7 +17,7 @@ #define ACCESSIBILITY_UI_TEST_ABILITY_IMPL_H #include "accessibility_ui_test_ability.h" -#include "accessible_ability_manager_service_proxy.h" +#include "i_accessible_ability_manager_service.h" namespace OHOS { namespace Accessibility { @@ -25,15 +25,11 @@ class AccessibilityUITestAbilityImpl final : public AccessibilityUITestAbility { public: /** * @brief Construct - * @param - * @return */ AccessibilityUITestAbilityImpl(); /** * @brief Destruct - * @param - * @return */ ~AccessibilityUITestAbilityImpl() = default; @@ -76,14 +72,10 @@ public: /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePath The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - virtual bool InjectGesture(const uint32_t sequence, - const std::shared_ptr& gesturePath, - const std::shared_ptr& listener) override; + virtual bool InjectGesture(const std::shared_ptr& gesturePath) override; /** * @brief Obtains elementInfo of the accessible root node. @@ -241,12 +233,11 @@ public: * PREFETCH_SIBLINGS: cache the sister/brothers node info also. * PREFETCH_CHILDREN: cache the child node info also. * otherwise: no cache. - * @return - */ virtual void SetCacheMode(const int32_t cacheMode) override; private: - sptr serviceProxy_ = nullptr; + sptr serviceProxy_ = nullptr; }; } // namespace Accessibility } // namespace OHOS diff --git a/frameworks/aafwk/include/accessible_ability_channel_client.h b/frameworks/aafwk/include/accessible_ability_channel_client.h index 7d129f38e..7d84a63e7 100644 --- a/frameworks/aafwk/include/accessible_ability_channel_client.h +++ b/frameworks/aafwk/include/accessible_ability_channel_client.h @@ -64,11 +64,10 @@ public: /** * @brief Send simulate gesture to aams. - * @param sequenceNum The sequence of gesture. * @param gesturePath The path of gesture. + * @return Return true if gesture injection is successfully, otherwise return false. */ - void SendSimulateGesture(const int32_t sequenceNum, - const std::shared_ptr &gesturePath); + bool SendSimulateGesture(const std::shared_ptr &gesturePath); /** * @brief execute the action on the component. diff --git a/frameworks/aafwk/include/accessible_ability_client_impl.h b/frameworks/aafwk/include/accessible_ability_client_impl.h index dbfed984d..4586058b8 100644 --- a/frameworks/aafwk/include/accessible_ability_client_impl.h +++ b/frameworks/aafwk/include/accessible_ability_client_impl.h @@ -38,7 +38,6 @@ public: /** * @brief Gets remote object. - * @param * @return Remote object. */ virtual sptr GetRemoteObject() override; @@ -54,21 +53,18 @@ public: * @brief Init accessible ability. * @param channel The object of IAccessibleAbilityChannel. * @param channelId The id of channel. - * @return */ virtual void Init(const sptr &channel, const int32_t channelId) override; /** * @brief Disconnect accessible ability. * @param channelId The id of channel. - * @return */ virtual void Disconnect(const int32_t channelId) override; /** * @brief Called when an accessibility event occurs. * @param eventInfo The information of accessible event. - * @return */ virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override; @@ -76,18 +72,9 @@ public: * @brief Called when a key event occurs. * @param keyEvent Indicates the key event to send. * @param sequence The sequence of the key event. - * @return */ virtual void OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence) override; - /** - * @brief Called when need to notify the result of simulation gesture. - * @param sequence The sequence of gesture. - * @param completedSuccessfully The result of gesture completion. - * @return - */ - virtual void OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) override; - /** * @brief Obtains elementInfo of focus. * @param focusType The type of focus. It contains FOCUS_TYPE_INPUT and FOCUS_TYPE_ACCESSIBILITY. @@ -108,14 +95,10 @@ public: /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePath The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - virtual bool InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) override; + virtual bool InjectGesture(const std::shared_ptr &gesturePath) override; /** * @brief Obtains elementInfo of the accessible root node. @@ -272,14 +255,12 @@ public: * PREFETCH_SIBLINGS: cache the sister/brothers node info also. * PREFETCH_CHILDREN: cache the child node info also. * otherwise: no cache. - * @return - */ virtual void SetCacheMode(const int32_t cacheMode) override; /** * @brief Clean data. * @param remote The object access to AAMS. - * @return */ void ResetAAClient(const wptr &remote); @@ -295,27 +276,18 @@ private: AccessibleAbilityClientImpl &client_; }; - /** - * @brief Dispatch the result of simulate gesture. - * @param sequence The sequence of gesture. - * @param result The result of gesture completion. - * @return - */ - void DispatchGestureInjectResult(uint32_t sequence, bool result); bool GetCacheElementInfo(const int32_t windowId, const int32_t elementId, AccessibilityElementInfo &elementInfo) const; void SetCacheElementInfo(const int32_t windowId, const std::vector &elementInfos); - bool SearchElementInfoFromAce(const int32_t windowId, const int32_t elementId, - const int32_t mode, AccessibilityElementInfo &info); + const uint32_t mode, AccessibilityElementInfo &info); sptr deathRecipient_ = nullptr; sptr serviceProxy_ = nullptr; std::shared_ptr listener_ = nullptr; std::shared_ptr channelClient_ = nullptr; - std::map> gestureResultListenerInfos_; - int32_t cacheMode_ = 0; + uint32_t cacheMode_ = 0; int32_t cacheWindowId_ = -1; std::map cacheElementInfos_; }; diff --git a/frameworks/aafwk/src/accessibility_element_operator_callback_impl.cpp b/frameworks/aafwk/src/accessibility_element_operator_callback_impl.cpp index cf5453c70..56fda6225 100644 --- a/frameworks/aafwk/src/accessibility_element_operator_callback_impl.cpp +++ b/frameworks/aafwk/src/accessibility_element_operator_callback_impl.cpp @@ -21,46 +21,40 @@ namespace Accessibility { void AccessibilityElementOperatorCallbackImpl::SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) { - HILOG_INFO("Response [requestId:%{public}d]", requestId); + HILOG_DEBUG("Response [requestId:%{public}d]", requestId); accessibilityInfoResult_ = info; promise_.set_value(); - HILOG_DEBUG("Response [requestId:%{public}d] end", requestId); } void AccessibilityElementOperatorCallbackImpl::SetSearchElementInfoByTextResult( const std::vector &infos, const int32_t requestId) { - HILOG_INFO("Response [elementInfoSize:%{public}zu] [requestId:%{public}d]", - infos.size(), requestId); + HILOG_DEBUG("Response [elementInfoSize:%{public}zu] [requestId:%{public}d]", infos.size(), requestId); elementInfosResult_ = infos; promise_.set_value(); - HILOG_DEBUG("Response [requestId:%{public}d] end", requestId); } void AccessibilityElementOperatorCallbackImpl::SetSearchElementInfoByAccessibilityIdResult( const std::vector &infos, const int32_t requestId) { - HILOG_INFO("Response[elementInfoSize:%{public}zu] [requestId:%{public}d]", infos.size(), requestId); + HILOG_DEBUG("Response[elementInfoSize:%{public}zu] [requestId:%{public}d]", infos.size(), requestId); elementInfosResult_ = infos; promise_.set_value(); - HILOG_DEBUG("Response [requestId:%{public}d] end", requestId); } void AccessibilityElementOperatorCallbackImpl::SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) { - HILOG_INFO("Response [requestId:%{public}d]", requestId); + HILOG_DEBUG("Response [requestId:%{public}d]", requestId); accessibilityInfoResult_ = info; promise_.set_value(); - HILOG_DEBUG("Response [requestId:%{public}d] end", requestId); } void AccessibilityElementOperatorCallbackImpl::SetExecuteActionResult(const bool succeeded, const int32_t requestId) { - HILOG_INFO("Response [requestId:%{public}d] result[%{public}d]", requestId, succeeded); + HILOG_DEBUG("Response [requestId:%{public}d] result[%{public}d]", requestId, succeeded); executeActionResult_ = succeeded; promise_.set_value(); - HILOG_DEBUG("Response [requestId:%{public}d] end", requestId); } } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/frameworks/aafwk/src/accessibility_ui_test_ability_impl.cpp b/frameworks/aafwk/src/accessibility_ui_test_ability_impl.cpp index fb6aa0660..a64c1a272 100644 --- a/frameworks/aafwk/src/accessibility_ui_test_ability_impl.cpp +++ b/frameworks/aafwk/src/accessibility_ui_test_ability_impl.cpp @@ -46,16 +46,14 @@ AccessibilityUITestAbilityImpl::AccessibilityUITestAbilityImpl() HILOG_ERROR("Failed to get ISystemAbilityManager"); return; } - HILOG_DEBUG("ISystemAbilityManager obtained"); sptr object = samgr->GetSystemAbility(ACCESSIBILITY_MANAGER_SERVICE_ID); if (!object) { HILOG_ERROR("Get IAccessibleAbilityManagerService object from samgr failed"); return; } - HILOG_DEBUG("Get remote object ok"); - serviceProxy_ = iface_cast(object); + serviceProxy_ = iface_cast(object); if (!serviceProxy_) { HILOG_ERROR("Get aams proxy failed"); return; @@ -129,9 +127,7 @@ bool AccessibilityUITestAbilityImpl::GetFocusByElementInfo(const AccessibilityEl return aaClient->GetFocusByElementInfo(sourceInfo, focusType, elementInfo); } -bool AccessibilityUITestAbilityImpl::InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) +bool AccessibilityUITestAbilityImpl::InjectGesture(const std::shared_ptr &gesturePath) { HILOG_INFO(); sptr aaClient = AccessibleAbilityClient::GetInstance(); @@ -139,7 +135,7 @@ bool AccessibilityUITestAbilityImpl::InjectGesture(const uint32_t sequence, HILOG_ERROR("aaClient is nullptr"); return false; } - return aaClient->InjectGesture(sequence, gesturePath, listener); + return aaClient->InjectGesture(gesturePath); } bool AccessibilityUITestAbilityImpl::GetRoot(AccessibilityElementInfo &elementInfo) diff --git a/frameworks/aafwk/src/accessible_ability_channel_client.cpp b/frameworks/aafwk/src/accessible_ability_channel_client.cpp index bf4e7f6ed..fa6e81b3d 100644 --- a/frameworks/aafwk/src/accessible_ability_channel_client.cpp +++ b/frameworks/aafwk/src/accessible_ability_channel_client.cpp @@ -24,7 +24,7 @@ namespace OHOS { namespace Accessibility { namespace { - constexpr uint32_t TIME_OUT_OPERATOR = 500; + constexpr uint32_t TIME_OUT_OPERATOR = 5000; constexpr int32_t REQUEST_ID_MAX = 0x7FFFFFFF; } // namespace @@ -96,14 +96,15 @@ bool AccessibleAbilityChannelClient::FindFocusedElementInfo(int32_t accessibilit return true; } -void AccessibleAbilityChannelClient::SendSimulateGesture(const int32_t sequenceNum, +bool AccessibleAbilityChannelClient::SendSimulateGesture( const std::shared_ptr &gesturePath) { HILOG_INFO("[channelId:%{public}d]", channelId_); if (proxy_) { - proxy_->SendSimulateGesture(sequenceNum, gesturePath); + return proxy_->SendSimulateGesture(gesturePath); } else { HILOG_ERROR("Failed to connect to aams [channelId:%{public}d]", channelId_); + return false; } } diff --git a/frameworks/aafwk/src/accessible_ability_client_impl.cpp b/frameworks/aafwk/src/accessible_ability_client_impl.cpp index 94b16c205..9ff507c9a 100644 --- a/frameworks/aafwk/src/accessible_ability_client_impl.cpp +++ b/frameworks/aafwk/src/accessible_ability_client_impl.cpp @@ -170,16 +170,6 @@ void AccessibleAbilityClientImpl::OnKeyPressEvent(const MMI::KeyEvent &keyEvent, } } -void AccessibleAbilityClientImpl::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - HILOG_INFO("sequence[%{public}d] completedSuccessfully[%{public}d]", sequence, completedSuccessfully); - if (!channelClient_) { - HILOG_ERROR("The channel is invalid."); - return; - } - DispatchGestureInjectResult(sequence, completedSuccessfully); -} - bool AccessibleAbilityClientImpl::GetFocus(const int32_t focusType, AccessibilityElementInfo &elementInfo) { HILOG_INFO("focusType[%{public}d]", focusType); @@ -219,11 +209,9 @@ bool AccessibleAbilityClientImpl::GetFocusByElementInfo(const AccessibilityEleme return channelClient_->FindFocusedElementInfo(windowId, elementId, focusType, elementInfo); } -bool AccessibleAbilityClientImpl::InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) +bool AccessibleAbilityClientImpl::InjectGesture(const std::shared_ptr &gesturePath) { - HILOG_INFO("sequence[%{public}d]", sequence); + HILOG_INFO(); if (!gesturePath) { HILOG_ERROR("The gesturePath is null."); @@ -242,12 +230,7 @@ bool AccessibleAbilityClientImpl::InjectGesture(const uint32_t sequence, return false; } - if (listener) { - gestureResultListenerInfos_.insert(make_pair(sequence, listener)); - } - - channelClient_->SendSimulateGesture(sequence, gesturePath); - return true; + return channelClient_->SendSimulateGesture(gesturePath); } bool AccessibleAbilityClientImpl::GetRoot(AccessibilityElementInfo &elementInfo) @@ -564,38 +547,17 @@ void AccessibleAbilityClientImpl::ResetAAClient(const wptr &remot } } -void AccessibleAbilityClientImpl::DispatchGestureInjectResult(uint32_t sequence, bool result) -{ - HILOG_DEBUG(); - - if (gestureResultListenerInfos_.empty()) { - HILOG_ERROR("There is no information of gestureResultListener"); - return; - } - - std::shared_ptr gestureResultListener = nullptr; - auto it = gestureResultListenerInfos_.find(sequence); - if (it != gestureResultListenerInfos_.end()) { - HILOG_DEBUG("gestureResultListenerInfo has been found."); - gestureResultListener = gestureResultListenerInfos_[sequence]; - gestureResultListenerInfos_.erase(it); - } - - if (!gestureResultListener) { - HILOG_ERROR("There is no gestureResultListenerInfo in gestureResultListenerInfos_[%{public}d", sequence); - return; - } - - HILOG_INFO("sequence[%{public}d] result[%{public}d]", sequence, result); - gestureResultListener->OnGestureInjectResult(sequence, result); -} - void AccessibleAbilityClientImpl::SetCacheMode(const int32_t cacheMode) { HILOG_INFO("set cache mode: [%{public}d]", cacheMode); cacheWindowId_ = -1; cacheElementInfos_.clear(); - cacheMode_ = cacheMode & GET_SOURCE_PREFETCH_MODE; + if (cacheMode < 0) { + cacheMode_ = 0; + } else { + uint32_t mode = static_cast(cacheMode); + cacheMode_ = mode & static_cast(GET_SOURCE_PREFETCH_MODE); + } } bool AccessibleAbilityClientImpl::GetCacheElementInfo(const int32_t windowId, @@ -629,7 +591,7 @@ void AccessibleAbilityClientImpl::SetCacheElementInfo(const int32_t windowId, } bool AccessibleAbilityClientImpl::SearchElementInfoFromAce(const int32_t windowId, const int32_t elementId, - const int32_t mode, AccessibilityElementInfo &info) + const uint32_t mode, AccessibilityElementInfo &info) { if (!channelClient_) { HILOG_ERROR("The channel is invalid."); @@ -637,7 +599,8 @@ bool AccessibleAbilityClientImpl::SearchElementInfoFromAce(const int32_t windowI } std::vector elementInfos {}; - if (!channelClient_->SearchElementInfosByAccessibilityId(windowId, elementId, mode, elementInfos)) { + if (!channelClient_->SearchElementInfosByAccessibilityId( + windowId, elementId, static_cast(mode), elementInfos)) { HILOG_ERROR("search element info failed. windowId[%{public}d] elementId[%{public}d] mode[%{public}d]", windowId, elementId, mode); return false; diff --git a/frameworks/aafwk/test/BUILD.gn b/frameworks/aafwk/test/BUILD.gn index 5d3c9cd49..ce3b3b809 100755 --- a/frameworks/aafwk/test/BUILD.gn +++ b/frameworks/aafwk/test/BUILD.gn @@ -45,13 +45,14 @@ config("module_private_config") { "//base/account/os_account/frameworks/common/database/include", "//base/account/os_account/interfaces/innerkits/osaccount/native/include", "//base/hiviewdfx/hiview/adapter/utility/include/extra/singleton.h", + "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", "//foundation/arkui/napi/native_engine", "//foundation/multimodalinput/input/util/common/include", "//foundation/barrierfree/accessibility/services/aams/test/mock/include", ] defines = [ "AAMS_LOG_TAG = \"accessibility_test\"", - "AAMS_LOG_DOMAIN = 0xD005205", + "AAMS_LOG_DOMAIN = 0xD001D05", ] } @@ -93,6 +94,7 @@ ohos_unittest("accessible_ability_test") { "//foundation/barrierfree/accessibility/services/interface/src/parcel/accessibility_caption_parcel.cpp", "//foundation/barrierfree/accessibility/services/interface/src/parcel/accessibility_element_info_parcel.cpp", "//foundation/barrierfree/accessibility/services/interface/src/parcel/accessibility_event_info_parcel.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "unittest/accessibility_element_operator_callback_impl_test.cpp", "unittest/accessibility_ui_test_ability_impl_test.cpp", "unittest/accessible_ability_channel_client_test.cpp", @@ -105,8 +107,8 @@ ohos_unittest("accessible_ability_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//foundation/arkui/napi:ace_napi", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] diff --git a/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_proxy.h b/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_proxy.h index e7e0bda27..84b0715ab 100644 --- a/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_proxy.h +++ b/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_proxy.h @@ -47,9 +47,7 @@ public: MOCK_METHOD1(ExecuteCommonAction, bool(const int32_t action)); MOCK_METHOD2(SetOnKeyPressEventResult, void(const bool handled, const int32_t sequence)); - MOCK_METHOD2( - SendSimulateGesture, void(const int32_t sequenceNum, - const std::shared_ptr& gesturePath)); + MOCK_METHOD1(SendSimulateGesture, bool(const std::shared_ptr& gesturePath)); }; } // namespace Accessibility } // namespace OHOS diff --git a/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_stub.h b/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_stub.h index c10f92280..79a298bf2 100644 --- a/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_stub.h +++ b/frameworks/aafwk/test/mock/include/mock_accessible_ability_channel_stub.h @@ -47,8 +47,7 @@ public: MOCK_METHOD2(GetWindowsByDisplayId, bool(const uint64_t displayId, std::vector &windows)); MOCK_METHOD1(ExecuteCommonAction, bool(const int32_t action)); MOCK_METHOD2(SetOnKeyPressEventResult, void(const bool handled, const int32_t sequence)); - MOCK_METHOD2(SendSimulateGesture, void(const int32_t sequenceNum, - const std::shared_ptr& gesturePath)); + MOCK_METHOD1(SendSimulateGesture, bool(const std::shared_ptr& gesturePath)); MOCK_METHOD1(SetEventTypeFilter, bool(const uint32_t filter)); MOCK_METHOD1(SetTargetBundleName, bool(const std::vector &targetBundleNames)); }; diff --git a/frameworks/aafwk/test/mock/src/mock_accessible_ability_channel_proxy.cpp b/frameworks/aafwk/test/mock/src/mock_accessible_ability_channel_proxy.cpp index 61898d75f..8693187fc 100644 --- a/frameworks/aafwk/test/mock/src/mock_accessible_ability_channel_proxy.cpp +++ b/frameworks/aafwk/test/mock/src/mock_accessible_ability_channel_proxy.cpp @@ -124,11 +124,11 @@ void AccessibleAbilityChannelProxy::SetOnKeyPressEventResult(const bool handled, (void)sequence; } -void AccessibleAbilityChannelProxy::SendSimulateGesture(const int32_t sequenceNum, +bool AccessibleAbilityChannelProxy::SendSimulateGesture( const std::shared_ptr& gesturePath) { - (void)sequenceNum; (void)gesturePath; + return true; } MockAccessibleAbilityChannelProxy::MockAccessibleAbilityChannelProxy(const sptr& object) diff --git a/frameworks/aafwk/test/unittest/accessibility_ui_test_ability_impl_test.cpp b/frameworks/aafwk/test/unittest/accessibility_ui_test_ability_impl_test.cpp index 00aaf2d73..871b869c6 100644 --- a/frameworks/aafwk/test/unittest/accessibility_ui_test_ability_impl_test.cpp +++ b/frameworks/aafwk/test/unittest/accessibility_ui_test_ability_impl_test.cpp @@ -29,7 +29,6 @@ namespace Accessibility { namespace { const std::string TEST = "test"; constexpr int32_t FOCUS_TYPE = 1; - constexpr uint32_t SEQUENCE = 1; } // namespace class AccessibilityUITestAbilityImplTest : public ::testing::Test { @@ -171,8 +170,7 @@ HWTEST_F(AccessibilityUITestAbilityImplTest, InjectGesture_001, TestSize.Level1) return; } std::shared_ptr gesturePath = std::make_shared(); - std::shared_ptr listener = nullptr; - EXPECT_FALSE(instance_->InjectGesture(SEQUENCE, gesturePath, listener)); + EXPECT_FALSE(instance_->InjectGesture(gesturePath)); GTEST_LOG_(INFO) << "InjectGesture_001 end"; } diff --git a/frameworks/aafwk/test/unittest/accessible_ability_channel_client_test.cpp b/frameworks/aafwk/test/unittest/accessible_ability_channel_client_test.cpp index 6b0b23fd4..9b3be213e 100644 --- a/frameworks/aafwk/test/unittest/accessible_ability_channel_client_test.cpp +++ b/frameworks/aafwk/test/unittest/accessible_ability_channel_client_test.cpp @@ -29,7 +29,6 @@ namespace { constexpr int32_t SEQUENCE = 1; constexpr int32_t ACCESSIBILITY_WINDOW_ID = 1; constexpr int32_t FOCUS_TYPE = 1; - constexpr int32_t SEQUENCE_NUM = 1; constexpr int32_t ELEMENT_ID = 1; constexpr int32_t ACTION = 1; constexpr int32_t DIRECTION = 1; @@ -120,7 +119,7 @@ HWTEST_F(AccessibleAbilityChannelClientTest, SendSimulateGesture_001, TestSize.L } std::shared_ptr gesturePath = std::make_shared(); - instance_->SendSimulateGesture(SEQUENCE_NUM, gesturePath); + instance_->SendSimulateGesture(gesturePath); GTEST_LOG_(INFO) << "SendSimulateGesture_001 end"; } diff --git a/frameworks/aafwk/test/unittest/accessible_ability_client_impl_test.cpp b/frameworks/aafwk/test/unittest/accessible_ability_client_impl_test.cpp index 2a874d592..7d8d10e6f 100644 --- a/frameworks/aafwk/test/unittest/accessible_ability_client_impl_test.cpp +++ b/frameworks/aafwk/test/unittest/accessible_ability_client_impl_test.cpp @@ -107,30 +107,6 @@ HWTEST_F(AccessibleAbilityClientImplTest, OnAccessibilityEvent_001, TestSize.Lev GTEST_LOG_(INFO) << "OnAccessibilityEvent_001 end"; } -/** - * @tc.number: OnGestureInjectResult_001 - * @tc.name: OnGestureInjectResult - * @tc.desc: Test function OnGestureInjectResult - */ -HWTEST_F(AccessibleAbilityClientImplTest, OnGestureInjectResult_001, TestSize.Level1) -{ - GTEST_LOG_(INFO) << "OnGestureInjectResult_001 start"; - std::shared_ptr listener = std::make_shared(); - instance_->RegisterAbilityListener(listener); - - sptr stub = new MockAccessibleAbilityChannelStub(); - sptr channel = new MockAccessibleAbilityChannelProxy(stub->AsObject()); - - int32_t channelId = 1; - instance_->Init(channel, channelId); - if (!instance_) { - GTEST_LOG_(INFO) << "Cann't get AccessibleAbilityClientImpl instance_"; - return; - } - instance_->OnGestureInjectResult(SEQUENCE, true); - GTEST_LOG_(INFO) << "OnGestureInjectResult_001 end"; -} - /** * @tc.number: GetFocus_001 * @tc.name: GetFocus @@ -254,8 +230,7 @@ HWTEST_F(AccessibleAbilityClientImplTest, InjectGesture_001, TestSize.Level1) return; } std::shared_ptr gesturePath = std::make_shared(); - std::shared_ptr listener = nullptr; - EXPECT_FALSE(instance_->InjectGesture(SEQUENCE, gesturePath, listener)); + EXPECT_FALSE(instance_->InjectGesture(gesturePath)); GTEST_LOG_(INFO) << "InjectGesture_001 end"; } diff --git a/frameworks/acfwk/include/accessibility_config_impl.h b/frameworks/acfwk/include/accessibility_config_impl.h index 5ea2099dd..f9350eb5b 100644 --- a/frameworks/acfwk/include/accessibility_config_impl.h +++ b/frameworks/acfwk/include/accessibility_config_impl.h @@ -22,6 +22,7 @@ #include "accessible_ability_manager_caption_observer_stub.h" #include "accessible_ability_manager_config_observer_stub.h" #include "accessible_ability_manager_service_proxy.h" +#include "event_handler.h" namespace OHOS { namespace AccessibilityConfig { @@ -30,7 +31,10 @@ public: Impl(); ~Impl() = default; - void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer); + bool InitializeContext(); + + void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer, + const bool retFlag); void UnsubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer); void SubscribeEnableAbilityListsObserver(const std::shared_ptr &observer); @@ -43,8 +47,8 @@ public: void SetScreenMagnificationState(const bool state); void SetShortKeyState(const bool state); void SetMouseKeyState(const bool state); - void SetCaptionState(const bool state); - void SetCaptionProperty(const CaptionProperty &caption); + void SetCaptionsState(const bool state); + void SetCaptionsProperty(const CaptionProperty &caption); void SetMouseAutoClick(const int32_t time); void SetShortkeyTarget(const std::string &name); void SetHighContrastTextState(bool state); @@ -59,8 +63,8 @@ public: void GetScreenMagnificationState(bool &state); void GetShortKeyState(bool &state); void GetMouseKeyState(bool &state); - void GetCaptionState(bool &state); - void GetCaptionProperty(CaptionProperty &caption); + void GetCaptionsState(bool &state); + void GetCaptionsProperty(CaptionProperty &caption); void GetMouseAutoClick(int32_t &time); void GetShortkeyTarget(std::string &name); void GetInvertColorState(bool &state); @@ -84,12 +88,12 @@ public: void OnAccessibilityEnableAbilityListsChanged(); private: - class AccessibilityEnableAbilityListsObserverStubImpl : + class AccessibilityEnableAbilityListsObserverImpl : public Accessibility::AccessibilityEnableAbilityListsObserverStub { public: - explicit AccessibilityEnableAbilityListsObserverStubImpl(Impl &client) + explicit AccessibilityEnableAbilityListsObserverImpl(Impl &client) : client_(client) {} - ~AccessibilityEnableAbilityListsObserverStubImpl() = default; + ~AccessibilityEnableAbilityListsObserverImpl() = default; virtual void OnAccessibilityEnableAbilityListsChanged() override { @@ -168,6 +172,11 @@ private: }; bool ConnectToService(); + bool ConnectToServiceAsync(); + + bool RegisterToService(); + bool InitAccessibilityServiceProxy(); + void NotifyCaptionStateChanged(const std::vector> &observers, const bool state); void NotifyCaptionChanged(const std::vector> &observers, @@ -208,12 +217,18 @@ private: void UpdateAnimationOffEnabled(const bool enabled); void UpdateInvertColorEnabled(const bool enabled); void UpdateHighContrastTextEnabled(const bool enabled); + void NotifyDefaultConfigs(); + void NotifyImmediately(const CONFIG_ID id, const std::shared_ptr &observer); + void InitConfigValues(); + void InitEventHandler(); + static void OnParameterChanged(const char *key, const char *value, void *context); - sptr enableAbilityListsObserverStub_ = nullptr; sptr serviceProxy_ = nullptr; sptr captionObserver_ = nullptr; - sptr configObserver_; + sptr configObserver_ = nullptr; + sptr enableAbilityListsObserver_ = nullptr; + bool isInitialized_ = false; bool highContrastText_ = false; bool invertColor_ = false; bool animationOff_ = false; @@ -235,6 +250,9 @@ private: std::vector> enableAbilityListsObservers_; std::map>> configObservers_; std::mutex mutex_; + + std::shared_ptr runner_; + std::shared_ptr handler_; }; } // namespace AccessibilityConfig } // namespace OHOS diff --git a/frameworks/acfwk/src/accessibility_config.cpp b/frameworks/acfwk/src/accessibility_config.cpp index 21144af71..8f241b25e 100644 --- a/frameworks/acfwk/src/accessibility_config.cpp +++ b/frameworks/acfwk/src/accessibility_config.cpp @@ -36,11 +36,17 @@ AccessibilityConfig::~AccessibilityConfig() { } +bool AccessibilityConfig::InitializeContext() +{ + CHECK_IMPL_PTR(false) + return pImpl_->InitializeContext(); +} + void AccessibilityConfig::SubscribeConfigObserver(const CONFIG_ID id, - const std::shared_ptr &observer) + const std::shared_ptr &observer, const bool retFlag) { CHECK_IMPL_PTR() - pImpl_->SubscribeConfigObserver(id, observer); + pImpl_->SubscribeConfigObserver(id, observer, retFlag); } void AccessibilityConfig::UnsubscribeConfigObserver(const CONFIG_ID id, @@ -94,16 +100,16 @@ void AccessibilityConfig::SetMouseKeyState(const bool state) pImpl_->SetMouseKeyState(state); } -void AccessibilityConfig::SetCaptionState(const bool state) +void AccessibilityConfig::SetCaptionsState(const bool state) { CHECK_IMPL_PTR() - pImpl_->SetCaptionState(state); + pImpl_->SetCaptionsState(state); } -void AccessibilityConfig::SetCaptionProperty(const CaptionProperty &caption) +void AccessibilityConfig::SetCaptionsProperty(const CaptionProperty &caption) { CHECK_IMPL_PTR() - pImpl_->SetCaptionProperty(caption); + pImpl_->SetCaptionsProperty(caption); } void AccessibilityConfig::SetMouseAutoClick(const int32_t time) @@ -184,16 +190,16 @@ void AccessibilityConfig::GetMouseKeyState(bool &state) const pImpl_->GetMouseKeyState(state); } -void AccessibilityConfig::GetCaptionState(bool &state) const +void AccessibilityConfig::GetCaptionsState(bool &state) const { CHECK_IMPL_PTR() - pImpl_->GetCaptionState(state); + pImpl_->GetCaptionsState(state); } -void AccessibilityConfig::GetCaptionProperty(CaptionProperty &caption) const +void AccessibilityConfig::GetCaptionsProperty(CaptionProperty &caption) const { CHECK_IMPL_PTR() - pImpl_->GetCaptionProperty(caption); + pImpl_->GetCaptionsProperty(caption); } void AccessibilityConfig::GetMouseAutoClick(int32_t &time) const diff --git a/frameworks/acfwk/src/accessibility_config_impl.cpp b/frameworks/acfwk/src/accessibility_config_impl.cpp index e58cd6019..562e014b3 100644 --- a/frameworks/acfwk/src/accessibility_config_impl.cpp +++ b/frameworks/acfwk/src/accessibility_config_impl.cpp @@ -17,44 +17,154 @@ #include "hilog_wrapper.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" +#include "parameter.h" #include "system_ability_definition.h" -#include "accessibility_constants.h" namespace OHOS { namespace AccessibilityConfig { +namespace { + const char *VALUE_TRUE = "true"; + const char *VALUE_FALSE = "false"; + const char *PARAMETER_NAME = "accessibility.config.ready"; + constexpr int32_t CONFIG_PARAMETER_VALUE_SIZE = 10; +} // namespace + AccessibilityConfig::Impl::Impl() { HILOG_INFO(); - if (!ConnectToService()) { - HILOG_ERROR("Failed to connect to aams service"); - return; - } - captionObserver_ = new(std::nothrow) AccessibleAbilityManagerCaptionObserverImpl(*this); - if (!captionObserver_) { - HILOG_ERROR("Create captionObserver_ fail."); - return; - } - serviceProxy_->RegisterCaptionObserver(captionObserver_); +} - enableAbilityListsObserverStub_ = new(std::nothrow) AccessibilityEnableAbilityListsObserverStubImpl(*this); - if (!enableAbilityListsObserverStub_) { - HILOG_ERROR("Create enableAbilityListsObserverStub_ fail."); - return; +bool AccessibilityConfig::Impl::InitializeContext() +{ + HILOG_INFO(); + std::lock_guard lock(mutex_); + if (isInitialized_) { + HILOG_DEBUG("Context has initialized"); + return true; } - serviceProxy_->RegisterEnableAbilityListsObserver(enableAbilityListsObserverStub_); + InitEventHandler(); + isInitialized_ = ConnectToService(); - configObserver_ = new(std::nothrow) AccessibleAbilityManagerConfigObserverImpl(*this); - if (!configObserver_) { - HILOG_ERROR("Create configObserver_ fail."); + return isInitialized_; +} + +void AccessibilityConfig::Impl::OnParameterChanged(const char *key, const char *value, void *context) +{ + HILOG_INFO("Parameter key = [%{public}s] value = [%{public}s]", key, value); + + if (!key || std::strcmp(key, PARAMETER_NAME)) { + HILOG_WARN("not accessibility.config.ready callback"); return; } - serviceProxy_->RegisterConfigObserver(configObserver_); + + if (!value || std::strcmp(value, VALUE_TRUE)) { + HILOG_WARN("accessibility.config.ready value not true"); + return; + } + + if (!context) { + HILOG_ERROR("accessibility.config.ready context NULL"); + return; + } + + Impl* implPtr = static_cast(context); + (void)implPtr->ConnectToServiceAsync(); + HILOG_INFO("OnParameterChanged End"); } bool AccessibilityConfig::Impl::ConnectToService() +{ + char value[CONFIG_PARAMETER_VALUE_SIZE] = "default"; + int retSysParam = GetParameter(PARAMETER_NAME, VALUE_FALSE, value, CONFIG_PARAMETER_VALUE_SIZE); + if (retSysParam >= 0 && !std::strcmp(value, VALUE_TRUE)) { + // Accessibility service is ready + if (!InitAccessibilityServiceProxy()) { + return false; + } + + if (!RegisterToService()) { + return false; + } + + InitConfigValues(); + } else { + HILOG_INFO("Accessibility service is not ready, start watching"); + retSysParam = WatchParameter(PARAMETER_NAME, &OnParameterChanged, this); + if (retSysParam) { + HILOG_ERROR("Watch parameter failed, error = %{public}d", retSysParam); + return false; + } + } + + HILOG_INFO("ConnectToService Success"); + return true; +} + +bool AccessibilityConfig::Impl::ConnectToServiceAsync() +{ + if (handler_) { + handler_->PostTask(std::bind([this]() { + HILOG_INFO("ConnectToServiceAsync start."); + std::lock_guard lock(mutex_); + if (InitAccessibilityServiceProxy()) { + (void)RegisterToService(); + InitConfigValues(); + } + }), "ConnectToServiceAsync"); + return true; + } else { + HILOG_ERROR("Event handler is nullptr"); + return false; + } +} + +bool AccessibilityConfig::Impl::RegisterToService() +{ + if (!serviceProxy_) { + HILOG_ERROR("Service is not connected"); + return false; + } + + if (captionObserver_ && enableAbilityListsObserver_ && configObserver_) { + HILOG_INFO("Observers is registered"); + return true; + } + + if (!captionObserver_) { + captionObserver_ = new(std::nothrow) AccessibleAbilityManagerCaptionObserverImpl(*this); + if (!captionObserver_) { + HILOG_ERROR("Create captionObserver_ failed."); + return false; + } + serviceProxy_->RegisterCaptionObserver(captionObserver_); + } + + if (!enableAbilityListsObserver_) { + enableAbilityListsObserver_ = new(std::nothrow) AccessibilityEnableAbilityListsObserverImpl(*this); + if (!enableAbilityListsObserver_) { + HILOG_ERROR("Create enableAbilityListsObserver_ failed."); + return false; + } + serviceProxy_->RegisterEnableAbilityListsObserver(enableAbilityListsObserver_); + } + + if (!configObserver_) { + configObserver_ = new(std::nothrow) AccessibleAbilityManagerConfigObserverImpl(*this); + if (!configObserver_) { + HILOG_ERROR("Create configObserver_ failed."); + return false; + } + serviceProxy_->RegisterConfigObserver(configObserver_); + } + + HILOG_INFO("RegisterToService success"); + return true; +} + +bool AccessibilityConfig::Impl::InitAccessibilityServiceProxy() { if (serviceProxy_) { - HILOG_INFO("AAMS Service is connected"); + HILOG_INFO("Accessibility Service is connected"); return true; } @@ -80,15 +190,16 @@ bool AccessibilityConfig::Impl::ConnectToService() if ((object->IsProxyObject()) && (!object->AddDeathRecipient(deathRecipient_))) { HILOG_ERROR("Failed to add death recipient"); + return false; } - HILOG_DEBUG("Get remote object ok"); serviceProxy_ = iface_cast(object); if (!serviceProxy_) { HILOG_ERROR("IAccessibleAbilityManagerService iface_cast failed"); return false; } + HILOG_INFO("InitAccessibilityServiceProxy success"); return true; } @@ -101,6 +212,9 @@ void AccessibilityConfig::Impl::ResetService(const wptr &remote) if (object && (remote == object)) { object->RemoveDeathRecipient(deathRecipient_); serviceProxy_ = nullptr; + captionObserver_ = nullptr; + enableAbilityListsObserver_ = nullptr; + configObserver_ = nullptr; HILOG_DEBUG("Reset OK"); } } @@ -111,7 +225,7 @@ bool AccessibilityConfig::Impl::EnableAbility(const std::string &name, const uin HILOG_INFO("name = [%{private}s] capabilities = [%{private}u]", name.c_str(), capabilities); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return false; } return serviceProxy_->EnableAbility(name, capabilities); @@ -122,52 +236,52 @@ bool AccessibilityConfig::Impl::DisableAbility(const std::string &name) HILOG_INFO("name = [%{private}s]", name.c_str()); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return false; } return serviceProxy_->DisableAbility(name); } -void AccessibilityConfig::Impl::GetCaptionState(bool &state) +void AccessibilityConfig::Impl::GetCaptionsState(bool &state) { HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } state = serviceProxy_->GetCaptionState(); } -void AccessibilityConfig::Impl::GetCaptionProperty(CaptionProperty &caption) +void AccessibilityConfig::Impl::GetCaptionsProperty(CaptionProperty &caption) { HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } caption = serviceProxy_->GetCaptionProperty(); } -void AccessibilityConfig::Impl::SetCaptionProperty(const CaptionProperty& caption) +void AccessibilityConfig::Impl::SetCaptionsProperty(const CaptionProperty& caption) { HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetCaptionProperty(caption); } -void AccessibilityConfig::Impl::SetCaptionState(const bool state) +void AccessibilityConfig::Impl::SetCaptionsState(const bool state) { HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetCaptionState(state); @@ -212,7 +326,7 @@ void AccessibilityConfig::Impl::NotifyCaptionChanged( } void AccessibilityConfig::Impl::SubscribeConfigObserver(const CONFIG_ID id, - const std::shared_ptr &observer) + const std::shared_ptr &observer, const bool retFlag) { HILOG_INFO("id = [%{public}d]", static_cast(id)); std::lock_guard lock(mutex_); @@ -227,6 +341,10 @@ void AccessibilityConfig::Impl::SubscribeConfigObserver(const CONFIG_ID id, configObservers_.insert(std::make_pair(id, ob)); HILOG_INFO("configObservers->second.size%{public}zu", ob.size()); } + + if (retFlag && observer) { + NotifyImmediately(id, observer); + } } void AccessibilityConfig::Impl::UnsubscribeConfigObserver(const CONFIG_ID id, @@ -274,7 +392,7 @@ void AccessibilityConfig::Impl::SetScreenMagnificationState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetScreenMagnificationState(state); @@ -285,7 +403,7 @@ void AccessibilityConfig::Impl::SetShortKeyState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetShortKeyState(state); @@ -296,7 +414,7 @@ void AccessibilityConfig::Impl::SetMouseKeyState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetMouseKeyState(state); @@ -307,7 +425,7 @@ void AccessibilityConfig::Impl::GetScreenMagnificationState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -320,7 +438,7 @@ void AccessibilityConfig::Impl::GetShortKeyState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -333,7 +451,7 @@ void AccessibilityConfig::Impl::GetMouseKeyState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -493,7 +611,7 @@ void AccessibilityConfig::Impl::UpdateHighContrastTextEnabled(const bool enabled } highContrastText_ = enabled; std::map>>::iterator it = - configObservers_.find(CONFIG_HIGH_CONTRASTE_TEXT); + configObservers_.find(CONFIG_HIGH_CONTRAST_TEXT); if (it == configObservers_.end()) { return; } @@ -594,7 +712,7 @@ void AccessibilityConfig::Impl::NotifyHighContrastTextChanged( if (observer) { ConfigValue configValue; configValue.highContrastText = state; - observer->OnConfigChanged(CONFIG_HIGH_CONTRASTE_TEXT, configValue); + observer->OnConfigChanged(CONFIG_HIGH_CONTRAST_TEXT, configValue); } else { HILOG_ERROR("end configObservers_ is null"); } @@ -646,7 +764,7 @@ void AccessibilityConfig::Impl::SetMouseAutoClick(const int32_t time) HILOG_INFO("time = [%{public}d]", time); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetMouseAutoClick(time); @@ -657,7 +775,7 @@ void AccessibilityConfig::Impl::SetShortkeyTarget(const std::string& name) HILOG_INFO("name = [%{public}s]", name.c_str()); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetShortkeyTarget(name); @@ -668,7 +786,7 @@ void AccessibilityConfig::Impl::GetMouseAutoClick(int32_t &time) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -681,7 +799,7 @@ void AccessibilityConfig::Impl::GetShortkeyTarget(std::string &name) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -814,7 +932,7 @@ void AccessibilityConfig::Impl::SetHighContrastTextState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetHighContrastTextState(state); @@ -825,7 +943,7 @@ void AccessibilityConfig::Impl::SetInvertColorState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetInvertColorState(state); @@ -836,7 +954,7 @@ void AccessibilityConfig::Impl::SetDaltonizationColorFilter(const DALTONIZATION_ HILOG_INFO("type = [%{public}u]", static_cast(type)); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetDaltonizationColorFilter(type); @@ -847,7 +965,7 @@ void AccessibilityConfig::Impl::SetContentTimeout(const uint32_t timer) HILOG_INFO("timer = [%{public}u]", timer); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetContentTimeout(timer); @@ -858,7 +976,7 @@ void AccessibilityConfig::Impl::SetAnimationOffState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetAnimationOffState(state); @@ -869,7 +987,7 @@ void AccessibilityConfig::Impl::SetBrightnessDiscount(const float brightness) HILOG_INFO("brightness = [%{public}f]", brightness); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetBrightnessDiscount(brightness); @@ -880,7 +998,7 @@ void AccessibilityConfig::Impl::SetAudioMonoState(const bool state) HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetAudioMonoState(state); @@ -891,7 +1009,7 @@ void AccessibilityConfig::Impl::SetAudioBalance(const float balance) HILOG_INFO("balance = [%{public}f]", balance); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } serviceProxy_->SetAudioBalance(balance); @@ -902,7 +1020,7 @@ void AccessibilityConfig::Impl::GetInvertColorState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -915,7 +1033,7 @@ void AccessibilityConfig::Impl::GetHighContrastTextState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -928,7 +1046,7 @@ void AccessibilityConfig::Impl::GetDaltonizationColorFilter(DALTONIZATION_TYPE & HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -941,7 +1059,7 @@ void AccessibilityConfig::Impl::GetContentTimeout(uint32_t &timer) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -954,7 +1072,7 @@ void AccessibilityConfig::Impl::GetAnimationOffState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -967,7 +1085,7 @@ void AccessibilityConfig::Impl::GetBrightnessDiscount(float &brightness) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -980,7 +1098,7 @@ void AccessibilityConfig::Impl::GetAudioMonoState(bool &state) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -993,7 +1111,7 @@ void AccessibilityConfig::Impl::GetAudioBalance(float &balance) HILOG_INFO(); std::lock_guard lock(mutex_); if (!serviceProxy_) { - HILOG_ERROR("Failed to get aams service"); + HILOG_ERROR("Failed to get accessibility service"); return; } @@ -1209,7 +1327,8 @@ void AccessibilityConfig::Impl::OnAccessibleAbilityManagerShortkeyTargetChanged( std::vector> observers; { std::lock_guard lock(mutex_); - if (!std::strcmp(shortkeyTarget_.c_str(), shortkeyTarget.c_str())) { + if (shortkeyTarget_.length() > 0 && shortkeyTarget.length() > 0 && + !std::strcmp(shortkeyTarget_.c_str(), shortkeyTarget.c_str())) { return; } shortkeyTarget_ = shortkeyTarget; @@ -1223,5 +1342,134 @@ void AccessibilityConfig::Impl::OnAccessibleAbilityManagerShortkeyTargetChanged( NotifyShortkeyTargetChanged(observers, shortkeyTarget); } + +void AccessibilityConfig::Impl::NotifyImmediately(const CONFIG_ID id, + const std::shared_ptr &observer) +{ + if (handler_) { + handler_->PostTask(std::bind([this, id, observer]() { + HILOG_INFO("NotifyImmediately start."); + ConfigValue configValue; + { + std::lock_guard lock(mutex_); + configValue.highContrastText = highContrastText_; + configValue.invertColor = invertColor_; + configValue.animationOff = animationOff_; + configValue.screenMagnifier = screenMagnifier_; + configValue.audioMono = audioMono_; + configValue.mouseKey = mouseKey_; + configValue.shortkey = shortkey_; + configValue.captionState = captionState_; + configValue.contentTimeout = contentTimeout_; + configValue.mouseAutoClick = mouseAutoClick_; + configValue.audioBalance = audioBalance_; + configValue.brightnessDiscount = brightnessDiscount_; + configValue.daltonizationColorFilter = static_cast(daltonizationColorFilter_); + configValue.shortkey_target = shortkeyTarget_; + configValue.captionStyle = captionProperty_; + } + observer->OnConfigChanged(id, configValue); + }), "NotifyImmediately"); + } else { + HILOG_ERROR("Event handler is nullptr"); + } +} + +void AccessibilityConfig::Impl::InitConfigValues() +{ + if (!serviceProxy_) { + HILOG_ERROR("Service is not connected"); + return; + } + highContrastText_ = serviceProxy_->GetHighContrastTextState(); + invertColor_ = serviceProxy_->GetInvertColorState(); + animationOff_ = serviceProxy_->GetAnimationOffState(); + audioMono_ = serviceProxy_->GetAudioMonoState(); + mouseKey_ = serviceProxy_->GetMouseKeyState(); + captionState_ = serviceProxy_->GetCaptionState(); + screenMagnifier_ = serviceProxy_->GetScreenMagnificationState(); + shortkey_ = serviceProxy_->GetShortKeyState(); + mouseAutoClick_ = serviceProxy_->GetMouseAutoClick(); + daltonizationColorFilter_ = serviceProxy_->GetDaltonizationColorFilter(); + contentTimeout_ = serviceProxy_->GetContentTimeout(); + brightnessDiscount_ = serviceProxy_->GetBrightnessDiscount(); + audioBalance_ = serviceProxy_->GetAudioBalance(); + shortkeyTarget_ = serviceProxy_->GetShortkeyTarget(); + captionProperty_ = serviceProxy_->GetCaptionProperty(); + + if (isInitialized_) { + NotifyDefaultConfigs(); + } +} + +void AccessibilityConfig::Impl::NotifyDefaultConfigs() +{ + std::map>>::iterator it = + configObservers_.find(CONFIG_HIGH_CONTRAST_TEXT); + if (it != configObservers_.end()) { + NotifyHighContrastTextChanged(it->second, highContrastText_); + } + if ((it = configObservers_.find(CONFIG_INVERT_COLOR)) != configObservers_.end()) { + NotifyInvertColorChanged(it->second, invertColor_); + } + if ((it = configObservers_.find(CONFIG_DALTONIZATION_COLOR_FILTER)) != configObservers_.end()) { + NotifyDaltonizationColorFilterChanged(it->second, daltonizationColorFilter_); + } + if ((it = configObservers_.find(CONFIG_CONTENT_TIMEOUT)) != configObservers_.end()) { + NotifyContentTimeoutChanged(it->second, contentTimeout_); + } + if ((it = configObservers_.find(CONFIG_ANIMATION_OFF)) != configObservers_.end()) { + NotifyAnimationOffChanged(it->second, animationOff_); + } + if ((it = configObservers_.find(CONFIG_BRIGHTNESS_DISCOUNT)) != configObservers_.end()) { + NotifyBrightnessDiscountChanged(it->second, brightnessDiscount_); + } + if ((it = configObservers_.find(CONFIG_AUDIO_MONO)) != configObservers_.end()) { + NotifyAudioMonoChanged(it->second, audioMono_); + } + if ((it = configObservers_.find(CONFIG_AUDIO_BALANCE)) != configObservers_.end()) { + NotifyAudioBalanceChanged(it->second, audioBalance_); + } + if ((it = configObservers_.find(CONFIG_MOUSE_KEY)) != configObservers_.end()) { + NotifyMouseKeyChanged(it->second, mouseKey_); + } + if ((it = configObservers_.find(CONFIG_SHORT_KEY)) != configObservers_.end()) { + NotifyShortKeyChanged(it->second, shortkey_); + } + if ((it = configObservers_.find(CONFIG_CAPTION_STATE)) != configObservers_.end()) { + NotifyCaptionStateChanged(it->second, captionState_); + } + if ((it = configObservers_.find(CONFIG_CAPTION_STYLE)) != configObservers_.end()) { + NotifyCaptionChanged(it->second, captionProperty_); + } + if ((it = configObservers_.find(CONFIG_SCREEN_MAGNIFICATION)) != configObservers_.end()) { + NotifyScreenMagnificationChanged(it->second, screenMagnifier_); + } + if ((it = configObservers_.find(CONFIG_SHORT_KEY_TARGET)) != configObservers_.end()) { + NotifyShortkeyTargetChanged(it->second, shortkeyTarget_); + } + if ((it = configObservers_.find(CONFIG_MOUSE_AUTOCLICK)) != configObservers_.end()) { + NotifyMouseAutoClickChanged(it->second, mouseAutoClick_); + } +} + +void AccessibilityConfig::Impl::InitEventHandler() +{ + if (!runner_) { + runner_ = AppExecFwk::EventRunner::Create("accessibility.config"); + if (!runner_) { + HILOG_ERROR("AccessibilityConfig::Impl::InitEventHandler create runner failed"); + return; + } + } + + if (!handler_) { + handler_ = std::make_shared(runner_); + if (!handler_) { + HILOG_ERROR("AccessibilityConfig::Impl::InitEventHandler create event handler failed"); + return; + } + } +} } // namespace AccessibilityConfig } // namespace OHOS \ No newline at end of file diff --git a/frameworks/asacfwk/include/accessibility_element_operator_impl.h b/frameworks/asacfwk/include/accessibility_element_operator_impl.h index 799716796..3aff7e760 100644 --- a/frameworks/asacfwk/include/accessibility_element_operator_impl.h +++ b/frameworks/asacfwk/include/accessibility_element_operator_impl.h @@ -35,15 +35,12 @@ public: * @brief construct function * @param windowId The window id. * @param operation - * @return */ explicit AccessibilityElementOperatorImpl(int32_t windowId, const std::shared_ptr &operation); /** * @brief destruct function - * @param - * @return */ ~AccessibilityElementOperatorImpl(); @@ -56,7 +53,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, const sptr &callback, const int32_t mode) override; @@ -67,7 +63,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string &text, const int32_t requestId, const sptr &callback) override; @@ -79,7 +74,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr &callback) override; @@ -90,7 +84,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr &callback) override; @@ -115,7 +108,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, @@ -124,8 +116,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() override; @@ -134,8 +124,6 @@ public: * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() override; @@ -162,7 +150,6 @@ public: * @brief Add request. * @param requestId The request id from AA, it is used to match with request and response. * @param callback To transfer the node info to ASAC and it defined by ASAC. - * @return */ void AddRequest(const int32_t requestId, const sptr &callback); @@ -170,7 +157,6 @@ public: * @brief Set the element information by accessibility id to AA. * @param infos The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByAccessibilityIdResult(const std::list &infos, const int32_t requestId) override; @@ -179,7 +165,6 @@ public: * @brief Set the element information matched with text to AA. * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByTextResult(const std::list &infos, const int32_t requestId) override; @@ -188,7 +173,6 @@ public: * @brief Set the element information matched with focus type to AA. * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -197,7 +181,6 @@ public: * @brief Set the element information by focus direction to AA. * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) override; @@ -205,7 +188,6 @@ public: * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; diff --git a/frameworks/asacfwk/include/accessibility_system_ability_client_impl.h b/frameworks/asacfwk/include/accessibility_system_ability_client_impl.h index 6f9e73749..b21663376 100644 --- a/frameworks/asacfwk/include/accessibility_system_ability_client_impl.h +++ b/frameworks/asacfwk/include/accessibility_system_ability_client_impl.h @@ -52,20 +52,17 @@ public: /** * @brief Deregister the element operator. * @param windowId Window ID - * @return */ virtual void DeregisterElementOperator(const int32_t windowId) override; /** * @brief Checks whether accessibility ability is enabled. - * @param - * @return true: enabled; false: disabled */ virtual bool IsEnabled() override; /** * @brief Checks whether touch exploration ability is enabled. - * @param - * @return true: enabled; false: disabled */ virtual bool IsTouchExplorationEnabled() override; @@ -134,7 +131,6 @@ public: /** * @brief Clean the AAMS object data. * @param remote The object access to AAMS. - * @return */ void ResetService(const wptr &remote); @@ -144,7 +140,6 @@ public: * state type: Refer to AccessibilityStateEventType. * value: STATE_ACCESSIBILITY_ENABLED/STATE_EXPLORATION_ENABLED/ * STATE_ACCESSIBILITY_DISABLED/STATE_EXPLORATION_DISABLED - * @return */ void OnAccessibleAbilityManagerStateChanged(const uint32_t stateType); private: @@ -178,7 +173,6 @@ private: /** * @brief Connect to AAMS Service. - * @param * @return success : true, failed : false. */ bool ConnectToService(); @@ -190,7 +184,6 @@ private: * @param stateType The state type and value. * state type: Refer to AccessibilityStateEventType. * @param value The value be changed. - * @return */ void NotifyStateChanged(uint32_t eventType, bool value); diff --git a/frameworks/asacfwk/test/BUILD.gn b/frameworks/asacfwk/test/BUILD.gn index 2adaebb66..e36025954 100644 --- a/frameworks/asacfwk/test/BUILD.gn +++ b/frameworks/asacfwk/test/BUILD.gn @@ -49,7 +49,7 @@ config("module_private_config") { "//base/powermgr/power_manager/interfaces/innerkits/native/include", ] defines = [ - "AAMS_LOG_DOMAIN = 0xD005205", + "AAMS_LOG_DOMAIN = 0xD001D05", "AAMS_LOG_TAG = \"accessibility_test\"", ] } @@ -92,8 +92,8 @@ ohos_unittest("asac_unit_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", diff --git a/interfaces/innerkits/aafwk/BUILD.gn b/interfaces/innerkits/aafwk/BUILD.gn index 6bda547f3..b55b51c93 100644 --- a/interfaces/innerkits/aafwk/BUILD.gn +++ b/interfaces/innerkits/aafwk/BUILD.gn @@ -26,7 +26,7 @@ config("accessibleability_private_config") { defines = [ "AAMS_LOG_TAG = \"accessibility_aakit\"", - "AAMS_LOG_DOMAIN = 0xD005201", + "AAMS_LOG_DOMAIN = 0xD001D01", ] } @@ -50,7 +50,7 @@ ohos_shared_library("accessibleability") { deps = [ "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", ] external_deps = [ diff --git a/interfaces/innerkits/aafwk/include/accessibility_gesture_result_listener.h b/interfaces/innerkits/aafwk/include/accessibility_gesture_result_listener.h deleted file mode 100644 index ca4dfadb1..000000000 --- a/interfaces/innerkits/aafwk/include/accessibility_gesture_result_listener.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ACCESSIBILITY_GESTURE_RESULT_LISTENER_H -#define ACCESSIBILITY_GESTURE_RESULT_LISTENER_H - -#include - -namespace OHOS { -namespace Accessibility { -class AccessibilityGestureResultListener { -public: - /** - * @brief Destruct - * @param - * @return - */ - virtual ~AccessibilityGestureResultListener() = default; - - /** - * @brief Called when the gesture is finished. - * @param sequence - * @param result Return true if the gesture which is listened is injected successfully, else return false. - * @return - */ - virtual void OnGestureInjectResult(uint32_t sequence, bool result) = 0; -}; -} // namespace Accessibility -} // namespace OHOS -#endif // ACCESSIBILITY_GESTURE_RESULT_LISTENER_H \ No newline at end of file diff --git a/interfaces/innerkits/aafwk/include/accessibility_ui_test_ability.h b/interfaces/innerkits/aafwk/include/accessibility_ui_test_ability.h index 1ee1c90d2..848eebe73 100644 --- a/interfaces/innerkits/aafwk/include/accessibility_ui_test_ability.h +++ b/interfaces/innerkits/aafwk/include/accessibility_ui_test_ability.h @@ -19,7 +19,6 @@ #include #include #include "accessibility_gesture_inject_path.h" -#include "accessibility_gesture_result_listener.h" #include "accessibility_window_info.h" #include "accessible_ability_listener.h" @@ -29,14 +28,11 @@ class AccessibilityUITestAbility { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibilityUITestAbility() = default; /** * @brief Gets an instance of AccessibilityUITestAbility. - * @param * @return Return an instance of AccessibilityUITestAbility. */ static std::shared_ptr GetInstance(); @@ -80,14 +76,10 @@ public: /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePath The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - virtual bool InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) = 0; + virtual bool InjectGesture(const std::shared_ptr &gesturePath) = 0; /** * @brief Obtains elementInfo of the accessible root node. @@ -244,7 +236,6 @@ public: * PREFETCH_SIBLINGS: cache the sister/brothers node info also. * PREFETCH_CHILDREN: cache the child node info also. * otherwise: no cache. - * @return - */ virtual void SetCacheMode(const int32_t cacheMode) = 0; }; diff --git a/interfaces/innerkits/aafwk/include/accessible_ability_client.h b/interfaces/innerkits/aafwk/include/accessible_ability_client.h index 6347379f2..a5a42ea7a 100644 --- a/interfaces/innerkits/aafwk/include/accessible_ability_client.h +++ b/interfaces/innerkits/aafwk/include/accessible_ability_client.h @@ -21,7 +21,6 @@ #include "accessibility_element_info.h" #include "accessibility_event_info.h" #include "accessibility_gesture_inject_path.h" -#include "accessibility_gesture_result_listener.h" #include "accessibility_window_info.h" #include "accessible_ability_listener.h" #include "iremote_object.h" @@ -32,21 +31,17 @@ class AccessibleAbilityClient : public virtual RefBase { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibleAbilityClient() = default; /** * @brief Gets an instance of AccessibleAbilityClient. - * @param * @return Return an instance of AccessibleAbilityClient. */ static sptr GetInstance(); /** * @brief Gets remote object. - * @param * @return Remote object. */ virtual sptr GetRemoteObject() = 0; @@ -71,14 +66,10 @@ public: /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePath The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - virtual bool InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) = 0; + virtual bool InjectGesture(const std::shared_ptr &gesturePath) = 0; /** * @brief Obtains elementInfo of the accessible root node. @@ -242,7 +233,6 @@ public: * PREFETCH_SIBLINGS: cache the sister/brothers node info also. * PREFETCH_CHILDREN: cache the child node info also. * otherwise: no cache. - * @return - */ virtual void SetCacheMode(const int32_t cacheMode) = 0; }; diff --git a/interfaces/innerkits/aafwk/include/accessible_ability_listener.h b/interfaces/innerkits/aafwk/include/accessible_ability_listener.h index b51691d6b..b32626086 100644 --- a/interfaces/innerkits/aafwk/include/accessible_ability_listener.h +++ b/interfaces/innerkits/aafwk/include/accessible_ability_listener.h @@ -29,22 +29,17 @@ public: /** * @brief Called when an accessibility is connected. - * @param - * @return */ virtual void OnAbilityConnected() = 0; /** * @brief Called when an accessibility is disconnected. - * @param - * @return */ virtual void OnAbilityDisconnected() = 0; /** * @brief Called when an accessibility event occurs. * @param eventInfo The information of accessible event. - * @return */ virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) = 0; diff --git a/interfaces/innerkits/acfwk/BUILD.gn b/interfaces/innerkits/acfwk/BUILD.gn index cec66e20d..175239cf2 100755 --- a/interfaces/innerkits/acfwk/BUILD.gn +++ b/interfaces/innerkits/acfwk/BUILD.gn @@ -25,7 +25,7 @@ config("accessibilityconfig_private_config") { defines = [ "AAMS_LOG_TAG = \"accessibility_acfwk\"", - "AAMS_LOG_DOMAIN = 0xD005203", + "AAMS_LOG_DOMAIN = 0xD001D03", ] } @@ -45,17 +45,17 @@ ohos_shared_library("accessibilityconfig") { public_configs = [ ":accessibilityconfig_public_config" ] - deps = [ - "//foundation/barrierfree/accessibility/services/interface:aams_interface", - ] + deps = [ "//foundation/barrierfree/accessibility/common/interface:accessibility_interface" ] public_deps = [ "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common" ] external_deps = [ "ability_base:want", - "ability_runtime:abilitykit_native", "c_utils:utils", + "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", + "init:libbeget_proxy", + "init:libbegetutil", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/acfwk/include/accessibility_config.h b/interfaces/innerkits/acfwk/include/accessibility_config.h index b026fd9b9..9820c721a 100644 --- a/interfaces/innerkits/acfwk/include/accessibility_config.h +++ b/interfaces/innerkits/acfwk/include/accessibility_config.h @@ -23,7 +23,7 @@ namespace OHOS { namespace AccessibilityConfig { enum CONFIG_ID : int32_t { - CONFIG_HIGH_CONTRASTE_TEXT = 0, + CONFIG_HIGH_CONTRAST_TEXT = 0, CONFIG_INVERT_COLOR, CONFIG_DALTONIZATION_COLOR_FILTER, CONFIG_CONTENT_TIMEOUT, @@ -70,8 +70,6 @@ class AccessibilityConfigObserver { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibilityConfigObserver() = default; @@ -79,7 +77,6 @@ public: * @brief Called when the config value changed. * @param id the id of config. * @param value the value of config. - * @return */ virtual void OnConfigChanged(const CONFIG_ID id, const ConfigValue &value) = 0; }; @@ -88,14 +85,11 @@ class AccessibilityEnableAbilityListsObserver { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibilityEnableAbilityListsObserver() = default; /** * @brief Called when the enable ability lists changed. - * @return */ virtual void OnEnableAbilityListsStateChanged() = 0; }; @@ -103,26 +97,30 @@ public: class AccessibilityConfig { DECLARE_SINGLETON(AccessibilityConfig) public: + /** + * @brief Initialize the run context. + * @return Return true if successfully, else return false. + */ + bool InitializeContext(); + /** * @brief Subscribes to accessibility config value. * @param id the config id which is observed. * @param observer Indicates the observer for listening to accessibility - * @return - */ - void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer); + void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer, + const bool retFlag = true); /** * @brief Unsubscribe the accessibility config value observer. * @param id the id which is observed. * @param observer Indicates the registered accessibility config observer. - * @return - */ void UnsubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr &observer); /** * @brief Subscribes the observer of enable Ability lists * @param observer Indicates the observer for listening to enable Ability lists - * @return - */ void SubscribeEnableAbilityListsObserver( const std::shared_ptr &observer); @@ -130,7 +128,6 @@ public: /** * @brief Unsubscribe the observer of enable Ability lists * @param observer Indicates the observer for listening to enable Ability lists - * @return - */ void UnsubscribeEnableAbilityListsObserver( const std::shared_ptr &observer); @@ -153,161 +150,138 @@ public: /** * @brief Set whether to enable the magnification function * @param state true:enable magnification function; false:disable magnification function - * @return - */ void SetScreenMagnificationState(const bool state); /** * @brief Set whether to enable the function of using short key to open accessibility ability * @param state true:enable short key function; false:disable short key function - * @return - */ void SetShortKeyState(const bool state); /** * @brief Set whether to enable the mouse key function * @param state true:enable mouse key function; false:disable mouse key function - * @return - */ void SetMouseKeyState(const bool state); /** * @brief Set whether to enable the caption function * @param state true:enable caption function; false:disable caption function - * @return - */ - void SetCaptionState(const bool state); + void SetCaptionsState(const bool state); /** * @brief Set caption properties * @param caption caption properties - * @return - */ - void SetCaptionProperty(const CaptionProperty &caption); + void SetCaptionsProperty(const CaptionProperty &caption); /** * @brief Set the time for the cursor to stop for the mouse to automatically perform the click action * @param time The valid time is 1000ms~5000ms, otherwise the automatic mouse click action will not be enabled - * @return - */ void SetMouseAutoClick(const int32_t time); /** * @brief Set the name of the accessibility ability to be opened by the short key * @param name name The string formatted by 'bundleName/abilityName' - * @return - */ void SetShortkeyTarget(const std::string &name); /** * @brief Set whether to enable the high-contrast text function * @param state true:enable high-contrast text function; false:disable high-contrast text function - * @return - */ void SetHighContrastTextState(bool state); /** * @brief Set whether to enable the invert color function * @param state true:enable invert color function; false:disable invert color function - * @return - */ void SetInvertColorState(const bool state); /** * @brief Set daltonization color filter * @param type Daltonization color filter type - * @return - */ void SetDaltonizationColorFilter(const DALTONIZATION_TYPE type); /** * @brief Set content duration * @param timer duration - * @return - */ void SetContentTimeout(const uint32_t timer); /** * @brief Set whether to turn off animation * @param state true:turn off animation; false:turn on animation - * @return - */ void SetAnimationOffState(const bool state); /** * @brief Set brightness discount * @param brightness The discount of brightness - * @return - */ void SetBrightnessDiscount(const float brightness); /** * @brief Set whether to enable audio mono * @param state true:enable audio mono; false:disable audio mono - * @return - */ void SetAudioMonoState(const bool state); /** * @brief Set audio balance * @param balance The balance of audio - * @return - */ void SetAudioBalance(const float balance); /** * @brief Get the status of whether the magnification function is enabled * @param state(out) true:the magnification function is enabled; false:the magnification function is disabled - * @return - */ void GetScreenMagnificationState(bool &state) const; /** * @brief Get the status of whether the use of short key to open accessibility ability is enabled * @param state(out) true:the short key is enabled; false:the short key is disabled - * @return - */ void GetShortKeyState(bool &state) const; /** * @brief Get the status of whether the mouse key function is enabled * @param state(out) true:the mouse key function is enabled; false:the mouse key function is disabled - * @return - */ void GetMouseKeyState(bool &state) const; /** * @brief Get the status of whether the caption function is enabled * @param state(out) true:the caption function is enabled; false:the caption function is disabled - * @return - */ - void GetCaptionState(bool &state) const; + void GetCaptionsState(bool &state) const; /** * @brief Get caption properties * @param caption(out) caption properties - * @return - */ - void GetCaptionProperty(CaptionProperty &caption) const; + void GetCaptionsProperty(CaptionProperty &caption) const; /** * @brief Get the time for the cursor to stop for the mouse to automatically perform the click action * @param time(out) the time for the cursor to stop for the mouse to automatically perform the click action - * @return - */ void GetMouseAutoClick(int32_t &time) const; /** * @brief Get the name of the accessibility ability to be opened by the short key * @param name(out) The string formatted by 'bundleName/abilityName' - * @return - */ void GetShortkeyTarget(std::string &name) const; /** * @brief Get the status of whether the invert color function is enabled * @param state(out) true:the invert color function is enabled; false:the invert color function is disabled - * @return - */ void GetInvertColorState(bool &state) const; @@ -315,49 +289,42 @@ public: * @brief Get the status of whether the high-contrast text function is enabled * @param state(out) true:the high-contrast text function is enabled; * false:the high-contrast text function is disabled - * @return - */ void GetHighContrastTextState(bool &state) const; /** * @brief Get daltonization color filter * @param type(out) Daltonization color filter type - * @return - */ void GetDaltonizationColorFilter(DALTONIZATION_TYPE &type) const; /** * @brief Get content duration * @param timer(out) duration - * @return - */ void GetContentTimeout(uint32_t &timer) const; /** * @brief Get the status of whether animation is disabled * @param state(out) true:animation is disabled; false:animation is enabled - * @return - */ void GetAnimationOffState(bool &state) const; /** * @brief Get brightness discount parameter * @param brightness(out) The discount parameter of brightness - * @return - */ void GetBrightnessDiscount(float &brightness) const; /** * @brief Get the status of whether the audio mono is enabled * @param state(out) true:audio mono is enabled; false:audio mono is disabled - * @return - */ void GetAudioMonoState(bool &state) const; /** * @brief Get the value of the audio balance * @param balance(out) The value of the audio balance - * @return - */ void GetAudioBalance(float &balance) const; diff --git a/interfaces/innerkits/asacfwk/BUILD.gn b/interfaces/innerkits/asacfwk/BUILD.gn index a8e34ba66..e95322d56 100644 --- a/interfaces/innerkits/asacfwk/BUILD.gn +++ b/interfaces/innerkits/asacfwk/BUILD.gn @@ -25,7 +25,7 @@ config("accessibilityclient_private_config") { defines = [ "AAMS_LOG_TAG = \"accessibility_asacfwk\"", - "AAMS_LOG_DOMAIN = 0xD005202", + "AAMS_LOG_DOMAIN = 0xD001D02", ] } @@ -45,9 +45,7 @@ ohos_shared_library("accessibilityclient") { public_configs = [ ":accessibilityclient_public_config" ] - deps = [ - "//foundation/barrierfree/accessibility/services/interface:aams_interface", - ] + deps = [ "//foundation/barrierfree/accessibility/common/interface:accessibility_interface" ] public_deps = [ "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common" ] diff --git a/interfaces/innerkits/asacfwk/include/accessibility_element_operator.h b/interfaces/innerkits/asacfwk/include/accessibility_element_operator.h index bd2883bea..5ef5c91fc 100644 --- a/interfaces/innerkits/asacfwk/include/accessibility_element_operator.h +++ b/interfaces/innerkits/asacfwk/include/accessibility_element_operator.h @@ -29,8 +29,6 @@ class AccessibilityElementOperator { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibilityElementOperator() = default; @@ -43,7 +41,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, AccessibilityElementOperatorCallback &callback, const int32_t mode) = 0; @@ -54,7 +51,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string &text, const int32_t requestId, AccessibilityElementOperatorCallback &callback) = 0; @@ -66,7 +62,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, AccessibilityElementOperatorCallback &callback) = 0; @@ -77,7 +72,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, AccessibilityElementOperatorCallback &callback) = 0; @@ -102,7 +96,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, @@ -111,8 +104,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() = 0; @@ -120,8 +111,6 @@ public: * @brief The low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() = 0; }; diff --git a/interfaces/innerkits/asacfwk/include/accessibility_element_operator_callback.h b/interfaces/innerkits/asacfwk/include/accessibility_element_operator_callback.h index 328a5c9dc..5503836ac 100644 --- a/interfaces/innerkits/asacfwk/include/accessibility_element_operator_callback.h +++ b/interfaces/innerkits/asacfwk/include/accessibility_element_operator_callback.h @@ -28,8 +28,6 @@ class AccessibilityElementOperatorCallback { public: /** * @brief Destruct - * @param - * @return */ virtual ~AccessibilityElementOperatorCallback() = default; @@ -37,7 +35,6 @@ public: * @brief Set the element information by accessibility id to AA. * @param infos The element information searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByAccessibilityIdResult(const std::list &infos, const int32_t requestId) = 0; @@ -46,7 +43,6 @@ public: * @brief Set the element information matched with text to AA. * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByTextResult(const std::list &infos, const int32_t requestId) = 0; @@ -55,7 +51,6 @@ public: * @brief Set the element information matched with focus type to AA. * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; @@ -63,7 +58,6 @@ public: * @brief Set the element information by focus direction to AA. * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; @@ -71,7 +65,6 @@ public: * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0; }; diff --git a/interfaces/innerkits/asacfwk/include/accessibility_state_event.h b/interfaces/innerkits/asacfwk/include/accessibility_state_event.h index aa7dc7ad3..277ae1a67 100644 --- a/interfaces/innerkits/asacfwk/include/accessibility_state_event.h +++ b/interfaces/innerkits/asacfwk/include/accessibility_state_event.h @@ -36,8 +36,6 @@ class AccessibilityStateObserver { public: /** * @brief Destruct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -46,7 +44,6 @@ public: /** * @brief Receives notifications on accessibility status changes. * @param state Indicates the status change. - * @return * @since 3 * @sysCap Accessibility */ diff --git a/interfaces/innerkits/asacfwk/include/accessibility_system_ability_client.h b/interfaces/innerkits/asacfwk/include/accessibility_system_ability_client.h index b783ceb25..7f792ad9a 100644 --- a/interfaces/innerkits/asacfwk/include/accessibility_system_ability_client.h +++ b/interfaces/innerkits/asacfwk/include/accessibility_system_ability_client.h @@ -42,15 +42,12 @@ class AccessibilitySystemAbilityClient { public: /** * @brief Obtains the AccessibilitySystemAbilityClient instance. - * @param - * @return AccessibilitySystemAbilityClient instance */ static std::shared_ptr GetInstance(); /** * @brief Deconstruct. - * @param - * @return */ virtual ~AccessibilitySystemAbilityClient() = default; @@ -66,20 +63,17 @@ public: /** * @brief Deregister the element operator. * @param windowId Window ID - * @return */ virtual void DeregisterElementOperator(const int32_t windowId) = 0; /** * @brief Checks whether accessibility ability is enabled. - * @param - * @return true: enabled; false: disabled */ virtual bool IsEnabled() = 0; /** * @brief Checks whether touch exploration ability is enabled. - * @param - * @return true: enabled; false: disabled */ virtual bool IsTouchExplorationEnabled() = 0; diff --git a/interfaces/innerkits/common/BUILD.gn b/interfaces/innerkits/common/BUILD.gn index d99c29794..58a959f54 100644 --- a/interfaces/innerkits/common/BUILD.gn +++ b/interfaces/innerkits/common/BUILD.gn @@ -23,7 +23,7 @@ config("accessibility_common_private_config") { defines = [ "AAMS_LOG_TAG = \"accessibility_common\"", - "AAMS_LOG_DOMAIN = 0xD005202", + "AAMS_LOG_DOMAIN = 0xD001D02", ] } diff --git a/interfaces/innerkits/common/include/accessibility_ability_info.h b/interfaces/innerkits/common/include/accessibility_ability_info.h index e1f30617b..c470c2386 100644 --- a/interfaces/innerkits/common/include/accessibility_ability_info.h +++ b/interfaces/innerkits/common/include/accessibility_ability_info.h @@ -53,56 +53,48 @@ public: /** * @brief Obtains the types of the accessible ability. - * @param * @return Return the types of the accessible ability. */ uint32_t GetAccessibilityAbilityType(); /** * @brief Obtains the types of the capabilities. - * @param * @return Return the types of the capabilities. */ uint32_t GetCapabilityValues() const; /** * @brief Obtains the description of the accessible ability. - * @param * @return Return the description of the accessible ability. */ const std::string &GetDescription() const; /** * @brief Obtains the types of the accessible events. - * @param * @return Return the types of the accessible events. */ uint32_t GetEventTypes(); /** * @brief Obtains the id of the accessible ability. - * @param * @return Return the id of the accessible ability. */ std::string GetId() const; /** * @brief Obtains the name of the accessible ability. - * @param * @return Return the name of the accessible ability. */ const std::string &GetName() const; /** * @brief Obtains the package name of the accessible ability. - * @param * @return Return the package name of the accessible ability. */ const std::string &GetPackageName() const; /** * @brief Obtains the module name of the accessible ability. - * @param * @return Return the module name of the accessible ability. */ const std::string &GetModuleName() const; @@ -110,20 +102,17 @@ public: /** * @brief Set the package name of the accessible ability. * @param bundleName the package name of the accessible ability - * @return - */ void SetPackageName(const std::string &bundleName); /** * @brief Obtains the target bundles's name that you are listening on. - * @param * @return Return the target bundles's name that you are listening on. */ const std::vector &GetFilterBundleNames() const; /** * @brief Obtains the setting ability of the accessible ability. - * @param * @return Return the setting ability of the accessible ability. */ const std::string &GetSettingsAbility() const; @@ -131,7 +120,6 @@ public: /** * @brief Set the target bundles's name that you want to listening on. * @param targetBundleNames the target bundle name to set. - * @return */ inline void SetFilterBundleNames(const std::vector &targetBundleNames) { @@ -141,7 +129,6 @@ public: /** * @brief Set the types of the capabilities. * @param capabilities the capabilities to set. - * @return */ inline void SetCapabilityValues(uint32_t capabilities) { @@ -151,7 +138,6 @@ public: /** * @brief Set the types of the ability. * @param abilityTypes the ability types to set. - * @return */ inline void SetAccessibilityAbilityType(uint32_t abilityTypes) { @@ -161,7 +147,6 @@ public: /** * @brief Set the types of the event. * @param eventTypes the event to set. - * @return */ inline void SetEventTypes(uint32_t eventTypes) { @@ -185,7 +170,7 @@ protected: std::string settingsAbility_; uint32_t abilityTypes_ = ACCESSIBILITY_ABILITY_TYPE_INVALID; - uint32_t eventTypes_ = EventType::TYPE_VIEW_INVALID; + uint32_t eventTypes_ = EventType::TYPES_ALL_MASK; std::vector targetBundleNames_; bool isImportant_ = false; diff --git a/interfaces/innerkits/common/include/accessibility_caption.h b/interfaces/innerkits/common/include/accessibility_caption.h index 991041b86..563e8fe13 100644 --- a/interfaces/innerkits/common/include/accessibility_caption.h +++ b/interfaces/innerkits/common/include/accessibility_caption.h @@ -35,20 +35,17 @@ public: /** * @brief Check property * @param property The value of property - * @return - */ bool CheckProperty(const std::string &property); /** * @brief Set font family * @param family Font family - * @return - */ void SetFontFamily(const std::string &family); /** * @brief Get font family - * @param - * @return Font family */ const std::string &GetFontFamily() const; @@ -56,13 +53,11 @@ public: /** * @brief Set font scale * @param scale Font scale - * @return - */ void SetFontScale(int32_t scale); /** * @brief Get font scale - * @param - * @return Font scale */ int32_t GetFontScale() const; @@ -70,13 +65,11 @@ public: /** * @brief Set font color * @param color Font color - * @return - */ void SetFontColor(uint32_t color); /** * @brief Get font color - * @param - * @return Font color */ uint32_t GetFontColor() const; @@ -84,13 +77,11 @@ public: /** * @brief Set font edge type * @param type The type of font edge - * @return - */ void SetFontEdgeType(const std::string &type); /** * @brief Get font edge type - * @param - * @return The type of font edge */ const std::string &GetFontEdgeType() const; @@ -98,13 +89,11 @@ public: /** * @brief Set window color * @param color The color of window - * @return - */ void SetWindowColor(uint32_t color); /** * @brief Get window color - * @param - * @return The color of window */ uint32_t GetWindowColor() const; @@ -112,13 +101,11 @@ public: /** * @brief Set background color * @param color The color of background - * @return - */ void SetBackgroundColor(uint32_t color); /** * @brief Get background color - * @param - * @return The color of background */ uint32_t GetBackgroundColor() const; @@ -153,14 +140,12 @@ public: /** * @brief Called when the accessibility state changed. * @param enable true:the accessibility state is enabled;false:the accessibility state is disabled - * @return - */ virtual void OnStateChanged(const bool& enable) = 0; /** * @brief Called when the caption property changed. * @param caption current caption property. - * @return - */ virtual void OnPropertyChanged(const CaptionProperty& caption) = 0; }; diff --git a/interfaces/innerkits/common/include/accessibility_element_info.h b/interfaces/innerkits/common/include/accessibility_element_info.h index 0ec66b2c9..0cc512fe0 100644 --- a/interfaces/innerkits/common/include/accessibility_element_info.h +++ b/interfaces/innerkits/common/include/accessibility_element_info.h @@ -29,8 +29,6 @@ class AccessibleAction { public: /** * @brief Construct - * @param - * @return */ AccessibleAction() {} @@ -38,20 +36,17 @@ public: * @brief Construct * @param actionType The type of action, refer to [ActionType] * @param description The description message of action. - * @return */ AccessibleAction(ActionType actionType, const std::string &description); /** * @brief Gets the action type. - * @param - * @return The type of action, refer to [ActionType] */ ActionType GetActionType() const; /** * @brief Gets the action description. - * @param - * @return The description message of action. */ const std::string &GetDescriptionInfo() const; @@ -70,8 +65,6 @@ class RangeInfo { public: /** * @brief Construct - * @param - * @return */ RangeInfo() {} @@ -80,27 +73,23 @@ public: * @param min The min value * @param max The max value * @param current current value - * @return */ RangeInfo(int32_t min, int32_t max, int32_t current); /** * @brief Gets the min value. - * @param * @return min value */ int32_t GetMin() const; /** * @brief Gets the max value. - * @param * @return max value. */ int32_t GetMax() const; /** * @brief Gets the current value. - * @param * @return current value. */ int32_t GetCurrent() const; @@ -108,21 +97,18 @@ public: /** * @brief Sets the min value. * @param min min value - * @return */ void SetMin(int32_t min); /** * @brief Sets the max value. * @param max max value. - * @return */ void SetMax(int32_t max); /** * @brief Sets the current value. * @param current current value - * @return */ void SetCurrent(int32_t current); @@ -141,8 +127,6 @@ class GridInfo { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -153,7 +137,6 @@ public: * @param rowCount The number of row * @param columnCount The number of column * @param mode 0: select one line only, otherwise select multilines. - * @return * @since 3 * @sysCap Accessibility */ @@ -164,7 +147,6 @@ public: * @param rowCount The number of row * @param columnCount The number of column * @param mode 0: select one line only, otherwise select multilines. - * @return * @since 3 * @sysCap Accessibility */ @@ -173,7 +155,6 @@ public: /** * @brief Copy grid object. * @param other The copied grid - * @return * @since 3 * @sysCap Accessibility */ @@ -181,7 +162,6 @@ public: /** * @brief Gets the number of rows. - * @param - * @return number of rows. * @since 3 * @sysCap Accessibility @@ -190,7 +170,6 @@ public: /** * @brief Gets the number of columns. - * @param * @return number of columns. * @since 3 * @sysCap Accessibility @@ -199,7 +178,6 @@ public: /** * @brief Get the mode of grid - * @param * @return 0: Selected by one line, otherwise is multilines. * @since 3 * @sysCap Accessibility @@ -216,8 +194,6 @@ class GridItemInfo { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -231,7 +207,6 @@ public: * @param columnSpan THe column spanned * @param heading true:The item isHeading, otherwise is not * @param selected true:The item is selected,otherwise is not - * @return * @since 3 * @sysCap Accessibility */ @@ -241,7 +216,6 @@ public: /** * @brief Copy the GridItemInfo * @param other The object of GridItemInfo copied. - * @return * @since 3 * @sysCap Accessibility */ @@ -255,7 +229,6 @@ public: * @param columnSpan THe column spanned * @param heading true:The item isHeading, otherwise is not * @param selected true:The item is selected,otherwise is not - * @return * @since 3 * @sysCap Accessibility */ @@ -264,7 +237,6 @@ public: /** * @brief Gets the column index at which the item is located. - * @param * @return The column index. * @since 3 * @sysCap Accessibility @@ -273,7 +245,6 @@ public: /** * @brief Gets the row index at which the item is located. - * @param * @return The row index. * @since 3 * @sysCap Accessibility @@ -282,7 +253,6 @@ public: /** * @brief Gets the number of columns the item spans. - * @param * @return The column span. * @since 3 * @sysCap Accessibility @@ -291,7 +261,6 @@ public: /** * @brief Gets the number of rows the item spans. - * @param * @return The row span. * @since 3 * @sysCap Accessibility @@ -300,7 +269,6 @@ public: /** * @brief Checks if the grid item is a heading. - * @param * @return true:If the item is a heading, otherwise is not. * @since 3 * @sysCap Accessibility @@ -309,7 +277,6 @@ public: /** * @brief Checks if the grid item is a selected. - * @param * @return true:If the item is a selected, otherwise is not. * @since 3 * @sysCap Accessibility @@ -329,8 +296,6 @@ class Rect { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -338,8 +303,6 @@ public: /** * @brief Destruct - * @param - - * @return * @since 3 * @sysCap Accessibility */ @@ -351,7 +314,6 @@ public: * @param leftTopY : The left top y pixel coordinates * @param rightBottomY : The right bottom y pixel coordinates * @param rightBottomX : The right bottom x pixel coordinates - * @return * @since 3 * @sysCap Accessibility */ @@ -365,7 +327,6 @@ public: /** * @brief Get the left top point's pixel coordinates - * @param - * @return The left top x pixel coordinates * @since 3 * @sysCap Accessibility @@ -377,7 +338,6 @@ public: /** * @brief Get the left top point's pixel coordinates - * @param - * @return The left top y pixel coordinates * @since 3 * @sysCap Accessibility @@ -389,7 +349,6 @@ public: /** * @brief Get the right bottom point's pixel coordinates - * @param - * @return The bottom x pixel coordinates * @since 3 * @sysCap Accessibility @@ -401,7 +360,6 @@ public: /** * @brief Get the right bottom point's pixel coordinates - * @param - * @return The bottom y pixel coordinates * @since 3 * @sysCap Accessibility @@ -414,7 +372,6 @@ public: * @brief Set the left top point's pixel coordinates * @param leftTopX The left top x pixel coordinates * @param leftTopY The left top y pixel coordinates - * @return * @since 3 * @sysCap Accessibility */ @@ -428,7 +385,6 @@ public: * @brief Set the right bottom point's pixel coordinates * @param rightBottomX The right bottom x pixel coordinates * @param rightBottomY The right bottom y pixel coordinates - * @return * @since 3 * @sysCap Accessibility */ @@ -455,8 +411,6 @@ public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -465,7 +419,6 @@ public: /** * @brief Set the id of AccessibilityElementInfo * @param componentId The id of component. - * @return * @since 3 * @sysCap Accessibility */ @@ -482,7 +435,6 @@ public: /** * @brief Gets the number of children - * @param - * @return The number of children * @since 3 * @sysCap Accessibility @@ -491,7 +443,6 @@ public: /** * @brief Gets the id of children - * @param - * @return The list of children id * @since 3 * @sysCap Accessibility @@ -501,7 +452,6 @@ public: /** * @brief Add child node information * @param childId The id of child node - * @return * @since 3 * @sysCap Accessibility */ @@ -518,7 +468,6 @@ public: /** * @brief Gets an action list. - * @param - * @return action list. Refer to AccessibleAction * @since 3 * @sysCap Accessibility @@ -528,7 +477,6 @@ public: /** * @brief Add action on the component * @param action The action on the component. - * @return * @since 3 * @sysCap Accessibility */ @@ -537,7 +485,6 @@ public: /** * @brief Remove action on the component * @param action The action object. - * @return * @since 3 * @sysCap Accessibility */ @@ -554,8 +501,6 @@ public: /** * @brief Remove all the action on the component. - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -564,7 +509,6 @@ public: /** * @brief Sets the maximum length of text allowed for this node. * @param max The maximum length of text - * @return * @since 3 * @sysCap Accessibility */ @@ -572,7 +516,6 @@ public: /** * @brief Gets the maximum length of text allowed for this node. - * @param * @return The maximum length of text * @since 3 * @sysCap Accessibility @@ -581,7 +524,6 @@ public: /** * @brief Get the window Id of the component that belongs to the window. - * @param * @return window id * @since 3 * @sysCap Accessibility @@ -591,7 +533,6 @@ public: /** * @brief Set the window Id of the component that belongs to the window. * @param windowId The window Id - * @return * @since 3 * @sysCap Accessibility */ @@ -599,7 +540,6 @@ public: /** * @brief Get parent accessibility Id. - * @param * @return The accessibility Id of parent. * @since 3 * @sysCap Accessibility @@ -609,7 +549,6 @@ public: /** * @brief Set parent node information * @param parentId Parent node id - * @return * @since 3 * @sysCap Accessibility */ @@ -617,7 +556,6 @@ public: /** * @brief Gets the rectangular area of this accessibility node control in the screen. - * @param * @return The rectangular area of this accessibility node * @since 3 * @sysCap Accessibility @@ -627,7 +565,6 @@ public: /** * @brief Set the rectangular area of this accessibility node control in the screen. * @param bounds The rectangular area of this accessibility node - * @return * @since 3 * @sysCap Accessibility */ @@ -635,7 +572,6 @@ public: /** * @brief Checks whether this node (a check box as an example) is checkable. - * @param * @return true:the node is checkable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -645,7 +581,6 @@ public: /** * @brief Set whether this node (a check box as an example) is checkable. * @param checkable true:the node is checkable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -653,7 +588,6 @@ public: /** * @brief Checks whether this node is checked. - * @param * @return true : Is checked, otherwise is not. * @since 3 * @sysCap Accessibility @@ -663,7 +597,6 @@ public: /** * @brief Set whether this node is checked. * @param checked true:Is checked, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -671,7 +604,6 @@ public: /** * @brief Checks whether this node can be focused. - * @param * @return true : Can be focused, otherwise is not. * @since 3 * @sysCap Accessibility @@ -681,7 +613,6 @@ public: /** * @brief Set whether this node can be focused. * @param focusable true : Can be focused, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -689,7 +620,6 @@ public: /** * @brief Checks whether this node has gained focus. - * @param * @return true:Focused, otherwise is not. * @since 3 * @sysCap Accessibility @@ -699,7 +629,6 @@ public: /** * @brief Set whether this node has gained focus. * @param focused true : Focused, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -707,7 +636,6 @@ public: /** * @brief Checks whether this node is visible to users. - * @param * @return true : visible, otherwise is not. * @since 3 * @sysCap Accessibility @@ -717,7 +645,6 @@ public: /** * @brief Set whether this node is visible to users. * @param visible true:visible, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -725,7 +652,6 @@ public: /** * @brief Checks whether this node has gained accessibility focus. - * @param * @return true:Gained accessibility focus, otherwise is not. * @since 3 * @sysCap Accessibility @@ -735,7 +661,6 @@ public: /** * @brief Set whether this node has gained accessibility focus. * @param focused true:Gained accessibility focus, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -743,7 +668,6 @@ public: /** * @brief Checks whether this node is selected. - * @param * @return true:selected, otherwise is not. * @since 3 * @sysCap Accessibility @@ -753,7 +677,6 @@ public: /** * @brief Set whether this node is selected. * @param selected true: selected, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -761,7 +684,6 @@ public: /** * @brief Checks whether this node is clickable. - * @param * @return true: clickable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -771,7 +693,6 @@ public: /** * @brief Set whether this node is clickable. * @param clickable true:clickable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -779,7 +700,6 @@ public: /** * @brief Checks whether this node is long clickable. - * @param * @return true: long clickable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -789,7 +709,6 @@ public: /** * @brief Set whether this node is long clickable. * @param longClickable true: long clickable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -797,7 +716,6 @@ public: /** * @brief Checks whether this node is enabled. - * @param * @return true:enabled, otherwise is not. * @since 3 * @sysCap Accessibility @@ -807,7 +725,6 @@ public: /** * @brief Set whether this node is enabled. * @param enabled true: enabled, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -815,7 +732,6 @@ public: /** * @brief Checks whether the content in this node is a password. - * @param * @return true: password, otherwise is not. * @since 3 * @sysCap Accessibility @@ -825,7 +741,6 @@ public: /** * @brief Set whether the content in this node is a password * @param type true:password, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -833,7 +748,6 @@ public: /** * @brief Checks whether this node is scrollable. - * @param * @return true: scrollable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -843,7 +757,6 @@ public: /** * @brief Set whether this node is scrollable. * @param scrollable true: scrollable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -851,7 +764,6 @@ public: /** * @brief Checks whether this node is editable. - * @param * @return true:editable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -861,7 +773,6 @@ public: /** * @brief Set whether this node is editable. * @param editable true: editable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -869,7 +780,6 @@ public: /** * @brief Checks whether this node can display text in multiple lines. - * @param * @return true: multilines, otherwise is not. * @since 3 * @sysCap Accessibility @@ -879,7 +789,6 @@ public: /** * @brief Set whether this node can display text in multiple lines. * @param multiLine true:multilines, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -887,7 +796,6 @@ public: /** * @brief Checks whether pop-up windows are supported. - * @param * @return true: Support popup, otherwise is not. * @since 3 * @sysCap Accessibility @@ -897,7 +805,6 @@ public: /** * @brief Set whether pop-up windows are supported. * @param supportPopup true: Support popup, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -905,7 +812,6 @@ public: /** * @brief Checks whether this node is deletable. - * @param * @return true:deletable, otherwise is not. * @since 3 * @sysCap Accessibility @@ -915,7 +821,6 @@ public: /** * @brief Set whether this node is deletable. * @param deletable true:deletable, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -923,7 +828,6 @@ public: /** * @brief Checks whether this node is essential to users. - * @param * @return true: essential to user, otherwise is not. * @since 3 * @sysCap Accessibility @@ -933,7 +837,6 @@ public: /** * @brief Set whether this node is essential to users. * @param essential true:essential to user, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -941,7 +844,6 @@ public: /** * @brief Checks whether this node is displaying a hint. - * @param * @return true:displaying a hint, otherwise is not. * @since 3 * @sysCap Accessibility @@ -951,7 +853,6 @@ public: /** * @brief Set whether this node is displaying a hint. * @param hinting true:displaying a hint, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -959,7 +860,6 @@ public: /** * @brief Gets the bundle name of application target. - * @param * @return bundle name * @since 3 * @sysCap Accessibility @@ -969,7 +869,6 @@ public: /** * @brief Set the bundle name of application target. * @param bundleName The bundle name of application target. - * @return * @since 3 * @sysCap Accessibility */ @@ -977,7 +876,6 @@ public: /** * @brief Get component type. - * @param * @return The component type. * @since 3 * @sysCap Accessibility @@ -987,7 +885,6 @@ public: /** * @brief Set component type. * @param className The component type. - * @return * @since 3 * @sysCap Accessibility */ @@ -995,7 +892,6 @@ public: /** * @brief Gets the text of node. - * @param * @return The text of node * @since 3 * @sysCap Accessibility @@ -1005,7 +901,6 @@ public: /** * @brief Set the text of node. * @param text The text of node - * @return * @since 3 * @sysCap Accessibility */ @@ -1013,7 +908,6 @@ public: /** * @brief Gets the hint information. - * @param * @return the hint information. * @since 3 * @sysCap Accessibility @@ -1023,7 +917,6 @@ public: /** * @brief Sets the hint information. * @param hintText the hint information. - * @return * @since 3 * @sysCap Accessibility */ @@ -1031,7 +924,6 @@ public: /** * @brief Gets the description of the accessibility node. - * @param * @return the description of the accessibility node. * @since 3 * @sysCap Accessibility @@ -1041,7 +933,6 @@ public: /** * @brief Set the description of the accessibility node. * @param contentDescription the description of the accessibility node. - * @return * @since 3 * @sysCap Accessibility */ @@ -1050,7 +941,6 @@ public: /** * @brief Set the resource name of the component. * @param viewIdResName The resource name. - * @return * @since 3 * @sysCap Accessibility */ @@ -1058,7 +948,6 @@ public: /** * @brief Gets the resource name. - * @param * @return the resource name. * @since 3 * @sysCap Accessibility @@ -1068,7 +957,6 @@ public: /** * @brief Set whether this node has live region * @param liveRegion live region: 0: not live region; 1: interrupt current talk back; 2: talk back by order - * @return * @since 3 * @sysCap Accessibility */ @@ -1076,7 +964,6 @@ public: /** * @brief Get the live region of the node - * @param * @return The live region of the node * @since 3 * @sysCap Accessibility @@ -1088,7 +975,6 @@ public: * @note If the node has content Invalid,when input invalid information, it will be talkbacked. such as: * The editbox permit number only, you input character("a"), The invalid information will be talkbacked. * @param contentInvalid true:the content is invalid; false:the content is valid - * @return * @since 3 * @sysCap Accessibility */ @@ -1096,7 +982,6 @@ public: /** * @brief Get whether this node has content Invalid. - * @param * @return true:the content is invalid; false:the content is valid * @since 3 * @sysCap Accessibility @@ -1106,7 +991,6 @@ public: /** * @brief Set error information, it used with contentInvalid is setted true. * @param error error information - * @return * @since 3 * @sysCap Accessibility */ @@ -1114,7 +998,6 @@ public: /** * @brief Get error information,it used with contentInvalid is setted true. - * @param * @return error information * @since 3 * @sysCap Accessibility @@ -1124,7 +1007,6 @@ public: /** * @brief Set the id of component labeled * @param componentId the id of component - * @return * @since 3 * @sysCap Accessibility */ @@ -1132,7 +1014,6 @@ public: /** * @brief Get labeled accessibility Id - * @param * @return accessibility Id * @since 3 * @sysCap Accessibility @@ -1141,7 +1022,6 @@ public: /** * @brief Get the id of the IAccessibleAbilityChannel - * @param * @return The id of the IAccessibleAbilityChannel * @since 3 * @sysCap Accessibility @@ -1151,7 +1031,6 @@ public: /** * @brief AAMS called to set the id of the IAccessibleAbilityChannel * @param channelId The id of the IAccessibleAbilityChannel - * @return * @since 3 * @sysCap Accessibility */ @@ -1160,7 +1039,6 @@ public: /** * @brief Set accessibility Id * @param componentId The id of component - * @return * @since 3 * @sysCap Accessibility */ @@ -1168,7 +1046,6 @@ public: /** * @brief Get accessibility Id - * @param * @return accessibility Id * @since 3 * @sysCap Accessibility @@ -1177,7 +1054,6 @@ public: /** * @brief Get the object of RangeInfo - * @param * @return the object of RangeInfo * @since 3 * @sysCap Accessibility @@ -1187,7 +1063,6 @@ public: /** * @brief Set the object of RangeInfo * @param rangeInfo the object of RangeInfo - * @return * @since 3 * @sysCap Accessibility */ @@ -1196,7 +1071,6 @@ public: /** * @brief Set the start location of text selected. * @param start the start location of text selected. - * @return * @since 3 * @sysCap Accessibility */ @@ -1204,7 +1078,6 @@ public: /** * @brief Get the start location of text selected. - * @param * @return the start location of text selected. * @since 3 * @sysCap Accessibility @@ -1214,7 +1087,6 @@ public: /** * @brief Set the end location of text selected. * @param end the end location of text selected. - * @return * @since 3 * @sysCap Accessibility */ @@ -1222,7 +1094,6 @@ public: /** * @brief Get the end location of text selected. - * @param * @return the end location of text selected. * @since 3 * @sysCap Accessibility @@ -1231,7 +1102,6 @@ public: /** * @brief Get the object of GridInfo - * @param * @return the object of GridInfo * @since 3 * @sysCap Accessibility @@ -1241,7 +1111,6 @@ public: /** * @brief Set the object of GridInfo * @param grid the object of GridInfo - * @return * @since 3 * @sysCap Accessibility */ @@ -1249,7 +1118,6 @@ public: /** * @brief Get the object of GridItemInfo - * @param * @return the object of GridItemInfo * @since 3 * @sysCap Accessibility @@ -1259,7 +1127,6 @@ public: /** * @brief Set the object of GridItemInfo * @param gridItem the object of GridItemInfo - * @return * @since 3 * @sysCap Accessibility */ @@ -1267,7 +1134,6 @@ public: /** * @brief Get the current index of list or location text - * @param * @return the current index of list or location text * @since 3 * @sysCap Accessibility @@ -1277,7 +1143,6 @@ public: /** * @brief Set the current index of list or location text * @param index the current index of list or location text - * @return * @since 3 * @sysCap Accessibility */ @@ -1285,7 +1150,6 @@ public: /** * @brief Get the start index of list or location text - * @param * @return the start index of list or location text * @since 3 * @sysCap Accessibility @@ -1295,7 +1159,6 @@ public: /** * @brief Set the start index of list or location text * @param index the start index of list or location text - * @return * @since 3 * @sysCap Accessibility */ @@ -1303,7 +1166,6 @@ public: /** * @brief Get the end index of list or location text - * @param * @return the end index of list or location text * @since 3 * @sysCap Accessibility @@ -1313,7 +1175,6 @@ public: /** * @brief Set the end index of list or location text * @param index the end index of list or location text - * @return * @since 3 * @sysCap Accessibility */ @@ -1321,7 +1182,6 @@ public: /** * @brief Get the input type of text - * @param * @return The input type of text * @since 3 * @sysCap Accessibility @@ -1331,7 +1191,6 @@ public: /** * @brief Set the input type of text * @param inputType The input type of text - * @return * @since 3 * @sysCap Accessibility */ @@ -1339,7 +1198,6 @@ public: /** * @brief Check whether this node is valid - * @param * @return true:valid, otherwise is not. * @since 3 * @sysCap Accessibility @@ -1349,7 +1207,6 @@ public: /** * @brief Set whether this node is valid * @param valid true:valid, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -1374,7 +1231,6 @@ public: /** * @brief Set page id * @param pageId page id. - * @return - * @sysCap Accessibility */ void SetPageId(const int32_t pageId); @@ -1389,14 +1245,12 @@ public: /** * @brief Set the text movement step * @param granularity text moving unit - * @return - * @sysCap Accessibility */ void SetTextMovementStep(const TextMoveUnit granularity); /** * @brief Get the text movement step - * @param - * @return Text moving unit * @sysCap Accessibility */ @@ -1405,14 +1259,12 @@ public: /** * @brief Set item count * @param itemCounts The count of item - * @return - * @sysCap Accessibility */ void SetItemCounts(const int32_t itemCounts); /** * @brief Get item count - * @param - * @return The count of item * @sysCap Accessibility */ @@ -1423,14 +1275,12 @@ public: /** * @brief Set trigger action * @param action The trigger action - * @return - * @sysCap Accessibility */ void SetTriggerAction(const ActionType action); /** * @brief Get trigger action - * @param - * @return The trigger action * @sysCap Accessibility */ @@ -1439,16 +1289,13 @@ public: /** * @brief Set content list * @param contentList The list of content - * @return - * @sysCap Accessibility */ void SetContentList(const std::vector &contentList); /** * @brief Get content list - * @param contentList Outgoing parameter - * The list of content - * @return - + * @param contentList(out) The list of content * @sysCap Accessibility */ void GetContentList(std::vector &contentList) const; @@ -1456,14 +1303,12 @@ public: /** * @brief Set latest content * @param content The latest content - * @return - * @sysCap Accessibility */ void SetLatestContent(const std::string &content); /** * @brief Get latest content - * @param - * @return The latest content * @sysCap Accessibility */ diff --git a/interfaces/innerkits/common/include/accessibility_event_info.h b/interfaces/innerkits/common/include/accessibility_event_info.h index f5b6273f6..465bac705 100644 --- a/interfaces/innerkits/common/include/accessibility_event_info.h +++ b/interfaces/innerkits/common/include/accessibility_event_info.h @@ -31,8 +31,6 @@ class AccessibilityMemo { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -41,7 +39,6 @@ public: /** * @brief AAMS called to set the id of the IAccessibleAbilityChannel * @param channelId The id of the IAccessibleAbilityChannel - * @return * @since 3 * @sysCap Accessibility */ @@ -49,7 +46,6 @@ public: /** * @brief Get the id of the IAccessibleAbilityChannel - * @param - * @return The id of the IAccessibleAbilityChannel * @since 3 * @sysCap Accessibility @@ -59,7 +55,6 @@ public: /** * @brief Set the component of the event related. * @param componentId The id of component. - * @return - * @since 3 * @sysCap Accessibility */ @@ -67,7 +62,6 @@ public: /** * @brief Gets the view(component) ID associated with the accessibility event. - * @param - * @return The view(component) ID associated with the accessibility event. * @since 3 * @sysCap Accessibility @@ -76,7 +70,6 @@ public: /** * @brief Gets the accessibility ID of the component. - * @param - * @return The accessibility ID of the component. * @since 3 * @sysCap Accessibility @@ -86,7 +79,6 @@ public: /** * @brief Set the window ID associated with the accessibility event. * @param windowId The window ID associated with the accessibility event. - * @return - * @since 3 * @sysCap Accessibility */ @@ -94,7 +86,6 @@ public: /** * @brief Gets the window ID associated with the accessibility event. - * @param - * @return The window ID associated with the accessibility event. * @since 3 * @sysCap Accessibility @@ -104,7 +95,6 @@ public: /** * @brief Gets the current index of listed items or text position associated with the current event. - * @param - * @return The current index of listed items or text position associated with the current event. * @since 3 * @sysCap Accessibility @@ -114,7 +104,6 @@ public: /** * @brief Sets the current index of listed items or text position associated with the current event. * @param index The current index of listed items or text position associated with the current event. - * @return * @since 3 * @sysCap Accessibility */ @@ -122,7 +111,6 @@ public: /** * @brief Gets the start index of listed items on the screen. - * @param - * @return The start index of listed items. It is unique value for the listed items. * @since 3 * @sysCap Accessibility @@ -132,7 +120,6 @@ public: /** * @brief Sets the start index of listed items on the screen. * @param index The start index of listed items. It is unique value for the listed items. - * @return * @since 3 * @sysCap Accessibility */ @@ -140,7 +127,6 @@ public: /** * @brief Gets the number items on the screen. - * @param - * @return The number of items. * @since 3 * @sysCap Accessibility @@ -150,7 +136,6 @@ public: /** * @brief Sets the number items on the screen. * @param ItemCounts The number of items. - * @return * @since 3 * @sysCap Accessibility */ @@ -158,7 +143,6 @@ public: /** * @brief Gets the end index of listed items on the screen. - * @param - * @return The end index of listed items on the screen. * @since 3 * @sysCap Accessibility @@ -168,7 +152,6 @@ public: /** * @brief Sets the end index of listed items on the screen. * @param index The end index of listed items on the screen. - * @return - * @since 3 * @sysCap Accessibility */ @@ -176,7 +159,6 @@ public: /** * @brief Gets the class(component type) name. - * @param - * @return The class(component type) name. * @since 3 * @sysCap Accessibility @@ -186,7 +168,6 @@ public: /** * @brief Sets the class(component type) name. * @param className The class(component type) name. - * @return - * @since 3 * @sysCap Accessibility */ @@ -194,7 +175,6 @@ public: /** * @brief Gets the before text changed of the component. - * @param - * @return The before text changed of the component. * @since 3 * @sysCap Accessibility @@ -204,7 +184,6 @@ public: /** * @brief Set the before text changed of the component. * @param beforeText The before text changed of the component. - * @return * @since 3 * @sysCap Accessibility */ @@ -213,7 +192,6 @@ public: /** * @brief Adds an text to the content list. * @param content Indicates the text to add. - * @return - * @since 3 * @sysCap Accessibility */ @@ -221,7 +199,6 @@ public: /** * @brief Get the content list in the event. - * @param - * @return The content list in the event. * @since 3 * @sysCap Accessibility @@ -230,7 +207,6 @@ public: /** * @brief Gets the last content of the component(The text of changed after). - * @param - * @return The last content of the component(The text of changed after). * @since 3 * @sysCap Accessibility @@ -240,7 +216,6 @@ public: /** * @brief Sets the last content of the component. * @param content The last content of component. - * @return - * @since 3 * @sysCap Accessibility */ @@ -248,7 +223,6 @@ public: /** * @brief Gets the accessibility event description. - * @param - * @return The accessibility event description * @since 3 * @sysCap Accessibility @@ -258,7 +232,6 @@ public: /** * @brief Sets the accessibility event description. * @param contentDescription The accessibility event description - * @return - * @since 3 * @sysCap Accessibility */ @@ -291,8 +264,6 @@ class AccessibilityEventInfo : public AccessibilityMemo { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -301,7 +272,6 @@ public: /** * @brief Construct * @param eventType the type of event info - * @return * @since 3 * @sysCap Accessibility */ @@ -311,7 +281,6 @@ public: * @brief Construct * @param windowId The id of window * @param windowChangeTypes the window change type - * @return * @since 3 * @sysCap Accessibility */ @@ -319,7 +288,6 @@ public: /** * @brief Gets the number of accessibility records. - * @param - * @return The number of the records that describe the information of current event * @since 3 * @sysCap Accessibility @@ -330,7 +298,6 @@ public: * @brief Set the number of accessibility records. * @note It is same to setCount​(int32_t count) * @param recordCount The number of the records that describe the information of current event - * @return - * @since 3 * @sysCap Accessibility */ @@ -339,7 +306,6 @@ public: /** * @brief Adds an accessibility record to describe the information of the current event. * @param record The record that describe the information of current event - * @return - * @since 3 * @sysCap Accessibility */ @@ -358,7 +324,6 @@ public: /** * @brief Get the accessibility record list. - * @param * @return The accessibility record list * @since 3 * @sysCap Accessibility @@ -367,7 +332,6 @@ public: /** * @brief Get the type of the accessibility event. - * @param - * @return The type of the accessibility event. * @since 3 * @sysCap Accessibility @@ -376,7 +340,6 @@ public: /** * @brief Get the window content changed types - * @param - * @return The window content changed types. Refer to "WindowsContentChangeTypes" * @since 3 * * @sysCap Accessibility @@ -386,7 +349,6 @@ public: /** * @brief Set the window content changed types * @param changeTypes The window content changed types. Refer to "WindowsContentChangeTypes" - * @return - * @since 3 * @sysCap Accessibility */ @@ -394,7 +356,6 @@ public: /** * @brief Get the window changed types - * @param - * @return The window changed types.refer to WindowUpdateType * @since 3 * @sysCap Accessibility @@ -404,7 +365,6 @@ public: /** * @brief Set the window changed types * @param changeTypes The window changed types.refer to WindowUpdateType - * @return - * @since 3 * @sysCap Accessibility */ @@ -414,7 +374,6 @@ public: * @brief Sets the type of an accessibility event. * @note It is same to setAccessibilityEventType​(int32_t accessibilityEventType) * @param eventType The type of an accessibility event. Refer to "EventType" - * @return - * @since 3 * @sysCap Accessibility */ @@ -422,7 +381,6 @@ public: /** * @brief AA get the time of accessibility event is sent from ASAC. - * @param - * @return The time of accessibility event is sent from ASAC * @since 3 * @sysCap Accessibility @@ -432,7 +390,6 @@ public: /** * @brief ASAC set the time of accessibility is sent to AA * @param timeStamp The time of accessibility event is sent from ASAC - * @return - * @since 3 * @sysCap Accessibility */ @@ -440,7 +397,6 @@ public: /** * @brief Gets the bundle name of the event source, that is, the bundle name of the target application. - * @param - * @return Returns the bundle name of the event source. * @since 3 * @sysCap Accessibility @@ -450,7 +406,6 @@ public: /** * @brief Set the bundle name of the event source, that is, the bundle name of the target application. * @param bundleName The bundle name of the event source. - * @return - * @since 3 * @sysCap Accessibility */ @@ -458,7 +413,6 @@ public: /** * @brief Get the notification content of the event source. - * @param - * @return Return the notification content of the event source. * @since 3 * @sysCap Accessibility @@ -468,7 +422,6 @@ public: /** * @brief Set the notification content of the event source. * @param notificationContent The notification content of the event source. - * @return - * @since 3 * @sysCap Accessibility */ @@ -477,7 +430,6 @@ public: /** * @brief Set the move granularity of the text * @param granularity The move granularity of the text. Refer to "AccessibilityElementInfo.TextMoveUnit" - * @return * @since 3 * @sysCap Accessibility */ @@ -485,7 +437,6 @@ public: /** * @brief Get the move granularity of the text - * @param - * @return The move granularity of the text. Refer to "AccessibilityElementInfo.TextMoveUnit" * @since 3 * @sysCap Accessibility @@ -495,7 +446,6 @@ public: /** * @brief Sets the action that triggers the accessibility event. * @param action The operation of the event. Refer to "AccessibilityElementInfo.ActionType" - * @return - * @since 3 * @sysCap Accessibility */ @@ -503,7 +453,6 @@ public: /** * @brief Gets the action that triggers the accessibility event. - * @param - * @return The operation of the event. Refer to "AccessibilityElementInfo.ActionType" * @since 3 * @sysCap Accessibility @@ -513,7 +462,6 @@ public: /** * @brief Set the information of accessibility event of [TYPE_NOTIFICATION_UPDATE_EVENT] * @param category Refer to [NotificationCategory], It maybe changed from APP - * @return - * @since 3 * @sysCap Accessibility */ @@ -521,7 +469,6 @@ public: /** * @brief Get the information of accessibility event of [TYPE_NOTIFICATION_UPDATE_EVENT] - * @param - * @return Refer to [NotificationCategory], It maybe changed from APP * @since 3 * @sysCap Accessibility @@ -531,7 +478,6 @@ public: /** * @brief Set the customize gesture type of accessibility event of [TYPE_GESTURE_EVENT] * @param category Refer to [GestureType], It maybe changed from APP - * @return - * @since 3 * @sysCap Accessibility */ @@ -539,7 +485,6 @@ public: /** * @brief Get the customize gesture type of accessibility event of [TYPE_GESTURE_EVENT] - * @param - * @return Refer to [GestureType], It maybe changed from APP * @since 3 * @sysCap Accessibility @@ -549,7 +494,6 @@ public: /** * @brief Set the page ID associated with the accessibility event. * @param pageId The page ID associated with the accessibility event. - * @return - * @since 3 * @sysCap Accessibility */ @@ -557,7 +501,6 @@ public: /** * @brief Gets the page ID associated with the accessibility event. - * @param - * @return The page ID associated with the accessibility event. * @since 3 * @sysCap Accessibility diff --git a/interfaces/innerkits/common/include/accessibility_gesture_inject_path.h b/interfaces/innerkits/common/include/accessibility_gesture_inject_path.h index 0f48778d8..38246fc9d 100644 --- a/interfaces/innerkits/common/include/accessibility_gesture_inject_path.h +++ b/interfaces/innerkits/common/include/accessibility_gesture_inject_path.h @@ -39,14 +39,12 @@ public: /** * @brief Obtains the duration in which this gesture path continues. - * @param * @return Return the duration in which this gesture path continues. */ int64_t GetDurationTime() const; /** * @brief Obtains all positions of this gesture path. - * @param * @return Return all positions of this gesture path. */ const std::vector &GetPositions() const; @@ -54,14 +52,12 @@ public: /** * @brief Sets the duration for this gesture path to continue. * @param durationTime The duration for this gesture path to continue. - * @return */ void SetDurationTime(int64_t durationTime); /** * @brief Add a position of this gesture path. * @param position A position of this gesture path. - * @return */ void AddPosition(AccessibilityGesturePosition &position); diff --git a/interfaces/innerkits/common/include/accessibility_window_info.h b/interfaces/innerkits/common/include/accessibility_window_info.h index 042fe5d6e..d180665bd 100644 --- a/interfaces/innerkits/common/include/accessibility_window_info.h +++ b/interfaces/innerkits/common/include/accessibility_window_info.h @@ -25,8 +25,6 @@ class AccessibilityWindowInfo { public: /** * @brief Construct - * @param - * @return * @since 3 * @sysCap Accessibility */ @@ -34,7 +32,6 @@ public: /** * @brief Get the window type. - * @param - * @return The accessibility window type. Refer to [AccessibilityWindowType]. * @since 3 * @sysCap Accessibility @@ -44,7 +41,6 @@ public: /** * @brief Set the window type. * @param type The accessibility window type. Refer to [AccessibilityWindowType]. - * @return - * @since 3 * @sysCap Accessibility */ @@ -52,7 +48,6 @@ public: /** * @brief Get The window layer - * @param - * @return The layer of window * @since 3 * @sysCap Accessibility @@ -62,7 +57,6 @@ public: /** * @brief Set The window layer * @param layer The window layer - * @return - * @since 3 * @sysCap Accessibility */ @@ -71,7 +65,6 @@ public: /** * @brief Set an anchor accessibility node that anchors this window to another window. * @param anchorId The accessibility id of component. - * @return * @since 3 * @sysCap Accessibility */ @@ -79,7 +72,6 @@ public: /** * @brief Get the anchor window - * @param - * @return The anchor id of the window. * @since 3 * @sysCap Accessibility @@ -88,7 +80,6 @@ public: /** * @brief Get the window id of current window. - * @param - * @return The window id of current window. * @since 3 * @sysCap Accessibility @@ -98,7 +89,6 @@ public: /** * @brief Set the window id of current window. * @param id The window id of current window. - * @return * @since 3 * @sysCap Accessibility */ @@ -107,7 +97,6 @@ public: /** * @brief AAMS called to set the id of the IAccessibleAbilityChannel. * @param channelId The id of the IAccessibleAbilityChannel. - * @return * @since 3 * @sysCap Accessibility */ @@ -115,7 +104,6 @@ public: /** * @brief Get the id of the IAccessibleAbilityChannel. - * @param * @return The id of the IAccessibleAbilityChannel. * @since 3 * @sysCap Accessibility @@ -124,7 +112,6 @@ public: /** * @brief Get the screen pixel coordinates - * @param - * @return The screen pixel coordinates * @since 3 * @sysCap Accessibility @@ -134,7 +121,6 @@ public: /** * @brief Set the screen pixel coordinates * @param bounds The screen pixel coordinates - * @return - * @since 3 * @sysCap Accessibility */ @@ -142,7 +128,6 @@ public: /** * @brief Check whether the window is active or not. - * @param - * @return true: the window is active, otherwise is not. * @since 3 * @sysCap Accessibility @@ -152,7 +137,6 @@ public: /** * @brief Set whether the window is active or not. * @param active true: the window is active, otherwise is not. - * @return * @since 3 * @sysCap Accessibility */ @@ -160,7 +144,6 @@ public: /** * @brief Checks whether this window has gained focus. - * @param * @return true: the window has gained focus, otherwise is not. * @since 3 * @sysCap Accessibility @@ -170,7 +153,6 @@ public: /** * @brief Set whether this window has gained focus. * @param focused true: the window has gained focus, otherwise is not. - * @return - * @since 3 * @sysCap Accessibility */ @@ -178,7 +160,6 @@ public: /** * @brief Checks whether this window has gained accessibility focus. - * @param - * @return true: this window has gained accessibility focus, otherwise is not. * @since 3 * @sysCap Accessibility @@ -188,7 +169,6 @@ public: /** * @brief Set whether this window has gained accessibility focus. * @param accessibilityFocused true: this window has gained accessibility focus, otherwise is not. - * @return - * @since 3 * @sysCap Accessibility */ @@ -197,7 +177,6 @@ public: /** * @brief Set the display id * @param displayId the display id of the window - * @return - * @sysCap Accessibility */ void SetDisplayId(const uint64_t displayId); @@ -219,7 +198,6 @@ public: /** * @brief Set window type * @param type The type of window. Refer to [OHOS::Rosen::WindowType]. - * @return - * @sysCap Accessibility */ void SetWindowType(const uint32_t type); @@ -234,14 +212,12 @@ public: /** * @brief Set window mode * @param mode The mode of window. Refer to [OHOS::Rosen::WindowMode]. - * @return - * @sysCap Accessibility */ void SetWindowMode(const uint32_t mode); /** * @brief Get whether the decoration state is enabled - * @param - * @return true:the decoration is enabled; false:the decoration is disabled * @sysCap Accessibility */ @@ -250,7 +226,6 @@ public: /** * @brief Set the decoration state * @param isDecorEnable true:enable decoration; false:disable decoration - * @return - * @sysCap Accessibility */ void SetDecorEnable(const bool isDecorEnable); diff --git a/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp b/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp index 598e6205b..71280ecbe 100644 --- a/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp +++ b/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp @@ -51,7 +51,7 @@ namespace { std::make_shared(); auto &config = OHOS::Singleton::GetInstance(); - config.SubscribeConfigObserver(CONFIG_SCREEN_MAGNIFICATION, configObserver); + config.SubscribeConfigObserver(CONFIG_SCREEN_MAGNIFICATION, configObserver, false); config.GetScreenMagnificationState(value); for (auto _ : state) { /* @tc.steps: step1.call SetScreenMagnificationState in loop */ @@ -94,7 +94,7 @@ namespace { std::make_shared(); auto &config = OHOS::Singleton::GetInstance(); - config.SubscribeConfigObserver(CONFIG_SHORT_KEY_TARGET, configObserver); + config.SubscribeConfigObserver(CONFIG_SHORT_KEY_TARGET, configObserver, false); for (auto _ : state) { /* @tc.steps: step1.call SetShortkeyTarget in loop */ @@ -103,7 +103,7 @@ namespace { configObserver->SetCompletePromise(complete); config.SetShortkeyTarget(nameStr); syncFuture.wait(); - if (!strcmp(nameStr.c_str(), "aaa")) { + if (!nameStr.compare("aaa")) { nameStr = "bbb"; } else { nameStr = "aaa"; @@ -140,7 +140,7 @@ namespace { std::make_shared(); auto &config = OHOS::Singleton::GetInstance(); - config.SubscribeConfigObserver(CONFIG_CONTENT_TIMEOUT, configObserver); + config.SubscribeConfigObserver(CONFIG_CONTENT_TIMEOUT, configObserver, false); config.GetContentTimeout(value); for (auto _ : state) { /* @tc.steps: step1.call SetContentTimeout in loop */ @@ -184,7 +184,7 @@ namespace { for (auto _ : state) { /* @tc.steps: step1.call SubscribeConfigObserver in loop */ - config.SubscribeConfigObserver(CONFIG_SCREEN_MAGNIFICATION, configObserver); + config.SubscribeConfigObserver(CONFIG_SCREEN_MAGNIFICATION, configObserver, false); config.UnsubscribeConfigObserver(CONFIG_SCREEN_MAGNIFICATION, configObserver); } } diff --git a/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp b/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp index 806493d62..fbfd0186d 100644 --- a/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp +++ b/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp @@ -52,12 +52,6 @@ namespace { std::promise complete_; }; - class AccessibilityGestureResultListenerForBenchmark : public AccessibilityGestureResultListener { - public: - virtual ~AccessibilityGestureResultListenerForBenchmark() = default; - void OnGestureInjectResult(uint32_t sequence, bool result) override {} - }; - class AccessibleAbilityClientTest : public benchmark::Fixture { public: AccessibleAbilityClientTest() @@ -174,19 +168,14 @@ namespace { BENCHMARK_F(AccessibleAbilityClientTest, InjectGestureTestCase)( benchmark::State &state) { - uint32_t sequence = 0; while (state.KeepRunning()) { - sequence++; std::shared_ptr gesturePath = std::make_shared(); int64_t durationTime = 20; gesturePath->SetDurationTime(durationTime); AccessibilityGesturePosition position = {200.0f, 200.0f}; gesturePath->AddPosition(position); - - std::shared_ptr listener = - std::make_shared(); - AccessibilityUITestAbility::GetInstance()->InjectGesture(sequence, gesturePath, listener); + AccessibilityUITestAbility::GetInstance()->InjectGesture(gesturePath); } } } diff --git a/interfaces/innerkits/test/fuzztest/accessibilityconfig_fuzzer/accessibilityconfig_fuzzer.cpp b/interfaces/innerkits/test/fuzztest/accessibilityconfig_fuzzer/accessibilityconfig_fuzzer.cpp index cfa6d512c..cde054dc1 100644 --- a/interfaces/innerkits/test/fuzztest/accessibilityconfig_fuzzer/accessibilityconfig_fuzzer.cpp +++ b/interfaces/innerkits/test/fuzztest/accessibilityconfig_fuzzer/accessibilityconfig_fuzzer.cpp @@ -15,6 +15,7 @@ #include "accessibilityconfig_fuzzer.h" #include "accessibility_config.h" +#include "securec.h" namespace OHOS { namespace { @@ -30,7 +31,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size) if (objectSize > size) { return 0; } - std::memcpy(&object, data, objectSize); + (void)memcpy_s(&object, objectSize, data, size); return objectSize; } @@ -53,12 +54,12 @@ static size_t GenerateCaptionProperty( char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string family(name); property.SetFontFamily(family); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string type(name); property.SetFontFamily(type); position += LEN; @@ -78,7 +79,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) abConfig.SetScreenMagnificationState(data[startPos++] & 0x01); abConfig.SetShortKeyState(data[startPos++] & 0x01); abConfig.SetMouseKeyState(data[startPos++] & 0x01); - abConfig.SetCaptionState(data[startPos++] & 0x01); + abConfig.SetCaptionsState(data[startPos++] & 0x01); abConfig.SetHighContrastTextState(data[startPos++] & 0x01); abConfig.SetInvertColorState(data[startPos++] & 0x01); abConfig.SetAnimationOffState(data[startPos++] & 0x01); @@ -103,22 +104,22 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string nameStr(name); abConfig.SetShortkeyTarget(nameStr); startPos += LEN; OHOS::AccessibilityConfig::CaptionProperty property; startPos += GenerateCaptionProperty(property, &data[startPos], size - startPos); - abConfig.SetCaptionProperty(property); + abConfig.SetCaptionsProperty(property); - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string abilityName1(name); startPos += LEN; startPos += GetObject(temp, &data[startPos], size - startPos); abConfig.EnableAbility(abilityName1, temp); - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string abilityName2(name); startPos += LEN; abConfig.DisableAbility(abilityName2); diff --git a/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/BUILD.gn b/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/BUILD.gn index 2edd3fae1..a83de12e7 100644 --- a/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/BUILD.gn +++ b/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/BUILD.gn @@ -29,6 +29,7 @@ ohos_fuzztest("AccessibilitySystemAbilityClientFuzzTest") { ] sources = [ "accessibilitysystemabilityclient_fuzzer.cpp" ] deps = [ "//foundation/barrierfree/accessibility/interfaces/innerkits/asacfwk:accessibilityclient" ] + external_deps = [ "c_utils:utils" ] } ############################################################################### diff --git a/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/accessibilitysystemabilityclient_fuzzer.cpp b/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/accessibilitysystemabilityclient_fuzzer.cpp index 2bc8f55f9..2e7c64648 100644 --- a/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/accessibilitysystemabilityclient_fuzzer.cpp +++ b/interfaces/innerkits/test/fuzztest/accessibilitysystemabilityclient_fuzzer/accessibilitysystemabilityclient_fuzzer.cpp @@ -15,6 +15,7 @@ #include "accessibilitysystemabilityclient_fuzzer.h" #include "accessibility_system_ability_client.h" +#include "securec.h" namespace OHOS { namespace Accessibility { @@ -31,7 +32,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size) if (objectSize > size) { return 0; } - std::memcpy(&object, data, objectSize); + (void)memcpy_s(&object, objectSize, data, size); return objectSize; } @@ -118,37 +119,37 @@ static size_t CreateEventInfo(AccessibilityEventInfo &eventInfo, const uint8_t* char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string className(name); eventInfo.SetComponentType(className); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string beforeText(name); eventInfo.SetBeforeText(beforeText); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string content(name); eventInfo.AddContent(content); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string lastContent(name); eventInfo.SetLatestContent(lastContent); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string contentDescription(name); eventInfo.SetDescription(contentDescription); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string bundleName(name); eventInfo.SetBundleName(bundleName); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string notificationContent(name); eventInfo.SetNotificationContent(notificationContent); position += LEN; diff --git a/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/BUILD.gn b/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/BUILD.gn index 772b7b6cf..ada3a587f 100644 --- a/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/BUILD.gn +++ b/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/BUILD.gn @@ -29,6 +29,7 @@ ohos_fuzztest("AccessibleAbilityClientFuzzTest") { ] sources = [ "accessibleabilityclient_fuzzer.cpp" ] deps = [ "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability" ] + external_deps = [ "c_utils:utils" ] } ############################################################################### diff --git a/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/accessibleabilityclient_fuzzer.cpp b/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/accessibleabilityclient_fuzzer.cpp index 150653edc..e1cc3be8c 100644 --- a/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/accessibleabilityclient_fuzzer.cpp +++ b/interfaces/innerkits/test/fuzztest/accessibleabilityclient_fuzzer/accessibleabilityclient_fuzzer.cpp @@ -16,6 +16,7 @@ #include "accessibleabilityclient_fuzzer.h" #include "accessibility_element_info.h" #include "accessibility_ui_test_ability.h" +#include "securec.h" namespace OHOS { namespace { @@ -33,7 +34,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size) if (objectSize > size) { return 0; } - std::memcpy(&object, data, objectSize); + (void)memcpy_s(&object, objectSize, data, size); return objectSize; } @@ -157,42 +158,42 @@ static size_t GenerateAccessibilityElementInfo(OHOS::Accessibility::Accessibilit char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string bundleName(name); sourceElementInfo.SetBundleName(bundleName); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string componentType(name); sourceElementInfo.SetComponentType(componentType); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string text(name); sourceElementInfo.SetContent(text); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string hintText(name); sourceElementInfo.SetHint(hintText); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string contentDescription(name); sourceElementInfo.SetDescriptionInfo(contentDescription); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string resourceName(name); sourceElementInfo.SetComponentResourceId(resourceName); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string inspectorKey(name); sourceElementInfo.SetInspectorKey(inspectorKey); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string error(name); sourceElementInfo.SetError(error); position += LEN; @@ -236,7 +237,7 @@ static size_t GenerateAccessibilityElementInfo(OHOS::Accessibility::Accessibilit for (size_t i = 0; i < VEC_SIZE; i++) { position += GetObject(int32Data, &data[position], size - position); - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); position += LEN; std::string description(name); @@ -301,12 +302,12 @@ static size_t GenerateAccessibilityEventInfoPartial(OHOS::Accessibility::Accessi char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string bundleName(name); sourceEventInfo.SetBundleName(bundleName); position += LEN; - std::memcpy(&name, &data[position], LEN); + (void)memcpy_s(&name, LEN, &data[position], LEN); std::string notificationContent(name); sourceEventInfo.SetNotificationContent(notificationContent); position += LEN; @@ -511,7 +512,7 @@ bool DoSomethingInterestingWithGetByContent(const uint8_t* data, size_t size) startPos += GenerateAccessibilityElementInfo(sourceElementInfo, &data[startPos], size - startPos); char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string text(name); startPos += LEN; OHOS::Accessibility::AccessibilityUITestAbility::GetInstance()->GetByContent( @@ -581,11 +582,11 @@ bool DoSomethingInterestingWithExecuteAction(const uint8_t* data, size_t size) for (size_t i = 0; i < MAP_SIZE; i++) { char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string action1(name); startPos += LEN; - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string action2(name); startPos += LEN; actionArguments.insert(std::make_pair(action1, action2)); @@ -621,7 +622,7 @@ bool DoSomethingInterestingWithSetTargetBundleName(const uint8_t* data, size_t s for (size_t i = 0; i < VEC_SIZE; i++) { char name[LEN + 1]; name[LEN] = END_CHAR; - std::memcpy(&name, &data[startPos], LEN); + (void)memcpy_s(&name, LEN, &data[startPos], LEN); std::string targetBundleName(name); startPos += LEN; targetBundleNames.push_back(targetBundleName); diff --git a/interfaces/kits/js/@ohos.accessibility.config.d.ts b/interfaces/kits/js/@ohos.accessibility.config.d.ts index 2464bd0ac..9897104a7 100644 --- a/interfaces/kits/js/@ohos.accessibility.config.d.ts +++ b/interfaces/kits/js/@ohos.accessibility.config.d.ts @@ -1,27 +1,75 @@ import accessibility from './@ohos.accessibility'; import { AsyncCallback, Callback } from './basic'; - + +/** + * Configuration of the accessibility. + * + * @since 9 + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + */ declare namespace config { + /** + * Indicates the configuration of high-contrast text. + */ var highContrastText: Config; + /** + * Indicates the configuration of invert color. + */ var invertColor: Config; + /** + * Indicates the configuration of daltonization color filter. + */ var daltonizationColorFilter: Config; - // number int scope: 0 - 5000 ms + /** + * Indicates the configuration of content timeout. + */ var contentTimeout: Config; + /** + * Indicates the configuration of animation state. + */ var animationOff: Config; - // number float scope: 0.0 - 1.0 + /** + * Indicates the configuration of brightness discount. + */ var brightnessDiscount: Config; + /** + * Indicates the configuration of screen magnifier. + */ var screenMagnifier: Config; + /** + * Indicates the configuration of audio mono. + */ var audioMono: Config; - // number float scope: -1.0 - 1.0 + /** + * Indicates the configuration of audio balance. + */ var audioBalance: Config; + /** + * Indicates the configuration of monse key state. + */ var mouseKey: Config; - // number int scope: -1 off / 0 - 5000 ms on + /** + * Indicates the configuration of mouse auto click. + */ var mouseAutoClick: Config; + /** + * Indicates the configuration of shortkey state. + */ var shortkey: Config; - var shortkey_target: Config; - var caption: Config; - var captionStyle: Config; - + /** + * Indicates the configuration of shortkey target. + */ + var shortkeyTarget: Config; + /** + * Indicates the configuration of captions state. + */ + var captions: Config; + /** + * Indicates the configuration of captions style. + */ + var captionsStyle: Config; + /** * Enable the acceessibility extension ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. @@ -38,35 +86,52 @@ declare namespace config { function disableAbility(name: string, callback: AsyncCallback): void; /** - * Register the observe of the AbilityLists enable status changed. - * @since 9 - * @sysCap Accessibility - * @param - - * @return - - */ + * Register the listener to listen for for changes in the enabled status of accessibility extensions. + * @param type Indicates the enableAbilityListsStateChanged type. + * @param callback Indicates the listener. + */ function on(type: 'enableAbilityListsStateChanged', callback: Callback): void; - - /** - * Deregister the observe of the AbilityLists enable status changed. - * @since 9 - * @sysCap Accessibility - * @param - - * @return - - */ + + /** + * Deregister listener that watch for changes in the enabled status of accessibility extensions. + * @param type Indicates the enableAbilityListsStateChanged type. + * @param callback Indicates the listener. + */ function off(type: 'enableAbilityListsStateChanged', callback?: Callback): void; - + + /** + * Indicates setting, getting, and listening to changes in configuration. + */ interface Config { - // permission: accessibility.config.write - set(value: T, callback: AsyncCallback): void; + /** + * Setting configuration value. + * @param value Indicates the value. + */ set(value: T): Promise; - // permission: accessibility.config.read - get(callback: AsyncCallback): void; + set(value: T, callback: AsyncCallback): void; + + /** + * Getting configuration value. + */ get(): Promise; - // permission: accessibility.config.read + get(callback: AsyncCallback): void; + + /** + * Register the listener to listen for configuration changes. + * @param callback Indicates the listener. + */ on(callback: Callback): void; + + /** + * Deregister the listener to listen for configuration changes. + * @param callback Indicates the listener. + */ off(callback?: Callback): void; } - + + /** + * Indicates the type of daltonization color filter. + */ type DaltonizationColorFilter = 'Normal' | 'Protanomaly' | 'Deuteranomaly' | 'Tritanomaly'; } export default config; \ No newline at end of file diff --git a/interfaces/kits/js/AccessibilityExtensionContext.d.ts b/interfaces/kits/js/AccessibilityExtensionContext.d.ts index b8271bb4b..e0561bd02 100644 --- a/interfaces/kits/js/AccessibilityExtensionContext.d.ts +++ b/interfaces/kits/js/AccessibilityExtensionContext.d.ts @@ -25,11 +25,12 @@ import { GesturePath } from "../@ohos.application.AccessibilityExtensionAbility" * @syscap SystemCapability.BarrierFree.Accessibility.Core */ export default class AccessibilityExtensionContext extends ExtensionContext { - setEventTypeFilter(type: Array, callback: AsyncCallback): boolean; - setEventTypeFilter(type: Array): Promise; - - setTargetBundleName(targetNames: Array, callback: AsyncCallback): boolean; - setTargetBundleName(targetNames: Array): Promise; + /** + * Set the name of the bundle name that is interested in sending the event. + * @param targetNames + */ + setTargetBundleName(targetNames: Array): Promise; + setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; /** * Get focus element. @@ -55,9 +56,12 @@ export default class AccessibilityExtensionContext extends ExtensionContext { getWindows(callback: AsyncCallback>): void; getWindows(displayId: number, callback: AsyncCallback>): void; - - gestureInject(gesturePath: GesturePath, listener: Callback, callback: AsyncCallback): void; - gestureInject(gesturePath: GesturePath, listener: Callback): Promise; + /** + * Inject gesture path events. + * @param gesturePath Indicates the gesture path. + */ + injectGesture(gesturePath: GesturePath): Promise; + injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; } /** diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index aa0825762..456fc38b0 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -22,7 +22,7 @@ ohos_shared_library("accessibility") { defines = [ "AAMS_LOG_TAG = \"accessibility_napi\"", - "AAMS_LOG_DOMAIN = 0xD005210", + "AAMS_LOG_DOMAIN = 0xD001D10", ] sources = [ @@ -39,11 +39,11 @@ ohos_shared_library("accessibility") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "${ability_runtime_path}/frameworks/native/appkit:appkit_native", "//foundation/arkui/napi:ace_napi", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability", "//foundation/barrierfree/accessibility/interfaces/innerkits/acfwk:accessibilityconfig", "//foundation/barrierfree/accessibility/interfaces/innerkits/asacfwk:accessibilityclient", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", ] external_deps = [ diff --git a/interfaces/kits/napi/accessibility_config/BUILD.gn b/interfaces/kits/napi/accessibility_config/BUILD.gn index 6ab1f1e7a..38feda1e9 100644 --- a/interfaces/kits/napi/accessibility_config/BUILD.gn +++ b/interfaces/kits/napi/accessibility_config/BUILD.gn @@ -22,7 +22,7 @@ ohos_shared_library("config_napi") { defines = [ "AAMS_LOG_TAG = \"accessibility_napi\"", - "AAMS_LOG_DOMAIN = 0xD005210", + "AAMS_LOG_DOMAIN = 0xD001D10", ] sources = [ @@ -36,12 +36,12 @@ ohos_shared_library("config_napi") { "//foundation/ability/ability_runtime/frameworks/native/ability/native:abilitykit_native", "//foundation/ability/ability_runtime/frameworks/native/appkit:appkit_native", "//foundation/arkui/napi:ace_napi", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/aafwk:accessibleability", "//foundation/barrierfree/accessibility/interfaces/innerkits/acfwk:accessibilityconfig", "//foundation/barrierfree/accessibility/interfaces/innerkits/asacfwk:accessibilityclient", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/interfaces/kits/napi:accessibility", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", ] external_deps = [ diff --git a/interfaces/kits/napi/accessibility_config/include/napi_accessibility_config.h b/interfaces/kits/napi/accessibility_config/include/napi_accessibility_config.h index 3710862bc..154e6aa68 100644 --- a/interfaces/kits/napi/accessibility_config/include/napi_accessibility_config.h +++ b/interfaces/kits/napi/accessibility_config/include/napi_accessibility_config.h @@ -114,7 +114,7 @@ public: static std::shared_ptr configObservers_; static std::shared_ptr enableAbilityListsObservers_; private: - static void SetConfigComplete(napi_env env, napi_status status, void* data); + static void AsyncWorkComplete(napi_env env, napi_status status, void* data); static void SetConfigExecute(napi_env env, void* data); static void GetConfigComplete(napi_env env, napi_status status, void* data); static void GetConfigExecute(napi_env env, void* data); diff --git a/interfaces/kits/napi/accessibility_config/src/napi_accessibility_config.cpp b/interfaces/kits/napi/accessibility_config/src/napi_accessibility_config.cpp index 76ab9cc34..a435a9b05 100644 --- a/interfaces/kits/napi/accessibility_config/src/napi_accessibility_config.cpp +++ b/interfaces/kits/napi/accessibility_config/src/napi_accessibility_config.cpp @@ -70,36 +70,7 @@ napi_value NAccessibilityConfig::EnableAbility(napi_env env, napi_callback_info callbackInfo->ret_ = instance.EnableAbility( callbackInfo->abilityName_, callbackInfo->capabilities_); } - }, - // Execute the complete function - [](napi_env env, napi_status status, void* data) { - NAccessibilityConfigData* callbackInfo = static_cast(data); - napi_value result[ARGS_SIZE_TWO] = {0}; - napi_value callback = 0; - napi_value undefined = 0; - napi_get_undefined(env, &undefined); - napi_get_undefined(env, &result[PARAM1]); - if (callbackInfo->callback_) { - result[PARAM0] = callbackInfo->ret_ ? - GetErrorValue(env, CODE_SUCCESS) : GetErrorValue(env, CODE_FAILED); - napi_get_reference_value(env, callbackInfo->callback_, &callback); - napi_value returnVal; - napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal); - napi_delete_reference(env, callbackInfo->callback_); - HILOG_DEBUG("complete function callback mode"); - } else { - if (callbackInfo->ret_) { - napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]); - } else { - napi_reject_deferred(env, callbackInfo->deferred_, result[PARAM1]); - } - } - napi_delete_async_work(env, callbackInfo->work_); - delete callbackInfo; - callbackInfo = nullptr; - }, - (void*)callbackInfo, - &callbackInfo->work_); + }, NAccessibilityConfig::AsyncWorkComplete, (void*)callbackInfo, &callbackInfo->work_); napi_queue_async_work(env, callbackInfo->work_); return promise; } @@ -142,36 +113,7 @@ napi_value NAccessibilityConfig::DisableAbility(napi_env env, napi_callback_info if (callbackInfo) { callbackInfo->ret_ = instance.DisableAbility(callbackInfo->abilityName_); } - }, - // Execute the complete function - [](napi_env env, napi_status status, void* data) { - NAccessibilityConfigData* callbackInfo = static_cast(data); - napi_value result[ARGS_SIZE_TWO] = {0}; - napi_value undefined = 0; - napi_get_undefined(env, &undefined); - napi_get_undefined(env, &result[PARAM1]); - if (callbackInfo->callback_) { - result[PARAM0] = callbackInfo->ret_ ? - GetErrorValue(env, CODE_SUCCESS) : GetErrorValue(env, CODE_FAILED); - napi_value callback = 0; - napi_get_reference_value(env, callbackInfo->callback_, &callback); - napi_value returnVal; - napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal); - napi_delete_reference(env, callbackInfo->callback_); - HILOG_DEBUG("complete function callback mode"); - } else { - if (callbackInfo->ret_) { - napi_resolve_deferred(env, callbackInfo->deferred_, result[PARAM1]); - } else { - napi_reject_deferred(env, callbackInfo->deferred_, result[PARAM1]); - } - } - napi_delete_async_work(env, callbackInfo->work_); - delete callbackInfo; - callbackInfo = nullptr; - }, - (void*)callbackInfo, - &callbackInfo->work_); + }, NAccessibilityConfig::AsyncWorkComplete, (void*)callbackInfo, &callbackInfo->work_); napi_queue_async_work(env, callbackInfo->work_); return promise; } @@ -224,7 +166,7 @@ napi_value NAccessibilityConfig::UnsubscribeState(napi_env env, napi_callback_in return nullptr; } -void NAccessibilityConfig::SetConfigComplete(napi_env env, napi_status status, void* data) +void NAccessibilityConfig::AsyncWorkComplete(napi_env env, napi_status status, void* data) { HILOG_INFO(); NAccessibilityConfigData* callbackInfo = static_cast(data); @@ -239,7 +181,11 @@ void NAccessibilityConfig::SetConfigComplete(napi_env env, napi_status status, v napi_get_undefined(env, &undefined); napi_get_undefined(env, &ret); if (callbackInfo->callback_) { - result[PARAM0] = GetErrorValue(env, CODE_SUCCESS); + if (callbackInfo->ret_) { + result[PARAM0] = GetErrorValue(env, CODE_SUCCESS); + } else { + result[PARAM0] = GetErrorValue(env, CODE_FAILED); + } result[PARAM1] = ret; napi_get_reference_value(env, callbackInfo->callback_, &callback); napi_value returnVal; @@ -247,7 +193,11 @@ void NAccessibilityConfig::SetConfigComplete(napi_env env, napi_status status, v napi_delete_reference(env, callbackInfo->callback_); HILOG_DEBUG("complete function callback mode"); } else { - napi_resolve_deferred(env, callbackInfo->deferred_, undefined); + if (callbackInfo->ret_) { + napi_resolve_deferred(env, callbackInfo->deferred_, undefined); + } else { + napi_reject_deferred(env, callbackInfo->deferred_, undefined); + } HILOG_DEBUG("complete function promise mode"); } napi_delete_async_work(env, callbackInfo->work_); @@ -263,9 +213,13 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data) HILOG_ERROR("callbackInfo is nullptr"); return; } + if (!callbackInfo->ret_) { + HILOG_ERROR("check param error"); + return; + } auto &instance = Singleton::GetInstance(); switch (callbackInfo->id_) { - case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRASTE_TEXT: + case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRAST_TEXT: instance.SetHighContrastTextState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_INVERT_COLOR: @@ -287,7 +241,7 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data) instance.SetShortKeyState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE: - instance.SetCaptionState(callbackInfo->boolConfig_); + instance.SetCaptionsState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT: instance.SetContentTimeout(callbackInfo->uint32Config_); @@ -311,7 +265,7 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data) instance.SetShortkeyTarget(callbackInfo->stringConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE: - instance.SetCaptionProperty(callbackInfo->captionProperty_); + instance.SetCaptionsProperty(callbackInfo->captionProperty_); break; default: break; @@ -332,7 +286,7 @@ void NAccessibilityConfig::GetConfigComplete(napi_env env, napi_status status, v napi_get_undefined(env, &undefined); HILOG_INFO("callbackInfo->id_ = %{public}d", callbackInfo->id_); switch (callbackInfo->id_) { - case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRASTE_TEXT: + case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRAST_TEXT: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_INVERT_COLOR: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_ANIMATION_OFF: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_SCREEN_MAGNIFICATION: @@ -343,8 +297,6 @@ void NAccessibilityConfig::GetConfigComplete(napi_env env, napi_status status, v napi_get_boolean(env, callbackInfo->boolConfig_, &result[PARAM1]); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT: - napi_create_uint32(env, callbackInfo->uint32Config_, &result[PARAM1]); - break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK: napi_create_int32(env, callbackInfo->int32Config_, &result[PARAM1]); break; @@ -389,7 +341,7 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data) } auto &instance = Singleton::GetInstance(); switch (callbackInfo->id_) { - case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRASTE_TEXT: + case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRAST_TEXT: instance.GetHighContrastTextState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_INVERT_COLOR: @@ -411,10 +363,14 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data) instance.GetShortKeyState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE: - instance.GetCaptionState(callbackInfo->boolConfig_); + instance.GetCaptionsState(callbackInfo->boolConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT: - instance.GetContentTimeout(callbackInfo->uint32Config_); + { + uint32_t timeout = 0; + instance.GetContentTimeout(timeout); + callbackInfo->int32Config_ = static_cast(timeout); + } break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK: instance.GetMouseAutoClick(callbackInfo->int32Config_); @@ -436,7 +392,7 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data) instance.GetShortkeyTarget(callbackInfo->stringConfig_); break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE: - instance.GetCaptionProperty(callbackInfo->captionProperty_); + instance.GetCaptionsProperty(callbackInfo->captionProperty_); break; default: break; @@ -468,7 +424,7 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info HILOG_INFO("ConfigID = %{public}d", obj->GetConfigId()); switch (obj->GetConfigId()) { - case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRASTE_TEXT: + case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRAST_TEXT: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_INVERT_COLOR: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_ANIMATION_OFF: case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_SCREEN_MAGNIFICATION: @@ -478,21 +434,21 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE: { bool state = false; - ParseBool(env, state, parameters[PARAM0]); + callbackInfo->ret_ = ParseBool(env, state, parameters[PARAM0]); callbackInfo->boolConfig_ = state; } break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT: { - uint32_t timeout = 0; - ParseUint32(env, timeout, parameters[PARAM0]); - callbackInfo->uint32Config_ = timeout; + int32_t timeout = 0; + callbackInfo->ret_ = ParseInt32(env, timeout, parameters[PARAM0]); + callbackInfo->uint32Config_ = static_cast(timeout); } break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK: { int32_t time = 0; - ParseInt32(env, time, parameters[PARAM0]); + callbackInfo->ret_ = ParseInt32(env, time, parameters[PARAM0]); callbackInfo->int32Config_ = time; } break; @@ -500,7 +456,7 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_BRIGHTNESS_DISCOUNT: { double doubleTemp = 0; - napi_get_value_double(env, parameters[PARAM0], &doubleTemp); + callbackInfo->ret_ = ParseDouble(env, doubleTemp, parameters[PARAM0]); callbackInfo->floatConfig_ = static_cast(doubleTemp); } break; @@ -508,12 +464,12 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_SHORT_KEY_TARGET: { std::string target = ""; - ParseString(env, target, parameters[PARAM0]); + callbackInfo->ret_ = ParseString(env, target, parameters[PARAM0]) && target.length() > 0; callbackInfo->stringConfig_ = target; } break; case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE: - ConvertObjToCaptionProperty(env, parameters[PARAM0], &callbackInfo->captionProperty_); + callbackInfo->ret_ = ConvertObjToCaptionProperty(env, parameters[PARAM0], &callbackInfo->captionProperty_); break; default: break; @@ -535,7 +491,7 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info // Execute async to call c++ function NAccessibilityConfig::SetConfigExecute, // Execute the complete function - NAccessibilityConfig::SetConfigComplete, + NAccessibilityConfig::AsyncWorkComplete, (void*)callbackInfo, &callbackInfo->work_); napi_queue_async_work(env, callbackInfo->work_); diff --git a/interfaces/kits/napi/accessibility_config/src/native_module.cpp b/interfaces/kits/napi/accessibility_config/src/native_module.cpp index 2c33c3a3e..ca6d48d8d 100644 --- a/interfaces/kits/napi/accessibility_config/src/native_module.cpp +++ b/interfaces/kits/napi/accessibility_config/src/native_module.cpp @@ -43,7 +43,7 @@ static napi_value InitHighContrastText(napi_env env) sizeof(configDesc) / sizeof(configDesc[0]), configDesc)); NAccessibilityConfigClass* nativeObj = - new(std::nothrow) NAccessibilityConfigClass(OHOS::AccessibilityConfig::CONFIG_HIGH_CONTRASTE_TEXT); + new(std::nothrow) NAccessibilityConfigClass(OHOS::AccessibilityConfig::CONFIG_HIGH_CONTRAST_TEXT); if (!nativeObj) { HILOG_ERROR("Failed to create nativeObj."); return nullptr; @@ -283,11 +283,11 @@ static napi_value InitShortKeyTarget(napi_env env) return shortKeyTargetValue; } -static napi_value InitCaptionState(napi_env env) +static napi_value InitCaptionsState(napi_env env) { - napi_value captionValue; - napi_create_object(env, &captionValue); - NAPI_CALL(env, napi_define_properties(env, captionValue, + napi_value captionsValue; + napi_create_object(env, &captionsValue); + NAPI_CALL(env, napi_define_properties(env, captionsValue, sizeof(configDesc) / sizeof(configDesc[0]), configDesc)); NAccessibilityConfigClass* nativeObj = @@ -297,16 +297,16 @@ static napi_value InitCaptionState(napi_env env) return nullptr; } nativeObj->SetEnv(env); - NAPI_CALL(env, napi_wrap(env, captionValue, reinterpret_cast(nativeObj), + NAPI_CALL(env, napi_wrap(env, captionsValue, reinterpret_cast(nativeObj), NAccessibilityConfigClass::Destructor, nullptr, nativeObj->GetWrapper())); - return captionValue; + return captionsValue; } -static napi_value InitCaptionStyle(napi_env env) +static napi_value InitCaptionsStyle(napi_env env) { - napi_value captionStyleValue; - napi_create_object(env, &captionStyleValue); - NAPI_CALL(env, napi_define_properties(env, captionStyleValue, + napi_value captionsStyleValue; + napi_create_object(env, &captionsStyleValue); + NAPI_CALL(env, napi_define_properties(env, captionsStyleValue, sizeof(configDesc) / sizeof(configDesc[0]), configDesc)); NAccessibilityConfigClass* nativeObj = @@ -316,9 +316,9 @@ static napi_value InitCaptionStyle(napi_env env) return nullptr; } nativeObj->SetEnv(env); - NAPI_CALL(env, napi_wrap(env, captionStyleValue, reinterpret_cast(nativeObj), + NAPI_CALL(env, napi_wrap(env, captionsStyleValue, reinterpret_cast(nativeObj), NAccessibilityConfigClass::Destructor, nullptr, nativeObj->GetWrapper())); - return captionStyleValue; + return captionsStyleValue; } static napi_value InitConfigModule(napi_env env, napi_value exports) @@ -336,8 +336,8 @@ static napi_value InitConfigModule(napi_env env, napi_value exports) napi_value mouseAutoClickValue = InitMouseAutoClick(env); napi_value shortKeyValue = InitShortKey(env); napi_value shortKeyTargetValue = InitShortKeyTarget(env); - napi_value captionValue = InitCaptionState(env); - napi_value captionStyleValue = InitCaptionStyle(env); + napi_value captionsValue = InitCaptionsState(env); + napi_value captionsStyleValue = InitCaptionsStyle(env); napi_property_descriptor desc[] = { DECLARE_NAPI_FUNCTION("on", NAccessibilityConfig::SubscribeState), @@ -356,13 +356,15 @@ static napi_value InitConfigModule(napi_env env, napi_value exports) DECLARE_NAPI_STATIC_PROPERTY("mouseKey", mouseKeyValue), DECLARE_NAPI_STATIC_PROPERTY("mouseAutoClick", mouseAutoClickValue), DECLARE_NAPI_STATIC_PROPERTY("shortkey", shortKeyValue), - DECLARE_NAPI_STATIC_PROPERTY("shortkey_target", shortKeyTargetValue), - DECLARE_NAPI_STATIC_PROPERTY("caption", captionValue), - DECLARE_NAPI_STATIC_PROPERTY("captionStyle", captionStyleValue), + DECLARE_NAPI_STATIC_PROPERTY("shortkeyTarget", shortKeyTargetValue), + DECLARE_NAPI_STATIC_PROPERTY("captions", captionsValue), + DECLARE_NAPI_STATIC_PROPERTY("captionsStyle", captionsStyleValue), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + auto &instance = OHOS::Singleton::GetInstance(); + (void)instance.InitializeContext(); NAccessibilityConfig::configObservers_->SubscribeToFramework(); NAccessibilityConfig::enableAbilityListsObservers_->SubscribeToFramework(); HILOG_INFO("-----Init config module end------"); diff --git a/interfaces/kits/napi/accessibility_extension_context/accessibility_extension_context.js b/interfaces/kits/napi/accessibility_extension_context/accessibility_extension_context.js index ec4c3a4b7..52e12a191 100644 --- a/interfaces/kits/napi/accessibility_extension_context/accessibility_extension_context.js +++ b/interfaces/kits/napi/accessibility_extension_context/accessibility_extension_context.js @@ -20,11 +20,6 @@ class AccessibilityExtensionContext extends ExtensionContext { super(obj); } - setEventTypeFilter(type, callback) { - console.log('setEventTypeFilter'); - return this.__context_impl__.setEventTypeFilter(type, callback); - } - setTargetBundleName(targetNames, callback) { console.log('setTargetBundleName'); return this.__context_impl__.setTargetBundleName(targetNames, callback); @@ -45,14 +40,9 @@ class AccessibilityExtensionContext extends ExtensionContext { return this.__context_impl__.getWindows(displayId, callback); } - executeCommonAction(action, callback) { - console.log('executeCommonAction'); - return this.__context_impl__.executeCommonAction(action, callback); - } - - gestureInject(gesture, listener, callback) { - console.log('gestureInject'); - return this.__context_impl__.gestureInject(gesture, listener, callback); + injectGesture(gesture, callback) { + console.log('injectGesture'); + return this.__context_impl__.injectGesture(gesture, callback); } } diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/BUILD.gn b/interfaces/kits/napi/accessibility_extension_module_loader/BUILD.gn index 5fd39bc77..33753c8dc 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/BUILD.gn +++ b/interfaces/kits/napi/accessibility_extension_module_loader/BUILD.gn @@ -25,7 +25,7 @@ config("accessibility_extension_module_config") { defines = [ "AAMS_LOG_TAG = \"accessibility_napi\"", - "AAMS_LOG_DOMAIN = 0xD005210", + "AAMS_LOG_DOMAIN = 0xD001D10", ] } diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/include/accessibility_extension_context.h b/interfaces/kits/napi/accessibility_extension_module_loader/include/accessibility_extension_context.h index 48915689f..5cf2b286d 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/include/accessibility_extension_context.h +++ b/interfaces/kits/napi/accessibility_extension_module_loader/include/accessibility_extension_context.h @@ -21,7 +21,6 @@ #include "accessibility_element_info.h" #include "accessibility_event_info.h" #include "accessibility_gesture_inject_path.h" -#include "accessibility_gesture_result_listener.h" #include "accessibility_window_info.h" #include "extension_context.h" @@ -52,24 +51,17 @@ public: /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePath The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - bool InjectGesture(const uint32_t sequence, const std::shared_ptr &gesturePath, - const std::shared_ptr &listener); + bool InjectGesture(const std::shared_ptr &gesturePath); /** * @brief Sends simulate gestures to the screen. - * @param sequence The sequence of gesture. * @param gesturePaths The gesture which need to send. - * @param listener The listener of the gesture. * @return Return true if the gesture sends successfully, else return false. */ - bool InjectGesture(const uint32_t sequence, - const std::vector> &gesturePaths, - const std::shared_ptr &listener); + bool InjectGesture(const std::vector> &gesturePaths); /** * @brief Obtains elementInfo of the accessible root node. diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension.h b/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension.h index a9615cf3a..56881fee6 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension.h +++ b/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension.h @@ -65,22 +65,17 @@ public: /** * @brief Called when your accessibility service is successfully connected to the OS. - * @param - * @return */ void OnAbilityConnected(); /** * @brief Called when your accessibility service is successfully disconnected to the OS. - * @param - * @return */ void OnAbilityDisconnected(); /** * @brief Called when an accessibility event occurs. * @param eventInfo The information of accessible event. - * @return */ void OnAccessibilityEvent(const AccessibilityEventInfo& eventInfo); @@ -99,8 +94,6 @@ private: ~AbilityListener() = default; /** * @brief Called when your accessibility service is successfully connected to the OS. - * @param - * @return */ void OnAbilityConnected() override { @@ -109,8 +102,6 @@ private: /** * @brief Called when an accessibility is disconnected. - * @param - * @return */ void OnAbilityDisconnected() override { @@ -120,7 +111,6 @@ private: /** * @brief Called when an accessibility event occurs. * @param eventInfo The information of accessible event. - * @return */ void OnAccessibilityEvent(const AccessibilityEventInfo& eventInfo) override { diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension_context.h b/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension_context.h index c51abdfb6..5fe77f748 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension_context.h +++ b/interfaces/kits/napi/accessibility_extension_module_loader/include/napi_accessibility_extension_context.h @@ -17,7 +17,6 @@ #define NAPI_ACCESSIBILITY_EXTENSION_CONTEXT_H #include "accessibility_extension_context.h" -#include "accessibility_gesture_result_listener.h" #include "napi/native_api.h" #include "napi/native_node_api.h" #include "native_engine/native_engine.h" @@ -26,25 +25,8 @@ namespace OHOS { namespace Accessibility { -class NAccessibilityGestureResultListener : public AccessibilityGestureResultListener { -public: - NAccessibilityGestureResultListener() = default; - virtual ~NAccessibilityGestureResultListener() = default; - - void OnGestureInjectResult(uint32_t sequence, bool result) override; -}; - -struct NAccessibilityGestureResultListenerInfo { - napi_env env_; - napi_ref callback_; - std::shared_ptr listener_ = nullptr; -}; - NativeValue* CreateJsAccessibilityExtensionContext( NativeEngine& engine, std::shared_ptr context); - -static uint32_t gestureInjectSequence = 0; -static std::map> jsGestureResultListenerInfos {}; } // namespace Accessibility } // namespace OHOS #endif // NAPI_ACCESSIBILITY_EXTENSION_CONTEXT_H \ No newline at end of file diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/src/accessibility_extension_context.cpp b/interfaces/kits/napi/accessibility_extension_module_loader/src/accessibility_extension_context.cpp index 88a14de24..ea621095f 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/src/accessibility_extension_context.cpp +++ b/interfaces/kits/napi/accessibility_extension_module_loader/src/accessibility_extension_context.cpp @@ -44,9 +44,7 @@ bool AccessibilityExtensionContext::GetFocusByElementInfo(const AccessibilityEle return aaClient->GetFocusByElementInfo(sourceInfo, focusType, elementInfo); } -bool AccessibilityExtensionContext::InjectGesture(const uint32_t sequence, - const std::shared_ptr &gesturePath, - const std::shared_ptr &listener) +bool AccessibilityExtensionContext::InjectGesture(const std::shared_ptr &gesturePath) { HILOG_DEBUG(); sptr aaClient = AccessibleAbilityClient::GetInstance(); @@ -54,12 +52,11 @@ bool AccessibilityExtensionContext::InjectGesture(const uint32_t sequence, HILOG_ERROR("aaClient is nullptr"); return false; } - return aaClient->InjectGesture(sequence, gesturePath, listener); + return aaClient->InjectGesture(gesturePath); } -bool AccessibilityExtensionContext::InjectGesture(const uint32_t sequence, - const std::vector> &gesturePaths, - const std::shared_ptr &listener) +bool AccessibilityExtensionContext::InjectGesture( + const std::vector> &gesturePaths) { HILOG_DEBUG("This method is temporarily not implemented!"); return false; diff --git a/interfaces/kits/napi/accessibility_extension_module_loader/src/napi_accessibility_extension_context.cpp b/interfaces/kits/napi/accessibility_extension_module_loader/src/napi_accessibility_extension_context.cpp index 165140503..877056b7a 100644 --- a/interfaces/kits/napi/accessibility_extension_module_loader/src/napi_accessibility_extension_context.cpp +++ b/interfaces/kits/napi/accessibility_extension_module_loader/src/napi_accessibility_extension_context.cpp @@ -167,7 +167,7 @@ private: } bool ret = context->SetEventTypeFilter(filter); if (ret) { - task.Resolve(engine, engine.CreateBoolean(ret)); + task.Resolve(engine, engine.CreateUndefined()); } else { HILOG_ERROR("set event type failed. ret: %{public}d.", ret); task.Reject(engine, CreateJsError(engine, RESULT_ERROR, "set event type failed.")); @@ -208,7 +208,7 @@ private: bool ret = context->SetTargetBundleName(targetBundleNames); if (ret) { - task.Resolve(engine, engine.CreateBoolean(ret)); + task.Resolve(engine, engine.CreateUndefined()); } else { HILOG_ERROR("set target bundle name failed. ret: %{public}d.", ret); task.Reject(engine, CreateJsError(engine, RESULT_ERROR, "set target bundle name failed.")); @@ -536,7 +536,7 @@ private: { HILOG_INFO(); // Only support two or three params - if (info.argc != ARGS_SIZE_TWO && info.argc != ARGS_SIZE_THREE) { + if (info.argc != ARGS_SIZE_ONE && info.argc != ARGS_SIZE_TWO) { HILOG_ERROR("Not enough params"); return engine.CreateUndefined(); } @@ -550,25 +550,8 @@ private: ConvertGesturePathsJSToNAPI(reinterpret_cast(&engine), nGesturePaths, gesturePath, gesturePathArray, isParameterArray); - // Unwrap callback - if (info.argv[PARAM1]->TypeOf() != NATIVE_FUNCTION) { - HILOG_ERROR("The type of params is %{public}d.", info.argv[PARAM1]->TypeOf()); - return engine.CreateUndefined(); - } - // Create callback info - std::shared_ptr pCallbackInfo = - std::make_shared(); - pCallbackInfo->env_ = reinterpret_cast(&engine); - NAPI_CALL(reinterpret_cast(&engine), napi_create_reference(reinterpret_cast(&engine), - reinterpret_cast(info.argv[PARAM1]), 1, &pCallbackInfo->callback_)); - pCallbackInfo->listener_ = std::make_shared(); - // Save callback info - gestureInjectSequence++; - jsGestureResultListenerInfos[gestureInjectSequence] = pCallbackInfo; - AsyncTask::CompleteCallback complete = - [weak = context_, sequence = gestureInjectSequence, gesturePath, gesturePathArray, - isParameterArray, listener = pCallbackInfo->listener_]( + [weak = context_, gesturePath, gesturePathArray, isParameterArray]( NativeEngine& engine, AsyncTask& task, int32_t status) { auto context = weak.lock(); if (!context) { @@ -578,19 +561,19 @@ private: } bool ret = false; if (isParameterArray) { - ret = context->InjectGesture(sequence, gesturePathArray, listener); + ret = context->InjectGesture(gesturePathArray); } else { - ret = context->InjectGesture(sequence, gesturePath, listener); + ret = context->InjectGesture(gesturePath); } if (ret) { - task.Resolve(engine, engine.CreateBoolean(ret)); + task.Resolve(engine, engine.CreateUndefined()); } else { HILOG_ERROR("Gesture inject failed. ret: %{public}d.", ret); task.Reject(engine, CreateJsError(engine, RESULT_ERROR, "Gesture inject failed.")); } }; - NativeValue* lastParam = (info.argc == ARGS_SIZE_TWO) ? nullptr : info.argv[PARAM2]; + NativeValue* lastParam = (info.argc == ARGS_SIZE_ONE) ? nullptr : info.argv[PARAM1]; NativeValue* result = nullptr; AsyncTask::Schedule("NAccessibilityExtensionContext::OnGestureInject", engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result)); @@ -614,78 +597,13 @@ NativeValue* CreateJsAccessibilityExtensionContext( } object->SetNativePointer(jsContext.release(), NAccessibilityExtensionContext::Finalizer, nullptr); - BindNativeFunction(engine, *object, "setEventTypeFilter", NAccessibilityExtensionContext::SetEventTypeFilter); BindNativeFunction(engine, *object, "setTargetBundleName", NAccessibilityExtensionContext::SetTargetBundleName); BindNativeFunction(engine, *object, "getFocusElement", NAccessibilityExtensionContext::GetFocusElement); BindNativeFunction(engine, *object, "getWindowRootElement", NAccessibilityExtensionContext::GetWindowRootElement); BindNativeFunction(engine, *object, "getWindows", NAccessibilityExtensionContext::GetWindows); - BindNativeFunction(engine, *object, "executeCommonAction", NAccessibilityExtensionContext::ExecuteCommonAction); - BindNativeFunction(engine, *object, "gestureInject", NAccessibilityExtensionContext::InjectGesture); + BindNativeFunction(engine, *object, "injectGesture", NAccessibilityExtensionContext::InjectGesture); return objValue; } - -void NAccessibilityGestureResultListener::OnGestureInjectResult(uint32_t sequence, bool result) -{ - HILOG_INFO(); - - if (jsGestureResultListenerInfos.empty()) { - HILOG_ERROR("There is no information of jsGestureResultListenerInfos"); - return; - } - - std::shared_ptr callbackInfo = nullptr; - auto it = jsGestureResultListenerInfos.find(sequence); - if (it != jsGestureResultListenerInfos.end()) { - HILOG_DEBUG("callbackInfo has been found."); - callbackInfo = jsGestureResultListenerInfos[sequence]; - jsGestureResultListenerInfos.erase(it); - } - - if (!callbackInfo) { - HILOG_ERROR("callbackInfo is nullptr"); - return; - } - - StateCallbackInfo *data = new(std::nothrow) StateCallbackInfo(); - if (!data) { - HILOG_ERROR("Failed to create data."); - return; - } - uv_work_t *work = new(std::nothrow) uv_work_t; - if (!work) { - HILOG_ERROR("Failed to create work."); - delete data; - data = nullptr; - return; - } - - data->env_ = callbackInfo->env_; - data->state_ = result; - data->ref_ = callbackInfo->callback_; - work->data = static_cast(data); - - uv_loop_s *loop = nullptr; - napi_get_uv_event_loop(callbackInfo->env_, &loop); - uv_queue_work( - loop, - work, - [](uv_work_t *work) {}, - [](uv_work_t *work, int status) { - StateCallbackInfo *callbackInfo = static_cast(work->data); - napi_value callback = 0; - napi_value undefined = 0; - napi_value napiResult = 0; - napi_value callResult = 0; - napi_get_undefined(callbackInfo->env_, &undefined); - napi_get_boolean(callbackInfo->env_, callbackInfo->state_, &napiResult); - napi_get_reference_value(callbackInfo->env_, callbackInfo->ref_, &callback); - napi_call_function(callbackInfo->env_, undefined, callback, ARGS_SIZE_ONE, &napiResult, &callResult); - delete callbackInfo; - callbackInfo = nullptr; - delete work; - work = nullptr; - }); -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/include/napi_accessibility_utils.h b/interfaces/kits/napi/include/napi_accessibility_utils.h index 8526900eb..95c7052a1 100644 --- a/interfaces/kits/napi/include/napi_accessibility_utils.h +++ b/interfaces/kits/napi/include/napi_accessibility_utils.h @@ -50,6 +50,7 @@ bool ParseBool(napi_env env, bool& param, napi_value args); bool ParseString(napi_env env, std::string& param, napi_value args); bool ParseUint32(napi_env env, uint32_t& param, napi_value args); bool ParseInt32(napi_env env, int32_t& param, napi_value args); +bool ParseDouble(napi_env env, double& param, napi_value args); napi_value GetErrorValue(napi_env env, int errCode); std::string ConvertWindowTypeToString(OHOS::Accessibility::AccessibilityWindowType type); @@ -68,7 +69,7 @@ void ConvertActionArgsJSToNAPI( void ConvertKeyEventToJS(napi_env env, napi_value result, const std::shared_ptr &keyEvent); void ConvertCaptionPropertyToJS(napi_env env, napi_value& result, OHOS::AccessibilityConfig::CaptionProperty captionProperty); -void ConvertObjToCaptionProperty( +bool ConvertObjToCaptionProperty( napi_env env, napi_value object, OHOS::AccessibilityConfig::CaptionProperty* ptrCaptionProperty); void ConvertJSToStringVec(napi_env env, napi_value arrayValue, std::vector &values); void ConvertStringVecToJS(napi_env env, napi_value &result, std::vector values); diff --git a/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp b/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp index 5988a43b6..a6b24727e 100644 --- a/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp @@ -52,10 +52,10 @@ void NAccessibilityConfigObserver::OnConfigChanged(const ConfigValue &value) NotifyIntChanged2JS(value.mouseAutoClick); break; case CONFIG_DALTONIZATION_COLOR_FILTER: - NotifyUintChanged2JS(value.daltonizationColorFilter); + NotifyStringChanged2JS(ConvertDaltonizationTypeToString(value.daltonizationColorFilter)); break; case CONFIG_CONTENT_TIMEOUT: - NotifyUintChanged2JS(value.contentTimeout); + NotifyIntChanged2JS(static_cast(value.contentTimeout)); break; case CONFIG_BRIGHTNESS_DISCOUNT: NotifyFloatChanged2JS(value.brightnessDiscount); @@ -63,7 +63,7 @@ void NAccessibilityConfigObserver::OnConfigChanged(const ConfigValue &value) case CONFIG_AUDIO_BALANCE: NotifyFloatChanged2JS(value.audioBalance); break; - case CONFIG_HIGH_CONTRASTE_TEXT: + case CONFIG_HIGH_CONTRAST_TEXT: NotifyStateChanged2JS(value.highContrastText); break; case CONFIG_INVERT_COLOR: @@ -110,6 +110,7 @@ void NAccessibilityConfigObserver::NotifyStateChanged2JS(bool enabled) [](uv_work_t *work, int status) { StateCallbackInfo *callbackInfo = static_cast(work->data); napi_value jsEvent; + napi_create_object(callbackInfo->env_, &jsEvent); napi_get_boolean(callbackInfo->env_, callbackInfo->state_, &jsEvent); napi_value handler = nullptr; @@ -378,7 +379,7 @@ void NAccessibilityConfigObserverImpl::SubscribeToFramework() { auto &instance = Singleton::GetInstance(); for (int32_t index = 0; index < static_cast(CONFIG_ID_MAX); index ++) { - instance.SubscribeConfigObserver(static_cast(index), shared_from_this()); + instance.SubscribeConfigObserver(static_cast(index), shared_from_this(), false); } } diff --git a/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp b/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp index f72b66f53..170f84875 100644 --- a/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp @@ -539,7 +539,7 @@ napi_value NAccessibilityClient::SetCaptionStateEnabled(napi_env env, napi_callb HILOG_INFO("captionState = %{public}s", captionState ? "True" : "False"); auto &instance = Singleton::GetInstance(); - instance.SetCaptionState(captionState); + instance.SetCaptionsState(captionState); } else { HILOG_ERROR("argc size Error"); } @@ -556,7 +556,7 @@ napi_value NAccessibilityClient::GetCaptionStateEnabled(napi_env env, napi_callb auto &instance = Singleton::GetInstance(); bool captionState = false; - instance.GetCaptionState(captionState); + instance.GetCaptionsState(captionState); napi_get_boolean(env, captionState, &captionStateEnabled); HILOG_INFO("captionState = %{public}s", captionState ? "True" : "False"); @@ -574,7 +574,7 @@ napi_value NAccessibilityClient::SetCaptionStyle(napi_env env, napi_callback_inf if (argc >= ARGS_SIZE_ONE) { ConvertObjToCaptionProperty(env, parameters[PARAM0], &captionProperty); auto &instance = Singleton::GetInstance(); - instance.SetCaptionProperty(captionProperty); + instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -697,7 +697,7 @@ napi_value NAccessibilityClient::GetCaptionsFontFamily(napi_env env, napi_callba napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &returnValue); return returnValue; } @@ -717,10 +717,10 @@ napi_value NAccessibilityClient::SetCaptionsFontFamily(napi_env env, napi_callba // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetFontFamily(std::string(outBuffer)); - instance.SetCaptionProperty(captionProperty); + instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -735,7 +735,7 @@ napi_value NAccessibilityClient::GetCaptionsFontScale(napi_env env, napi_callbac napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); napi_create_int32(env, captionProperty.GetFontScale(), &returnValue); return returnValue; } @@ -754,10 +754,10 @@ napi_value NAccessibilityClient::SetCaptionsFontScale(napi_env env, napi_callbac // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetFontScale(num); - instance.SetCaptionProperty(captionProperty); + instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -772,7 +772,7 @@ napi_value NAccessibilityClient::GetCaptionFrontColor(napi_env env, napi_callbac napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); uint32_t color = captionProperty.GetFontColor(); std::string colorStr = ConvertColorToString(color); napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue); @@ -790,10 +790,10 @@ napi_value NAccessibilityClient::SetCaptionFrontColor(napi_env env, napi_callbac // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetFontColor(color); - (void)instance.SetCaptionProperty(captionProperty); + (void)instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -808,7 +808,7 @@ napi_value NAccessibilityClient::GetCaptionFontEdgeType(napi_env env, napi_callb napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); napi_create_string_utf8(env, captionProperty.GetFontEdgeType().c_str(), NAPI_AUTO_LENGTH, &returnValue); return returnValue; } @@ -829,10 +829,10 @@ napi_value NAccessibilityClient::SetCaptionFontEdgeType(napi_env env, napi_callb // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetFontEdgeType(std::string(outBuffer)); - instance.SetCaptionProperty(captionProperty); + instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -847,7 +847,7 @@ napi_value NAccessibilityClient::GetCaptionBackgroundColor(napi_env env, napi_ca napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); uint32_t color = captionProperty.GetBackgroundColor(); std::string colorStr = ConvertColorToString(color); napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue); @@ -865,10 +865,10 @@ napi_value NAccessibilityClient::SetCaptionBackgroundColor(napi_env env, napi_ca // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetBackgroundColor(color); - (void)instance.SetCaptionProperty(captionProperty); + (void)instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } @@ -883,7 +883,7 @@ napi_value NAccessibilityClient::GetCaptionWindowColor(napi_env env, napi_callba napi_value returnValue = nullptr; auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); uint32_t color = captionProperty.GetWindowColor(); std::string colorStr = ConvertColorToString(color); napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue); @@ -901,10 +901,10 @@ napi_value NAccessibilityClient::SetCaptionWindowColor(napi_env env, napi_callba // Get CaptionProperty auto &instance = Singleton::GetInstance(); OHOS::AccessibilityConfig::CaptionProperty captionProperty = {}; - instance.GetCaptionProperty(captionProperty); + instance.GetCaptionsProperty(captionProperty); // Change the input info and then set the CaptionProperty captionProperty.SetWindowColor(color); - (void)instance.SetCaptionProperty(captionProperty); + (void)instance.SetCaptionsProperty(captionProperty); } else { HILOG_ERROR("argc size Error"); } diff --git a/interfaces/kits/napi/src/napi_accessibility_utils.cpp b/interfaces/kits/napi/src/napi_accessibility_utils.cpp index 20abe1d6f..cc97313c0 100644 --- a/interfaces/kits/napi/src/napi_accessibility_utils.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_utils.cpp @@ -128,6 +128,25 @@ bool ParseInt32(napi_env env, int32_t& param, napi_value args) return true; } +bool ParseDouble(napi_env env, double& param, napi_value args) +{ + napi_status status; + napi_valuetype valuetype; + status = napi_typeof(env, args, &valuetype); + if (status != napi_ok) { + HILOG_ERROR("napi_typeof error and status is %{public}d", status); + return false; + } + + if (valuetype != napi_number) { + HILOG_ERROR("Wrong argument type. uint32 expected."); + return false; + } + + napi_get_value_double(env, args, ¶m); + return true; +} + napi_value GetErrorValue(napi_env env, int errCode) { napi_value result = nullptr; @@ -1350,7 +1369,7 @@ uint32_t GetColorValue(napi_env env, napi_value value) return color; } -void ConvertObjToCaptionProperty( +bool ConvertObjToCaptionProperty( napi_env env, napi_value object, OHOS::AccessibilityConfig::CaptionProperty* ptrCaptionProperty) { HILOG_DEBUG("start"); @@ -1367,6 +1386,8 @@ void ConvertObjToCaptionProperty( napi_get_property(env, object, propertyNameValue, &value); napi_get_value_string_utf8(env, value, outBuffer, CHAE_BUFFER_MAX, &outSize); ptrCaptionProperty->SetFontFamily(std::string(outBuffer)); + } else { + return false; } napi_create_string_utf8(env, "fontScale", NAPI_AUTO_LENGTH, &propertyNameValue); @@ -1376,12 +1397,16 @@ void ConvertObjToCaptionProperty( napi_get_property(env, object, propertyNameValue, &value); napi_get_value_int32(env, value, &num); ptrCaptionProperty->SetFontScale(num); + } else { + return false; } napi_create_string_utf8(env, "fontColor", NAPI_AUTO_LENGTH, &propertyNameValue); napi_has_property(env, object, propertyNameValue, &hasProperty); if (hasProperty) { ptrCaptionProperty->SetFontColor(GetColorValue(env, object, propertyNameValue)); + } else { + return false; } napi_create_string_utf8(env, "fontEdgeType", NAPI_AUTO_LENGTH, &propertyNameValue); @@ -1393,19 +1418,27 @@ void ConvertObjToCaptionProperty( napi_get_property(env, object, propertyNameValue, &value); napi_get_value_string_utf8(env, value, outBuffer, CHAE_BUFFER_MAX, &outSize); ptrCaptionProperty->SetFontEdgeType(std::string(outBuffer)); + } else { + return false; } napi_create_string_utf8(env, "backgroundColor", NAPI_AUTO_LENGTH, &propertyNameValue); napi_has_property(env, object, propertyNameValue, &hasProperty); if (hasProperty) { ptrCaptionProperty->SetBackgroundColor(GetColorValue(env, object, propertyNameValue)); + } else { + return false; } napi_create_string_utf8(env, "windowColor", NAPI_AUTO_LENGTH, &propertyNameValue); napi_has_property(env, object, propertyNameValue, &hasProperty); if (hasProperty) { ptrCaptionProperty->SetWindowColor(GetColorValue(env, object, propertyNameValue)); + } else { + return false; } + + return true; } void ConvertJSToStringVec(napi_env env, napi_value arrayValue, std::vector& values) diff --git a/interfaces/kits/napi/src/native_module.cpp b/interfaces/kits/napi/src/native_module.cpp index 772041d4c..b514194dc 100644 --- a/interfaces/kits/napi/src/native_module.cpp +++ b/interfaces/kits/napi/src/native_module.cpp @@ -42,6 +42,8 @@ static napi_value Init(napi_env env, napi_value exports) NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + auto &instance = OHOS::Singleton::GetInstance(); + (void)instance.InitializeContext(); NAccessibilityClient::DefineJSCaptionsManager(env); NAccessibilityClient::DefineJSCaptionsStyle(env); NAccessibilityEventInfo::DefineJSAccessibilityEventInfo(env, exports); diff --git a/services/aams/BUILD.gn b/services/aams/BUILD.gn index e7e8fdf7d..34917807f 100755 --- a/services/aams/BUILD.gn +++ b/services/aams/BUILD.gn @@ -32,7 +32,7 @@ config("aams_service_config") { defines = [ "AAMS_LOG_TAG = \"accessibility\"", - "AAMS_LOG_DOMAIN = 0xD005200", + "AAMS_LOG_DOMAIN = 0xD001D00", ] } @@ -67,8 +67,8 @@ ohos_shared_library("accessibleabilityms") { configs = [ ":aams_service_config" ] deps = [ + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", ] external_deps = [ @@ -82,6 +82,8 @@ ohos_shared_library("accessibleabilityms") { "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", + "init:libbeget_proxy", + "init:libbegetutil", "input:libmmi-client", "ipc:ipc_core", "os_account:os_account_innerkits", diff --git a/services/aams/include/accessibility_account_data.h b/services/aams/include/accessibility_account_data.h index 4649d7660..3b734862d 100644 --- a/services/aams/include/accessibility_account_data.h +++ b/services/aams/include/accessibility_account_data.h @@ -43,57 +43,48 @@ public: /** * @brief Get the ID of the account. - * @param * @return Returns accountId. */ int32_t GetAccountId(); /** * @brief Get Accessibility state. - * @param * @return returns whether accessibility is connected and whether can touch browse. */ uint32_t GetAccessibilityState(); /** * @brief Switch users and clear old user data. - * @param - * @return */ void OnAccountSwitched(); /** * @brief Add connected accessibility services. * @param connection Accessible ability connection. - * @return */ void AddConnectedAbility(sptr& connection); /** * @brief Remove connected accessibility services. * @param connection Accessible ability connection. - * @return */ void RemoveConnectedAbility(sptr& connection); /** * @brief Remove connecting accessibility services. * @param name bundle name + / + ability name. - * @return */ void RemoveConnectingA11yAbility(const std::string &name); /** * @brief Add accessibility monitoring connection. * @param callback Accessibility monitoring connection. - * @return */ void AddStateCallback(const sptr& callback); /** * @brief Remove accessibility monitoring connection. * @param callback Accessibility monitoring connection. - * @return */ void RemoveStateCallback(const wptr& callback); @@ -109,7 +100,6 @@ public: * corresponding window id. * @param interactionConnection Interface interface operation * interactive connection. - * @return */ void AddAccessibilityWindowConnection( const int32_t windowId, const sptr& interactionConnection); @@ -117,14 +107,12 @@ public: /** * @brief Remove interface operation interactive connection. * @param windowId Interface operation interactive connection the corresponding window id. - * @return */ void RemoveAccessibilityWindowConnection(const int32_t windowId); /** * @brief Add connecting accessibility. * @param elementName Accessibility corresponding elementName. - * @return */ void AddConnectingA11yAbility(const std::string &bundleName); @@ -142,27 +130,22 @@ public: /** * @brief Empty installed accessibility list. * @param abilityInfo Accessibility ability info. - * @return */ void RemoveInstalledAbility(const std::string &bundleName); /** * @brief The real procedure for add connecting ability. - * @param - * @return */ void ClearInstalledAbility(); /** * @brief Get connected accessibility list. - * @param * @return Store map of connected accessibility abilities. */ const std::map> GetConnectedA11yAbilities(); /** * @brief Get accessibility listening connection list. - * @param * @return Store vector of accessibility listening connection. */ const std::vector> &GetStateCallbacks() const; @@ -171,7 +154,6 @@ public: /** * @brief Get interface operation interactive connection list. - * @param * @return Store map of interface operation interactive connection. */ const std::map> GetAsacConnections(); @@ -192,7 +174,6 @@ public: /** * @brief Get connecting abilities list. - * @param * @return Store map of connecting abilities. */ const std::vector &GetConnectingA11yAbilities(); @@ -201,40 +182,33 @@ public: * @brief Get the accessibility ability info of the corresponding state according to the * ability state type. * @param state Ability state type. - * @return */ void GetAbilitiesByState(AbilityStateType state, std::vector &abilities) const; /** * @brief Get the accessibility ability info of the disabled ability. - * @return */ void GetDisableAbilities(std::vector &disabledAbilities) const; /** * @brief Get enable accessibility list. - * @param * @return Store map of enable accessibility abilities. */ const std::vector &GetEnabledAbilities(); /** * @brief Get install accessibility list. - * @param * @return Store vector of install accessibility abilities. */ const std::vector &GetInstalledAbilities() const; /** * @brief Update user enabled accessibility capabilities. - * @param - * @return */ void UpdateAccountCapabilities(); /** * @brief Get flag with whether have zoom capability. - * @param * @return isScreenMagnification_. */ bool GetScreenMagnificationFlag() @@ -244,7 +218,6 @@ public: /** * @brief Get flag with whether have touch guide capability. - * @param * @return isEventTouchGuideState_. */ bool GetEventTouchGuideStateFlag() @@ -254,7 +227,6 @@ public: /** * @brief Get flag with whether have key event observer capability. - * @param * @return isFilteringKeyEvents_. */ bool GetFilteringKeyEventsFlag() @@ -264,7 +236,6 @@ public: /** * @brief Get flag with whether have gesture capability. - * @param * @return isGesturesSimulation_. */ bool GetGesturesSimulationFlag() @@ -301,13 +272,22 @@ public: void GetImportantEnabledAbilities(std::map &importantEnabledAbilities) const; void UpdateImportantEnabledAbilities(std::map &importantEnabledAbilities); + + uint32_t GetInputFilterFlag() const; + void UpdateAbilities(); + bool RemoveAbility(const std::string &bundleName); + void AddAbility(const std::string &bundleName); + void ChangeAbility(const std::string &bundleName); + + void AddUITestClient(const sptr &obj, + const std::string &bundleName, const std::string &abilityName); + void RemoveUITestClient(sptr &connection, const std::string &bundleName); + private: /** * @brief Update connected accessibility whether have touch guide * capability. Have touch guide capability isEventTouchGuideState_ is * true, otherwise isEventTouchGuideState_ is false. - * @param - * @return */ void UpdateEventTouchGuideCapability(); @@ -315,8 +295,6 @@ private: * @brief Update connected accessibility whether have gesture capability. * Have gesture capability isGesturesSimulation_ is true, * otherwise isGesturesSimulation_ is false. - * @param - * @return */ void UpdateGesturesSimulationCapability(); @@ -324,8 +302,6 @@ private: * @brief Update connected accessibility whether have key event observer capability. * Have key event observer capability isFilteringKeyEvents_ is true, * otherwise isFilteringKeyEvents_ is false. - * @param - * @return */ void UpdateFilteringKeyEventsCapability(); @@ -333,8 +309,6 @@ private: * @brief Update connected accessibility whether have zoom capability. * Have zoom capability isScreenMagnification_ is true, * otherwise isScreenMagnification_ is false. - * @param - * @return */ void UpdateMagnificationCapability(); @@ -353,6 +327,7 @@ private: bool isScreenMagnification_ = false; bool isFilteringKeyEvents_ = false; bool isGesturesSimulation_ = false; + uint32_t connectCounter_ = 1; std::map> connectedA11yAbilities_; // key: bundleName/abilityName std::vector> stateCallbacks_; std::vector> enableAbilityListsObservers_; diff --git a/services/aams/include/accessibility_gesture_recognizer.h b/services/aams/include/accessibility_gesture_recognizer.h index fc6ae33f7..0c86c88b2 100644 --- a/services/aams/include/accessibility_gesture_recognizer.h +++ b/services/aams/include/accessibility_gesture_recognizer.h @@ -54,7 +54,6 @@ public: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; private: @@ -65,15 +64,12 @@ class AccessibilityGestureRecognizeListener { public: /** * @brief A destructor used to delete the listener instance. - * @param - * @return */ virtual ~AccessibilityGestureRecognizeListener() = default; /** * @brief The callback function when performed a double tap and then held down the second tap. * @param event the touch event received. - * @return */ virtual void OnDoubleTapLongPress(MMI::PointerEvent &event); @@ -87,7 +83,6 @@ public: /** * @brief The callback function when recognized an event stream as a gesture. - * @param * @return true if the event is consumed, else false */ virtual bool OnStarted(); @@ -114,35 +109,28 @@ public: /** * @brief A constructor used to create a accessibilityGestureRecognizer instance. - * @param - * @return */ AccessibilityGestureRecognizer(); /** * @brief A destructor used to delete the accessibilityGestureRecognizer instance. - * @param - * @return */ ~AccessibilityGestureRecognizer() {} /** * @brief Register GestureRecognizeListener. * @param listener the listener from touchguide - * @return */ void RegisterListener(AccessibilityGestureRecognizeListener& listener); /** * @brief Register GestureRecognizeListener. * @param listener the listener from touchguide - * @return */ void UnregisterListener(); /** * @brief Determine whether a single tap has occurred. - * @param * @return true if a single tap has occurred, else false. */ bool IsfirstTap() @@ -161,29 +149,23 @@ public: /** * @brief Clear state. - * @param - * @return */ void Clear(); /** * @brief If a double tap occurred, call OnDoubleTapLongPress callback. * @param event the touch event from touchguide - * @return */ void MaybeRecognizeLongPress(MMI::PointerEvent &event); /** * @brief If a single tap completed. - * @param - * @return */ void SingleTapDetected(); /** * @brief Set isLongpress_ flag; * @param value set isLongpress_ flag - * @return */ void SetIsLongpress (bool value) { @@ -192,8 +174,6 @@ public: /** * @brief Get pCurDown_ ptr. - * @param - * @return */ std::shared_ptr GetCurDown() { @@ -202,8 +182,6 @@ public: /** * @brief Get continueDown_ flag. - * @param - * @return */ bool GetContinueDown() { @@ -235,21 +213,18 @@ private: /** * @brief Handle the down event from touchguide. * @param event the touch event from touchguide - * @return */ void HandleTouchDownEvent(MMI::PointerEvent &event); /** * @brief Handle the move event from touchguide. * @param event the touch event from touchguide - * @return */ bool HandleTouchMoveEvent(MMI::PointerEvent &event); /** * @brief Handle the up event from touchguide. * @param event the touch event from touchguide - * @return */ bool HandleTouchUpEvent(MMI::PointerEvent &event); @@ -262,8 +237,6 @@ private: /** * @brief Cancel the gesture. - * @param - * @return */ void StandardGestureCancled(); diff --git a/services/aams/include/accessibility_keyevent_filter.h b/services/aams/include/accessibility_keyevent_filter.h index 0a2854305..61569ec16 100644 --- a/services/aams/include/accessibility_keyevent_filter.h +++ b/services/aams/include/accessibility_keyevent_filter.h @@ -39,15 +39,11 @@ public: /** * @brief A constructor used to create a KeyEventFilter instance. - * @param - * @return */ KeyEventFilter(); /** * @brief A destructor used to delete the KeyEventFilter instance. - * @param - * @return */ virtual ~KeyEventFilter(); @@ -62,7 +58,6 @@ public: /** * @brief Send key event to next stream node. * @param event the key event prepared to send - * @return */ void SendEventToNext(MMI::KeyEvent &event); @@ -71,21 +66,17 @@ public: * @param connection the AccessibleAbility * @param isHandled true if the AccessibleAbility can handle the event else false * @param sequenceNum the sequence of keyevent - * @return */ void SetServiceOnKeyEventResult(AccessibleAbilityConnection &connection, bool isHandled, uint32_t sequenceNum); /** * @brief Clear AccessibleAbility keyevents. * @param connection the AccessibleAbility - * @return */ void ClearServiceKeyEvents(AccessibleAbilityConnection &connection); /** * @brief Destroy the events. - * @param - * @return */ void DestroyEvents() override; @@ -100,7 +91,6 @@ private: /** * @brief Dispatch the keyevents. * @param event the keyevent from Multimodal - * @return */ void DispatchKeyEvent(MMI::KeyEvent &event); @@ -123,8 +113,6 @@ class KeyEventFilterEventHandler : public AppExecFwk::EventHandler { public: /** * @brief A constructor used to create a KeyEventFilterEventHandler instance. - * @param - * @return */ KeyEventFilterEventHandler(const std::shared_ptr &runner, KeyEventFilter &keyEventFilter); virtual ~KeyEventFilterEventHandler() = default; @@ -132,7 +120,6 @@ public: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; diff --git a/services/aams/include/accessibility_mouse_autoclick.h b/services/aams/include/accessibility_mouse_autoclick.h index 0ca5657fe..07aa97084 100644 --- a/services/aams/include/accessibility_mouse_autoclick.h +++ b/services/aams/include/accessibility_mouse_autoclick.h @@ -25,15 +25,11 @@ class AccessibilityMouseAutoclick : public EventTransmission { public: /** * @brief A constructor used to create a AccessibilityMouseAutoclick instance. - * @param - * @return */ AccessibilityMouseAutoclick(); /** * @brief A destructor used to delete the AccessibilityMouseAutoclick instance. - * @param - * @return */ virtual ~AccessibilityMouseAutoclick(); @@ -50,8 +46,6 @@ public: /** * @brief Destroy the events. - * @param - * @return */ void DestroyEvents() override; @@ -60,8 +54,6 @@ private: public: /** * @brief A constructor used to create a MouseAutoclickEventHandler instance. - * @param - * @return */ MouseAutoclickEventHandler(const std::shared_ptr &runner, AccessibilityMouseAutoclick &mouseAutoclick); @@ -70,7 +62,6 @@ private: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; diff --git a/services/aams/include/accessibility_mouse_key.h b/services/aams/include/accessibility_mouse_key.h index a030836f1..ec4da8b6e 100644 --- a/services/aams/include/accessibility_mouse_key.h +++ b/services/aams/include/accessibility_mouse_key.h @@ -24,15 +24,11 @@ class AccessibilityMouseKey : public EventTransmission { public: /** * @brief A constructor used to create a AccessibilityMouseKey instance. - * @param - * @return */ AccessibilityMouseKey() = default; /** * @brief A destructor used to delete the AccessibilityMouseKey instance. - * @param - * @return */ virtual ~AccessibilityMouseKey() = default; diff --git a/services/aams/include/accessibility_touchEvent_injector.h b/services/aams/include/accessibility_touchEvent_injector.h index 6ba5f400a..532d47dfd 100644 --- a/services/aams/include/accessibility_touchEvent_injector.h +++ b/services/aams/include/accessibility_touchEvent_injector.h @@ -19,7 +19,6 @@ #include #include "accessibility_event_transmission.h" -#include "i_accessible_ability_client.h" #include "event_handler.h" #include "event_runner.h" #include "accessibility_gesture_inject_path.h" @@ -32,7 +31,6 @@ const int64_t DOUBLE_TAP_MIN_TIME = 50000; // microsecond struct SendEventArgs { std::shared_ptr event_; - bool isLastEvent_; }; class TouchEventInjector; @@ -43,7 +41,6 @@ public: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; private: @@ -53,19 +50,14 @@ private: class TouchEventInjector : public EventTransmission, public AppExecFwk::EventHandler { public: static constexpr uint32_t SEND_TOUCH_EVENT_MSG = 1; - static constexpr uint32_t GESTURE_INJECT_EVENT_MSG = 2; /** * @brief A constructor used to create a TouchEventInjector instance. - * @param - * @return */ TouchEventInjector(); /** * @brief A destructor used to delete the TouchEventInjector instance. - * @param - * @return */ ~TouchEventInjector() {} @@ -80,73 +72,34 @@ public: /** * @brief Clear event state from specific input source. * @param inputSource the input source - * @return */ void ClearEvents(uint32_t inputSource) override; /** * @brief Destroy event state. - * @param - * @return */ void DestroyEvents() override; /** * @brief Send pointer event to next stream node. * @param event the touch event prepared to send - * @return */ void SendPointerEvent(MMI::PointerEvent &event); - /** - * @brief Get current gesture service. - * @param - * @return the corresponding AccessibleAbility - */ - sptr GetCurrentGestureService() - { - return currentGestureService_; - } - - /** - * @brief Get sequence of gesture. - * @param - * @return the sequence of gesture - */ - int32_t GetSequence() - { - return sequence_; - } - /** * @brief Inject simulated gestures. * @param gesturePath the gesture path - * @param service the corresponding AccessibleAbility - * @param sequence the sequence of gesture - * @return */ - void InjectEvents(const std::shared_ptr& gesturePath, - const sptr &service, int32_t sequence); - - /** - * @brief Parsing inject simulated gestures. - * @param - * @return - */ - void InjectGesturePathInner(); + void InjectEvents(const std::shared_ptr& gesturePath); private: /** * @brief Cancel the gesture. - * @param - * @return */ void CancelGesture(); /** * @brief Cancel the injected events. - * @param - * @return */ void CancelInjectedEvents(); @@ -161,40 +114,37 @@ private: /** * @brief Get the number of microseconds elapsed since the system was booted. - * @param * @return the number of microseconds elapsed since the system was booted */ int64_t GetSystemTime(); /** * @brief Parse taps events. - * @param - * @return + * @param startTime the start time of gesture injection + * @param gesturePath the gesture path */ - void ParseTapsEvents(int64_t startTime); + void ParseTapsEvents(int64_t startTime, const std::shared_ptr& gesturePath); /** * @brief Parse move events. - * @param - * @return + * @param startTime the start time of gesture injection + * @param gesturePath the gesture path */ - void ParseMovesEvents(int64_t startTime); + void ParseMovesEvents(int64_t startTime, const std::shared_ptr& gesturePath); /** * @brief Parse touchevents from gesturepath. - * @param - * @return + * @param startTime the start time of gesture injection + * @param gesturePath the gesture path */ - void ParseTouchEventsFromGesturePath(int64_t startTime); + void ParseTouchEventsFromGesturePath(int64_t startTime, + const std::shared_ptr& gesturePath); - int32_t sequence_ = -1; bool isGestureUnderway_ = false; bool isDestroyEvent_ = false; - sptr currentGestureService_ = nullptr; std::shared_ptr handler_ = nullptr; std::shared_ptr runner_ = nullptr; std::vector> injectedEvents_; - std::shared_ptr gesturePositions_ = nullptr; }; } // namespace Accessibility } // namespace OHOS diff --git a/services/aams/include/accessibility_touch_guider.h b/services/aams/include/accessibility_touch_guider.h index ee780c9aa..f00120239 100644 --- a/services/aams/include/accessibility_touch_guider.h +++ b/services/aams/include/accessibility_touch_guider.h @@ -92,22 +92,17 @@ public: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; private: /** * @brief Send HoverEnter and HoverMove to Multimodal. - * @param - * @return */ void HoverEnterAndMoveRunner(); /** * @brief Send HoverExit to Multimodal. - * @param - * @return */ void HoverExitRunner(); TouchGuider &tgServer_; @@ -123,22 +118,16 @@ public: /** * @brief A constructor used to create a touchGuide instance. - * @param - * @return */ TouchGuider(); /** * @brief A destructor used to delete the touchGuide instance. - * @param - * @return */ ~TouchGuider() {} /** * @brief TouchGuide start up. - * @param - * @return */ void StartUp(); @@ -155,21 +144,17 @@ public: * @brief Handle accessibility events from previous event stream node. * * @param event the accessibility event to be handled. - * @return */ void OnAccessibilityEvent(AccessibilityEventInfo &event) override; /** * @brief Clear event state from specific input source. * @param inputSource the input source. - * @return */ void ClearEvents(uint32_t inputSource) override; /** * @brief Destroy event state. - * @param - * @return */ void DestroyEvents() override; @@ -177,41 +162,34 @@ public: * @brief Send event to multimodal input. * @param event the event prepared to send to Multimodal * @param action the action of the event - * @return */ void SendEventToMultimodal(MMI::PointerEvent &event, int32_t action); /** * @brief Send accessibility event to specific AccessibleAbility. * @param eventType the type of the event - * @return */ void SendAccessibilityEventToAA(EventType eventType); /** * @brief Send gesture event to specific AccessibleAbility. * @param gestureId the gesture id of the event - * @return */ void SendGestureEventToAA(GestureType gestureId); /** * @brief Get hover enter and move event. - * @param * @return Returns pointerEvents_ list. */ std::list getHoverEnterAndMoveEvent(); /** * @brief Clear hover enter and move event. - * @param - * @return */ void ClearHoverEnterAndMoveEvent(); /** * @brief Get last received event. - * @param * @return Returns last event ptr. */ std::shared_ptr getLastReceivedEvent(); @@ -239,43 +217,35 @@ private: public: /** * @brief A constructor used to create a TouchGuideListener instance. - * @param - * @return */ explicit TouchGuideListener(TouchGuider &server) : server_(server) {}; /** * @brief Prepare to send the event corresponding to the long press to the Multimodal. * @param event the touch event from Multimodal - * @return */ void OnDoubleTapLongPress(MMI::PointerEvent &event) override; /** * @brief Prepare to send the event corresponding to the single tap to the Multimodal. * @param event the touch event from Multimodal - * @return */ bool OnDoubleTap(MMI::PointerEvent &event) override; /** * @brief Send GESTURE_BEGIN to AccessibleAbility. - * @param - * @return */ bool OnStarted() override; /** * @brief Send GESTURE_END and TOUCH_END to AccessibleAbility. * @param gestureId the id of gesture - * @return */ bool OnCompleted(GestureType gestureId) override; /** * @brief The gesture has been cancelled. * @param event the touch event from Multimodal - * @return */ bool OnCancelled(MMI::PointerEvent &event) override; @@ -315,36 +285,30 @@ private: /** * @brief Determine whether to clear the touchguide. - * @param - * @return */ void Clear(); /** * @brief clear the touchguide. * @param event the last event from Multimodal - * @return */ void Clear(MMI::PointerEvent &event); /** * @brief Handle touch events on touchExploring state. * @param event the touch event from Multimodal - * @return */ void HandleTouchGuidingState(MMI::PointerEvent &event); /** * @brief Handle touch events on dragging state. * @param event the touch event from Multimodal - * @return */ void HandleDraggingState(MMI::PointerEvent &event); /** * @brief Handle touch events on transmitting state. * @param event the touch event from Multimodal - * @return */ void HandleTransmitingState(MMI::PointerEvent &event); @@ -367,98 +331,79 @@ private: /** * @brief Get the info of injected event. * @param event the event prepared to send to Multimodal - * @return */ void RecordInjectedEvent(MMI::PointerEvent &event); /** * @brief Get the info of Received event. * @param event event the touch event from Multimodal - * @return */ void RecordReceivedEvent(MMI::PointerEvent &event); /** * @brief Clear received recorder info. - * @param - * @return */ void ClearReceivedEventRecorder(); /** * @brief Clear Injected recorder info. - * @param - * @return */ void ClearInjectedEventRecorder(); /** * @brief Send exit event to multimodal. - * @param - * @return */ void SendExitEvents(); /** * @brief Send all down events to multimodal. * @param event the event prepared to send to Multimodal - * @return */ void SendAllDownEvents(MMI::PointerEvent &event); /** * @brief Send all up events to multimodal. * @param event the event prepared to send to Multimodal - * @return */ void SendUpForAllInjectedEvent(MMI::PointerEvent &event); /** * @brief Send exit message. - * @param - * @return */ void PostGestureRecognizeExit(); /** * @brief Send enter and move message. * @param event event the touch event from Multimodal - * @return */ void PostHoverEnterAndMove(MMI::PointerEvent &event); /** * @brief Send exit message. - * @param - * @return */ void PostHoverExit(); /** * @brief Send accessibility event message. * @param innerEventID the id of inner event - * @return */ void PostAccessibilityEvent(uint32_t innerEventID); /** * @brief Cancel message. * @param innerEventID the id of inner event - * @return */ void CancelPostEvent(uint32_t innerEventID); /** * @brief Cancel message if it has been sent. * @param innerEventID the id of inner event - * @return */ void CancelPostEventIfNeed(uint32_t innerEventID); /** * @brief Check whether it has been sending. * @param innerEventID the id of inner event - * @return */ bool HasEventPending(uint32_t innerEventID); @@ -466,28 +411,24 @@ private: * @brief Force send and remove event. * @param innerEventID the id of inner event * @param event event the touch event from Multimodal - * @return */ void ForceSendAndRemoveEvent(uint32_t innerEventID, MMI::PointerEvent &event); /** * @brief Handle down events on touchExploring state. * @param event event the touch event from Multimodal - * @return */ void HandleTouchGuidingStateInnerDown(MMI::PointerEvent &event); /** * @brief Handle move events on touchExploring state. * @param event event the touch event from Multimodal - * @return */ void HandleTouchGuidingStateInnerMove(MMI::PointerEvent &event); /** * @brief Handle move events on dragging state. * @param event event the touch event from Multimodal - * @return */ void HandleDraggingStateInnerMove(MMI::PointerEvent &event); diff --git a/services/aams/include/accessible_ability_channel.h b/services/aams/include/accessible_ability_channel.h index 6d9882a82..c58eb55f2 100644 --- a/services/aams/include/accessible_ability_channel.h +++ b/services/aams/include/accessible_ability_channel.h @@ -56,8 +56,7 @@ public: void SetOnKeyPressEventResult(const bool handled, const int32_t sequence) override; - void SendSimulateGesture(const int32_t requestId, - const std::shared_ptr& gesturePath) override; + bool SendSimulateGesture(const std::shared_ptr& gesturePath) override; bool SetEventTypeFilter(const uint32_t filter) override; @@ -83,7 +82,7 @@ private: std::vector &windows); void InnerExecuteCommonAction(const int32_t action); void InnerSetOnKeyPressEventResult(const bool handled, const int32_t sequence); - void InnerSendSimulateGesturePath(const int32_t requestId, + void InnerSendSimulateGesturePath(std::promise &syncPromise, const std::shared_ptr& gesturePath); void InnerSetEventTypeFilter(std::promise &syncPromise, const uint32_t filter); void InnerSetTargetBundleName(std::promise &syncPromise, const std::vector &targetBundleNames); diff --git a/services/aams/include/accessible_ability_connection.h b/services/aams/include/accessible_ability_connection.h index 083fbcd55..e371494ba 100644 --- a/services/aams/include/accessible_ability_connection.h +++ b/services/aams/include/accessible_ability_connection.h @@ -47,8 +47,6 @@ public: bool OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence); - void OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully); - void SetAbilityInfoEventTypeFilter(const uint32_t eventTypes); void SetAbilityInfoTargetBundleName(const std::vector &targetBundleNames); @@ -108,7 +106,6 @@ private: }; bool IsWantedEvent(int32_t eventType); - bool IsAllowedListEvent(EventType eventType); void InnerOnAbilityConnectDone(const AppExecFwk::ElementName &element, const sptr &remoteObject, int32_t resultCode); diff --git a/services/aams/include/accessible_ability_manager_service.h b/services/aams/include/accessible_ability_manager_service.h index f750c31bc..a637469e0 100644 --- a/services/aams/include/accessible_ability_manager_service.h +++ b/services/aams/include/accessible_ability_manager_service.h @@ -125,11 +125,6 @@ public: return currentAccountId_; } - inline uint32_t GetConnectCounter() - { - return connectCounter_; - } - inline std::shared_ptr &GetMainHandler() { return handler_; @@ -152,7 +147,6 @@ public: void PackageAdd(const std::string &bundleName); void UpdateAccessibilityManagerService(); - void UpdateAbilities(); void SetScreenMagnificationState(const bool state) override; void SetShortKeyState(const bool state) override; @@ -192,9 +186,6 @@ public: void UpdateShortkeyTarget(); private: - void AddUITestClient(const sptr &obj); - void RemoveUITestClient(sptr &connection); - class StateCallbackDeathRecipient final : public IRemoteObject::DeathRecipient { public: StateCallbackDeathRecipient() = default; @@ -243,6 +234,15 @@ private: void OnRemoteDied(const wptr &remote) final; }; + class BundleManagerDeathRecipient final : public IRemoteObject::DeathRecipient { + public: + BundleManagerDeathRecipient() = default; + ~BundleManagerDeathRecipient() final = default; + DISALLOW_COPY_AND_MOVE(BundleManagerDeathRecipient); + + void OnRemoteDied(const wptr &remote) final; + }; + void InitAccountDependence(); void InitBundleDependence(); void InitCommonEventDependence(); @@ -261,11 +261,11 @@ private: void UpdateCaptionProperty(); void RemoveCallback(CallBackID callback, const sptr &recipient, const wptr &remote); + void OnBundleManagerDied(const wptr &remote); bool isRunning_ = false; std::map dependentServicesStatus_; int32_t currentAccountId_ = -1; - uint32_t connectCounter_ = 1; std::map> a11yAccountsData_; sptr bundleManager_ = nullptr; @@ -282,7 +282,7 @@ private: sptr captionPropertyCallbackDeathRecipient_ = nullptr; sptr enableAbilityListsObserverDeathRecipient_ = nullptr; sptr configCallbackDeathRecipient_ = nullptr; - static std::mutex mutex_; + sptr bundleManagerDeathRecipient_ = nullptr; }; } // namespace Accessibility } // namespace OHOS diff --git a/services/aams/include/accessible_ability_manager_service_event_handler.h b/services/aams/include/accessible_ability_manager_service_event_handler.h index 1a576fe16..416144a7b 100644 --- a/services/aams/include/accessible_ability_manager_service_event_handler.h +++ b/services/aams/include/accessible_ability_manager_service_event_handler.h @@ -27,7 +27,6 @@ public: /** * @brief Process the event of install system bundles. * @param event Indicates the event to be processed. - * @return */ virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; }; diff --git a/services/aams/src/accessibility_account_data.cpp b/services/aams/src/accessibility_account_data.cpp index 6d58b852e..a637f4f96 100644 --- a/services/aams/src/accessibility_account_data.cpp +++ b/services/aams/src/accessibility_account_data.cpp @@ -25,6 +25,11 @@ namespace OHOS { namespace Accessibility { +namespace { + constexpr int32_t AUTOCLICK_DELAY_TIME_MIN = 1000; // ms + constexpr int32_t AUTOCLICK_DELAY_TIME_MAX = 5000; // ms +} // namespace + AccessibilityAccountData::AccessibilityAccountData(int32_t accountId) { id_ = accountId; @@ -523,6 +528,7 @@ bool AccessibilityAccountData::EnableAbility(const std::string &name, const uint } enabledAbilities_.push_back(name); UpdateEnableAbilityListsState(); + UpdateAbilities(); Utils::RecordStartingA11yEvent(bundleName, abilityName); return true; } @@ -725,5 +731,213 @@ void AccessibilityAccountData::UpdateImportantEnabledAbilities( } } } + +uint32_t AccessibilityAccountData::GetInputFilterFlag() const +{ + HILOG_DEBUG(); + if (!config_) { + HILOG_ERROR("config is null"); + return 0; + } + uint32_t flag = 0; + if (isScreenMagnification_ && config_->GetScreenMagnificationState()) { + flag |= AccessibilityInputInterceptor::FEATURE_SCREEN_MAGNIFICATION; + } + if (isEventTouchGuideState_) { + flag |= AccessibilityInputInterceptor::FEATURE_TOUCH_EXPLORATION; + } + if (isFilteringKeyEvents_) { + flag |= AccessibilityInputInterceptor::FEATURE_FILTER_KEY_EVENTS; + } + if (isGesturesSimulation_) { + flag |= AccessibilityInputInterceptor::FEATURE_INJECT_TOUCH_EVENTS; + } + if (config_->GetShortKeyState()) { + flag |= AccessibilityInputInterceptor::FEATURE_SHORT_KEY; + } + if (config_->GetMouseKeyState()) { + flag |= AccessibilityInputInterceptor::FEATURE_MOUSE_KEY; + } + + int32_t autoclickTime = config_->GetMouseAutoClick(); + if (autoclickTime >= AUTOCLICK_DELAY_TIME_MIN && autoclickTime <= AUTOCLICK_DELAY_TIME_MAX) { + flag |= AccessibilityInputInterceptor::FEATURE_MOUSE_AUTOCLICK; + } + + return flag; +} + +void AccessibilityAccountData::UpdateAbilities() +{ + HILOG_DEBUG("installedAbilities is %{public}zu.", installedAbilities_.size()); + for (auto &installAbility : installedAbilities_) { + std::string deviceId = ""; + std::string bundleName = installAbility.GetPackageName(); + std::string abilityName = installAbility.GetName(); + HILOG_DEBUG("installAbility's packageName is %{public}s and abilityName is %{public}s", + bundleName.c_str(), abilityName.c_str()); + + std::vector::iterator iter = std::find(connectingA11yAbilities_.begin(), + connectingA11yAbilities_.end(), Utils::GetUri(bundleName, abilityName)); + if (iter != connectingA11yAbilities_.end()) { + HILOG_DEBUG("The ability(bundleName[%{public}s] abilityName[%{public}s]) is connecting.", + bundleName.c_str(), abilityName.c_str()); + continue; + } + sptr connection = + GetAccessibleAbilityConnection(Utils::GetUri(bundleName, abilityName)); + + iter = std::find(enabledAbilities_.begin(), enabledAbilities_.end(), Utils::GetUri(bundleName, abilityName)); + if (iter != enabledAbilities_.end()) { + if (!connection) { + AppExecFwk::ElementName element(deviceId, bundleName, abilityName); + connection = new(std::nothrow) AccessibleAbilityConnection(this, connectCounter_++, installAbility); + if (connection) { + connection->Connect(element); + } + } + } else { + HILOG_DEBUG("not in enabledAbilites list ."); + if (connection) { + connection->Disconnect(); + } + } + } +} + +bool AccessibilityAccountData::RemoveAbility(const std::string &bundleName) +{ + HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); + if (installedAbilities_.empty()) { + HILOG_DEBUG("There is no installed abilities."); + return false; + } + RemoveInstalledAbility(bundleName); + + bool result = false; + // Remove enabled ability, remove connecting ability if it is connecting. + for (auto& enableAbility : enabledAbilities_) { + if (enableAbility.substr(0, enableAbility.find("/")) == bundleName) { + RemoveEnabledAbility(enableAbility); + RemoveConnectingA11yAbility(enableAbility); + result = true; + } + } + + // Remove connected ability + for (auto &connectedAbility : connectedA11yAbilities_) { + 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()); + RemoveConnectedAbility(connectedAbility.second); + result = true; + } + } + + if (result) { + UpdateAbilities(); + } + return result; +} + +void AccessibilityAccountData::AddAbility(const std::string &bundleName) +{ + HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); + bool hasNewExtensionAbility = false; + std::vector extensionInfos; + sptr bms = Singleton::GetInstance().GetBundleMgrProxy(); + if (!bms) { + HILOG_ERROR("bms is nullptr."); + return; + } + bms->QueryExtensionAbilityInfos(AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, id_, extensionInfos); + HILOG_DEBUG("query extensionAbilityInfos' size is %{public}zu.", extensionInfos.size()); + for (auto &newAbility : extensionInfos) { + if (newAbility.bundleName == bundleName) { + HILOG_DEBUG("The package added is an extension ability and\ + extension ability's name is %{public}s", newAbility.name.c_str()); + AccessibilityAbilityInitParams initParams; + Utils::Parse(newAbility, initParams); + std::shared_ptr accessibilityInfo = + std::make_shared(initParams); + if (!accessibilityInfo) { + HILOG_ERROR("accessibilityInfo is nullptr"); + return; + } + AddInstalledAbility(*accessibilityInfo); + hasNewExtensionAbility = true; + break; + } + } + + if (hasNewExtensionAbility) { + HILOG_DEBUG("add new extension ability and update abilities."); + UpdateAbilities(); + } +} + +void AccessibilityAccountData::ChangeAbility(const std::string &bundleName) +{ + HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); + + if (installedAbilities_.empty()) { + HILOG_DEBUG("There is no installed abilities."); + return; + } + RemoveInstalledAbility(bundleName); + AddAbility(bundleName); +} + +void AccessibilityAccountData::AddUITestClient(const sptr &obj, + const std::string &bundleName, const std::string &abilityName) +{ + HILOG_DEBUG(); + // Add installed ability + std::shared_ptr abilityInfo = std::make_shared(); + if (!abilityInfo) { + HILOG_ERROR("abilityInfo is null"); + return; + } + abilityInfo->SetPackageName(bundleName); + uint32_t capabilities = CAPABILITY_RETRIEVE | CAPABILITY_GESTURE; + abilityInfo->SetCapabilityValues(capabilities); + abilityInfo->SetAccessibilityAbilityType(ACCESSIBILITY_ABILITY_TYPE_ALL); + abilityInfo->SetEventTypes(EventType::TYPES_ALL_MASK); + AddInstalledAbility(*abilityInfo); + + // Add connected ability + sptr elementName = new(std::nothrow) AppExecFwk::ElementName(); + if (!elementName) { + HILOG_ERROR("elementName is null"); + return; + } + elementName->SetBundleName(bundleName); + elementName->SetAbilityName(abilityName); + sptr connection = new(std::nothrow) AccessibleAbilityConnection( + this, connectCounter_++, *abilityInfo); + if (!connection) { + HILOG_ERROR("connection is null"); + return; + } + connection->OnAbilityConnectDoneSync(*elementName, obj, 0); +} + +void AccessibilityAccountData::RemoveUITestClient(sptr &connection, + const std::string &bundleName) +{ + HILOG_DEBUG(); + if (!connection) { + HILOG_ERROR("connection is nullptr"); + return; + } + RemoveInstalledAbility(bundleName); + connection->OnAbilityDisconnectDoneSync(connection->GetElementName(), 0); +} } // namespace Accessibility } // namespace OHOS diff --git a/services/aams/src/accessibility_settings_config.cpp b/services/aams/src/accessibility_settings_config.cpp index b08ae1047..f00e95794 100644 --- a/services/aams/src/accessibility_settings_config.cpp +++ b/services/aams/src/accessibility_settings_config.cpp @@ -503,7 +503,7 @@ void AccessibilitySettingsConfig::InitSetting() mouseAutoClick_ = static_cast(pref_->GetInt("MouseAutoClick", -1)); daltonizationColorFilter_ = static_cast(pref_->GetInt("daltonizationColorFilter", 0)); contentTimeout_ = static_cast(pref_->GetInt("contentTimeout", 0)); - brightnessDiscount_ = static_cast(pref_->GetFloat("brightnessDiscount", 0)); + brightnessDiscount_ = static_cast(pref_->GetFloat("brightnessDiscount", 1.0)); audioBalance_ = static_cast(pref_->GetFloat("audioBalance", 0)); } diff --git a/services/aams/src/accessibility_touchEvent_injector.cpp b/services/aams/src/accessibility_touchEvent_injector.cpp index ecfe03011..acfc1becd 100755 --- a/services/aams/src/accessibility_touchEvent_injector.cpp +++ b/services/aams/src/accessibility_touchEvent_injector.cpp @@ -40,15 +40,11 @@ void TouchInjectHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &eve switch (event->GetInnerEventId()) { case TouchEventInjector::SEND_TOUCH_EVENT_MSG: parameters = event->GetSharedObject(); - server_.SendPointerEvent(*parameters->event_); - if (parameters->isLastEvent_) { - if (server_.GetCurrentGestureService()) { - server_.GetCurrentGestureService()->OnGestureInjectResult(server_.GetSequence(), true); - } + if (!parameters->event_) { + HILOG_WARN("pointer event is nullptr"); + return; } - break; - case TouchEventInjector::GESTURE_INJECT_EVENT_MSG: - server_.InjectGesturePathInner(); + server_.SendPointerEvent(*parameters->event_); break; default: break; @@ -112,7 +108,6 @@ void TouchEventInjector::CancelGesture() HILOG_DEBUG(); std::shared_ptr event; MMI::PointerEvent::PointerItem pointer = {}; - pointer.SetPointerId(0); int64_t time = GetSystemTime(); pointer.SetDownTime(time); pointer.SetPointerId(0); @@ -129,7 +124,6 @@ void TouchEventInjector::CancelInjectedEvents() if (handler_->HasInnerEvent(SEND_TOUCH_EVENT_MSG)) { handler_->RemoveEvent(SEND_TOUCH_EVENT_MSG); CancelGesture(); - currentGestureService_->OnGestureInjectResult(sequence_, false); } } @@ -155,36 +149,26 @@ int64_t TouchEventInjector::GetSystemTime() return microsecond; } -void TouchEventInjector::InjectEvents(const std::shared_ptr& gesturePath, - const sptr &service, int32_t sequence) -{ - sequence_ = sequence; - currentGestureService_ = service; - gesturePositions_ = gesturePath; - handler_->SendEvent(GESTURE_INJECT_EVENT_MSG, 0, 0); -} - -void TouchEventInjector::InjectGesturePathInner() +void TouchEventInjector::InjectEvents(const std::shared_ptr& gesturePath) { HILOG_DEBUG(); int64_t curTime = GetSystemTime(); if (isDestroyEvent_ || !GetNext()) { - currentGestureService_->OnGestureInjectResult(sequence_, false); + HILOG_WARN("Inject gesture fail"); return; } CancelInjectedEvents(); CancelGesture(); - ParseTouchEventsFromGesturePath(curTime); + ParseTouchEventsFromGesturePath(curTime, gesturePath); if (injectedEvents_.empty()) { - currentGestureService_->OnGestureInjectResult(sequence_, false); + HILOG_WARN("No injected events"); return; } for (size_t i = 0; i < injectedEvents_.size(); i++) { std::shared_ptr parameters = std::make_shared(); - parameters->isLastEvent_ = (i == injectedEvents_.size() - 1) ? true : false; parameters->event_ = injectedEvents_[i]; if (injectedEvents_[i]) { int64_t timeout = (injectedEvents_[i]->GetActionTime() - curTime) / MS_TO_US; @@ -198,17 +182,22 @@ void TouchEventInjector::InjectGesturePathInner() injectedEvents_.clear(); } -void TouchEventInjector::ParseTapsEvents(int64_t startTime) +void TouchEventInjector::ParseTapsEvents(int64_t startTime, + const std::shared_ptr& gesturePath) { HILOG_DEBUG(); - const std::vector &positions = gesturePositions_->GetPositions(); + if (!gesturePath) { + HILOG_ERROR("gesturePath is null."); + return; + } + const std::vector &positions = gesturePath->GetPositions(); size_t positionSize = positions.size(); if (!positionSize) { HILOG_WARN("PositionSize is zero."); return; } - int64_t durationTime = gesturePositions_->GetDurationTime(); + int64_t durationTime = gesturePath->GetDurationTime(); if (durationTime < 0) { HILOG_WARN("DurationTime is wrong."); return; @@ -239,17 +228,22 @@ void TouchEventInjector::ParseTapsEvents(int64_t startTime) } } -void TouchEventInjector::ParseMovesEvents(int64_t startTime) +void TouchEventInjector::ParseMovesEvents(int64_t startTime, + const std::shared_ptr& gesturePath) { HILOG_DEBUG(); - std::vector positions = gesturePositions_->GetPositions(); - size_t positionSize = positions.size(); - if (positionSize < MOVE_GESTURE_MIN_PATH_COUNT) { - HILOG_WARN("PositionSize is zero."); + if (!gesturePath) { + HILOG_ERROR("gesturePath is null."); return; } - int64_t durationTime = gesturePositions_->GetDurationTime(); + std::vector positions = gesturePath->GetPositions(); + size_t positionSize = positions.size(); + if (positionSize < MOVE_GESTURE_MIN_PATH_COUNT) { + HILOG_WARN("PositionSize is wrong."); + return; + } + int64_t durationTime = gesturePath->GetDurationTime(); if (durationTime < 0) { HILOG_WARN("DurationTime is wrong."); return; @@ -288,14 +282,15 @@ void TouchEventInjector::ParseMovesEvents(int64_t startTime) } } -void TouchEventInjector::ParseTouchEventsFromGesturePath(int64_t startTime) +void TouchEventInjector::ParseTouchEventsFromGesturePath(int64_t startTime, + const std::shared_ptr& gesturePath) { HILOG_DEBUG(); - if (!gesturePositions_) { - HILOG_ERROR("gesturePositions_ is null."); + if (!gesturePath) { + HILOG_ERROR("gesturePath is null."); return; } - const std::vector &positions = gesturePositions_->GetPositions(); + const std::vector &positions = gesturePath->GetPositions(); if (positions.size() == 0) { HILOG_ERROR("position size is 0."); return; @@ -303,9 +298,9 @@ void TouchEventInjector::ParseTouchEventsFromGesturePath(int64_t startTime) if ((positions.size() == 1) || ((positions[0].positionX_ == positions[1].positionX_) && (positions[0].positionY_ == positions[1].positionY_))) { - ParseTapsEvents(startTime); + ParseTapsEvents(startTime, gesturePath); } else { - ParseMovesEvents(startTime); + ParseMovesEvents(startTime, gesturePath); } } } // namespace Accessibility diff --git a/services/aams/src/accessibility_touch_guider.cpp b/services/aams/src/accessibility_touch_guider.cpp index 4273b1192..a71b0784a 100755 --- a/services/aams/src/accessibility_touch_guider.cpp +++ b/services/aams/src/accessibility_touch_guider.cpp @@ -880,7 +880,7 @@ bool TouchGuider::ExecuteActionOnAccessibilityFocused(const ActionType &action) return false; } - uint32_t timeOut = 500; + uint32_t timeOut = 5000; sptr focusCallback = new(std::nothrow) ElementOperatorCallbackImpl(); if (!focusCallback) { HILOG_ERROR("Failed to create focusCallback."); diff --git a/services/aams/src/accessibility_window_manager.cpp b/services/aams/src/accessibility_window_manager.cpp index a5bc21525..b6ce76ff3 100644 --- a/services/aams/src/accessibility_window_manager.cpp +++ b/services/aams/src/accessibility_window_manager.cpp @@ -155,20 +155,20 @@ int32_t AccessibilityWindowManager::ConvertToRealWindowId(int32_t windowId, int3 { HILOG_DEBUG("ConvertToRealWindowId called, windowId[%{public}d], focusType[%{public}d]", windowId, focusType); if (windowId == ACTIVE_WINDOW_ID) { - HILOG_INFO("After convert active windowId[%{public}d]", activeWindowId_); + HILOG_DEBUG("After convert active windowId[%{public}d]", activeWindowId_); return activeWindowId_; } if (windowId == ANY_WINDOW_ID) { if (focusType == FOCUS_TYPE_ACCESSIBILITY) { - HILOG_INFO("After convert a11yFocused windowId[%{public}d] by accessibility type", a11yFocusedWindowId_); + HILOG_DEBUG("After convert a11yFocused windowId[%{public}d] by accessibility type", a11yFocusedWindowId_); return a11yFocusedWindowId_; } else if (focusType == FOCUS_TYPE_INPUT) { - HILOG_INFO("After convert active windowId[%{public}d] by input type", activeWindowId_); + HILOG_DEBUG("After convert active windowId[%{public}d] by input type", activeWindowId_); return activeWindowId_; } } - HILOG_INFO("After convert windowId[%{public}d]", windowId); + HILOG_DEBUG("After convert windowId[%{public}d]", windowId); return windowId; } diff --git a/services/aams/src/accessibility_zoom_gesture.cpp b/services/aams/src/accessibility_zoom_gesture.cpp index 42cd0f86b..4c01cdc34 100755 --- a/services/aams/src/accessibility_zoom_gesture.cpp +++ b/services/aams/src/accessibility_zoom_gesture.cpp @@ -26,7 +26,7 @@ namespace { constexpr int32_t MULTI_TAP_TIMER = 300; // ms constexpr int32_t LONG_PRESS_TIMER = 500; // ms constexpr int64_t US_TO_MS = 1000; - constexpr float MIN_SCALE_SPAN = 26.0f; // 27mm + constexpr float MIN_SCALE_SPAN = 26.0f; constexpr float DOUBLE_TAP_SLOP = 100.0f; constexpr float HALF = 0.5f; constexpr uint32_t TRIPLE_TAP_COUNT = 3; @@ -99,17 +99,20 @@ void AccessibilityZoomGesture::CacheEvents(MMI::PointerEvent &event) switch (action) { case MMI::PointerEvent::POINTER_ACTION_DOWN: if (pointerCount == POINTER_COUNT_1) { + HILOG_DEBUG("Cache pointer down"); preLastDownEvent_ = lastDownEvent_; lastDownEvent_ = pointerEvent; } break; case MMI::PointerEvent::POINTER_ACTION_UP: if (pointerCount == POINTER_COUNT_1) { + HILOG_DEBUG("Cache pointer up"); preLastUpEvent_ = lastUpEvent_; lastUpEvent_ = pointerEvent; } break; default: + HILOG_DEBUG("Action is %{public}d", action); break; } cacheEvents_.emplace_back(pointerEvent); @@ -136,6 +139,7 @@ void AccessibilityZoomGesture::SendCacheEventsToNext() if ((cacheEventsNum > 1) && (cacheEventsNum == cacheEventsTotalNum) && (action == MMI::PointerEvent::POINTER_ACTION_DOWN)) { + HILOG_DEBUG("The down event needs to be parsed again"); isStartNewAction = true; } if (isStartNewAction) { @@ -166,6 +170,7 @@ void AccessibilityZoomGesture::RecognizeInReadyState(MMI::PointerEvent &event) size_t pointerCount = event.GetPointerIds().size(); bool isTripleTaps = false; + HILOG_DEBUG("action:%{public}d, pointerCount:%{public}zu", action, pointerCount); switch (action) { case MMI::PointerEvent::POINTER_ACTION_DOWN: zoomGestureEventHandler_->RemoveEvent(MULTI_TAP_MSG); @@ -202,6 +207,7 @@ void AccessibilityZoomGesture::RecognizeInZoomState(MMI::PointerEvent &event) size_t pointerCount = event.GetPointerIds().size(); bool isTripleTaps = false; + HILOG_DEBUG("action:%{public}d, pointerCount:%{public}zu", action, pointerCount); switch (action) { case MMI::PointerEvent::POINTER_ACTION_DOWN: zoomGestureEventHandler_->RemoveEvent(MULTI_TAP_MSG); @@ -258,6 +264,7 @@ void AccessibilityZoomGesture::RecognizeInSlidingState(MMI::PointerEvent &event) RecognizeScroll(event); RecognizeScale(event); + HILOG_DEBUG("action:%{public}d, pointerCount:%{public}zu", action, pointerCount); switch (action) { case MMI::PointerEvent::POINTER_ACTION_UP: if (pointerCount == POINTER_COUNT_1) { @@ -282,12 +289,13 @@ void AccessibilityZoomGesture::RecognizeScroll(MMI::PointerEvent &event) switch (action) { case MMI::PointerEvent::POINTER_ACTION_DOWN: + case MMI::PointerEvent::POINTER_ACTION_UP: lastScrollFocusX_ = coordinate.centerX; lastScrollFocusY_ = coordinate.centerY; break; case MMI::PointerEvent::POINTER_ACTION_MOVE: { - float offsetX = lastScrollFocusX_ - coordinate.centerX; - float offsetY = lastScrollFocusY_ - coordinate.centerY; + float offsetX = coordinate.centerX - lastScrollFocusX_; + float offsetY = coordinate.centerY - lastScrollFocusY_; if ((abs(offsetX) > 1) || (abs(offsetY) > 1)) { lastScrollFocusX_ = coordinate.centerX; lastScrollFocusY_ = coordinate.centerY; @@ -295,10 +303,6 @@ void AccessibilityZoomGesture::RecognizeScroll(MMI::PointerEvent &event) } break; } - case MMI::PointerEvent::POINTER_ACTION_UP: - lastScrollFocusX_ = coordinate.centerX; - lastScrollFocusY_ = coordinate.centerY; - break; default: break; } @@ -312,6 +316,7 @@ void AccessibilityZoomGesture::RecognizeScale(MMI::PointerEvent &event) size_t pointerCount = event.GetPointerIds().size(); if (((action == MMI::PointerEvent::POINTER_ACTION_UP) && (pointerCount == POINTER_COUNT_1)) || (action == MMI::PointerEvent::POINTER_ACTION_CANCEL)) { + HILOG_DEBUG("Scaling is end"); startScaling_ = false; preSpan_ = lastSpan_ = 0; return; @@ -340,10 +345,12 @@ void AccessibilityZoomGesture::RecognizeScale(MMI::PointerEvent &event) } if (!startScaling_) { + HILOG_DEBUG("Current is not scaling"); return; } if (action != MMI::PointerEvent::POINTER_ACTION_MOVE) { + HILOG_DEBUG("Action(%{public}d) is not move", action); return; } @@ -366,15 +373,18 @@ void AccessibilityZoomGesture::CalcFocusCoordinate(MMI::PointerEvent &event, ZOO std::vector pointerIdList = event.GetPointerIds(); size_t count = pointerIdList.size(); if (!count) { + HILOG_DEBUG("The size of PointerIds is 0"); return; } if (action == MMI::PointerEvent::POINTER_ACTION_UP) { upPointerId = event.GetPointerId(); + HILOG_DEBUG("The pointer id of up is %{public}d", upPointerId); count--; } if (count <= 0) { + HILOG_DEBUG("The size of PointerIds(down) is invalid"); return; } @@ -390,6 +400,7 @@ void AccessibilityZoomGesture::CalcFocusCoordinate(MMI::PointerEvent &event, ZOO coordinate.centerX = sumX / count; coordinate.centerY = sumY / count; + HILOG_DEBUG("centerX:%{public}f, centerY:%{public}f", coordinate.centerX, coordinate.centerY); } float AccessibilityZoomGesture::CalcScaleSpan(MMI::PointerEvent &event, ZOOM_FOCUS_COORDINATE coordinate) @@ -404,15 +415,18 @@ float AccessibilityZoomGesture::CalcScaleSpan(MMI::PointerEvent &event, ZOOM_FOC std::vector pointerIdList = event.GetPointerIds(); size_t count = pointerIdList.size(); if (!count) { + HILOG_DEBUG("The size of PointerIds is 0"); return span; } if (action == MMI::PointerEvent::POINTER_ACTION_UP) { upPointerId = event.GetPointerId(); + HILOG_DEBUG("The pointer id of up is %{public}d", upPointerId); count--; } if (count <= 0) { + HILOG_DEBUG("The size of PointerIds(down) is invalid"); return span; } @@ -429,6 +443,7 @@ float AccessibilityZoomGesture::CalcScaleSpan(MMI::PointerEvent &event, ZOOM_FOC float spanX = sumSpanX / count; float spanY = sumSpanY / count; span = hypot(spanX, spanY) / HALF; + HILOG_DEBUG("The span is %{public}f", span); return span; } @@ -437,10 +452,12 @@ bool AccessibilityZoomGesture::IsDownValid() HILOG_DEBUG(); if (!preLastDownEvent_) { + HILOG_DEBUG("This is the first down event"); return true; } if (CalcSeparationDistance(preLastDownEvent_, lastDownEvent_) >= multiTapDistance_) { + HILOG_DEBUG("The down event is vailid"); return false; } return true; @@ -451,14 +468,17 @@ bool AccessibilityZoomGesture::IsUpValid() HILOG_DEBUG(); if (!lastDownEvent_) { + HILOG_DEBUG("The up event is invailid"); return false; } if (CalcIntervalTime(lastDownEvent_, lastUpEvent_) >= LONG_PRESS_TIMER) { + HILOG_DEBUG("The time has exceeded the long press time"); return false; } if (CalcSeparationDistance(lastDownEvent_, lastUpEvent_) >= tapDistance_) { + HILOG_DEBUG("The distance has exceeded the threshold"); return false; } return true; @@ -478,6 +498,7 @@ bool AccessibilityZoomGesture::IsTripleTaps() } if (upEventCount >= TRIPLE_TAP_COUNT) { + HILOG_DEBUG("Triple tap detected"); return true; } @@ -490,6 +511,7 @@ int64_t AccessibilityZoomGesture::CalcIntervalTime(std::shared_ptrSetServiceOnKeyEventResult(connection_, handled, sequence); } -void AccessibleAbilityChannel::SendSimulateGesture(const int32_t requestId, - const std::shared_ptr& gesturePath) +bool AccessibleAbilityChannel::SendSimulateGesture(const std::shared_ptr& gesturePath) { HILOG_INFO(); if (!eventHandler_) { HILOG_ERROR("eventHandler_ is nullptr"); - return; + return false; } + std::promise syncPromise; + std::future syncFuture = syncPromise.get_future(); std::function task = std::bind(&AccessibleAbilityChannel::InnerSendSimulateGesturePath, - this, requestId, gesturePath); + this, std::ref(syncPromise), gesturePath); eventHandler_->PostTask(task, TASK_SEND_SIMULATE_GESTURE_PATH); + bool ret = syncFuture.get(); + return ret; } -void AccessibleAbilityChannel::InnerSendSimulateGesturePath(const int32_t requestId, +void AccessibleAbilityChannel::InnerSendSimulateGesturePath(std::promise &syncPromise, const std::shared_ptr& gesturePath) { HILOG_DEBUG(); - sptr abilityClient = connection_.GetAbilityClient(); - if (!abilityClient) { - return; - } if (!(connection_.GetAbilityInfo().GetCapabilityValues() & Capability::CAPABILITY_GESTURE)) { HILOG_ERROR("AccessibleAbilityChannel::SendSimulateGesture failed: no capability"); - abilityClient->OnGestureInjectResult(requestId, false); + syncPromise.set_value(false); return; } sptr touchEventInjector = Singleton::GetInstance().GetTouchEventInjector(); if (!touchEventInjector) { - abilityClient->OnGestureInjectResult(requestId, false); + HILOG_ERROR("touchEventInjector is null"); + syncPromise.set_value(false); return; } - touchEventInjector->InjectEvents(gesturePath, abilityClient, requestId); + touchEventInjector->InjectEvents(gesturePath); + syncPromise.set_value(true); } bool AccessibleAbilityChannel::SetEventTypeFilter(const uint32_t filter) diff --git a/services/aams/src/accessible_ability_connection.cpp b/services/aams/src/accessible_ability_connection.cpp index 824594450..3e266a55b 100644 --- a/services/aams/src/accessible_ability_connection.cpp +++ b/services/aams/src/accessible_ability_connection.cpp @@ -80,7 +80,7 @@ void AccessibleAbilityConnection::InnerOnAbilityConnectDone(const AppExecFwk::El if (resultCode != NO_ERROR) { accountData_->RemoveEnabledAbility(Utils::GetUri(elementName_)); accountData_->RemoveConnectingA11yAbility(Utils::GetUri(elementName_)); - Singleton::GetInstance().UpdateAbilities(); + accountData_->UpdateAbilities(); Utils::RecordUnavailableEvent(A11yUnavailableEvent::CONNECT_EVENT, A11yError::ERROR_CONNECT_A11Y_APPLICATION_FAILED, bundleName, abilityName); return; @@ -181,20 +181,9 @@ void AccessibleAbilityConnection::OnAccessibilityEvent(AccessibilityEventInfo &e return; } - bool send = false; - if (IsAllowedListEvent(eventInfo.GetEventType())) { - HILOG_DEBUG("EventType is in the allowed list!"); - send = true; - } else { - std::vector filterBundleNames = abilityInfo_.GetFilterBundleNames(); - if (IsWantedEvent(eventInfo.GetEventType()) && (filterBundleNames.empty() || - find(filterBundleNames.begin(), filterBundleNames.end(), - eventInfo.GetBundleName()) != filterBundleNames.end())) { - send = true; - } - } - - if (send) { + std::vector filterBundleNames = abilityInfo_.GetFilterBundleNames(); + if (IsWantedEvent(eventInfo.GetEventType()) && (filterBundleNames.empty() || find(filterBundleNames.begin(), + filterBundleNames.end(), eventInfo.GetBundleName()) != filterBundleNames.end())) { eventInfo.SetChannelId(connectionId_); abilityClient_->OnAccessibilityEvent(eventInfo); HILOG_INFO("windowId[%{public}d] evtType[%{public}d] windowChangeType[%{public}d] GestureId[%{public}d]", @@ -205,33 +194,6 @@ void AccessibleAbilityConnection::OnAccessibilityEvent(AccessibilityEventInfo &e return; } -bool AccessibleAbilityConnection::IsAllowedListEvent(EventType eventType) -{ - bool ret = false; - switch (eventType) { - case EventType::TYPE_PAGE_STATE_UPDATE: - case EventType::TYPE_NOTIFICATION_UPDATE_EVENT: - case EventType::TYPE_PUBLIC_NOTICE_EVENT: - case EventType::TYPE_TOUCH_GUIDE_GESTURE_BEGIN: - case EventType::TYPE_TOUCH_GUIDE_GESTURE_END: - case EventType::TYPE_TOUCH_GUIDE_BEGIN: - case EventType::TYPE_TOUCH_GUIDE_END: - case EventType::TYPE_TOUCH_BEGIN: - case EventType::TYPE_TOUCH_END: - case EventType::TYPE_VIEW_HOVER_ENTER_EVENT: - case EventType::TYPE_VIEW_HOVER_EXIT_EVENT: - case EventType::TYPE_INTERRUPT_EVENT: - case EventType::TYPE_GESTURE_EVENT: - case EventType::TYPE_WINDOW_UPDATE: { - ret = true; - break; - } - default: - break; - } - return ret; -} - bool AccessibleAbilityConnection::OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence) { if (!abilityClient_) { @@ -248,15 +210,6 @@ bool AccessibleAbilityConnection::OnKeyPressEvent(const MMI::KeyEvent &keyEvent, return true; } -void AccessibleAbilityConnection::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - if (!abilityClient_) { - HILOG_ERROR("OnGestureInjectResult failed"); - return; - } - abilityClient_->OnGestureInjectResult(sequence, completedSuccessfully); -} - void AccessibleAbilityConnection::SetAbilityInfoEventTypeFilter(const uint32_t eventTypes) { HILOG_DEBUG(); @@ -384,7 +337,7 @@ void AccessibleAbilityConnection::AccessibleAbilityConnectionDeathRecipient::OnR } auto &aams = Singleton::GetInstance(); - aams.UpdateAbilities(); + recipientAccountData_->UpdateAbilities(); aams.UpdateAccessibilityManagerService(); }), "OnRemoteDied"); } diff --git a/services/aams/src/accessible_ability_manager_service.cpp b/services/aams/src/accessible_ability_manager_service.cpp index 8c5ccf3cf..41b5a54aa 100644 --- a/services/aams/src/accessible_ability_manager_service.cpp +++ b/services/aams/src/accessible_ability_manager_service.cpp @@ -27,6 +27,7 @@ #include "iservice_registry.h" #include "input_manager.h" #include "os_account_manager.h" +#include "parameter.h" #include "system_ability_definition.h" #include "utils.h" @@ -38,15 +39,15 @@ namespace { const std::string AAMS_SERVICE_NAME = "AccessibleAbilityManagerService"; const std::string UI_TEST_BUNDLE_NAME = "ohos.uitest"; const std::string UI_TEST_ABILITY_NAME = "uitestability"; - constexpr int32_t AUTOCLICK_DELAY_TIME_MIN = 1000; // ms - constexpr int32_t AUTOCLICK_DELAY_TIME_MAX = 5000; // ms + const std::string SYSTEM_PARAMETER_AAMS_NAME = "accessibility.config.ready"; + const std::string GRAPHIC_ANIMATION_SCALE_NAME = "persist.sys.graphic.animationscale"; + const std::string ARKUI_ANIMATION_SCALE_NAME = "persist.sys.arkui.animationscale"; constexpr int32_t QUERY_USER_ID_RETRY_COUNT = 60; constexpr int32_t QUERY_USER_ID_SLEEP_TIME = 50; } // namespace const bool REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(&Singleton::GetInstance()); -std::mutex AccessibleAbilityManagerService::mutex_; AccessibleAbilityManagerService::AccessibleAbilityManagerService() : SystemAbility(ACCESSIBILITY_MANAGER_SERVICE_ID, true) @@ -121,14 +122,16 @@ void AccessibleAbilityManagerService::OnStop() touchEventInjector_ = nullptr; keyEventFilter_ = nullptr; stateCallbackDeathRecipient_ = nullptr; + bundleManagerDeathRecipient_ = nullptr; runner_.reset(); handler_.reset(); for (auto &iter : dependentServicesStatus_) { iter.second = false; } - HILOG_INFO("AccessibleAbilityManagerService::OnStop OK."); isRunning_ = false; + SetParameter(SYSTEM_PARAMETER_AAMS_NAME.c_str(), "false"); + HILOG_INFO("AccessibleAbilityManagerService::OnStop OK."); } void AccessibleAbilityManagerService::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) @@ -378,7 +381,6 @@ bool AccessibleAbilityManagerService::GetAbilityList(const uint32_t abilityTypes void AccessibleAbilityManagerService::RegisterElementOperator( const int32_t windowId, const sptr &operation) { - HILOG_INFO("Register windowId[%{public}d] start", windowId); if (!handler_) { Utils::RecordUnavailableEvent(A11yUnavailableEvent::CONNECT_EVENT, A11yError::ERROR_CONNECT_TARGET_APPLICATION_FAILED); @@ -432,7 +434,6 @@ void AccessibleAbilityManagerService::RegisterElementOperator( void AccessibleAbilityManagerService::DeregisterElementOperator(int32_t windowId) { - HILOG_INFO("Deregister windowId[%{public}d] start", windowId); if (!handler_) { HILOG_ERROR("handler_ is nullptr."); return; @@ -450,20 +451,23 @@ void AccessibleAbilityManagerService::DeregisterElementOperator(int32_t windowId HILOG_WARN("The operation of windowId[%{public}d] has not been registered.", windowId); return; } - if (connection->GetProxy()) { - auto object = connection->GetProxy()->AsObject(); - if (object) { - auto iter = interactionOperationDeathRecipients_.find(windowId); - if (iter != interactionOperationDeathRecipients_.end()) { - sptr deathRecipient = iter->second; - bool result = object->RemoveDeathRecipient(deathRecipient); - HILOG_DEBUG("The result of deleting operation's death recipient is %{public}d", result); - interactionOperationDeathRecipients_.erase(iter); - } - } + accountData->RemoveAccessibilityWindowConnection(windowId); + + if (!connection->GetProxy()) { + HILOG_ERROR("proxy is null"); + return; } - accountData->RemoveAccessibilityWindowConnection(windowId); + auto object = connection->GetProxy()->AsObject(); + if (object) { + auto iter = interactionOperationDeathRecipients_.find(windowId); + if (iter != interactionOperationDeathRecipients_.end()) { + sptr deathRecipient = iter->second; + bool result = object->RemoveDeathRecipient(deathRecipient); + HILOG_DEBUG("The result of deleting operation's death recipient is %{public}d", result); + interactionOperationDeathRecipients_.erase(iter); + } + } }), "TASK_DEREGISTER_ELEMENT_OPERATOR"); } @@ -691,7 +695,6 @@ bool AccessibleAbilityManagerService::InnerEnableAbility(const std::string &name return false; } bool result = accountData->EnableAbility(name, capabilities); - UpdateAbilities(); return result; } @@ -777,7 +780,7 @@ bool AccessibleAbilityManagerService::InnerDisableAbility(const std::string &nam HILOG_ERROR("RemoveEnabledAbility failed"); return false; } - UpdateAbilities(); + accountData->UpdateAbilities(); return true; } @@ -807,8 +810,8 @@ RetError AccessibleAbilityManagerService::EnableUITestAbility(const sptr addUITestClientFunc = - std::bind(&AccessibleAbilityManagerService::AddUITestClient, this, obj); + std::function addUITestClientFunc = std::bind(&AccessibilityAccountData::AddUITestClient, accountData, + obj, UI_TEST_BUNDLE_NAME, UI_TEST_ABILITY_NAME); handler_->PostTask(addUITestClientFunc, "AddUITestClient"); syncPromise.set_value(RET_OK); }), "TASK_ENABLE_UI_TEST_ABILITIES"); @@ -841,7 +844,7 @@ bool AccessibleAbilityManagerService::DisableUITestAbility() return; } std::function removeUITestClientFunc = - std::bind(&AccessibleAbilityManagerService::RemoveUITestClient, this, connection); + std::bind(&AccessibilityAccountData::RemoveUITestClient, accountData, connection, UI_TEST_BUNDLE_NAME); handler_->PostTask(removeUITestClientFunc, "RemoveUITestClient"); syncPromise.set_value(true); }), "TASK_DISABLE_UI_TEST_ABILITIES"); @@ -893,6 +896,7 @@ bool AccessibleAbilityManagerService::Init() HILOG_DEBUG("Query account information success, account id:%{public}d", accountIds[0]); SwitchedUser(accountIds[0]); } + SetParameter(SYSTEM_PARAMETER_AAMS_NAME.c_str(), "true"); return true; } @@ -949,9 +953,18 @@ sptr AccessibleAbilityManagerService::GetBundleMgrProxy( bundleManager_ = iface_cast(remoteObject); if (!bundleManager_) { HILOG_ERROR("fail to new bundle manager."); - } else { - HILOG_INFO("AccessibleAbilityManagerService::GetBundleMgrProxy OK"); + return nullptr; } + + if (!bundleManagerDeathRecipient_) { + bundleManagerDeathRecipient_ = new(std::nothrow) BundleManagerDeathRecipient(); + if (!bundleManagerDeathRecipient_) { + HILOG_ERROR("bundleManagerDeathRecipient_ is null"); + return nullptr; + } + } + + bundleManager_->AsObject()->AddDeathRecipient(bundleManagerDeathRecipient_); return bundleManager_; } @@ -1057,7 +1070,7 @@ void AccessibleAbilityManagerService::SwitchedUser(int32_t accountId) HILOG_DEBUG("accountId(%{public}d)", accountId); if (accountId == currentAccountId_) { - HILOG_ERROR("switch user failed, this account is current account."); + HILOG_WARN("The account id(%{public}d) is current account id.", accountId); return; } @@ -1087,159 +1100,43 @@ void AccessibleAbilityManagerService::SwitchedUser(int32_t accountId) accountData->Init(); if (accountData->GetInstalledAbilitiesFromBMS()) { accountData->UpdateImportantEnabledAbilities(importantEnabledAbilities); - UpdateAbilities(); + accountData->UpdateAbilities(); UpdateAccessibilityManagerService(); } } void AccessibleAbilityManagerService::PackageRemoved(const std::string &bundleName) { - HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); - sptr packageAccount = GetCurrentAccountData(); if (!packageAccount) { HILOG_ERROR("packageAccount is nullptr."); return; } - if (packageAccount->GetInstalledAbilities().empty()) { - HILOG_DEBUG("There is no installed abilities."); - return; - } - packageAccount->RemoveInstalledAbility(bundleName); - // Remove enabled ability, remove connecting ability if it is connecting. - bool needUpdateAbility = false; - std::vector enabledAbilities = packageAccount->GetEnabledAbilities(); - if (enabledAbilities.empty()) { - HILOG_DEBUG("There is no enabled abilities."); - return; - } - for (auto& enableAbility : enabledAbilities) { - if (enableAbility.substr(0, enableAbility.find("/")) == bundleName) { - packageAccount->RemoveEnabledAbility(enableAbility); - packageAccount->RemoveConnectingA11yAbility(enableAbility); - needUpdateAbility = true; - } - } - - // Remove connected ability - std::map> connectedAbilities = - packageAccount->GetConnectedA11yAbilities(); - if (connectedAbilities.empty()) { - HILOG_DEBUG("There is no connected abilities."); - return; - } - 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()); - packageAccount->RemoveConnectedAbility(connectedAbility.second); - needUpdateAbility = true; - } - } - - if (needUpdateAbility) { - UpdateAbilities(); + if (packageAccount->RemoveAbility(bundleName)) { + HILOG_DEBUG("ability%{public}s removed!", bundleName.c_str()); UpdateAccessibilityManagerService(); } } void AccessibleAbilityManagerService::PackageAdd(const std::string &bundleName) { - HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); sptr packageAccount = GetCurrentAccountData(); if (!packageAccount) { HILOG_ERROR("packageAccount is nullptr"); return; } - bool hasNewExtensionAbility = false; - std::vector extensionInfos; - sptr bundleMgrProxy = GetBundleMgrProxy(); - if (!bundleMgrProxy) { - HILOG_ERROR("bundleMgrProxy is nullptr."); - return; - } - bundleMgrProxy->QueryExtensionAbilityInfos( - AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, currentAccountId_, extensionInfos); - HILOG_DEBUG("query extensionAbilityInfos' size is %{public}zu.", extensionInfos.size()); - for (auto &newAbility : extensionInfos) { - if (newAbility.bundleName == bundleName) { - HILOG_DEBUG("The package added is an extension ability and\ - extension ability's name is %{public}s", newAbility.name.c_str()); - AccessibilityAbilityInitParams initParams; - Utils::Parse(newAbility, initParams); - std::shared_ptr accessibilityInfo = - std::make_shared(initParams); - if (!accessibilityInfo) { - HILOG_ERROR("accessibilityInfo is nullptr"); - return; - } - packageAccount->AddInstalledAbility(*accessibilityInfo); - HILOG_DEBUG("add new extension ability successfully and installed abilities's size is %{public}zu", - packageAccount->GetInstalledAbilities().size()); - hasNewExtensionAbility = true; - break; - } - } - - if (hasNewExtensionAbility) { - HILOG_DEBUG("add new extension ability and update abilities."); - UpdateAbilities(); - } + packageAccount->AddAbility(bundleName); } void AccessibleAbilityManagerService::PackageChanged(const std::string &bundleName) { - HILOG_DEBUG("bundleName(%{public}s)", bundleName.c_str()); - - bool hasChanged = false; sptr packageAccount = GetCurrentAccountData(); if (!packageAccount) { HILOG_ERROR("packageAccount is nullptr"); return; } - if (packageAccount->GetInstalledAbilities().empty()) { - HILOG_DEBUG("There is no installed abilities."); - return; - } - packageAccount->RemoveInstalledAbility(bundleName); - - // Add installed ability - std::vector extensionInfos; - sptr bundleMgrProxy = GetBundleMgrProxy(); - if (!bundleMgrProxy) { - HILOG_ERROR("bundleMgrProxy is nullptr."); - return; - } - bundleMgrProxy->QueryExtensionAbilityInfos( - AppExecFwk::ExtensionAbilityType::ACCESSIBILITY, currentAccountId_, extensionInfos); - HILOG_DEBUG("query extensionAbilityInfos' size is %{public}zu.", extensionInfos.size()); - for (auto &changedAbility : extensionInfos) { - if (changedAbility.bundleName == bundleName) { - HILOG_DEBUG("The package changed is an extension ability and\ - extension ability's name is %{public}s", changedAbility.name.c_str()); - AccessibilityAbilityInitParams initParams; - Utils::Parse(changedAbility, initParams); - std::shared_ptr accessibilityInfo = - std::make_shared(initParams); - packageAccount->AddInstalledAbility(*accessibilityInfo); - HILOG_DEBUG("update new extension ability successfully and installed abilities's size is %{public}zu", - packageAccount->GetInstalledAbilities().size()); - hasChanged = true; - break; - } - } - - if (hasChanged) { - HILOG_DEBUG("update new extension ability and update abilities."); - UpdateAbilities(); - } + packageAccount->ChangeAbility(bundleName); } void AccessibleAbilityManagerService::UpdateAccessibilityWindowStateByEvent(const AccessibilityEventInfo &event) @@ -1272,54 +1169,6 @@ void AccessibleAbilityManagerService::UpdateAccessibilityManagerService() UpdateAccessibilityState(); } -void AccessibleAbilityManagerService::UpdateAbilities() -{ - HILOG_DEBUG("start."); - - sptr accountData = GetCurrentAccountData(); - if (!accountData) { - HILOG_ERROR("Account data is null"); - return; - } - - vector installedAbilities = accountData->GetInstalledAbilities(); - HILOG_DEBUG("installedAbilities is %{public}zu.", installedAbilities.size()); - for (auto &installAbility : installedAbilities) { - std::string deviceId = ""; - std::string bundleName = installAbility.GetPackageName(); - std::string abilityName = installAbility.GetName(); - HILOG_DEBUG("installAbility's packageName is %{public}s and abilityName is %{public}s", - bundleName.c_str(), abilityName.c_str()); - - auto connectingAbilities = accountData->GetConnectingA11yAbilities(); - vector::iterator iter = std::find(connectingAbilities.begin(), - connectingAbilities.end(), Utils::GetUri(bundleName, abilityName)); - if (iter != connectingAbilities.end()) { - HILOG_DEBUG("The ability(bundleName[%{public}s] abilityName[%{public}s]) is connecting.", - bundleName.c_str(), abilityName.c_str()); - continue; - } - sptr connection = - accountData->GetAccessibleAbilityConnection(Utils::GetUri(bundleName, abilityName)); - - auto enabledAbilities = accountData->GetEnabledAbilities(); - iter = std::find(enabledAbilities.begin(), enabledAbilities.end(), Utils::GetUri(bundleName, abilityName)); - if (iter != enabledAbilities.end()) { - if (!connection) { - AppExecFwk::ElementName element(deviceId, bundleName, abilityName); - connection = new(std::nothrow) AccessibleAbilityConnection(accountData, - connectCounter_++, installAbility); - connection->Connect(element); - } - } else { - HILOG_DEBUG("not in enabledAbilites list ."); - if (connection) { - connection->Disconnect(); - } - } - } -} - void AccessibleAbilityManagerService::UpdateAccessibilityState() { HILOG_DEBUG("start."); @@ -1367,31 +1216,7 @@ void AccessibleAbilityManagerService::UpdateInputFilter() return; } - uint32_t flag = 0; - if (accountData->GetScreenMagnificationFlag() && accountData->GetConfig()->GetScreenMagnificationState()) { - flag |= AccessibilityInputInterceptor::FEATURE_SCREEN_MAGNIFICATION; - } - if (accountData->GetEventTouchGuideStateFlag()) { - flag |= AccessibilityInputInterceptor::FEATURE_TOUCH_EXPLORATION; - } - if (accountData->GetFilteringKeyEventsFlag()) { - flag |= AccessibilityInputInterceptor::FEATURE_FILTER_KEY_EVENTS; - } - if (accountData->GetGesturesSimulationFlag()) { - flag |= AccessibilityInputInterceptor::FEATURE_INJECT_TOUCH_EVENTS; - } - if (accountData->GetConfig()->GetShortKeyState()) { - flag |= AccessibilityInputInterceptor::FEATURE_SHORT_KEY; - } - if (accountData->GetConfig()->GetMouseKeyState()) { - flag |= AccessibilityInputInterceptor::FEATURE_MOUSE_KEY; - } - - int32_t autoclickTime = accountData->GetConfig()->GetMouseAutoClick(); - if (autoclickTime >= AUTOCLICK_DELAY_TIME_MIN && autoclickTime <= AUTOCLICK_DELAY_TIME_MAX) { - flag |= AccessibilityInputInterceptor::FEATURE_MOUSE_AUTOCLICK; - } - + uint32_t flag = accountData->GetInputFilterFlag(); HILOG_DEBUG("InputInterceptor flag is %{public}d", flag); inputInterceptor_ = AccessibilityInputInterceptor::GetInstance(); @@ -1403,61 +1228,6 @@ void AccessibleAbilityManagerService::UpdateInputFilter() Utils::RecordStartingA11yEvent(flag); } -void AccessibleAbilityManagerService::AddUITestClient(const sptr &obj) -{ - HILOG_DEBUG(); - auto currentAccountData = GetCurrentAccountData(); - if (!currentAccountData) { - HILOG_ERROR("currentAccountData is nullptr"); - return; - } - - // Add installed ability - std::shared_ptr abilityInfo = std::make_shared(); - if (!abilityInfo) { - HILOG_ERROR("abilityInfo is null"); - return; - } - abilityInfo->SetPackageName(UI_TEST_BUNDLE_NAME); - uint32_t capabilities = CAPABILITY_RETRIEVE | CAPABILITY_GESTURE; - abilityInfo->SetCapabilityValues(capabilities); - abilityInfo->SetAccessibilityAbilityType(ACCESSIBILITY_ABILITY_TYPE_ALL); - abilityInfo->SetEventTypes(EventType::TYPES_ALL_MASK); - currentAccountData->AddInstalledAbility(*abilityInfo); - - // Add connected ability - sptr elementName = new(std::nothrow) AppExecFwk::ElementName(); - if (!elementName) { - HILOG_ERROR("elementName is null"); - return; - } - elementName->SetBundleName(UI_TEST_BUNDLE_NAME); - elementName->SetAbilityName(UI_TEST_ABILITY_NAME); - sptr connection = new(std::nothrow) AccessibleAbilityConnection( - currentAccountData, connectCounter_++, *abilityInfo); - if (!connection) { - HILOG_ERROR("connection is null"); - return; - } - connection->OnAbilityConnectDoneSync(*elementName, obj, 0); -} - -void AccessibleAbilityManagerService::RemoveUITestClient(sptr &connection) -{ - HILOG_DEBUG(); - if (!connection) { - HILOG_ERROR("connection is nullptr"); - return; - } - sptr accountData = GetCurrentAccountData(); - if (!accountData) { - HILOG_ERROR("accountData is nullptr"); - return; - } - accountData->RemoveInstalledAbility(UI_TEST_BUNDLE_NAME); - connection->OnAbilityDisconnectDoneSync(connection->GetElementName(), 0); -} - void AccessibleAbilityManagerService::SetScreenMagnificationState(const bool state) { HILOG_INFO("state = [%{public}s]", state ? "True" : "False"); @@ -1656,6 +1426,16 @@ void AccessibleAbilityManagerService::SetAnimationOffState(const bool state) UpdateConfigState(); }), "TASK_SET_ANIMATIONOFF_STATE"); syncFuture.get(); + int setGraphicParamRes = -1; + int setArkuiParamRes = -1; + if (state) { + setGraphicParamRes = SetParameter(GRAPHIC_ANIMATION_SCALE_NAME.c_str(), "0"); + setArkuiParamRes = SetParameter(ARKUI_ANIMATION_SCALE_NAME.c_str(), "0"); + } else { + setGraphicParamRes = SetParameter(GRAPHIC_ANIMATION_SCALE_NAME.c_str(), "1"); + setArkuiParamRes = SetParameter(ARKUI_ANIMATION_SCALE_NAME.c_str(), "1"); + } + HILOG_INFO("SetParameter results are %{public}d and %{public}d", setGraphicParamRes, setArkuiParamRes); } void AccessibleAbilityManagerService::SetAudioMonoState(const bool state) @@ -2140,6 +1920,12 @@ void AccessibleAbilityManagerService::ConfigCallbackDeathRecipient::OnRemoteDied Singleton::GetInstance().RemoveCallback(CONFIG_CALLBACK, this, remote); } +void AccessibleAbilityManagerService::BundleManagerDeathRecipient::OnRemoteDied( + const wptr &remote) +{ + Singleton::GetInstance().OnBundleManagerDied(remote); +} + void AccessibleAbilityManagerService::UpdateConfigState() { handler_->PostTask(std::bind([this]() -> void { @@ -2311,5 +2097,24 @@ void AccessibleAbilityManagerService::RemoveCallback(CallBackID callback, } }), "RemoveCallback"); } + +void AccessibleAbilityManagerService::OnBundleManagerDied(const wptr &remote) +{ + HILOG_INFO("OnBundleManagerDied "); + if (!handler_) { + HILOG_ERROR("handler is nullptr"); + return; + } + + handler_->PostTask(std::bind([=]() -> void { + if (!remote.GetRefPtr() || !bundleManager_) { + HILOG_ERROR("remote is null"); + return; + } + + bundleManager_->AsObject()->RemoveDeathRecipient(bundleManagerDeathRecipient_); + bundleManager_ = nullptr; + }), "OnBundleManagerDied"); +} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/aams/test/BUILD.gn b/services/aams/test/BUILD.gn index ba91c3b98..db8469076 100644 --- a/services/aams/test/BUILD.gn +++ b/services/aams/test/BUILD.gn @@ -44,6 +44,7 @@ config("module_private_config") { "//base/global/resource_management/interfaces/inner_api/include", "//base/notification/common_event_service/interfaces/inner_api", "//base/powermgr/power_manager/interfaces/innerkits/native/include", + "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", "//foundation", "${ability_runtime_path}/interfaces/kits/native/ability/native/", "${ability_runtime_path}/interfaces/kits/native/appkit/app/", @@ -69,7 +70,7 @@ config("module_private_config") { ] defines = [ "AAMS_LOG_TAG = \"accessibility_test\"", - "AAMS_LOG_DOMAIN = 0xD005205", + "AAMS_LOG_DOMAIN = 0xD001D05", ] } @@ -96,9 +97,9 @@ ohos_unittest("accessibility_account_data_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//foundation/window/window_manager/utils:libwmutil", @@ -147,9 +148,9 @@ ohos_unittest("accessible_ability_manager_service_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", @@ -248,6 +249,7 @@ ohos_unittest("accessibility_common_event_registry_test") { "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_channel_proxy.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_client_proxy.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_manager_service_stub.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "mock/src/mock_accessibility_account_data.cpp", "mock/src/mock_common_event_data.cpp", "mock/src/mock_common_event_manager.cpp", @@ -267,9 +269,9 @@ ohos_unittest("accessibility_common_event_registry_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", @@ -298,23 +300,24 @@ ohos_unittest("accessibility_input_interceptor_test") { module_out_path = module_output_path sources = [ + "../src/accessibility_common_event.cpp", "../src/accessibility_display_manager.cpp", + "../src/accessibility_dumper.cpp", + "../src/accessibility_event_transmission.cpp", "../src/accessibility_input_interceptor.cpp", "../src/accessibility_mouse_autoclick.cpp", "../src/accessibility_mouse_key.cpp", "../src/accessibility_short_key.cpp", + "../src/accessible_ability_manager_service.cpp", "../src/accessible_ability_manager_service_event_handler.cpp", "../src/utils.cpp", "//foundation/barrierfree/accessibility/frameworks/common/src/accessibility_ability_info.cpp", "//foundation/barrierfree/accessibility/frameworks/common/src/accessibility_caption.cpp", "//foundation/barrierfree/accessibility/frameworks/common/src/accessibility_event_info.cpp", "//foundation/barrierfree/accessibility/frameworks/common/src/accessibility_window_info.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_common_event.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_dumper.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_event_transmission.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessible_ability_manager_service.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_channel_proxy.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_client_proxy.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "mock/src/aafwk/mock_bundle_manager.cpp", "mock/src/mock_accessibility_account_data.cpp", "mock/src/mock_accessibility_gesture_recognizer.cpp", @@ -337,9 +340,9 @@ ohos_unittest("accessibility_input_interceptor_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//foundation/window/window_manager/utils:libwmutil", @@ -392,9 +395,9 @@ ohos_unittest("accessibility_window_manager_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//foundation/window/window_manager/utils:libwmutil", @@ -421,21 +424,22 @@ ohos_unittest("accessibility_window_manager_test") { ohos_unittest("accessibility_keyevent_filter_test") { module_out_path = module_output_path sources = [ + "../src/accessibility_account_data.cpp", + "../src/accessibility_common_event.cpp", + "../src/accessibility_dumper.cpp", + "../src/accessibility_event_transmission.cpp", "../src/accessibility_keyevent_filter.cpp", "../src/accessibility_window_connection.cpp", + "../src/accessible_ability_channel.cpp", + "../src/accessible_ability_connection.cpp", + "../src/accessible_ability_manager_service.cpp", "../src/accessible_ability_manager_service_event_handler.cpp", "../src/utils.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_account_data.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_common_event.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_dumper.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessibility_event_transmission.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessible_ability_channel.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessible_ability_connection.cpp", - "//foundation/barrierfree/accessibility/services/aams/src/accessible_ability_manager_service.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_channel_proxy.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_client_proxy.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_client_stub.cpp", "//foundation/barrierfree/accessibility/services/interface/src/accessible_ability_manager_service_stub.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "mock/src/aafwk/mock_bundle_manager.cpp", "mock/src/mock_common_event_data.cpp", "mock/src/mock_common_event_manager.cpp", @@ -455,9 +459,9 @@ ohos_unittest("accessibility_keyevent_filter_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", @@ -506,6 +510,7 @@ ohos_unittest("accessible_ability_connection_test") { "../src/accessible_ability_manager_service.cpp", "../src/accessible_ability_manager_service_event_handler.cpp", "../src/utils.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "mock/src/aafwk/mock_ability_manager_client.cpp", "mock/src/aafwk/mock_bundle_manager.cpp", "mock/src/mock_accessibility_element_operator_callback_stub.cpp", @@ -533,8 +538,8 @@ ohos_unittest("accessible_ability_connection_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//foundation/window/window_manager/utils:libwmutil", @@ -576,7 +581,7 @@ ohos_unittest("accessibility_display_manager_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", @@ -622,9 +627,9 @@ ohos_unittest("accessibility_touchevent_injector_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "//base/global/resource_management/frameworks/resmgr:global_resmgr", "//base/powermgr/power_manager/interfaces/innerkits:powermgr_client", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", "//foundation/barrierfree/accessibility/services/aams:accessibleabilityms", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", diff --git a/services/aams/test/mock/include/accessibility_ability_helper.h b/services/aams/test/mock/include/accessibility_ability_helper.h index a127310bb..307b453e0 100644 --- a/services/aams/test/mock/include/accessibility_ability_helper.h +++ b/services/aams/test/mock/include/accessibility_ability_helper.h @@ -221,16 +221,6 @@ public: testDisplayId_ = DisplayId; } - int GetTestGestureSimulateResult() - { - return testGestureSimulateResult_; - } - - void SetTestGestureSimulateResult(int GestureSimulateResult) - { - testGestureSimulateResult_ = GestureSimulateResult; - } - int GetTestStateType() { return testStateType_; @@ -307,7 +297,6 @@ private: int testGesture_ = -1; int testKeyPressEvent_ = -1; int testDisplayId_ = -1; - int testGestureSimulateResult_ = -1; int testStateType_ = -1; bool testKeyEvent_ = false; bool isServicePublished_ = false; diff --git a/services/aams/test/mock/include/mock_accessibility_touchEvent_injector.h b/services/aams/test/mock/include/mock_accessibility_touchEvent_injector.h index 6540cf347..3d92dd942 100644 --- a/services/aams/test/mock/include/mock_accessibility_touchEvent_injector.h +++ b/services/aams/test/mock/include/mock_accessibility_touchEvent_injector.h @@ -38,12 +38,8 @@ public: MOCK_METHOD1(OnPointerEvent, void(MMI::PointerEvent& event)); MOCK_METHOD1(ClearEvents, void(uint32_t inputSource)); MOCK_METHOD0(DestroyEvents, void()); - MOCK_METHOD3(InjectEvents, void(const std::shared_ptr& gesturePath, - const sptr &service, int32_t sequence)); + MOCK_METHOD1(InjectEvents, void(const std::shared_ptr& gesturePath)); MOCK_METHOD1(SendPointerEvent, void(MMI::PointerEvent& event)); - MOCK_METHOD0(InjectGesturePathInner, void()); - MOCK_METHOD0(GetCurrentGestureService, sptr()); - MOCK_METHOD0(GetSequence, int32_t()); }; } // namespace Accessibility } // namespace OHOS diff --git a/services/aams/test/mock/include/mock_accessible_ability_client_stub_impl.h b/services/aams/test/mock/include/mock_accessible_ability_client_stub_impl.h index 232fb5cf8..583d43b1b 100644 --- a/services/aams/test/mock/include/mock_accessible_ability_client_stub_impl.h +++ b/services/aams/test/mock/include/mock_accessible_ability_client_stub_impl.h @@ -33,14 +33,12 @@ public: virtual void Disconnect(const int32_t channelId) override; virtual void OnAccessibilityEvent(const AccessibilityEventInfo& eventInfo) override; virtual void OnKeyPressEvent(const MMI::KeyEvent& keyEvent, const int32_t sequence) override; - virtual void OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) override; private: ErrCode HandleInit(MessageParcel& data, MessageParcel& reply); ErrCode HandleDisconnect(MessageParcel& data, MessageParcel& reply); ErrCode HandleOnAccessibilityEvent(MessageParcel& data, MessageParcel& reply); ErrCode HandleOnKeyPressEvent(MessageParcel& data, MessageParcel& reply); - ErrCode HandleOnGestureInjectResult(MessageParcel& data, MessageParcel& reply); DISALLOW_COPY_AND_MOVE(MockAccessibleAbilityClientStubImpl); }; } // namespace Accessibility diff --git a/services/aams/test/mock/include/mock_accessible_ability_connection.h b/services/aams/test/mock/include/mock_accessible_ability_connection.h index 409d3d422..a2d14b975 100644 --- a/services/aams/test/mock/include/mock_accessible_ability_connection.h +++ b/services/aams/test/mock/include/mock_accessible_ability_connection.h @@ -47,9 +47,7 @@ public: MOCK_METHOD2(GetWindowsByDisplayId, bool(const uint64_t displayId, std::vector &windows)); MOCK_METHOD1(ExecuteCommonAction, bool(const int32_t action)); MOCK_METHOD2(SetOnKeyPressEventResult, void(const bool handled, const int32_t sequence)); - MOCK_METHOD2( - SendSimulateGesture, void(const int32_t sequenceNum, - const std::shared_ptr& gesturePath)); + MOCK_METHOD1(SendSimulateGesture, bool(const std::shared_ptr& gesturePath)); }; class MockAccessibleAbilityConnection : public AccessibleAbilityConnection { diff --git a/services/aams/test/mock/include/mock_accessible_ability_manager_service.h b/services/aams/test/mock/include/mock_accessible_ability_manager_service.h index 170dbe4b4..ea4bdda46 100644 --- a/services/aams/test/mock/include/mock_accessible_ability_manager_service.h +++ b/services/aams/test/mock/include/mock_accessible_ability_manager_service.h @@ -62,11 +62,6 @@ public: return 0; } - inline uint32_t GetConnectCounter() - { - return 0; - } - std::shared_ptr runner_; std::shared_ptr handler_; inline std::shared_ptr& GetMainHandler() @@ -88,7 +83,6 @@ public: MOCK_METHOD1(PackageRemoved, void(const std::string& bundleName)); MOCK_METHOD1(PackageAdd, void(const std::string& bundleName)); MOCK_METHOD0(UpdateAccessibilityManagerService, void()); - MOCK_METHOD0(UpdateAbilities, void()); MOCK_METHOD0(GetEnabledState, bool()); MOCK_METHOD0(GetCaptionState, bool()); MOCK_METHOD0(GetTouchGuideState, bool()); diff --git a/services/aams/test/mock/src/mock_accessibility_account_data.cpp b/services/aams/test/mock/src/mock_accessibility_account_data.cpp index 3f0764d54..a27833714 100644 --- a/services/aams/test/mock/src/mock_accessibility_account_data.cpp +++ b/services/aams/test/mock/src/mock_accessibility_account_data.cpp @@ -388,5 +388,29 @@ void AccessibilityAccountData::UpdateImportantEnabledAbilities( HILOG_DEBUG(); (void)importantEnabledAbilities; } + +uint32_t AccessibilityAccountData::GetInputFilterFlag() const +{ + return 0; +} + +void AccessibilityAccountData::UpdateAbilities() +{ +} + +void AccessibilityAccountData::AddUITestClient(const sptr &obj, + const std::string &bundleName, const std::string &abilityName) +{ + (void)obj; + (void)bundleName; + (void)abilityName; +} + +void AccessibilityAccountData::RemoveUITestClient( + sptr &connection, const std::string &bundleName) +{ + (void)connection; + (void)bundleName; +} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/aams/test/mock/src/mock_accessibility_touchEvent_injector.cpp b/services/aams/test/mock/src/mock_accessibility_touchEvent_injector.cpp index edeb1cebb..85c2ac0bd 100644 --- a/services/aams/test/mock/src/mock_accessibility_touchEvent_injector.cpp +++ b/services/aams/test/mock/src/mock_accessibility_touchEvent_injector.cpp @@ -28,8 +28,21 @@ TouchInjectHandler::TouchInjectHandler( void TouchInjectHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event) { - (void)event; - server_.InjectGesturePathInner(); + std::shared_ptr parameters = nullptr; + if (!event) { + return; + } + switch (event->GetInnerEventId()) { + case TouchEventInjector::SEND_TOUCH_EVENT_MSG: + parameters = event->GetSharedObject(); + if (!parameters->event_) { + return; + } + server_.SendPointerEvent(*parameters->event_); + break; + default: + break; + } } TouchEventInjector::TouchEventInjector() diff --git a/services/aams/test/mock/src/mock_accessible_ability_channel_proxy.cpp b/services/aams/test/mock/src/mock_accessible_ability_channel_proxy.cpp index 23a60f50d..9b2a3bd81 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_channel_proxy.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_channel_proxy.cpp @@ -130,12 +130,11 @@ void AccessibleAbilityChannelProxy::SetOnKeyPressEventResult(const bool handled, (void)sequence; } -void AccessibleAbilityChannelProxy::SendSimulateGesture(const int32_t requestId, +bool AccessibleAbilityChannelProxy::SendSimulateGesture( const std::shared_ptr& gesturePath) { - (void)requestId; (void)gesturePath; - return; + return true; } bool AccessibleAbilityChannelProxy::SetEventTypeFilter(const uint32_t filter) diff --git a/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp b/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp index 6a05b5d87..a2c6278c9 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp @@ -69,12 +69,5 @@ void AccessibleAbilityClientProxy::OnKeyPressEvent(const MMI::KeyEvent& keyEvent AccessibilityAbilityHelper::GetInstance().SetTestKeyPressEvent(sequence); HILOG_DEBUG("start.-----------------------------mock Proxy end "); } - -void AccessibleAbilityClientProxy::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - (void)sequence; - (void)completedSuccessfully; - AccessibilityAbilityHelper::GetInstance().SetTestGestureSimulateResult(1); -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp b/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp index a8f1881ce..483462801 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp @@ -66,13 +66,6 @@ ErrCode MockAccessibleAbilityClientStubImpl::HandleOnKeyPressEvent(MessageParcel GTEST_LOG_(INFO) << "MockAccessibleAbilityClientStubImpl HandleOnKeyPressEvent"; return 0; } -ErrCode MockAccessibleAbilityClientStubImpl::HandleOnGestureInjectResult(MessageParcel& data, MessageParcel& reply) -{ - (void)data; - (void)reply; - GTEST_LOG_(INFO) << "MockAccessibleAbilityClientStubImpl HandleOnGestureInjectResult"; - return 0; -} void MockAccessibleAbilityClientStubImpl::Init(const sptr& channel, const int32_t channelId) { (void)channel; @@ -95,13 +88,5 @@ void MockAccessibleAbilityClientStubImpl::OnKeyPressEvent(const MMI::KeyEvent& k (void)sequence; GTEST_LOG_(INFO) << "MockAccessibleAbilityClientStubImpl OnKeyPressEvent"; } -void MockAccessibleAbilityClientStubImpl::OnGestureInjectResult( - const int32_t sequence, const bool completedSuccessfully) -{ - (void)sequence; - (void)completedSuccessfully; - GTEST_LOG_(INFO) << "MockAccessibleAbilityClientStubImpl OnGestureInjectResult"; - AccessibilityAbilityHelper::GetInstance().SetTestGestureSimulateResult(1); -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/aams/test/mock/src/mock_accessible_ability_connection.cpp b/services/aams/test/mock/src/mock_accessible_ability_connection.cpp index 9927ce6f7..4758f3691 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_connection.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_connection.cpp @@ -134,12 +134,10 @@ void AccessibleAbilityChannel::SetOnKeyPressEventResult(const bool handled, cons (void)sequence; } -void AccessibleAbilityChannel::SendSimulateGesture(const int32_t requestId, - const std::shared_ptr& gesturePath) +bool AccessibleAbilityChannel::SendSimulateGesture(const std::shared_ptr& gesturePath) { - (void)requestId; (void)gesturePath; - return; + return true; } AccessibleAbilityConnection::AccessibleAbilityConnection( @@ -174,12 +172,6 @@ void AccessibleAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::Elem return; } -bool AccessibleAbilityConnection::IsAllowedListEvent(EventType eventType) -{ - (void)eventType; - return true; -} - bool AccessibleAbilityConnection::OnKeyPressEvent(const MMI::KeyEvent& keyEvent, const int32_t sequence) { (void)keyEvent; @@ -187,12 +179,6 @@ bool AccessibleAbilityConnection::OnKeyPressEvent(const MMI::KeyEvent& keyEvent, return false; } -void AccessibleAbilityConnection::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - (void)sequence; - (void)completedSuccessfully; -} - bool AccessibleAbilityConnection::IsWantedEvent(int32_t eventType) { (void)eventType; diff --git a/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp b/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp index fd59a7293..9bcb68903 100644 --- a/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp +++ b/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp @@ -45,7 +45,6 @@ public: sptr inputInterceptor_ = nullptr; protected: - sptr service = nullptr; MMI::PointerEvent CreateTouchEvent(int32_t action); int32_t pointId_ = -1; bool isClearEvents_ = false; @@ -70,17 +69,13 @@ void TouchEventInjectorTest::SetUp() { GTEST_LOG_(INFO) << "TouchEventInjectorTest SetUp"; touchEventInjector_ = new TouchEventInjector(); - sptr stub = new MockAccessibleAbilityClientStubImpl(); - - service = new AccessibleAbilityClientProxy(stub->AsObject()); inputInterceptor_ = AccessibilityInputInterceptor::GetInstance(); } void TouchEventInjectorTest::TearDown() { GTEST_LOG_(INFO) << "TouchEventInjectorTest TearDown"; - service = nullptr; inputInterceptor_ = nullptr; } @@ -111,7 +106,7 @@ HWTEST_F(TouchEventInjectorTest, TouchEventInjector_Unittest_TouchEventInjector_ gesturePath->AddPosition(point); gesturePath->SetDurationTime(100); - touchEventInjector_->InjectEvents(gesturePath, service, 1); + touchEventInjector_->InjectEvents(gesturePath); sleep(SLEEP_TIME_2); int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); @@ -173,7 +168,7 @@ HWTEST_F(TouchEventInjectorTest, TouchEventInjector_Unittest_TouchEventInjector_ gesturePath->AddPosition(point); gesturePath->SetDurationTime(100000); - touchEventInjector_->InjectEvents(gesturePath, service, 1); + touchEventInjector_->InjectEvents(gesturePath); sleep(SLEEP_TIME_1); int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); @@ -206,7 +201,7 @@ HWTEST_F(TouchEventInjectorTest, TouchEventInjector_Unittest_TouchEventInjector_ gesturePath->AddPosition(point3); gesturePath->SetDurationTime(200); - touchEventInjector_->InjectEvents(gesturePath, service, 1); + touchEventInjector_->InjectEvents(gesturePath); sleep(SLEEP_TIME_2); int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_DOWN; diff --git a/services/aams/test/unittest/accessible_ability_connection_test.cpp b/services/aams/test/unittest/accessible_ability_connection_test.cpp index ffb94b45d..3db19f2ab 100644 --- a/services/aams/test/unittest/accessible_ability_connection_test.cpp +++ b/services/aams/test/unittest/accessible_ability_connection_test.cpp @@ -224,25 +224,6 @@ HWTEST_F( GTEST_LOG_(INFO) << "AccessibleAbilityConnection_Unittest_OnAccessibilityEvent_002 end"; } -/** - * @tc.number: AccessibleAbilityConnection_Unittest_OnGestureSimulateResult_001 - * @tc.name: OnGestureSimulateResult - * @tc.desc: Test function OnGestureSimulateResult - */ -HWTEST_F(AccessibleAbilityConnectionUnitTest, AccessibleAbilityConnection_Unittest_OnGestureSimulateResult_001, - TestSize.Level1) -{ - GTEST_LOG_(INFO) << "AccessibleAbilityConnection_Unittest_OnGestureSimulateResult_001 start"; - if (connection_ != nullptr) { - sleep(SLEEP_TIME_2); - OHOS::Accessibility::Rect rect(0, 0, 0, 0); - connection_->OnGestureInjectResult(1, false); - sleep(SLEEP_TIME_2); - EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTestGestureSimulateResult(), 1); - } - GTEST_LOG_(INFO) << "AccessibleAbilityConnection_Unittest_OnGestureSimulateResult_001 end"; -} - /** * @tc.number: AccessibleAbilityConnection_Unittest_Connect_001 * @tc.name: Connect diff --git a/services/test/BUILD.gn b/services/test/BUILD.gn index 22dee31c5..ebbf626c0 100644 --- a/services/test/BUILD.gn +++ b/services/test/BUILD.gn @@ -44,6 +44,7 @@ config("module_private_config") { "//base/account/os_account/interfaces/innerkits/osaccount/native/include", "//base/global/resource_management/interfaces/inner_api/include", "//base/notification/common_event_service/interfaces/inner_api", + "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", "//foundation", "${ability_runtime_path}/interfaces/kits/native/ability/native/", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", @@ -70,7 +71,7 @@ config("module_private_config") { ] defines = [ "AAMS_LOG_TAG = \"accessibility_test\"", - "AAMS_LOG_DOMAIN = 0xD005205", + "AAMS_LOG_DOMAIN = 0xD001D05", ] } @@ -114,9 +115,9 @@ ohos_moduletest("aams_accessibility_touch_guider_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", - "//third_party/jsoncpp/src/lib_json/json_writer.cpp", "moduletest/aamstest/aams_accessibility_touch_guider_test/aams_accessibility_touch_guider_test.cpp", ] sources += aams_mock_distributeddatamgr_src @@ -128,8 +129,8 @@ ohos_moduletest("aams_accessibility_touch_guider_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -194,9 +195,9 @@ ohos_moduletest("aams_accessibility_touchEvent_injector_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", - "//third_party/jsoncpp/src/lib_json/json_writer.cpp", "moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp", ] @@ -209,8 +210,8 @@ ohos_moduletest("aams_accessibility_touchEvent_injector_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -281,9 +282,9 @@ ohos_moduletest("aams_accessible_ability_channel_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_matching_skill.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", - "//third_party/jsoncpp/src/lib_json/json_writer.cpp", "moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp", ] @@ -296,8 +297,8 @@ ohos_moduletest("aams_accessible_ability_channel_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -366,9 +367,9 @@ ohos_moduletest("aams_server_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_matching_skill.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", - "//third_party/jsoncpp/src/lib_json/json_writer.cpp", "moduletest/aamstest/aams_server_test/aams_server_test.cpp", ] @@ -381,8 +382,8 @@ ohos_moduletest("aams_server_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -445,9 +446,9 @@ ohos_moduletest("aams_accessibility_keyevent_filter_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", - "//third_party/jsoncpp/src/lib_json/json_writer.cpp", "moduletest/aamstest/aams_accessibility_keyevent_filter_test/aams_accessibility_keyevent_filter_test.cpp", ] @@ -460,8 +461,8 @@ ohos_moduletest("aams_accessibility_keyevent_filter_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -530,6 +531,7 @@ ohos_moduletest("aams_common_event_registry_test") { "//foundation/barrierfree/accessibility/services/test/mock/mock_display_manager.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_matching_skill.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_os_account_manager.cpp", + "//foundation/barrierfree/accessibility/services/test/mock/mock_parameter.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_service_registry.cpp", "//foundation/barrierfree/accessibility/services/test/mock/mock_system_ability.cpp", "moduletest/aamstest/aams_common_event_registry_test/aams_common_event_registry_test.cpp", @@ -544,8 +546,8 @@ ohos_moduletest("aams_common_event_registry_test") { deps = [ "//base/global/resource_management/frameworks/resmgr:global_resmgr", + "//foundation/barrierfree/accessibility/common/interface:accessibility_interface", "//foundation/barrierfree/accessibility/interfaces/innerkits/common:accessibility_common", - "//foundation/barrierfree/accessibility/services/interface:aams_interface", "//foundation/multimedia/image_standard/interfaces/innerkits:image_native", "//foundation/window/window_manager/utils:libwmutil", "//third_party/googletest:gmock_main", diff --git a/services/test/mock/accessibility_helper.h b/services/test/mock/accessibility_helper.h index 46e56fd04..e306196f4 100644 --- a/services/test/mock/accessibility_helper.h +++ b/services/test/mock/accessibility_helper.h @@ -59,16 +59,6 @@ public: { mTgestureId_ = gestureId; } - - int32_t GetTestGestureSimulate() - { - return testGestureSimulate_; - } - void SetTestGestureSimulate(int32_t testGestureSimulate) - { - testGestureSimulate_ = testGestureSimulate; - } - OHOS::sptr& GetTestStub() { return testStub_; @@ -170,7 +160,6 @@ public: static const int32_t accountId_ = 100; private: - int32_t testGestureSimulate_ = -1; OHOS::sptr testStub_ = nullptr; std::vector mTeventType_ = {}; int32_t mTgestureId_ = 0; diff --git a/services/test/mock/mock_accessibility_element_operator_impl.h b/services/test/mock/mock_accessibility_element_operator_impl.h index f9caddbec..c35bb4c2a 100644 --- a/services/test/mock/mock_accessibility_element_operator_impl.h +++ b/services/test/mock/mock_accessibility_element_operator_impl.h @@ -34,15 +34,12 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit MockAccessibilityElementOperatorImpl( int32_t windowId, const std::shared_ptr& operation); /** * @brief destruct function - * @param - * @return */ ~MockAccessibilityElementOperatorImpl(); @@ -55,7 +52,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, const sptr& callback, const int32_t mode) override; @@ -66,7 +62,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, const sptr& callback) override; @@ -78,7 +73,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr& callback) override; @@ -89,7 +83,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr& callback) override; @@ -114,7 +107,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, int32_t requestId, @@ -123,8 +115,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() override; @@ -133,15 +123,12 @@ public: * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() override; /** * @brief Get the window id related with operator object * @param windowId: The unique id of the window related with operator object. - * @return - */ int32_t GetWindowId(); @@ -164,7 +151,6 @@ public: * @brief Set the element information by accessibility id to AA. * @param infos The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByAccessibilityIdResult( const std::list& infos, const int32_t requestId) override; @@ -173,7 +159,6 @@ public: * @brief Set the element information matched with text to AA. * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetSearchElementInfoByTextResult( const std::list& infos, const int32_t requestId) override; @@ -182,7 +167,6 @@ public: * @brief Set the element information matched with focus type to AA. * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFindFocusedElementInfoResult( const AccessibilityElementInfo& info, const int32_t requestId) override; @@ -191,7 +175,6 @@ public: * @brief Set the element information by focus direction to AA. * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo& info, const int32_t requestId) override; @@ -199,7 +182,6 @@ public: * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. - * @return */ virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; diff --git a/services/test/mock/mock_accessibility_element_operator_proxy.h b/services/test/mock/mock_accessibility_element_operator_proxy.h index c40a69135..ae2be8966 100644 --- a/services/test/mock/mock_accessibility_element_operator_proxy.h +++ b/services/test/mock/mock_accessibility_element_operator_proxy.h @@ -30,14 +30,11 @@ public: /** * @brief construct function * @param object The object of IPC - * @return */ explicit MockAccessibilityElementOperatorProxy(const sptr& object); /** * @brief destruct function - * @param - * @return */ virtual ~MockAccessibilityElementOperatorProxy() override; @@ -50,7 +47,6 @@ public: * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. - * @return - * @sysCap Accessibility */ virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, @@ -62,7 +58,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text - * @return */ virtual void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, const sptr& callback) override; @@ -74,7 +69,6 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus - * @return */ virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr& callback) override; @@ -85,7 +79,6 @@ public: * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) - * @return - */ virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr& callback) override; @@ -110,7 +103,6 @@ public: * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") - * @return */ virtual void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, int32_t requestId, @@ -119,8 +111,6 @@ public: /** * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. - * @param - - * @return */ virtual void ClearFocus() override; @@ -128,8 +118,6 @@ public: * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. - * @param - - * @return */ virtual void OutsideTouch() override; diff --git a/services/test/mock/mock_accessible_ability_client_proxy.cpp b/services/test/mock/mock_accessible_ability_client_proxy.cpp index 886aebe7b..c468a642b 100644 --- a/services/test/mock/mock_accessible_ability_client_proxy.cpp +++ b/services/test/mock/mock_accessible_ability_client_proxy.cpp @@ -76,12 +76,5 @@ void AccessibleAbilityClientProxy::OnKeyPressEvent(const MMI::KeyEvent& keyEvent AccessibilityHelper::GetInstance().SetTestKeyPressEvent(sequence); HILOG_DEBUG("start.-----------------------------mock Proxy end "); } - -void AccessibleAbilityClientProxy::OnGestureInjectResult(const int32_t sequence, const bool completedSuccessfully) -{ - GTEST_LOG_(INFO) << "AccessibleAbilityClientProxy OnGestureInjectResult"; - AccessibilityHelper::GetInstance().SetTestGestureSimulateResult(1); - AccessibilityHelper::GetInstance().SetTestGestureSimulate(sequence); -} } // namespace Accessibility } // namespace OHOS \ No newline at end of file diff --git a/services/test/mock/mock_parameter.cpp b/services/test/mock/mock_parameter.cpp new file mode 100644 index 000000000..269559ecb --- /dev/null +++ b/services/test/mock/mock_parameter.cpp @@ -0,0 +1,23 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "parameter.h" + +int SetParameter(const char *key, const char *value) +{ + (void)key; + (void)value; + return 0; +} \ No newline at end of file diff --git a/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp b/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp index b5fa63df7..e1df8f4d5 100644 --- a/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp @@ -149,7 +149,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_001, std::shared_ptr gesturePath = std::make_shared(); gesturePath->AddPosition(point); gesturePath->SetDurationTime(100); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; @@ -185,7 +185,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_004, gesturePath->AddPosition(point3); gesturePath->SetDurationTime(200); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; @@ -225,7 +225,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_005, gesturePath->AddPosition(point4); gesturePath->SetDurationTime(300); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; auto mtTouchAction = MMI::MockInputManager::GetTouchActions(); @@ -266,7 +266,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_006, gesturePath->AddPosition(point4); gesturePath->SetDurationTime(300); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; @@ -308,7 +308,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_007, gesturePath->AddPosition(point4); gesturePath->SetDurationTime(300); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; @@ -350,7 +350,7 @@ HWTEST_F(AamsInjectorTest, TouchEventInjector_ModuleTest_TouchEventInjector_008, gesturePath->AddPosition(point4); gesturePath->SetDurationTime(300); - aacs_->SendSimulateGesture(1, gesturePath); + aacs_->SendSimulateGesture(gesturePath); sleep(3); int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_MOVE; diff --git a/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp b/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp index a977e8f35..b20541488 100644 --- a/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp @@ -75,7 +75,6 @@ void AamsAccessibleAbilityChannelTest::SetUp() void AamsAccessibleAbilityChannelTest::TearDown() { GTEST_LOG_(INFO) << "AamsAccessibleAbilityChannelTest TearDown"; - AccessibilityHelper::GetInstance().SetTestGestureSimulate(-1); // Deregister ElementOperator Singleton::GetInstance().DeregisterElementOperator(0); @@ -498,11 +497,9 @@ HWTEST_F(AamsAccessibleAbilityChannelTest, AccessibleAbilityChannel_ModuleTest_S gesturePath->SetDurationTime(100); ASSERT_TRUE(AccessibilityHelper::GetInstance().GetTestStub()); - AccessibilityHelper::GetInstance().GetTestStub()->SendSimulateGesture(1, gesturePath); + AccessibilityHelper::GetInstance().GetTestStub()->SendSimulateGesture(gesturePath); sleep(2); - int32_t result = Singleton::GetInstance().GetTouchEventInjector()->GetSequence(); - EXPECT_EQ(1, result); AAConnection_->OnAbilityDisconnectDoneSync(*elementName_, 0); GTEST_LOG_(INFO) << "AccessibleAbilityChannel_ModuleTest_SendSimulateGesture_001 end"; } @@ -699,9 +696,8 @@ HWTEST_F(AamsAccessibleAbilityChannelTest, AccessibleAbilityChannel_ModuleTest_S gesturePath->SetDurationTime(100); ASSERT_TRUE(AccessibilityHelper::GetInstance().GetTestStub()); - AccessibilityHelper::GetInstance().GetTestStub()->SendSimulateGesture(1, gesturePath); + AccessibilityHelper::GetInstance().GetTestStub()->SendSimulateGesture(gesturePath); sleep(2); - EXPECT_EQ(1, AccessibilityHelper::GetInstance().GetTestGestureSimulate()); GTEST_LOG_(INFO) << "clear end"; AAConnection_->OnAbilityDisconnectDoneSync(*elementName_, 0); GTEST_LOG_(INFO) << "AccessibleAbilityChannel_ModuleTest_SendSimulateGesture_NoCapability_001 end";