Merge branch 'master' of gitee.com:openharmony/accessibility into 726

This commit is contained in:
chen
2022-08-05 10:21:40 +00:00
committed by Gitee
170 changed files with 1306 additions and 2119 deletions
+17 -12
View File
@@ -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"
@@ -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" ]
@@ -29,14 +29,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibilityElementOperatorCallbackProxy(const sptr<IRemoteObject> &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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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;
@@ -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;
@@ -30,14 +30,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibilityElementOperatorProxy(const sptr<IRemoteObject> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<std::string, std::string> &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:
@@ -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;
@@ -26,20 +26,16 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibilityEnableAbilityListsObserverProxy(const sptr<IRemoteObject> &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:
@@ -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;
@@ -26,14 +26,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibleAbilityChannelProxy(const sptr<IRemoteObject> &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<AccessibilityGestureInjectPath>& gesturePath) override;
virtual bool SendSimulateGesture(const std::shared_ptr<AccessibilityGestureInjectPath>& gesturePath) override;
/**
* @brief Set event types to filter.
@@ -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;
@@ -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<IAccessibleAbilityChannel> &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.
@@ -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);
@@ -26,21 +26,17 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibleAbilityManagerCaptionObserverProxy(const sptr<IRemoteObject> &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:
@@ -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;
@@ -26,14 +26,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibleAbilityManagerConfigObserverProxy(const sptr<IRemoteObject> &object);
/**
* @brief destruct function
* @param
* @return
*/
virtual ~AccessibleAbilityManagerConfigObserverProxy() override;
@@ -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;
@@ -29,14 +29,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibleAbilityManagerServiceProxy(const sptr<IRemoteObject> &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;
@@ -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;
@@ -26,14 +26,11 @@ public:
/**
* @brief construct function
* @param object The object of IPC
* @return
*/
explicit AccessibleAbilityManagerStateObserverProxy(const sptr<IRemoteObject> &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:
@@ -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;
@@ -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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<std::string, std::string> &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;
@@ -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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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;
@@ -26,7 +26,6 @@ public:
/**
* @brief Receive the state notify from AAMS and send it to the observer registered.
* @return
*/
virtual void OnAccessibilityEnableAbilityListsChanged() = 0;
@@ -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<AccessibilityGestureInjectPath>& gesturePath) = 0;
virtual bool SendSimulateGesture(const std::shared_ptr<AccessibilityGestureInjectPath>& gesturePath) = 0;
/**
* @brief Set event types to filter.
@@ -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<IAccessibleAbilityChannel> &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
@@ -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;
@@ -81,7 +81,6 @@ public:
/**
* @brief Deregister the element operator.
* @param windowId Window ID
* @return
*/
virtual void DeregisterElementOperator(const int32_t windowId) = 0;
@@ -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;
@@ -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<RangeInfoParcel> 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
*/
@@ -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
*/
@@ -442,7 +442,7 @@ void AccessibleAbilityChannelProxy::SetOnKeyPressEventResult(const bool handled,
}
}
void AccessibleAbilityChannelProxy::SendSimulateGesture(const int32_t requestId,
bool AccessibleAbilityChannelProxy::SendSimulateGesture(
const std::shared_ptr<AccessibilityGestureInjectPath>& 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<AccessibilityGestureInjectPathParcel> 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)
@@ -311,8 +311,6 @@ ErrCode AccessibleAbilityChannelStub::HandleSendSimulateGesturePath(MessageParce
{
HILOG_DEBUG();
int32_t requestId = data.ReadInt32();
sptr<AccessibilityGestureInjectPathParcel> positions =
data.ReadStrongParcelable<AccessibilityGestureInjectPathParcel>();
if (!positions) {
@@ -322,7 +320,8 @@ ErrCode AccessibleAbilityChannelStub::HandleSendSimulateGesturePath(MessageParce
std::shared_ptr<AccessibilityGestureInjectPath> gesturePath =
std::make_shared<AccessibilityGestureInjectPath>(*positions);
SendSimulateGesture(requestId, gesturePath);
bool result = SendSimulateGesture(gesturePath);
reply.WriteBool(result);
return NO_ERROR;
}
@@ -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
@@ -31,8 +31,6 @@ AccessibleAbilityClientStub::AccessibleAbilityClientStub()
&AccessibleAbilityClientStub::HandleOnAccessibilityEvent;
memberFuncMap_[static_cast<uint32_t>(IAccessibleAbilityClient::Message::ON_KEY_PRESS_EVENT)] =
&AccessibleAbilityClientStub::HandleOnKeyPressEvent;
memberFuncMap_[static_cast<uint32_t>(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
+1 -1
View File
@@ -41,7 +41,7 @@
#endif
#ifndef AAMS_LOG_DOMAIN
#define AAMS_LOG_DOMAIN 0xD005000
#define AAMS_LOG_DOMAIN 0xD001D04
#endif
#ifndef AAMS_LOG_TAG
@@ -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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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;
@@ -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<AccessibilityGestureInjectPath>& gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener>& listener) override;
virtual bool InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath>& 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<AccessibleAbilityManagerServiceProxy> serviceProxy_ = nullptr;
sptr<IAccessibleAbilityManagerService> serviceProxy_ = nullptr;
};
} // namespace Accessibility
} // namespace OHOS
@@ -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<AccessibilityGestureInjectPath> &gesturePath);
bool SendSimulateGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &gesturePath);
/**
* @brief execute the action on the component.
@@ -38,7 +38,6 @@ public:
/**
* @brief Gets remote object.
* @param
* @return Remote object.
*/
virtual sptr<IRemoteObject> 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<IAccessibleAbilityChannel> &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<AccessibilityGestureInjectPath> &gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener> &listener) override;
virtual bool InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &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<IRemoteObject> &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<OHOS::Accessibility::AccessibilityElementInfo> &elementInfos);
bool SearchElementInfoFromAce(const int32_t windowId, const int32_t elementId,
const int32_t mode, AccessibilityElementInfo &info);
const uint32_t mode, AccessibilityElementInfo &info);
sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
sptr<IAccessibleAbilityManagerService> serviceProxy_ = nullptr;
std::shared_ptr<AccessibleAbilityListener> listener_ = nullptr;
std::shared_ptr<AccessibleAbilityChannelClient> channelClient_ = nullptr;
std::map<uint32_t, std::shared_ptr<AccessibilityGestureResultListener>> gestureResultListenerInfos_;
int32_t cacheMode_ = 0;
uint32_t cacheMode_ = 0;
int32_t cacheWindowId_ = -1;
std::map<int32_t, AccessibilityElementInfo> cacheElementInfos_;
};
@@ -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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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
@@ -46,16 +46,14 @@ AccessibilityUITestAbilityImpl::AccessibilityUITestAbilityImpl()
HILOG_ERROR("Failed to get ISystemAbilityManager");
return;
}
HILOG_DEBUG("ISystemAbilityManager obtained");
sptr<IRemoteObject> 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<AccessibleAbilityManagerServiceProxy>(object);
serviceProxy_ = iface_cast<IAccessibleAbilityManagerService>(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<AccessibilityGestureInjectPath> &gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener> &listener)
bool AccessibilityUITestAbilityImpl::InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &gesturePath)
{
HILOG_INFO();
sptr<AccessibleAbilityClient> 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)
@@ -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<AccessibilityGestureInjectPath> &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;
}
}
@@ -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<AccessibilityGestureInjectPath> &gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener> &listener)
bool AccessibleAbilityClientImpl::InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &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<IRemoteObject> &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<AccessibilityGestureResultListener> 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<uint32_t>(cacheMode);
cacheMode_ = mode & static_cast<uint32_t>(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<AccessibilityElementInfo> elementInfos {};
if (!channelClient_->SearchElementInfosByAccessibilityId(windowId, elementId, mode, elementInfos)) {
if (!channelClient_->SearchElementInfosByAccessibilityId(
windowId, elementId, static_cast<int32_t>(mode), elementInfos)) {
HILOG_ERROR("search element info failed. windowId[%{public}d] elementId[%{public}d] mode[%{public}d]",
windowId, elementId, mode);
return false;
+4 -2
View File
@@ -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",
]
@@ -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<AccessibilityGestureInjectPath>& gesturePath));
MOCK_METHOD1(SendSimulateGesture, bool(const std::shared_ptr<AccessibilityGestureInjectPath>& gesturePath));
};
} // namespace Accessibility
} // namespace OHOS
@@ -47,8 +47,7 @@ public:
MOCK_METHOD2(GetWindowsByDisplayId, bool(const uint64_t displayId, std::vector<AccessibilityWindowInfo> &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<AccessibilityGestureInjectPath>& gesturePath));
MOCK_METHOD1(SendSimulateGesture, bool(const std::shared_ptr<AccessibilityGestureInjectPath>& gesturePath));
MOCK_METHOD1(SetEventTypeFilter, bool(const uint32_t filter));
MOCK_METHOD1(SetTargetBundleName, bool(const std::vector<std::string> &targetBundleNames));
};
@@ -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<AccessibilityGestureInjectPath>& gesturePath)
{
(void)sequenceNum;
(void)gesturePath;
return true;
}
MockAccessibleAbilityChannelProxy::MockAccessibleAbilityChannelProxy(const sptr<IRemoteObject>& object)
@@ -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<AccessibilityGestureInjectPath> gesturePath = std::make_shared<AccessibilityGestureInjectPath>();
std::shared_ptr<AccessibilityGestureResultListener> listener = nullptr;
EXPECT_FALSE(instance_->InjectGesture(SEQUENCE, gesturePath, listener));
EXPECT_FALSE(instance_->InjectGesture(gesturePath));
GTEST_LOG_(INFO) << "InjectGesture_001 end";
}
@@ -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<AccessibilityGestureInjectPath> gesturePath = std::make_shared<AccessibilityGestureInjectPath>();
instance_->SendSimulateGesture(SEQUENCE_NUM, gesturePath);
instance_->SendSimulateGesture(gesturePath);
GTEST_LOG_(INFO) << "SendSimulateGesture_001 end";
}
@@ -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<AccessibleAbilityListener> listener = std::make_shared<MockAccessibleAbilityListener>();
instance_->RegisterAbilityListener(listener);
sptr<MockAccessibleAbilityChannelStub> stub = new MockAccessibleAbilityChannelStub();
sptr<IAccessibleAbilityChannel> 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<AccessibilityGestureInjectPath> gesturePath = std::make_shared<AccessibilityGestureInjectPath>();
std::shared_ptr<AccessibilityGestureResultListener> listener = nullptr;
EXPECT_FALSE(instance_->InjectGesture(SEQUENCE, gesturePath, listener));
EXPECT_FALSE(instance_->InjectGesture(gesturePath));
GTEST_LOG_(INFO) << "InjectGesture_001 end";
}
@@ -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<AccessibilityConfigObserver> &observer);
bool InitializeContext();
void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr<AccessibilityConfigObserver> &observer,
const bool retFlag);
void UnsubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr<AccessibilityConfigObserver> &observer);
void SubscribeEnableAbilityListsObserver(const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &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<std::shared_ptr<AccessibilityConfigObserver>> &observers,
const bool state);
void NotifyCaptionChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &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<AccessibilityConfigObserver> &observer);
void InitConfigValues();
void InitEventHandler();
static void OnParameterChanged(const char *key, const char *value, void *context);
sptr<AccessibilityEnableAbilityListsObserverStubImpl> enableAbilityListsObserverStub_ = nullptr;
sptr<Accessibility::IAccessibleAbilityManagerService> serviceProxy_ = nullptr;
sptr<AccessibleAbilityManagerCaptionObserverImpl> captionObserver_ = nullptr;
sptr<AccessibleAbilityManagerConfigObserverImpl> configObserver_;
sptr<AccessibleAbilityManagerConfigObserverImpl> configObserver_ = nullptr;
sptr<AccessibilityEnableAbilityListsObserverImpl> enableAbilityListsObserver_ = nullptr;
bool isInitialized_ = false;
bool highContrastText_ = false;
bool invertColor_ = false;
bool animationOff_ = false;
@@ -235,6 +250,9 @@ private:
std::vector<std::shared_ptr<AccessibilityEnableAbilityListsObserver>> enableAbilityListsObservers_;
std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>> configObservers_;
std::mutex mutex_;
std::shared_ptr<AppExecFwk::EventRunner> runner_;
std::shared_ptr<AppExecFwk::EventHandler> handler_;
};
} // namespace AccessibilityConfig
} // namespace OHOS
+16 -10
View File
@@ -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<AccessibilityConfigObserver> &observer)
const std::shared_ptr<AccessibilityConfigObserver> &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
@@ -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<std::mutex> 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<Impl*>(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<std::mutex> 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<Accessibility::IAccessibleAbilityManagerService>(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<IRemoteObject> &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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<AccessibilityConfigObserver> &observer)
const std::shared_ptr<AccessibilityConfigObserver> &observer, const bool retFlag)
{
HILOG_INFO("id = [%{public}d]", static_cast<int32_t>(id));
std::lock_guard<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<uint32_t>(type));
std::lock_guard<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::shared_ptr<AccessibilityConfigObserver>> observers;
{
std::lock_guard<std::mutex> 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<AccessibilityConfigObserver> &observer)
{
if (handler_) {
handler_->PostTask(std::bind([this, id, observer]() {
HILOG_INFO("NotifyImmediately start.");
ConfigValue configValue;
{
std::lock_guard<std::mutex> 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<DALTONIZATION_TYPE>(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<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::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<AppExecFwk::EventHandler>(runner_);
if (!handler_) {
HILOG_ERROR("AccessibilityConfig::Impl::InitEventHandler create event handler failed");
return;
}
}
}
} // namespace AccessibilityConfig
} // namespace OHOS
@@ -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<AccessibilityElementOperator> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<IAccessibilityElementOperatorCallback> &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<std::string, std::string> &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<IAccessibilityElementOperatorCallback> &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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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;
@@ -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<IRemoteObject> &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);
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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 = [
@@ -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 <cstdint>
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
@@ -19,7 +19,6 @@
#include <map>
#include <memory>
#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<AccessibilityUITestAbility> 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<AccessibilityGestureInjectPath> &gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener> &listener) = 0;
virtual bool InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &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;
};
@@ -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<AccessibleAbilityClient> GetInstance();
/**
* @brief Gets remote object.
* @param
* @return Remote object.
*/
virtual sptr<IRemoteObject> 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<AccessibilityGestureInjectPath> &gesturePath,
const std::shared_ptr<AccessibilityGestureResultListener> &listener) = 0;
virtual bool InjectGesture(const std::shared_ptr<AccessibilityGestureInjectPath> &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;
};
@@ -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;
+5 -5
View File
@@ -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",
]
@@ -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<AccessibilityConfigObserver> &observer);
void SubscribeConfigObserver(const CONFIG_ID id, const std::shared_ptr<AccessibilityConfigObserver> &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<AccessibilityConfigObserver> &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<AccessibilityEnableAbilityListsObserver> &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<AccessibilityEnableAbilityListsObserver> &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;
+2 -4
View File
@@ -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" ]
@@ -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<std::string, std::string> &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;
};
@@ -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<AccessibilityElementInfo> &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<AccessibilityElementInfo> &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;
};
@@ -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
*/
@@ -42,15 +42,12 @@ class AccessibilitySystemAbilityClient {
public:
/**
* @brief Obtains the AccessibilitySystemAbilityClient instance.
* @param -
* @return AccessibilitySystemAbilityClient instance
*/
static std::shared_ptr<AccessibilitySystemAbilityClient> 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;
+1 -1
View File
@@ -23,7 +23,7 @@ config("accessibility_common_private_config") {
defines = [
"AAMS_LOG_TAG = \"accessibility_common\"",
"AAMS_LOG_DOMAIN = 0xD005202",
"AAMS_LOG_DOMAIN = 0xD001D02",
]
}
@@ -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<std::string> &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<std::string> &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<std::string> targetBundleNames_;
bool isImportant_ = false;
@@ -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;
};
File diff suppressed because it is too large Load Diff
@@ -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
@@ -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<AccessibilityGesturePosition> &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);

Some files were not shown because too many files have changed in this diff Show More