mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
commit
885b47fbd5
@ -191,9 +191,6 @@ private:
|
||||
|
||||
ErrCode HandleGetRootParentId(MessageParcel &data, MessageParcel &reply);
|
||||
ErrCode HandleGetAllTreeId(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
using AccessibilityAbilityManagerServiceFunc = ErrCode (AccessibleAbilityManagerServiceStub::*)(
|
||||
MessageParcel &data, MessageParcel &reply);
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -20,28 +20,28 @@
|
||||
#include "parcel_util.h"
|
||||
|
||||
#define SWITCH_BEGIN(code) switch (code) {
|
||||
#define SWITCH_CASE(case_code, func) case case_code:\
|
||||
{\
|
||||
result_code = func(data, reply);\
|
||||
break;\
|
||||
#define SWITCH_CASE(case_code, func) \
|
||||
case case_code: { \
|
||||
result_code = func(data, reply); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define SWITCH_END() default:\
|
||||
{\
|
||||
result_code = ERR_CODE_DEFAULT;\
|
||||
#define SWITCH_END() \
|
||||
default: { \
|
||||
result_code = ERR_CODE_DEFAULT; \
|
||||
HILOG_WARN("AccessibilityElementOperatorCallbackStub::OnRemoteRequest, default case, need check."); \
|
||||
break;\
|
||||
}\
|
||||
}
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_STUB_CASES() \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::SET_RESULT_BY_ACCESSIBILITY_ID, HandleSetSearchElementInfoByAccessibilityIdResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_BY_TEXT, HandleSetSearchElementInfoByTextResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_FOCUSED_INFO, HandleSetFindFocusedElementInfoResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_FOCUS_MOVE, HandleSetFocusMoveSearchResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_PERFORM_ACTION, HandleSetExecuteActionResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_CURSOR_RESULT, HandleSetCursorPositionResult)\
|
||||
#define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_BY_ACCESSIBILITY_ID, \
|
||||
HandleSetSearchElementInfoByAccessibilityIdResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_BY_TEXT, HandleSetSearchElementInfoByTextResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_FOCUSED_INFO, HandleSetFindFocusedElementInfoResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_FOCUS_MOVE, HandleSetFocusMoveSearchResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_PERFORM_ACTION, HandleSetExecuteActionResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_RESULT_CURSOR_RESULT, HandleSetCursorPositionResult)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
@ -18,32 +18,32 @@
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
#define SWITCH_BEGIN(code) switch (code) {
|
||||
#define SWITCH_CASE(case_code, func) case case_code:\
|
||||
{\
|
||||
result_code = func(data, reply);\
|
||||
break;\
|
||||
#define SWITCH_CASE(case_code, func) \
|
||||
case case_code: { \
|
||||
result_code = func(data, reply); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define SWITCH_END() default:\
|
||||
{\
|
||||
result_code = ERR_CODE_DEFAULT;\
|
||||
HILOG_WARN("AccessibilityElementOperatorStub::OnRemoteRequest, default case, need check.");\
|
||||
break;\
|
||||
}\
|
||||
}
|
||||
#define SWITCH_END() \
|
||||
default: { \
|
||||
result_code = ERR_CODE_DEFAULT; \
|
||||
HILOG_WARN("AccessibilityElementOperatorStub::OnRemoteRequest, default case, need check."); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCESSIBILITY_ELEMENT_OPERATOR_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_BY_ACCESSIBILITY_ID, HandleSearchElementInfoByAccessibilityId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_BY_TEXT, HandleSearchElementInfosByText)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FIND_FOCUSED_INFO, HandleFindFocusedElementInfo)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FOCUS_FIND, HandleFocusFind)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::PERFORM_ACTION_ELEMENT, HandleExecuteAction)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CURSOR_POSITION, HandleGetCursorPosition)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CLEAR_FOCUS, HandleClearFocus)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::OUTSIDE_TOUCH, HandleOutsideTouch)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CHILDTREEID, HandleSetChildTreeIdAndWinId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_BELONGTREEID, HandleSetBelongTreeId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_PARENTWINDOWID, HandleSetParentWindowId)\
|
||||
#define ACCESSIBILITY_ELEMENT_OPERATOR_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_BY_ACCESSIBILITY_ID, HandleSearchElementInfoByAccessibilityId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_BY_TEXT, HandleSearchElementInfosByText) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FIND_FOCUSED_INFO, HandleFindFocusedElementInfo) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FOCUS_FIND, HandleFocusFind) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::PERFORM_ACTION_ELEMENT, HandleExecuteAction) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CURSOR_POSITION, HandleGetCursorPosition) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CLEAR_FOCUS, HandleClearFocus) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::OUTSIDE_TOUCH, HandleOutsideTouch) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CHILDTREEID, HandleSetChildTreeIdAndWinId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_BELONGTREEID, HandleSetBelongTreeId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_PARENTWINDOWID, HandleSetParentWindowId)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
@ -23,35 +23,35 @@
|
||||
#include "parcel_util.h"
|
||||
|
||||
#define SWITCH_BEGIN(code) switch (code) {
|
||||
#define SWITCH_CASE(case_code, func) case case_code:\
|
||||
{\
|
||||
result_code = func(data, reply);\
|
||||
break;\
|
||||
#define SWITCH_CASE(case_code, func) \
|
||||
case case_code: { \
|
||||
result_code = func(data, reply); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define SWITCH_END() default:\
|
||||
{\
|
||||
result_code = ERR_CODE_DEFAULT;\
|
||||
HILOG_WARN("AccessibleAbilityChannelStub::OnRemoteRequest, default case, need check.");\
|
||||
break;\
|
||||
}\
|
||||
#define SWITCH_END() \
|
||||
default: { \
|
||||
result_code = ERR_CODE_DEFAULT; \
|
||||
HILOG_WARN("AccessibleAbilityChannelStub::OnRemoteRequest, default case, need check."); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCESSIBLE_ABILITY_CHANNEL_STUB_CASES() \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::SEARCH_ELEMENTINFO_BY_ACCESSIBILITY_ID, HandleSearchElementInfoByAccessibilityId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_ELEMENTINFOS_BY_TEXT, HandleSearchElementInfosByText)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FIND_FOCUSED_ELEMENTINFO, HandleFindFocusedElementInfo)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FOCUS_MOVE_SEARCH, HandleFocusMoveSearch)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::PERFORM_ACTION, HandleExecuteAction)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CURTAIN_SCREEN, HandleEnableScreenCurtain)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOW, HandleGetWindow)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOWS, HandleGetWindows)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOWS_BY_DISPLAY_ID, HandleGetWindowsByDisplayId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_ON_KEY_PRESS_EVENT_RESULT, HandleSetOnKeyPressEventResult)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEND_SIMULATE_GESTURE_PATH, HandleSendSimulateGesturePath)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_TARGET_BUNDLE_NAME, HandleSetTargetBundleName)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CURSOR_POSITION, HandleGetCursorPosition)\
|
||||
#define ACCESSIBLE_ABILITY_CHANNEL_STUB_CASES() \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::SEARCH_ELEMENTINFO_BY_ACCESSIBILITY_ID, HandleSearchElementInfoByAccessibilityId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEARCH_ELEMENTINFOS_BY_TEXT, HandleSearchElementInfosByText) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FIND_FOCUSED_ELEMENTINFO, HandleFindFocusedElementInfo) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::FOCUS_MOVE_SEARCH, HandleFocusMoveSearch) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::PERFORM_ACTION, HandleExecuteAction) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CURTAIN_SCREEN, HandleEnableScreenCurtain) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOW, HandleGetWindow) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOWS, HandleGetWindows) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOWS_BY_DISPLAY_ID, HandleGetWindowsByDisplayId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_ON_KEY_PRESS_EVENT_RESULT, HandleSetOnKeyPressEventResult) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEND_SIMULATE_GESTURE_PATH, HandleSendSimulateGesturePath) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_TARGET_BUNDLE_NAME, HandleSetTargetBundleName) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CURSOR_POSITION, HandleGetCursorPosition)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
@ -20,25 +20,25 @@
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
#define SWITCH_BEGIN(code) switch (code) {
|
||||
#define SWITCH_CASE(case_code, func) case case_code:\
|
||||
{\
|
||||
result_code = func(data, reply);\
|
||||
break;\
|
||||
#define SWITCH_CASE(case_code, func) \
|
||||
case case_code: { \
|
||||
result_code = func(data, reply); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define SWITCH_END() default:\
|
||||
{\
|
||||
result_code = ERR_CODE_DEFAULT;\
|
||||
HILOG_WARN("AccessibleAbilityClientStub::OnRemoteRequest, default case, need check.");\
|
||||
break;\
|
||||
}\
|
||||
}
|
||||
#define SWITCH_END() \
|
||||
default: { \
|
||||
result_code = ERR_CODE_DEFAULT; \
|
||||
HILOG_WARN("AccessibleAbilityClientStub::OnRemoteRequest, default case, need check."); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCESSIBLE_ABILITY_CLIENT_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::INIT, HandleInit)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISCONNECT, HandleDisconnect)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ON_ACCESSIBILITY_EVENT, HandleOnAccessibilityEvent)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ON_KEY_PRESS_EVENT, HandleOnKeyPressEvent)\
|
||||
#define ACCESSIBLE_ABILITY_CLIENT_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::INIT, HandleInit) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISCONNECT, HandleDisconnect) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ON_ACCESSIBILITY_EVENT, HandleOnAccessibilityEvent) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ON_KEY_PRESS_EVENT, HandleOnKeyPressEvent)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
@ -24,92 +24,93 @@
|
||||
#include "tokenid_kit.h"
|
||||
|
||||
#define SWITCH_BEGIN(code) switch (code) {
|
||||
#define SWITCH_CASE(case_code, func) case case_code:\
|
||||
{\
|
||||
result_code = func(data, reply);\
|
||||
break;\
|
||||
#define SWITCH_CASE(case_code, func) \
|
||||
case case_code: { \
|
||||
result_code = func(data, reply); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define SWITCH_END() default:\
|
||||
{\
|
||||
result_code = ERR_CODE_DEFAULT;\
|
||||
HILOG_WARN("AccessibleAbilityManagerServiceStub::OnRemoteRequest, default case, need check.");\
|
||||
break;\
|
||||
}\
|
||||
}
|
||||
#define SWITCH_END() \
|
||||
default: { \
|
||||
result_code = ERR_CODE_DEFAULT; \
|
||||
HILOG_WARN("AccessibleAbilityManagerServiceStub::OnRemoteRequest, default case, need check."); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCESSIBILITY_ABILITY_MANAGER_SERVICE_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SCREENMAGNIFIER_STATE, HandleSetScreenMagnificationState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_STATE, HandleSetShortKeyState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_MOUSEKEY_STATE, HandleSetMouseKeyState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_TARGET, HandleSetShortkeyTarget)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_MOUSEKEY_AUTOCLICK, HandleSetMouseAutoClick)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_INVERTCOLOR_STATE, HandleSetInvertColorState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_HIGHCONTRASTTEXT_STATE, HandleSetHighContrastTextState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_AUDIOMONO_STATE, HandleSetAudioMonoState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_ANIMATIONOFF_STATE, HandleSetAnimationOffState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE, HandleSetDaltonizationState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_DALTONIZATION_COLORFILTER, HandleSetDaltonizationColorFilter)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CONTENT_TIMEOUT, HandleSetContentTimeout)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_BRIGHTNESS_DISCOUNT, HandleSetBrightnessDiscount)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_AUDIO_BALANCE, HandleSetAudioBalance)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CAPTION_PROPERTY, HandleSetCaptionProperty)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CAPTION_STATE, HandleSetCaptionState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CLICK_RESPONSE_TIME, HandleSetClickResponseTime)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_STATE, HandleSetIgnoreRepeatClickState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_TIME, HandleSetIgnoreRepeatClickTime)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CLICK_RESPONSE_TIME, HandleGetClickResponseTime)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_STATE, HandleGetIgnoreRepeatClickState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_TIME, HandleGetIgnoreRepeatClickTime)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_MULTI_TARGET, HandleSetShortkeyMultiTarget)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SCREENMAGNIFIER_STATE, HandleGetScreenMagnificationState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_STATE, HandleGetShortKeyState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_MOUSEKEY_STATE, HandleGetMouseKeyState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_TARGET, HandleGetShortkeyTarget)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_MOUSEKEY_AUTOCLICK, HandleGetMouseAutoClick)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_INVERTCOLOR_STATE, HandleGetInvertColorState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_HIGHCONTRASTTEXT_STATE, HandleGetHighContrastTextState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_AUDIOMONO_STATE, HandleGetAudioMonoState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ANIMATIONOFF_STATE, HandleGetAnimationOffState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_DALTONIZATION_STATE, HandleGetDaltonizationState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_DALTONIZATION_COLORFILTER, HandleGetDaltonizationColorFilter)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CONTENT_TIMEOUT, HandleGetContentTimeout)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_BRIGHTNESS_DISCOUNT, HandleGetBrightnessDiscount)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_AUDIO_BALANCE, HandleGetAudioBalance)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ALL_CONFIGS, HandleGetAllConfigs)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_CONFIG_CALLBACK, HandleRegisterConfigCallback)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CAPTION_PROPERTY, HandleGetCaptionProperty)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CAPTION_STATE, HandleGetCaptionState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOW_AND_ELEMENT_ID, HandleGetWindowAndElementId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SCENE_BOARD_INNER_WINDOW_ID, HandleGetSceneBoardInnerWinId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_MULTI_TARGET, HandleGetShortkeyMultiTarget)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEND_EVENT, HandleSendEvent)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_STATE_CALLBACK, HandleRegisterStateCallback)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ABILITYLIST, HandleGetAbilityList)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_INTERACTION_CONNECTION, HandleRegisterAccessibilityElementOperator)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CARDREGISTER_INTERACTION_CONNECTION, \
|
||||
HandleMultiRegisterAccessibilityElementOperator)\
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::DEREGISTER_INTERACTION_CONNECTION, HandleDeregisterAccessibilityElementOperator)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CARDDEREGISTER_INTERACTION_CONNECTION, \
|
||||
HandleMultiDeregisterAccessibilityElementOperator)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ENABLED, HandleGetEnabled)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_TOUCH_GUIDE_STATE, HandleGetTouchGuideState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_GESTURE_STATE, HandleGetGestureState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_KEY_EVENT_OBSERVE_STATE, HandleGetKeyEventObserverState)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ENABLE_ABILITIES, HandleEnableAbility)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ENABLED_OBJECT, HandleGetEnabledAbilities)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISABLE_ABILITIES, HandleDisableAbility)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_CAPTION_PROPERTY_CALLBACK, HandleRegisterCaptionPropertyCallback)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ENABLE_UI_TEST_ABILITY, HandleEnableUITestAbility)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISABLE_UI_TEST_ABILITY, HandleDisableUITestAbility)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ACTIVE_WINDOW, HandleGetActiveWindow)\
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::REGISTER_ENABLE_ABILITY_LISTS_OBSERVER, HandleRegisterEnableAbilityListsObserver)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_FOCUSED_WINDOW_ID, HandleGetFocusedWindowId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REMOVE_REQUEST_ID, HandleRemoveRequestId)\
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ROOT_PARENT_ID, HandleGetRootParentId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ALL_TREE_ID, HandleGetAllTreeId) \
|
||||
#define ACCESSIBILITY_ABILITY_MANAGER_SERVICE_STUB_CASES() \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SCREENMAGNIFIER_STATE, HandleSetScreenMagnificationState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_STATE, HandleSetShortKeyState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_MOUSEKEY_STATE, HandleSetMouseKeyState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_TARGET, HandleSetShortkeyTarget) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_MOUSEKEY_AUTOCLICK, HandleSetMouseAutoClick) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_INVERTCOLOR_STATE, HandleSetInvertColorState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_HIGHCONTRASTTEXT_STATE, HandleSetHighContrastTextState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_AUDIOMONO_STATE, HandleSetAudioMonoState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_ANIMATIONOFF_STATE, HandleSetAnimationOffState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE, HandleSetDaltonizationState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_DALTONIZATION_COLORFILTER, HandleSetDaltonizationColorFilter) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CONTENT_TIMEOUT, HandleSetContentTimeout) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_BRIGHTNESS_DISCOUNT, HandleSetBrightnessDiscount) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_AUDIO_BALANCE, HandleSetAudioBalance) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CAPTION_PROPERTY, HandleSetCaptionProperty) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CAPTION_STATE, HandleSetCaptionState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_CLICK_RESPONSE_TIME, HandleSetClickResponseTime) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_STATE, HandleSetIgnoreRepeatClickState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_IGNORE_REPEAT_CLICK_TIME, HandleSetIgnoreRepeatClickTime) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CLICK_RESPONSE_TIME, HandleGetClickResponseTime) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_STATE, HandleGetIgnoreRepeatClickState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_IGNORE_REPEAT_CLICK_TIME, HandleGetIgnoreRepeatClickTime) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SET_SHORTKEY_MULTI_TARGET, HandleSetShortkeyMultiTarget) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SCREENMAGNIFIER_STATE, HandleGetScreenMagnificationState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_STATE, HandleGetShortKeyState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_MOUSEKEY_STATE, HandleGetMouseKeyState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_TARGET, HandleGetShortkeyTarget) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_MOUSEKEY_AUTOCLICK, HandleGetMouseAutoClick) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_INVERTCOLOR_STATE, HandleGetInvertColorState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_HIGHCONTRASTTEXT_STATE, HandleGetHighContrastTextState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_AUDIOMONO_STATE, HandleGetAudioMonoState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ANIMATIONOFF_STATE, HandleGetAnimationOffState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_DALTONIZATION_STATE, HandleGetDaltonizationState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_DALTONIZATION_COLORFILTER, HandleGetDaltonizationColorFilter) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CONTENT_TIMEOUT, HandleGetContentTimeout) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_BRIGHTNESS_DISCOUNT, HandleGetBrightnessDiscount) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_AUDIO_BALANCE, HandleGetAudioBalance) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ALL_CONFIGS, HandleGetAllConfigs) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_CONFIG_CALLBACK, HandleRegisterConfigCallback) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CAPTION_PROPERTY, HandleGetCaptionProperty) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_CAPTION_STATE, HandleGetCaptionState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_WINDOW_AND_ELEMENT_ID, HandleGetWindowAndElementId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SCENE_BOARD_INNER_WINDOW_ID, HandleGetSceneBoardInnerWinId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_SHORTKEY_MULTI_TARGET, HandleGetShortkeyMultiTarget) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::SEND_EVENT, HandleSendEvent) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_STATE_CALLBACK, HandleRegisterStateCallback) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ABILITYLIST, HandleGetAbilityList) \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::REGISTER_INTERACTION_CONNECTION, HandleRegisterAccessibilityElementOperator) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CARDREGISTER_INTERACTION_CONNECTION, \
|
||||
HandleMultiRegisterAccessibilityElementOperator) \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::DEREGISTER_INTERACTION_CONNECTION, HandleDeregisterAccessibilityElementOperator) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::CARDDEREGISTER_INTERACTION_CONNECTION, \
|
||||
HandleMultiDeregisterAccessibilityElementOperator) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ENABLED, HandleGetEnabled) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_TOUCH_GUIDE_STATE, HandleGetTouchGuideState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_GESTURE_STATE, HandleGetGestureState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_KEY_EVENT_OBSERVE_STATE, HandleGetKeyEventObserverState) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ENABLE_ABILITIES, HandleEnableAbility) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ENABLED_OBJECT, HandleGetEnabledAbilities) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISABLE_ABILITIES, HandleDisableAbility) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REGISTER_CAPTION_PROPERTY_CALLBACK, HandleRegisterCaptionPropertyCallback) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::ENABLE_UI_TEST_ABILITY, HandleEnableUITestAbility) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::DISABLE_UI_TEST_ABILITY, HandleDisableUITestAbility) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ACTIVE_WINDOW, HandleGetActiveWindow) \
|
||||
SWITCH_CASE( \
|
||||
AccessibilityInterfaceCode::REGISTER_ENABLE_ABILITY_LISTS_OBSERVER, HandleRegisterEnableAbilityListsObserver) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_FOCUSED_WINDOW_ID, HandleGetFocusedWindowId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::REMOVE_REQUEST_ID, HandleRemoveRequestId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ROOT_PARENT_ID, HandleGetRootParentId) \
|
||||
SWITCH_CASE(AccessibilityInterfaceCode::GET_ALL_TREE_ID, HandleGetAllTreeId)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
|
@ -25,12 +25,19 @@ ohos_fuzztest("AccessibleAbilityManagerServiceStubFuzzTest") {
|
||||
"../../fuzztest:configs_cc_ld",
|
||||
"../../../../../resources/config/build:coverage_flags",
|
||||
]
|
||||
sources = [ "accessibleabilitymanagerservicestub_fuzzer.cpp" ]
|
||||
sources = [
|
||||
"../common_fuzzer/addaamstoken_fuzzer.cpp",
|
||||
"accessibleabilitymanagerservicestub_fuzzer.cpp",
|
||||
]
|
||||
deps = [
|
||||
"../../../../../interfaces/innerkits/common:accessibility_common",
|
||||
"../../../../../services/aams:accessibleabilityms",
|
||||
"../../../../interface:accessibility_interface",
|
||||
]
|
||||
external_deps = [
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken",
|
||||
"access_token:libtoken_setproc",
|
||||
"c_utils:utils",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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_ACCESSIBILITY_ELEMENT_OPERATOR_FUZZ_IMPL_H
|
||||
#define ACCESSIBILITY_ACCESSIBILITY_ELEMENT_OPERATOR_FUZZ_IMPL_H
|
||||
|
||||
#include "accessibility_element_operator.h"
|
||||
|
||||
class AccessibilityElementOperatorFuzzImpl : public OHOS::Accessibility::AccessibilityElementOperator {
|
||||
public:
|
||||
virtual ~AccessibilityElementOperatorFuzzImpl() = default;
|
||||
void SearchElementInfoByAccessibilityId(const int64_t elementId, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback, const int32_t mode) override
|
||||
{
|
||||
}
|
||||
void SearchElementInfosByText(const int64_t elementId, const std::string &text, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback) override
|
||||
{
|
||||
}
|
||||
|
||||
void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback) override
|
||||
{
|
||||
}
|
||||
|
||||
void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback) override
|
||||
{
|
||||
}
|
||||
|
||||
void ExecuteAction(const int64_t elementId, const int32_t action,
|
||||
const std::map<std::string, std::string> &actionArguments, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback) override
|
||||
{
|
||||
}
|
||||
void GetCursorPosition(const int64_t elementId, const int32_t requestId,
|
||||
OHOS::Accessibility::AccessibilityElementOperatorCallback &callback) override
|
||||
{
|
||||
}
|
||||
void ClearFocus() override
|
||||
{
|
||||
}
|
||||
void OutsideTouch() override
|
||||
{
|
||||
}
|
||||
void SetChildTreeIdAndWinId(const int64_t elementId, const int32_t treeId, const int32_t childWindowId) override
|
||||
{
|
||||
}
|
||||
void SetBelongTreeId(const int32_t treeId) override
|
||||
{
|
||||
}
|
||||
void SetParentWindowId(const int32_t parentWindowId) override
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif //ACCESSIBILITY_ACCESSIBILITY_ELEMENT_OPERATOR_FUZZ_IMPL_H
|
@ -14,127 +14,323 @@
|
||||
*/
|
||||
|
||||
#include "accessibleabilitymanagerservicestub_fuzzer.h"
|
||||
#include "accessible_ability_manager_service_stub.h"
|
||||
|
||||
#include "accessibility_ipc_interface_code.h"
|
||||
#include "accessible_ability_manager_service_stub.h"
|
||||
#include "securec.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
namespace {
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
constexpr size_t U32_AT_SIZE = 4;
|
||||
constexpr size_t BASE_CODE = 800;
|
||||
constexpr size_t MESSAGE_SIZE = 66;
|
||||
constexpr size_t FUZZ_NUM1 = 1;
|
||||
constexpr size_t FUZZ_NUM2 = 2;
|
||||
constexpr size_t FUZZ_NUM3 = 3;
|
||||
constexpr size_t FUZZ_NUM8 = 8;
|
||||
constexpr size_t FUZZ_NUM16 = 16;
|
||||
constexpr size_t FUZZ_NUM24 = 24;
|
||||
constexpr uint8_t DEVISOR_TWO = 2;
|
||||
}
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
constexpr size_t U32_AT_SIZE = 4;
|
||||
constexpr size_t BASE_CODE = 800;
|
||||
constexpr size_t MESSAGE_SIZE = 66;
|
||||
constexpr size_t FUZZ_NUM1 = 1;
|
||||
constexpr size_t FUZZ_NUM2 = 2;
|
||||
constexpr size_t FUZZ_NUM3 = 3;
|
||||
constexpr size_t FUZZ_NUM8 = 8;
|
||||
constexpr size_t FUZZ_NUM16 = 16;
|
||||
constexpr size_t FUZZ_NUM24 = 24;
|
||||
constexpr uint8_t DEVISOR_TWO = 2;
|
||||
} // namespace
|
||||
|
||||
class AccessibleAbilityManagerServiceStubFuzzTest : public AccessibleAbilityManagerServiceStub {
|
||||
public:
|
||||
AccessibleAbilityManagerServiceStubFuzzTest() = default;
|
||||
~AccessibleAbilityManagerServiceStubFuzzTest() = default;
|
||||
|
||||
RetError SendEvent(const AccessibilityEventInfo &uiEvent, const int32_t flag) override {return RET_OK;}
|
||||
RetError SendEvent(const AccessibilityEventInfo &uiEvent, const int32_t flag) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
uint32_t RegisterStateObserver(const sptr<IAccessibleAbilityManagerStateObserver> &callback) override {return 0;}
|
||||
uint32_t RegisterStateObserver(const sptr<IAccessibleAbilityManagerStateObserver> &callback) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t RegisterCaptionObserver(const sptr<IAccessibleAbilityManagerCaptionObserver>
|
||||
&callback) override {return 0;}
|
||||
uint32_t RegisterCaptionObserver(const sptr<IAccessibleAbilityManagerCaptionObserver> &callback) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RegisterEnableAbilityListsObserver(
|
||||
const sptr<IAccessibilityEnableAbilityListsObserver> &observer) override {}
|
||||
void RegisterEnableAbilityListsObserver(const sptr<IAccessibilityEnableAbilityListsObserver> &observer) override
|
||||
{
|
||||
}
|
||||
|
||||
RetError GetAbilityList(const uint32_t abilityTypes, const int32_t stateType,
|
||||
std::vector<AccessibilityAbilityInfo> &infos) override {return RET_OK;}
|
||||
RetError GetAbilityList(
|
||||
const uint32_t abilityTypes, const int32_t stateType, std::vector<AccessibilityAbilityInfo> &infos) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError RegisterElementOperator(const int32_t windowId,
|
||||
const sptr<IAccessibilityElementOperator> &operation, bool isApp = false) override {return RET_OK;}
|
||||
RetError RegisterElementOperator(
|
||||
const int32_t windowId, const sptr<IAccessibilityElementOperator> &operation, bool isApp = false) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError RegisterElementOperator(Registration parameter,
|
||||
const sptr<IAccessibilityElementOperator> &operation, bool isApp = false) override {return RET_OK;}
|
||||
RetError RegisterElementOperator(
|
||||
Registration parameter, const sptr<IAccessibilityElementOperator> &operation, bool isApp = false) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError DeregisterElementOperator(const int32_t windowId) override {return RET_OK;}
|
||||
RetError DeregisterElementOperator(const int32_t windowId) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError DeregisterElementOperator(const int32_t windowId, const int32_t treeId) override {return RET_OK;}
|
||||
RetError DeregisterElementOperator(const int32_t windowId, const int32_t treeId) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError GetCaptionProperty(AccessibilityConfig::CaptionProperty &caption) override {return RET_OK;}
|
||||
bool GetEnabledState() override {return true;}
|
||||
RetError GetCaptionState(bool &state) override {return RET_OK;}
|
||||
bool GetTouchGuideState() override {return true;}
|
||||
bool GetGestureState() override {return true;}
|
||||
bool GetKeyEventObserverState() override {return true;}
|
||||
RetError GetCaptionProperty(AccessibilityConfig::CaptionProperty &caption) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
bool GetEnabledState() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
RetError GetCaptionState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
bool GetTouchGuideState() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetGestureState() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool GetKeyEventObserverState() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
RetError SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption) override {return RET_OK;}
|
||||
RetError SetCaptionState(const bool state) override {return RET_OK;}
|
||||
RetError SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetCaptionState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError EnableAbility(const std::string &name, const uint32_t capabilities) override {return RET_OK;}
|
||||
RetError GetEnabledAbilities(std::vector<std::string> &enabledAbilities) override {return RET_OK;}
|
||||
RetError DisableAbility(const std::string &name) override {return RET_OK;}
|
||||
int32_t GetActiveWindow() override {return 0;}
|
||||
RetError EnableAbility(const std::string &name, const uint32_t capabilities) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetEnabledAbilities(std::vector<std::string> &enabledAbilities) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError DisableAbility(const std::string &name) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
int32_t GetActiveWindow() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
RetError EnableUITestAbility(const sptr<IRemoteObject> &obj) override {return RET_OK;}
|
||||
RetError DisableUITestAbility() override {return RET_OK;}
|
||||
RetError EnableUITestAbility(const sptr<IRemoteObject> &obj) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError DisableUITestAbility() override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError SetScreenMagnificationState(const bool state) override {return RET_OK;}
|
||||
RetError SetShortKeyState(const bool state) override {return RET_OK;}
|
||||
RetError SetMouseKeyState(const bool state) override {return RET_OK;}
|
||||
RetError SetMouseAutoClick(const int32_t time) override {return RET_OK;}
|
||||
RetError SetShortkeyTarget(const std::string &name) override {return RET_OK;}
|
||||
RetError SetShortkeyMultiTarget(const std::vector<std::string> &name) override {return RET_OK;}
|
||||
RetError SetHighContrastTextState(const bool state) override {return RET_OK;}
|
||||
RetError SetInvertColorState(const bool state) override {return RET_OK;}
|
||||
RetError SetAnimationOffState(const bool state) override {return RET_OK;}
|
||||
RetError SetAudioMonoState(const bool state) override {return RET_OK;}
|
||||
RetError SetDaltonizationState(const bool state) override {return RET_OK;}
|
||||
RetError SetDaltonizationColorFilter(const uint32_t filter) override {return RET_OK;}
|
||||
RetError SetContentTimeout(const uint32_t time) override {return RET_OK;}
|
||||
RetError SetBrightnessDiscount(const float discount) override {return RET_OK;}
|
||||
RetError SetAudioBalance(const float balance) override {return RET_OK;}
|
||||
RetError SetClickResponseTime(const uint32_t time) override {return RET_OK;}
|
||||
RetError SetIgnoreRepeatClickState(const bool state) override {return RET_OK;}
|
||||
RetError SetIgnoreRepeatClickTime(const uint32_t time) override {return RET_OK;}
|
||||
RetError SetScreenMagnificationState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetShortKeyState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetMouseKeyState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetMouseAutoClick(const int32_t time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetShortkeyTarget(const std::string &name) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetShortkeyMultiTarget(const std::vector<std::string> &name) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetHighContrastTextState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetInvertColorState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetAnimationOffState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetAudioMonoState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetDaltonizationState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetDaltonizationColorFilter(const uint32_t filter) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetContentTimeout(const uint32_t time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetBrightnessDiscount(const float discount) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetAudioBalance(const float balance) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetClickResponseTime(const uint32_t time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetIgnoreRepeatClickState(const bool state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError SetIgnoreRepeatClickTime(const uint32_t time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError GetScreenMagnificationState(bool &state) override {return RET_OK;}
|
||||
RetError GetShortKeyState(bool &state) override {return RET_OK;}
|
||||
RetError GetMouseKeyState(bool &state) override {return RET_OK;}
|
||||
RetError GetMouseAutoClick(int32_t &time) override {return RET_OK;}
|
||||
RetError GetShortkeyTarget(std::string &name) override {return RET_OK;}
|
||||
RetError GetShortkeyMultiTarget(std::vector<std::string> &name) override {return RET_OK;}
|
||||
RetError GetHighContrastTextState(bool &state) override {return RET_OK;}
|
||||
RetError GetInvertColorState(bool &state) override {return RET_OK;}
|
||||
RetError GetAnimationOffState(bool &state) override {return RET_OK;}
|
||||
RetError GetAudioMonoState(bool &state) override {return RET_OK;}
|
||||
RetError GetDaltonizationState(bool &state) override {return RET_OK;}
|
||||
RetError GetDaltonizationColorFilter(uint32_t &type) override {return RET_OK;}
|
||||
RetError GetContentTimeout(uint32_t &timer) override {return RET_OK;}
|
||||
RetError GetBrightnessDiscount(float &brightness) override {return RET_OK;}
|
||||
RetError GetAudioBalance(float &balance) override {return RET_OK;}
|
||||
RetError GetClickResponseTime(uint32_t& time) override {return RET_OK;}
|
||||
RetError GetIgnoreRepeatClickState(bool& state) override {return RET_OK;}
|
||||
RetError GetIgnoreRepeatClickTime(uint32_t& time) override {return RET_OK;}
|
||||
void GetAllConfigs(AccessibilityConfigData& configData) override {}
|
||||
void GetRealWindowAndElementId(int32_t& windowId, int64_t& elementId) override {}
|
||||
void GetSceneBoardInnerWinId(int32_t windowId, int64_t elementId, int32_t& innerWid) override {}
|
||||
RetError GetFocusedWindowId(int32_t &focusedWindowId) override {return RET_OK;}
|
||||
uint32_t RegisterConfigObserver(const sptr<IAccessibleAbilityManagerConfigObserver> &callback) override {return 0;}
|
||||
void PostDelayUnloadTask() override {}
|
||||
void RemoveRequestId(int32_t requestId) override {}
|
||||
int64_t GetRootParentId(int32_t windowsId, int32_t treeId) override {return 0;}
|
||||
RetError GetAllTreeId(int32_t windowId, std::vector<int32_t> &treeIds) override {return RET_OK;}
|
||||
RetError GetScreenMagnificationState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetShortKeyState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetMouseKeyState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetMouseAutoClick(int32_t &time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetShortkeyTarget(std::string &name) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetShortkeyMultiTarget(std::vector<std::string> &name) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetHighContrastTextState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetInvertColorState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetAnimationOffState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetAudioMonoState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetDaltonizationState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetDaltonizationColorFilter(uint32_t &type) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetContentTimeout(uint32_t &timer) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetBrightnessDiscount(float &brightness) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetAudioBalance(float &balance) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetClickResponseTime(uint32_t &time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetIgnoreRepeatClickState(bool &state) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
RetError GetIgnoreRepeatClickTime(uint32_t &time) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
void GetAllConfigs(AccessibilityConfigData &configData) override
|
||||
{
|
||||
}
|
||||
void GetRealWindowAndElementId(int32_t &windowId, int64_t &elementId) override
|
||||
{
|
||||
}
|
||||
void GetSceneBoardInnerWinId(int32_t windowId, int64_t elementId, int32_t &innerWid) override
|
||||
{
|
||||
}
|
||||
RetError GetFocusedWindowId(int32_t &focusedWindowId) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
uint32_t RegisterConfigObserver(const sptr<IAccessibleAbilityManagerConfigObserver> &callback) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void PostDelayUnloadTask() override
|
||||
{
|
||||
}
|
||||
void RemoveRequestId(int32_t requestId) override
|
||||
{
|
||||
}
|
||||
int64_t GetRootParentId(int32_t windowsId, int32_t treeId) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
RetError GetAllTreeId(int32_t windowId, std::vector<int32_t> &treeIds) override
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t GetU32Data(const uint8_t* ptr)
|
||||
uint32_t GetU32Data(const uint8_t *ptr)
|
||||
{
|
||||
return (ptr[0] << FUZZ_NUM24) | (ptr[FUZZ_NUM1] << FUZZ_NUM16) |
|
||||
(ptr[FUZZ_NUM2] << FUZZ_NUM8) | (ptr[FUZZ_NUM3]);
|
||||
return (ptr[0] << FUZZ_NUM24) | (ptr[FUZZ_NUM1] << FUZZ_NUM16) | (ptr[FUZZ_NUM2] << FUZZ_NUM8) | (ptr[FUZZ_NUM3]);
|
||||
}
|
||||
|
||||
bool OnRemoteRequestSvcFuzzTest(const uint8_t* data, size_t size)
|
||||
bool OnRemoteRequestSvcFuzzTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
uint32_t code = (GetU32Data(data) % MESSAGE_SIZE) + BASE_CODE;
|
||||
MessageParcel datas;
|
||||
@ -160,31 +356,15 @@ bool HandleSetDaltonizationStateTest(const uint8_t *data, size_t size)
|
||||
MessageOption option;
|
||||
AccessibleAbilityManagerServiceStubFuzzTest serviceStub;
|
||||
|
||||
serviceStub.OnRemoteRequest(static_cast<uint32_t>(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE),
|
||||
datas, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleRemoveRequestIdTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
MessageParcel datas;
|
||||
int32_t requestId = static_cast<int32_t>(*data);
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStubFuzzTest::GetDescriptor();
|
||||
datas.WriteInterfaceToken(descriptor);
|
||||
datas.WriteInt32(requestId);
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
AccessibleAbilityManagerServiceStubFuzzTest serviceStub;
|
||||
|
||||
serviceStub.OnRemoteRequest(static_cast<uint32_t>(AccessibilityInterfaceCode::REMOVE_REQUEST_ID),
|
||||
datas, reply, option);
|
||||
serviceStub.OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE), datas, reply, option);
|
||||
return true;
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
||||
// Fuzzer entry point.
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
if (data == nullptr) {
|
||||
@ -197,6 +377,5 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
|
||||
OHOS::Accessibility::OnRemoteRequestSvcFuzzTest(data, size);
|
||||
OHOS::Accessibility::HandleSetDaltonizationStateTest(data, size);
|
||||
OHOS::Accessibility::HandleRemoveRequestIdTest(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "accessibility_config_impl.h"
|
||||
#include "accessibility_def.h"
|
||||
#include "accessibility_element_operator_fuzz_impl.h"
|
||||
#include "accessibility_element_operator_impl.h"
|
||||
#include "accessibility_event_info_parcel.h"
|
||||
#include "accessibility_ipc_interface_code.h"
|
||||
#include "accessibility_system_ability_client_impl.h"
|
||||
#include "accessible_ability_manager_service.h"
|
||||
#include "accessible_ability_manager_service_stub.h"
|
||||
#include "accessibleabilitymanagerservicestub_fuzzer.h"
|
||||
#include "addaamstoken_fuzzer.h"
|
||||
#include "singleton.h"
|
||||
|
||||
#define private public
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
namespace {
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
constexpr size_t U32_AT_SIZE = 4;
|
||||
constexpr size_t BASE_CODE = 800;
|
||||
constexpr size_t MESSAGE_SIZE = 66;
|
||||
constexpr size_t FUZZ_NUM1 = 1;
|
||||
constexpr size_t FUZZ_NUM2 = 2;
|
||||
constexpr size_t FUZZ_NUM3 = 3;
|
||||
constexpr size_t FUZZ_NUM8 = 8;
|
||||
constexpr size_t FUZZ_NUM16 = 16;
|
||||
constexpr size_t FUZZ_NUM24 = 24;
|
||||
constexpr uint8_t DEVISOR_TWO = 2;
|
||||
} // namespace
|
||||
|
||||
uint32_t GetU32Data(const uint8_t *ptr)
|
||||
{
|
||||
return (ptr[0] << FUZZ_NUM24) | (ptr[FUZZ_NUM1] << FUZZ_NUM16) | (ptr[FUZZ_NUM2] << FUZZ_NUM8) | (ptr[FUZZ_NUM3]);
|
||||
}
|
||||
|
||||
static bool g_initialized = false;
|
||||
|
||||
bool InitService()
|
||||
{
|
||||
if (!g_initialized) {
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnStart();
|
||||
if (DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->handler_) {
|
||||
g_initialized = true;
|
||||
}
|
||||
}
|
||||
return g_initialized;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sort the functions from AccessibilityInterfaceCode 800 in ascending order
|
||||
*/
|
||||
bool HandleRegisterStateCallbackTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
request.WriteInterfaceToken(descriptor);
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto *impl = new AccessibilityConfig::AccessibilityConfig::Impl();
|
||||
sptr<AccessibleAbilityManagerConfigObserverImpl> callback = new (std::nothrow)
|
||||
AccessibleAbilityManagerConfigObserverImpl(impl);
|
||||
if (!request.WriteRemoteObject(callback->AsObject())) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::REGISTER_STATE_CALLBACK), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleGetAbilityListTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
request.WriteInterfaceToken(descriptor);
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t abilityTypes = ACCESSIBILITY_ABILITY_TYPE_ALL;
|
||||
int32_t stateType = data[0];
|
||||
auto *impl = new AccessibilityConfig::AccessibilityConfig::Impl();
|
||||
if (!request.WriteUint32(abilityTypes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!request.WriteInt32(stateType)) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::GET_ABILITYLIST), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleRegisterAccessibilityElementOperatorTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
request.WriteInterfaceToken(descriptor);
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t windowId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(windowId)) {
|
||||
return false;
|
||||
}
|
||||
std::shared_ptr<AccessibilityElementOperatorFuzzImpl> operation =
|
||||
std::make_shared<AccessibilityElementOperatorFuzzImpl>();
|
||||
auto *impl = new AccessibilitySystemAbilityClientImpl();
|
||||
sptr<AccessibilityElementOperatorImpl> optr = new (std::nothrow) AccessibilityElementOperatorImpl(
|
||||
windowId, operation, reinterpret_cast<AccessibilityElementOperatorCallback &>(impl));
|
||||
if (optr == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (!request.WriteRemoteObject(optr->AsObject())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::REGISTER_INTERACTION_CONNECTION), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleMultiRegisterAccessibilityElementOperatorTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
request.WriteInterfaceToken(descriptor);
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t windowId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(windowId)) {
|
||||
return false;
|
||||
}
|
||||
int32_t parentWindowId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(parentWindowId)) {
|
||||
return false;
|
||||
}
|
||||
int32_t parentTreeId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(parentTreeId)) {
|
||||
return false;
|
||||
}
|
||||
int32_t elementId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt64(elementId)) {
|
||||
return false;
|
||||
}
|
||||
std::shared_ptr<AccessibilityElementOperatorFuzzImpl> operation =
|
||||
std::make_shared<AccessibilityElementOperatorFuzzImpl>();
|
||||
auto *impl = new AccessibilitySystemAbilityClientImpl();
|
||||
sptr<AccessibilityElementOperatorImpl> optr = new (std::nothrow) AccessibilityElementOperatorImpl(
|
||||
windowId, operation, reinterpret_cast<AccessibilityElementOperatorCallback &>(impl));
|
||||
if (optr == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (!request.WriteRemoteObject(optr->AsObject())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::CARDREGISTER_INTERACTION_CONNECTION), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleDeregisterAccessibilityElementOperatorTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
request.WriteInterfaceToken(descriptor);
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t windowId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(windowId)) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::DEREGISTER_INTERACTION_CONNECTION), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleSendEventTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (!InitService()) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
AccessibilityEventInfo event;
|
||||
AccessibilityEventInfoParcel eventParcel(event);
|
||||
if (!request.WriteParcelable(&eventParcel)) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::SEND_EVENT), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleSetDaltonizationStateTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
bool isSetDaltonizationState = data[0] % DEVISOR_TWO;
|
||||
if (!request.WriteBool(isSetDaltonizationState)) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::SET_DALTONIZATION_STATE), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HandleRemoveRequestIdTest(const uint8_t *data, size_t size)
|
||||
{
|
||||
MessageParcel request;
|
||||
std::u16string descriptor = AccessibleAbilityManagerServiceStub::GetDescriptor();
|
||||
if (!request.WriteInterfaceToken(descriptor)) {
|
||||
return false;
|
||||
}
|
||||
int32_t requestId = static_cast<int32_t>(*data);
|
||||
if (!request.WriteInt32(requestId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->OnRemoteRequest(
|
||||
static_cast<uint32_t>(AccessibilityInterfaceCode::REMOVE_REQUEST_ID), request, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
{
|
||||
OHOS::AddAAMSTokenFuzzer token;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fuzzer entry point.
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
if (data == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size < OHOS::Accessibility::U32_AT_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
OHOS::Accessibility::HandleRegisterStateCallbackTest(data, size);
|
||||
OHOS::Accessibility::HandleGetAbilityListTest(data, size);
|
||||
OHOS::Accessibility::HandleRegisterAccessibilityElementOperatorTest(data, size);
|
||||
OHOS::Accessibility::HandleMultiRegisterAccessibilityElementOperatorTest(data, size);
|
||||
OHOS::Accessibility::HandleDeregisterAccessibilityElementOperatorTest(data, size);
|
||||
OHOS::Accessibility::HandleSendEventTest(data, size);
|
||||
OHOS::Accessibility::HandleSetDaltonizationStateTest(data, size);
|
||||
OHOS::Accessibility::HandleRemoveRequestIdTest(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "addaamstoken_fuzzer.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "nativetoken_kit.h"
|
||||
#include "token_setproc.h"
|
||||
|
||||
namespace OHOS {
|
||||
const int PERMS_NUM = 11;
|
||||
|
||||
AddAAMSTokenFuzzer::AddAAMSTokenFuzzer()
|
||||
{
|
||||
const char *perms[PERMS_NUM] = {
|
||||
"ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
|
||||
};
|
||||
|
||||
NativeTokenInfoParams testCoreServiceInfoParams = {
|
||||
.dcapsNum = 0,
|
||||
.permsNum = PERMS_NUM,
|
||||
.aclsNum = 0,
|
||||
.dcaps = nullptr,
|
||||
.perms = perms,
|
||||
.acls = nullptr,
|
||||
.processName = "aams_fuzzer",
|
||||
.aplStr = "system_basic",
|
||||
};
|
||||
currentID_ = GetAccessTokenId(&testCoreServiceInfoParams);
|
||||
SetSelfTokenID(currentID_);
|
||||
Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
|
||||
}
|
||||
AddAAMSTokenFuzzer::~AddAAMSTokenFuzzer()
|
||||
{
|
||||
}
|
||||
} // namespace OHOS
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 ADD_AAMS_TOKEN_FUZZER
|
||||
#define ADD_AAMS_TOKEN_FUZZER
|
||||
|
||||
#include "accesstoken_kit.h"
|
||||
|
||||
namespace OHOS {
|
||||
class AddAAMSTokenFuzzer {
|
||||
public:
|
||||
AddAAMSTokenFuzzer();
|
||||
~AddAAMSTokenFuzzer();
|
||||
|
||||
private:
|
||||
Security::AccessToken::AccessTokenID currentID_ = 0;
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // ADD_AAMS_TOKEN_FUZZER
|
@ -53,37 +53,37 @@
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE_VERSION
|
||||
#define HILOG_FATAL(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[%{public}s(%{public}s:%{public}d)]" fmt, __FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_ERROR(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[%{public}s(%{public}s:%{public}d)]" fmt, __FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_WARN(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_WARN, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[%{public}s(%{public}s:%{public}d)]" fmt, __FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_INFO(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_INFO, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[%{public}s(%{public}s:%{public}d)]" fmt, __FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_DEBUG(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[%{public}s(%{public}s:%{public}d)]" fmt, __FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_FATAL(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[%{public}s(%{public}s:%{public}d)]" fmt, \
|
||||
__FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_ERROR(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[%{public}s(%{public}s:%{public}d)]" fmt, \
|
||||
__FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_WARN(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_WARN, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[%{public}s(%{public}s:%{public}d)]" fmt, \
|
||||
__FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_INFO(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_INFO, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[%{public}s(%{public}s:%{public}d)]" fmt, \
|
||||
__FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_DEBUG(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[%{public}s(%{public}s:%{public}d)]" fmt, \
|
||||
__FILE_NAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#else // RELEASE_VERSION
|
||||
#define HILOG_FATAL(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_ERROR(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_WARN(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_WARN, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_INFO(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_INFO, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_DEBUG(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, \
|
||||
"[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_FATAL(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[(%{public}s:%{public}d)]" fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_ERROR(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[(%{public}s:%{public}d)]" fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_WARN(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_WARN, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[(%{public}s:%{public}d)]" fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_INFO(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_INFO, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[(%{public}s:%{public}d)]" fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#define HILOG_DEBUG(fmt, ...) \
|
||||
((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, AAMS_LOG_DOMAIN, AAMS_LOG_TAG, "[(%{public}s:%{public}d)]" fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__))
|
||||
#endif // RELEASE_VERSION
|
||||
#else
|
||||
|
||||
@ -92,6 +92,6 @@
|
||||
#define HILOG_WARN(...)
|
||||
#define HILOG_INFO(...)
|
||||
#define HILOG_DEBUG(...)
|
||||
#endif // CONFIG_HILOG
|
||||
#endif // CONFIG_HILOG
|
||||
|
||||
#endif // HILOG_WRAPPER_H
|
||||
#endif // HILOG_WRAPPER_H
|
Loading…
Reference in New Issue
Block a user