diff --git a/service/BUILD.gn b/service/BUILD.gn index 81e356af33376a0d25f9e60325c13d57b24e1203..0b7a7a0cf74cb6a75b7656eb79b709741a123f75 100644 --- a/service/BUILD.gn +++ b/service/BUILD.gn @@ -270,11 +270,15 @@ ohos_shared_library("libmmi-server") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/connect_manager:mmi_connect_manager_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] deps = [ ":mmi_device_config.ini", ":mmi_rust", + "${mmi_path}/frameworks/proxy:libmmi-common", "${mmi_path}/service/connect_manager:mmi_connect_manager_service", "${mmi_path}/service/filter:mmi_event_filter_proxy", "${mmi_path}/util:libmmi-util", @@ -284,9 +288,7 @@ ohos_shared_library("libmmi-server") { deps += [ "${mmi_path}/etc/mouse_icon:input_mouse_icon" ] } - if (input_ext_feature_anco) { - deps += [ "${mmi_path}/common/anco/comm:mmi_anco_channel_proxy" ] - } + deps += [ "${mmi_path}/common/anco/comm:mmi_anco_channel_proxy" ] external_deps = [ "cJSON:cjson", @@ -549,7 +551,11 @@ ohos_unittest("EventFilterHandlerTest") { "${mmi_path}/service/filter/test", ] - configs = [ ":libmmi_server_config" ] + configs = [ + ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", + ] cflags = [ "-DUNIT_TEST", @@ -557,9 +563,15 @@ ohos_unittest("EventFilterHandlerTest") { "-Dprotected=public", ] + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = true + blocklist = "./ipc_blocklist.txt" + } + sources = [ - "${mmi_path}/service/filter/src/event_filter_handler.cpp", - "${mmi_path}/service/filter/src/event_filter_proxy.cpp", "${mmi_path}/service/filter/test/event_filter_handler_ex_test.cpp", "${mmi_path}/service/filter/test/event_filter_handler_test.cpp", "${mmi_path}/service/filter/test/message_parcel_mock.cpp", @@ -568,6 +580,8 @@ ohos_unittest("EventFilterHandlerTest") { deps = [ "${mmi_path}/service:libmmi-server", + "${mmi_path}/service/filter:mmi_event_filter_proxy", + "${mmi_path}/service/filter:mmi_event_filter_service", "${mmi_path}/util:libmmi-util", ] @@ -694,6 +708,7 @@ ohos_unittest("KeyShortcutManagerTest") { "-Dprivate=public", "-Dprotected=public", ] + configs = [ "${mmi_path}/service/filter:mmi_event_filter_config" ] deps = [ "${mmi_path}/service:libmmi-server", @@ -994,6 +1009,7 @@ ohos_unittest("PointerDrawingManagerTest") { sources = [ "window_manager/test/pointer_drawing_manager_test.cpp" ] deps = [ + "${mmi_path}/frameworks/proxy:libmmi-common", "${mmi_path}/service:libmmi-server", "${mmi_path}/test/facility/mock:mmi_mock_sources", "${mmi_path}/util:libmmi-util", @@ -1050,6 +1066,7 @@ ohos_unittest("PointerDrawingManagerExTest") { sources = [ "window_manager/test/pointer_drawing_manager_ex_test.cpp" ] deps = [ + "${mmi_path}/frameworks/proxy:libmmi-common", "${mmi_path}/service:libmmi-server", "${mmi_path}/test/facility/mock:mmi_mock_sources", "${mmi_path}/util:libmmi-util", @@ -1283,6 +1300,8 @@ ohos_unittest("InputWindowsManagerTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1331,7 +1350,10 @@ ohos_unittest("InputWindowsManagerTest") { ohos_unittest("InputWindowsManagerOneTest") { module_out_path = module_output_path - configs = [ "${mmi_path}:coverage_flags" ] + configs = [ + "${mmi_path}:coverage_flags", + "${mmi_path}/service/filter:mmi_event_filter_config", + ] cflags = [ "-Dprivate=public", @@ -1416,6 +1438,8 @@ ohos_unittest("InputWindowsManagerEXTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1542,6 +1566,8 @@ ohos_unittest("SubscriberTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1682,6 +1708,8 @@ ohos_unittest("MonitorTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1728,6 +1756,9 @@ ohos_unittest("ModuleLoaderTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/service/connect_manager:mmi_connect_manager_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1744,6 +1775,7 @@ ohos_unittest("ModuleLoaderTest") { ] deps = [ + "${mmi_path}/frameworks/proxy:libmmi-common", "${mmi_path}/service:libmmi-server", "${mmi_path}/util:libmmi-util", ] @@ -1885,6 +1917,8 @@ ohos_unittest("KeyCommandTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -1988,7 +2022,11 @@ ohos_unittest("LongPressSubscribeHandlerTest") { "joystick/include", ] - configs = [ "${mmi_path}:coverage_flags" ] + configs = [ + "${mmi_path}:coverage_flags", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", + ] cflags = [ "-Dprivate=public", @@ -2199,6 +2237,8 @@ ohos_unittest("EventHandlerTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -2244,13 +2284,23 @@ ohos_unittest("EventHandlerTest") { ohos_unittest("InputEventHandlerTest") { module_out_path = module_output_path - configs = [ "${mmi_path}:coverage_flags" ] + configs = [ + "${mmi_path}:coverage_flags", + "${mmi_path}/service/filter:mmi_event_filter_config", + ] cflags = [ "-Dprivate=public", "-Dprotected=public", ] + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + cflags_cc = [ "-Wno-string-conversion" ] include_dirs = [ @@ -2316,6 +2366,8 @@ ohos_unittest("EventNormalizeHandlerTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -2392,6 +2444,7 @@ ohos_unittest("EventDispatchTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", ] cflags = [ @@ -2461,6 +2514,8 @@ ohos_unittest("ServerMsgHandlerTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -2694,6 +2749,9 @@ ohos_unittest("ConnectManagerTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/service/connect_manager:mmi_connect_manager_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -2829,6 +2887,8 @@ ohos_unittest("ConnectManagerProxyEXTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/service/connect_manager:mmi_connect_manager_config", ] cflags = [ @@ -2836,17 +2896,24 @@ ohos_unittest("ConnectManagerProxyEXTest") { "-Dprotected=public", ] + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = true + blocklist = "./ipc_blocklist.txt" + } + sources = [ - "${mmi_path}/common/anco/comm/src/anco_channel_death_recipient.cpp", - "${mmi_path}/common/anco/comm/src/anco_channel_proxy.cpp", - "${mmi_path}/frameworks/proxy/events/src/i_anco_consumer.cpp", - "connect_manager/src/multimodal_input_connect_def_parcel.cpp", - "connect_manager/src/multimodal_input_connect_proxy.cpp", "connect_manager/test/message_parcel_mock.cpp", "connect_manager/test/multimodal_input_connect_proxy_ex_test.cpp", ] - deps = [ "${mmi_path}/util:libmmi-util" ] + deps = [ + "${mmi_path}/common/anco/comm:mmi_anco_channel_proxy", + "${mmi_path}/service/connect_manager:mmi_connect_manager_proxy", + "${mmi_path}/util:libmmi-util", + ] external_deps = [ "ability_runtime:app_manager", @@ -2880,6 +2947,9 @@ ohos_unittest("ConnectManagerEXTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/service/connect_manager:mmi_connect_manager_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -2890,8 +2960,6 @@ ohos_unittest("ConnectManagerEXTest") { cflags_cc = [ "-Wno-inconsistent-missing-override" ] sources = [ - "connect_manager/src/multimodal_input_connect_def_parcel.cpp", - "connect_manager/src/multimodal_input_connect_stub.cpp", "connect_manager/test/message_parcel_mock.cpp", "connect_manager/test/multimodal_input_connect_stub_ex_test.cpp", "module_loader/src/input_screen_capture_agent.cpp", @@ -2899,6 +2967,7 @@ ohos_unittest("ConnectManagerEXTest") { deps = [ "${mmi_path}/service:libmmi-server", + "${mmi_path}/service/connect_manager:mmi_connect_manager_service", "${mmi_path}/util:libmmi-util", ] @@ -2936,6 +3005,7 @@ ohos_unittest("EventDumpTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", ] cflags = [ @@ -3096,6 +3166,7 @@ ohos_unittest("KeymapMgrTest") { configs = [ "${mmi_path}:coverage_flags", ":libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", ] cflags = [ diff --git a/service/connect_manager/BUILD.gn b/service/connect_manager/BUILD.gn index 4e580674cfbc6ba6549617a2a8a2a1e37c92a154..bcfe82ef2e470c0d8318d0dc50cb512635dac38d 100644 --- a/service/connect_manager/BUILD.gn +++ b/service/connect_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -11,10 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import("../../multimodalinput_mini.gni") mmi_connect_manager_path = "${mmi_path}/service/connect_manager" +idl_gen_interface("multimodal_input_interface") { + sources = [ "IMultimodalInputConnect.idl" ] +} + config("mmi_connect_manager_config") { include_dirs = [ "${mmi_path}/common/anco/comm/include", @@ -32,6 +37,7 @@ config("mmi_connect_manager_config") { "${mmi_path}/service/permission_helper/include", "${mmi_path}/frameworks/proxy/event_handler/include", "${mmi_connect_manager_path}/include", + "${target_gen_dir}", ] } @@ -41,13 +47,15 @@ ohos_source_set("mmi_connect_manager_service") { sources = [ "${mmi_connect_manager_path}/src/multimodal_input_connect_def_parcel.cpp", - "${mmi_connect_manager_path}/src/multimodal_input_connect_stub.cpp", ] sources += [ "${mmi_connect_manager_path}/src/input_binder_client_death_recipient.cpp", ] + output_values = get_target_outputs(":multimodal_input_interface") + sources += filter_include(output_values, [ "*_stub.cpp" ]) + branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -56,7 +64,16 @@ ohos_source_set("mmi_connect_manager_service") { } defines = input_default_defines - configs = [ ":mmi_connect_manager_config" ] + configs = [ + ":mmi_connect_manager_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + ] + + deps = [ + ":multimodal_input_interface", + "${mmi_path}/frameworks/proxy:libmmi-common", + ] external_deps = [ "access_token:libaccesstoken_sdk", @@ -115,7 +132,6 @@ ohos_source_set("mmi_connect_manager_proxy") { "${mmi_connect_manager_path}/src/multimodal_input_connect_death_recipient.cpp", "${mmi_connect_manager_path}/src/multimodal_input_connect_def_parcel.cpp", "${mmi_connect_manager_path}/src/multimodal_input_connect_manager.cpp", - "${mmi_connect_manager_path}/src/multimodal_input_connect_proxy.cpp", ] sources += [ @@ -123,8 +139,19 @@ ohos_source_set("mmi_connect_manager_proxy") { "${mmi_connect_manager_path}/src/input_binder_client_stub.cpp", ] - configs = [ ":mmi_connect_manager_config" ] + output_values = get_target_outputs(":multimodal_input_interface") + sources += filter_include(output_values, [ "*_proxy.cpp" ]) + + configs = [ + ":mmi_connect_manager_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + ] + deps = [ + ":multimodal_input_interface", + "${mmi_path}/frameworks/proxy:libmmi-common", + ] external_deps = [ "bounds_checking_function:libsec_shared", "c_utils:utilsbase", diff --git a/service/connect_manager/IMultimodalInputConnect.idl b/service/connect_manager/IMultimodalInputConnect.idl new file mode 100644 index 0000000000000000000000000000000000000000..5f92ae9c0f59d19a29dec3a75e1af85e0d979d85 --- /dev/null +++ b/service/connect_manager/IMultimodalInputConnect.idl @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2025 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. + */ + +sequenceable input_device..OHOS.MMI.InputDevice; +sequenceable key_event..OHOS.MMI.KeyEvent; +sequenceable key_option..OHOS.MMI.KeyOption; +sequenceable long_press_event..OHOS.MMI.LongPressRequest; +sequenceable pointer_event..OHOS.MMI.PointerEvent; +sequenceable pixel_map..OHOS.Media.PixelMap; +sequenceable shift_info..OHOS.MMI.ShiftWindowParam; +sequenceable extra_data..OHOS.MMI.ExtraData; +sequenceable mmi_event_map..OHOS.MMI.MmiEventMap; +sequenceable OHOS.IRemoteObject; +sequenceable touchpad_control_display_gain..OHOS.MMI.TouchpadCDG; +sequenceable infrared_frequency_info..OHOS.MMI.InfraredFrequency; +sequenceable pointer_style..OHOS.MMI.CustomCursorParcel; +sequenceable pointer_style..OHOS.MMI.CursorOptionsParcel; +sequenceable pointer_style..OHOS.MMI.CursorPixelMap; +sequenceable window_info..OHOS.MMI.DisplayBindInfo; +sequenceable pointer_style..OHOS.MMI.PointerStyle; +sequenceable key_option..OHOS.MMI.KeyMonitorOption; + +interface OHOS.MMI.IAncoChannel; +interface OHOS.MMI.IEventFilter; + +interface OHOS.MMI.IMultimodalInputConnect { + void AllocSocketFd([in] String programName, [in] int moduleType, + [out] FileDescriptor socketFd, [out] int tokenType); + void AddInputEventFilter([in] IEventFilter filter, [in]int filterId, [in] int priority, + [in] unsigned int deviceTags); + void NotifyNapOnline(); + void RemoveInputEventObserver(); + void RemoveInputEventFilter([in] int filterId); + void SetMouseScrollRows([in] int rows); + void GetMouseScrollRows([out] int rows); + void SetCustomCursorPixelMap([in] int windowId, [in] int focusX, [in] int focusY, [in] CursorPixelMap pixelMap); + void SetCustomCursor([in] int windowId, [in] CustomCursorParcel curParcel, [in] CursorOptionsParcel cOptionParcel); + void SetMouseIcon([in] int windowId, [in] CursorPixelMap pixelMap); + void SetPointerSize([in] int size); + void SetNapStatus([in] int pid, [in] int uid, [in] String bundleName, [in] int napStatus); + void GetPointerSize([out] int size); + void GetCursorSurfaceId([out] unsigned long surfaceId); + void SetMouseHotSpot([in] int pid, [in] int windowId, [in] int hotSpotX, [in] int hotSpotY); + void SetMousePrimaryButton([in] int primaryButton); + void GetMousePrimaryButton([out] int primaryButton); + void SetHoverScrollState([in] boolean state); + void GetHoverScrollState([out] boolean state); + void SetPointerVisible([in] boolean visible, [in] int priority); + void IsPointerVisible([out] boolean visible); + void MarkProcessed([in] int eventType, [in] int eventId); + void SetPointerColor([in] int color); + void GetPointerColor([out] int color); + void EnableCombineKey([in] boolean enable); + void SetPointerSpeed([in] int speed); + void GetPointerSpeed([out] int speed); + void SetPointerStyle([in] int windowId, [in] PointerStyle pointerStyle, [in] boolean isUiExtension); + void GetPointerStyle([in] int windowId, [out] PointerStyle pointerStyle, [in] boolean isUiExtension); + void SupportKeys([in] int deviceId, [in] int[] keys, [out] boolean[] keystroke); + void GetDeviceIds([out] int[] ids); + void GetDevice([in] int deviceId, [out] InputDevice inputDevice); + void RegisterDevListener(); + void UnregisterDevListener(); + void GetKeyboardType([in] int deviceId, [out] int keyboardType); + void SetKeyboardRepeatDelay([in] int delay); + void SetKeyboardRepeatRate([in] int rate); + void GetKeyboardRepeatDelay([out] int delay); + void GetKeyboardRepeatRate([out] int rate); + void AddInputHandler([in] int handlerType, [in] unsigned int eventType, + [in] int priority, [in] unsigned int deviceTags, [in] int[] actionsType); + void RemoveInputHandler([in] int handlerType, [in] unsigned int eventType, + [in] int priority, [in] unsigned int deviceTags, [in] int[] actionsType); + void AddPreInputHandler([in] int handlerId, [in] unsigned int eventType, [in] int[] keys); + void RemovePreInputHandler([in] int handlerId); + void AddGestureMonitor([in] int handlerType, [in] unsigned int eventType, + [in] unsigned int gestureType, [in] int fingers); + void RemoveGestureMonitor([in] int handlerType, [in] unsigned int eventType, + [in] unsigned int gestureType, [in] int fingers); + void MarkEventConsumed([in] int eventId); + void MoveMouseEvent([in] int offsetX, [in] int offsetY); + void InjectKeyEvent([in] KeyEvent keyEvent, [in] boolean isNativeInject); + void SubscribeKeyEvent([in] int subscribeId, [in] KeyOption keyOption); + void UnsubscribeKeyEvent([in] int subscribeId); + void SubscribeHotkey([in] int subscribeId, [in] KeyOption keyOption); + void UnsubscribeHotkey([in] int subscribeId); + void SubscribeKeyMonitor([in] KeyMonitorOption keyOption); + void UnsubscribeKeyMonitor([in] KeyMonitorOption keyOption); + void SubscribeSwitchEvent([in] int subscribeId, [in] int switchType); + void UnsubscribeSwitchEvent([in] int subscribeId); + void SubscribeTabletProximity([in] int subscribeId); + void UnsubscribetabletProximity([in] int subscribeId); + void SubscribeLongPressEvent([in] int subscribeId, [in] LongPressRequest longPressRequest); + void UnsubscribeLongPressEvent([in] int subscribeId); + void InjectPointerEvent([in] PointerEvent pointerEvent, [in] boolean isNativeInject); + void InjectTouchPadEvent([in] PointerEvent pointerEvent, [in] TouchpadCDG touchpadCDG, [in] boolean isNativeInject); + void SetAnrObserver(); + void GetDisplayBindInfo([out] DisplayBindInfo[] infos); + void SetMoveEventFilters([in] boolean flag); + void SetCurrentUser([in] int userId); + void SetTouchpadThreeFingersTapSwitch([in] boolean switchFlag); + void GetTouchpadThreeFingersTapSwitch([out] boolean switchFlag); + void AddVirtualInputDevice([in] InputDevice device, [out] int deviceId); + void RemoveVirtualInputDevice([in] int deviceId); + void EnableHardwareCursorStats([in] boolean enable); + void GetHardwareCursorStats([out] unsigned int frameCount, [out] unsigned int vsyncCount); + void GetAllMmiSubscribedEvents([out] MmiEventMap mmiEventMap); + void SetDisplayBind([in] int deviceId, [in] int displayId, [out] String msg); + void GetFunctionKeyState([in] int funckey, [out] boolean state); + void SetFunctionKeyState([in] int funcKey, [in] boolean enable); + void SetPointerLocation([in] int x, [in] int y, [in] int displayId); + void ClearWindowPointerStyle([in] int pid, [in] int windowId); + void SetMouseCaptureMode([in] int windowId, [in] boolean isCaptureMode); + void GetWindowPid([in] int windowId, [out] int windowPid); + void AppendExtraData([in] ExtraData extraData); + void EnableInputDevice([in] boolean enable); + void SetKeyDownDuration([in] String businessId, [in] int delay); + void SetTouchpadScrollSwitch([in] boolean switchFlag); + void GetTouchpadScrollSwitch([out] boolean switchFlag); + void SetTouchpadScrollDirection([in] boolean state); + void GetTouchpadScrollDirection([out] boolean state); + void SetTouchpadTapSwitch([in] boolean switchFlag); + void GetTouchpadTapSwitch([out] boolean switchFlag); + void SetTouchpadPointerSpeed([in] int speed); + void GetTouchpadPointerSpeed([out] int speed); + void GetTouchpadCDG([out] TouchpadCDG touchpadCDG); + void SetTouchpadPinchSwitch([in] boolean switchFlag); + void GetTouchpadPinchSwitch([out] boolean switchFlag); + void SetTouchpadSwipeSwitch([in] boolean switchFlag); + void GetTouchpadSwipeSwitch([out] boolean switchFlag); + void SetTouchpadRightClickType([in] int type); + void GetTouchpadRightClickType([out] int type); + void SetTouchpadRotateSwitch([in] boolean rotateSwitch); + void GetTouchpadRotateSwitch([out] boolean rotateSwitch); + void SetTouchpadDoubleTapAndDragState([in] boolean switchFlag); + void GetTouchpadDoubleTapAndDragState([out] boolean switchFlag); + void SetShieldStatus([in] int shieldMode, [in] boolean isShield); + void GetShieldStatus([in] int shieldMode, [out] boolean isShield); + void GetKeyState([out] int[] pressedKeys, [out] Map specialKeysState); + void Authorize([in] boolean isAuthorize); + void CancelInjection(); + void HasIrEmitter([out] boolean hasIrEmitter); + void GetInfraredFrequencies([out] InfraredFrequency[] requencys); + void TransmitInfrared([in] long number, [in] long[] pattern); + [macrodef OHOS_BUILD_ENABLE_VKEYBOARD] void CreateVKeyboardDevice([out] IRemoteObject vkeyboardDevice); + void SetPixelMapData([in] int infoId, [in] CursorPixelMap pixelMap); + void SetTouchpadScrollRows([in] int rows); + void GetTouchpadScrollRows([out] int rows); + void SetClientInfo([in] int pid, [in] unsigned long readThreadId); + void GetIntervalSinceLastInput([out] long timeInterval); + [macrodef OHOS_BUILD_ENABLE_MAGICCURSOR] void GetPointerSnapshot([out] CursorPixelMap pixelMap); + void TransferBinderClientSrv([in] IRemoteObject binderClientObject); + void SkipPointerLayer([in] boolean isSkip); + [macrodef OHOS_BUILD_ENABLE_ANCO] void AncoAddChannel([in] IAncoChannel channel); + [macrodef OHOS_BUILD_ENABLE_ANCO] void AncoRemoveChannel([in] IAncoChannel channel); + [macrodef OHOS_BUILD_ENABLE_ANCO] void CheckKnuckleEvent([in] float pointX, [in] float pointY, [out] boolean isKnuckleType); + void GetAllSystemHotkeys([out] KeyOption[] keyOptions); + void SetInputDeviceEnabled([in] int deviceId, [in] boolean enable, [in] int index); + void ShiftAppPointerEvent([in] ShiftWindowParam param, [in] boolean autoGenDown); + void SetMultiWindowScreenId([in] unsigned long screenId, [in] unsigned long displayNodeScreenId); + void QuerySwitchStatus([in] int switchType, [out] int status); + void SetKnuckleSwitch([in] boolean isKnuckleSwitch); + void LaunchAiScreenAbility(); +} diff --git a/service/connect_manager/include/i_multimodal_input_connect.h b/service/connect_manager/include/i_multimodal_input_connect.h deleted file mode 100644 index 842174206942c78b5266dd5332a61ae28ec8a267..0000000000000000000000000000000000000000 --- a/service/connect_manager/include/i_multimodal_input_connect.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2021-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 I_MULTIMODAL_INPUT_CONNECT_H -#define I_MULTIMODAL_INPUT_CONNECT_H - -#include - -#include "extra_data.h" -#ifdef OHOS_BUILD_ENABLE_ANCO -#include "i_anco_channel.h" -#endif // OHOS_BUILD_ENABLE_ANCO -#include "i_event_filter.h" -#include "infrared_frequency_info.h" -#include "input_device.h" -#include "key_option.h" -#include "long_press_event.h" -#include "nap_process.h" -#include "pointer_style.h" -#include "touchpad_control_display_gain.h" -#include "shift_info.h" - -namespace OHOS { -namespace MMI { -class IMultimodalInputConnect : public IRemoteBroker { -public: - enum { - CONNECT_MODULE_TYPE_MMI_CLIENT = 0, - }; - static constexpr int32_t INVALID_SOCKET_FD = -1; - static constexpr int32_t MULTIMODAL_INPUT_CONNECT_SERVICE_ID = MULTIMODAL_INPUT_SERVICE_ID; - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.multimodalinput.IConnectManager"); - - virtual int32_t AllocSocketFd(const std::string &programName, const int32_t moduleType, - int32_t &socketFd, int32_t &tokenType) = 0; - virtual int32_t AddInputEventFilter(sptr filter, int32_t filterId, int32_t priority, - uint32_t deviceTags) = 0; - virtual int32_t NotifyNapOnline() = 0; - virtual int32_t RemoveInputEventObserver() = 0; - virtual int32_t RemoveInputEventFilter(int32_t filterId) = 0; - virtual int32_t SetMouseScrollRows(int32_t rows) = 0; - virtual int32_t GetMouseScrollRows(int32_t &rows) = 0; - virtual int32_t SetCustomCursor(int32_t windowId, int32_t focusX, int32_t focusY, void* pixelMap) = 0; - virtual int32_t SetCustomCursor(int32_t windowId, CustomCursor cursor, CursorOptions options) = 0; - virtual int32_t SetMouseIcon(int32_t windowId, void* pixelMap) = 0; - virtual int32_t SetPointerSize(int32_t size) = 0; - virtual int32_t SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus) = 0; - virtual int32_t GetPointerSize(int32_t &size) = 0; - virtual int32_t GetCursorSurfaceId(uint64_t &surfaceId) = 0; - virtual int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) = 0; - virtual int32_t SetMousePrimaryButton(int32_t primaryButton) = 0; - virtual int32_t GetMousePrimaryButton(int32_t &primaryButton) = 0; - virtual int32_t SetHoverScrollState(bool state) = 0; - virtual int32_t GetHoverScrollState(bool &state) = 0; - virtual int32_t SetPointerVisible(bool visible, int32_t priority) = 0; - virtual int32_t IsPointerVisible(bool &visible) = 0; - virtual int32_t MarkProcessed(int32_t eventType, int32_t eventId) = 0; - virtual int32_t SetPointerColor(int32_t color) = 0; - virtual int32_t GetPointerColor(int32_t &color) = 0; - virtual int32_t EnableCombineKey(bool enable) = 0; - virtual int32_t SetPointerSpeed(int32_t speed) = 0; - virtual int32_t GetPointerSpeed(int32_t &speed) = 0; - virtual int32_t SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension = false) = 0; - virtual int32_t GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension = false) = 0; - virtual int32_t SupportKeys(int32_t deviceId, std::vector &keys, std::vector &keystroke) = 0; - virtual int32_t GetDeviceIds(std::vector &ids) = 0; - virtual int32_t GetDevice(int32_t deviceId, std::shared_ptr &inputDevice) = 0; - virtual int32_t RegisterDevListener() = 0; - virtual int32_t UnregisterDevListener() = 0; - virtual int32_t GetKeyboardType(int32_t deviceId, int32_t &keyboardType) = 0; - virtual int32_t SetKeyboardRepeatDelay(int32_t delay) = 0; - virtual int32_t SetKeyboardRepeatRate(int32_t rate) = 0; - virtual int32_t GetKeyboardRepeatDelay(int32_t &delay) = 0; - virtual int32_t GetKeyboardRepeatRate(int32_t &rate) = 0; - virtual int32_t AddInputHandler(InputHandlerType handlerType, HandleEventType eventType, - int32_t priority, uint32_t deviceTags, std::vector actionsType = std::vector()) = 0; - virtual int32_t RemoveInputHandler(InputHandlerType handlerType, HandleEventType eventType, - int32_t priority, uint32_t deviceTags, std::vector actionsType = std::vector()) = 0; - virtual int32_t AddPreInputHandler(int32_t handlerId, HandleEventType eventType, std::vector keys) = 0; - virtual int32_t RemovePreInputHandler(int32_t handlerId) = 0; - virtual int32_t AddGestureMonitor(InputHandlerType handlerType, - HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) = 0; - virtual int32_t RemoveGestureMonitor(InputHandlerType handlerType, - HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) = 0; - virtual int32_t MarkEventConsumed(int32_t eventId) = 0; - virtual int32_t MoveMouseEvent(int32_t offsetX, int32_t offsetY) = 0; - virtual int32_t InjectKeyEvent(const std::shared_ptr keyEvent, bool isNativeInject) = 0; - virtual int32_t SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr option) = 0; - virtual int32_t UnsubscribeKeyEvent(int32_t subscribeId) = 0; - virtual int32_t SubscribeHotkey(int32_t subscribeId, const std::shared_ptr option) = 0; - virtual int32_t UnsubscribeHotkey(int32_t subscribeId) = 0; -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - virtual int32_t SubscribeKeyMonitor(const KeyMonitorOption &keyOption) = 0; - virtual int32_t UnsubscribeKeyMonitor(const KeyMonitorOption &keyOption) = 0; -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - virtual int32_t SubscribeSwitchEvent(int32_t subscribeId, int32_t switchType) = 0; - virtual int32_t UnsubscribeSwitchEvent(int32_t subscribeId) = 0; - virtual int32_t QuerySwitchStatus(int32_t switchType, int32_t& state) = 0; - virtual int32_t SubscribeTabletProximity(int32_t subscribeId) = 0; - virtual int32_t UnsubscribetabletProximity(int32_t subscribeId) = 0; - virtual int32_t SubscribeLongPressEvent(int32_t subscribeId, const LongPressRequest &longPressRequest) = 0; - virtual int32_t UnsubscribeLongPressEvent(int32_t subscribeId) = 0; - virtual int32_t InjectPointerEvent(const std::shared_ptr pointerEvent, bool isNativeInject) = 0; - virtual int32_t InjectTouchPadEvent(std::shared_ptr pointerEvent, - const TouchpadCDG &touchpadCDG, bool isNativeInject) = 0; - virtual int32_t SetAnrObserver() = 0; - virtual int32_t GetDisplayBindInfo(DisplayBindInfos &infos) = 0; - virtual int32_t GetAllMmiSubscribedEvents(std::map, int32_t> &datas) = 0; - virtual int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg) = 0; - virtual int32_t GetFunctionKeyState(int32_t funckey, bool &state) = 0; - virtual int32_t SetFunctionKeyState(int32_t funcKey, bool enable) = 0; - virtual int32_t SetPointerLocation(int32_t x, int32_t y, int32_t displayId) = 0; - virtual int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) = 0; - virtual int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode) = 0; - virtual int32_t GetWindowPid(int32_t windowId) = 0; - virtual int32_t AppendExtraData(const ExtraData& extraData) = 0; - virtual int32_t EnableInputDevice(bool enable) = 0; - virtual int32_t SetKeyDownDuration(const std::string &businessId, int32_t delay) = 0; - virtual int32_t SetTouchpadScrollSwitch(bool switchFlag) = 0; - virtual int32_t GetTouchpadScrollSwitch(bool &switchFlag) = 0; - virtual int32_t SetTouchpadScrollDirection(bool state) = 0; - virtual int32_t GetTouchpadScrollDirection(bool &state) = 0; - virtual int32_t SetTouchpadTapSwitch(bool switchFlag) = 0; - virtual int32_t GetTouchpadTapSwitch(bool &switchFlag) = 0; - virtual int32_t SetTouchpadPointerSpeed(int32_t speed) = 0; - virtual int32_t GetTouchpadPointerSpeed(int32_t &speed) = 0; - virtual int32_t GetTouchpadCDG(TouchpadCDG &touchpadCDG) = 0; - virtual int32_t SetTouchpadPinchSwitch(bool switchFlag) = 0; - virtual int32_t GetTouchpadPinchSwitch(bool &switchFlag) = 0; - virtual int32_t SetTouchpadSwipeSwitch(bool switchFlag) = 0; - virtual int32_t GetTouchpadSwipeSwitch(bool &switchFlag) = 0; - virtual int32_t SetTouchpadRightClickType(int32_t type) = 0; - virtual int32_t GetTouchpadRightClickType(int32_t &type) = 0; - virtual int32_t SetTouchpadRotateSwitch(bool rotateSwitch) = 0; - virtual int32_t GetTouchpadRotateSwitch(bool &rotateSwitch) = 0; - virtual int32_t SetTouchpadDoubleTapAndDragState(bool switchFlag) = 0; - virtual int32_t GetTouchpadDoubleTapAndDragState(bool &switchFlag) = 0; - virtual int32_t SetShieldStatus(int32_t shieldMode, bool isShield) = 0; - virtual int32_t GetShieldStatus(int32_t shieldMode, bool &isShield) = 0; - virtual int32_t GetKeyState(std::vector &pressedKeys, std::map &specialKeysState) = 0; - virtual int32_t Authorize(bool isAuthorize) = 0; - virtual int32_t CancelInjection() = 0; - virtual int32_t HasIrEmitter(bool &hasIrEmitter) = 0; - virtual int32_t GetInfraredFrequencies(std::vector& requencys) = 0; - virtual int32_t TransmitInfrared(int64_t number, std::vector& pattern) = 0; -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - virtual int32_t CreateVKeyboardDevice(sptr &vkeyboardDevice) = 0; -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - virtual int32_t SetPixelMapData(int32_t infoId, void* pixelMap) = 0; - virtual int32_t SetMoveEventFilters(bool flag) = 0; - virtual int32_t SetCurrentUser(int32_t userId) = 0; - virtual int32_t SetTouchpadThreeFingersTapSwitch(bool switchFlag) = 0; - virtual int32_t GetTouchpadThreeFingersTapSwitch(bool &switchFlag) = 0; - virtual int32_t AddVirtualInputDevice(std::shared_ptr device, int32_t &deviceId) = 0; - virtual int32_t RemoveVirtualInputDevice(int32_t deviceId) = 0; - virtual int32_t EnableHardwareCursorStats(bool enable) = 0; - virtual int32_t GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount) = 0; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - virtual int32_t GetPointerSnapshot(void *pixelMapPtr) = 0; -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - virtual int32_t SetTouchpadScrollRows(int32_t rows) = 0; - virtual int32_t GetTouchpadScrollRows(int32_t &rows) = 0; - virtual int32_t SetClientInfo(int32_t pid, uint64_t readThreadId) = 0; - virtual int32_t GetIntervalSinceLastInput(int64_t &timeInterval) = 0; -#ifdef OHOS_BUILD_ENABLE_ANCO - virtual int32_t AncoAddChannel(sptr channel) = 0; - virtual int32_t AncoRemoveChannel(sptr channel) = 0; - virtual int32_t CheckKnuckleEvent(float pointX, float pointY, bool &isKnuckleType) = 0; -#endif // OHOS_BUILD_ENABLE_ANCO - virtual int32_t TransferBinderClientSrv(const sptr &binderClientObject) = 0; - virtual int32_t SkipPointerLayer(bool isSkip) = 0; - virtual int32_t GetAllSystemHotkeys(std::vector> &keyOptions) = 0; - virtual int32_t SetInputDeviceEnabled(int32_t deviceId, bool enable, int32_t index) = 0; - virtual int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown) = 0; - virtual int32_t SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId) = 0; - virtual int32_t SetKnuckleSwitch(bool knuckleSwitch) = 0; - virtual int32_t LaunchAiScreenAbility() = 0; -}; -} // namespace MMI -} // namespace OHOS -#endif // I_MULTIMODAL_INPUT_CONNECT_H diff --git a/service/connect_manager/include/multimodal_input_connect_manager.h b/service/connect_manager/include/multimodal_input_connect_manager.h index dfecf926e679fe2c277ce7959a96fe347efb6f1e..38417d3c88bf492b13339375f1c8aa2ac6ff262f 100644 --- a/service/connect_manager/include/multimodal_input_connect_manager.h +++ b/service/connect_manager/include/multimodal_input_connect_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -16,13 +16,20 @@ #ifndef MULTIMODAL_INPUT_CONNECT_MANAGER_H #define MULTIMODAL_INPUT_CONNECT_MANAGER_H +#include + #include "i_input_service_watcher.h" -#include "i_multimodal_input_connect.h" +#include "imultimodal_input_connect.h" namespace OHOS { namespace MMI { class MultimodalInputConnectManager final : public std::enable_shared_from_this { public: + enum { + CONNECT_MODULE_TYPE_MMI_CLIENT = 0, + }; + static constexpr int32_t INVALID_SOCKET_FD = -1; + static constexpr int32_t MULTIMODAL_INPUT_CONNECT_SERVICE_ID = MULTIMODAL_INPUT_SERVICE_ID; ~MultimodalInputConnectManager() = default; static std::shared_ptr GetInstance(); int32_t AllocSocketPair(const int32_t moduleType); @@ -187,7 +194,7 @@ private: void NotifyDeath(); sptr multimodalInputConnectService_ { nullptr }; sptr multimodalInputConnectRecipient_ { nullptr }; - int32_t socketFd_ { IMultimodalInputConnect::INVALID_SOCKET_FD }; + int32_t socketFd_ { MultimodalInputConnectManager::INVALID_SOCKET_FD }; int32_t tokenType_ { -1 }; std::mutex lock_; std::set> watchers_; diff --git a/service/connect_manager/include/multimodal_input_connect_proxy.h b/service/connect_manager/include/multimodal_input_connect_proxy.h deleted file mode 100644 index dfecb7f253fe4c91f5cea6fcdfa178b3e9937086..0000000000000000000000000000000000000000 --- a/service/connect_manager/include/multimodal_input_connect_proxy.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2021-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 MULTIMODAL_INPUT_CONNECT_PROXY_H -#define MULTIMODAL_INPUT_CONNECT_PROXY_H - -#include "iremote_proxy.h" - -#include "i_multimodal_input_connect.h" - -namespace OHOS { -namespace MMI { -class MultimodalInputConnectProxy final : public IRemoteProxy { -public: - explicit MultimodalInputConnectProxy(const sptr &impl); - DISALLOW_COPY_AND_MOVE(MultimodalInputConnectProxy); - ~MultimodalInputConnectProxy() override; - - int32_t AllocSocketFd(const std::string &programName, const int32_t moduleType, - int32_t &socketFd, int32_t &tokenType) override; - int32_t AddInputEventFilter(sptr filter, int32_t filterId, int32_t priority, - uint32_t deviceTags) override; - int32_t NotifyNapOnline() override; - int32_t RemoveInputEventObserver() override; - int32_t RemoveInputEventFilter(int32_t filterId) override; - int32_t SetMouseScrollRows(int32_t rows) override; - int32_t GetMouseScrollRows(int32_t &rows) override; - int32_t SetPointerSize(int32_t size) override; - int32_t SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus) override; - int32_t GetPointerSize(int32_t &size) override; - int32_t GetCursorSurfaceId(uint64_t &surfaceId) override; - int32_t SetCustomCursor(int32_t windowId, int32_t focusX, int32_t focusY, void* pixelMap) override; - int32_t SetCustomCursor(int32_t windowId, CustomCursor cursor, CursorOptions options) override; - int32_t SetMouseIcon(int32_t windowId, void* pixelMap) override; - int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) override; - int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) override; - int32_t SetMousePrimaryButton(int32_t primaryButton) override; - int32_t GetMousePrimaryButton(int32_t &primaryButton) override; - int32_t SetHoverScrollState(bool state) override; - int32_t GetHoverScrollState(bool &state) override; - int32_t SetPointerVisible(bool visible, int32_t priority) override; - int32_t IsPointerVisible(bool &visible) override; - int32_t MarkProcessed(int32_t eventType, int32_t eventId) override; - int32_t SetPointerColor(int32_t color) override; - int32_t GetPointerColor(int32_t &color) override; - int32_t SetPointerSpeed(int32_t speed) override; - int32_t GetPointerSpeed(int32_t &speed) override; - int32_t SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension = false) override; - int32_t GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension = false) override; - int32_t SupportKeys(int32_t deviceId, std::vector &keys, std::vector &keystroke) override; - int32_t GetDeviceIds(std::vector &ids) override; - int32_t GetDevice(int32_t deviceId, std::shared_ptr &inputDevice) override; - int32_t RegisterDevListener() override; - int32_t UnregisterDevListener() override; - int32_t GetKeyboardType(int32_t deviceId, int32_t &keyboardType) override; - int32_t SetKeyboardRepeatDelay(int32_t delay) override; - int32_t SetKeyboardRepeatRate(int32_t rate) override; - int32_t GetKeyboardRepeatDelay(int32_t &delay) override; - int32_t GetKeyboardRepeatRate(int32_t &rate) override; - int32_t AddInputHandler(InputHandlerType handlerType, HandleEventType eventType, - int32_t priority, uint32_t deviceTags, std::vector actionsType = std::vector()) override; - int32_t RemoveInputHandler(InputHandlerType handlerType, HandleEventType eventType, - int32_t priority, uint32_t deviceTags, std::vector actionsType = std::vector()) override; - int32_t AddPreInputHandler(int32_t handlerId, HandleEventType eventType, std::vector keys) override; - int32_t RemovePreInputHandler(int32_t handlerId) override; - int32_t AddGestureMonitor(InputHandlerType handlerType, - HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) override; - int32_t RemoveGestureMonitor(InputHandlerType handlerType, - HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) override; - int32_t MarkEventConsumed(int32_t eventId) override; - int32_t MoveMouseEvent(int32_t offsetX, int32_t offsetY) override; - int32_t InjectKeyEvent(const std::shared_ptr keyEvent, bool isNativeInject) override; - int32_t SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr option) override; - int32_t UnsubscribeKeyEvent(int32_t subscribeId) override; - int32_t SubscribeHotkey(int32_t subscribeId, const std::shared_ptr option) override; - int32_t UnsubscribeHotkey(int32_t subscribeId) override; -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - int32_t SubscribeKeyMonitor(const KeyMonitorOption &keyOption) override; - int32_t UnsubscribeKeyMonitor(const KeyMonitorOption &keyOption) override; -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - int32_t SubscribeSwitchEvent(int32_t subscribeId, int32_t switchType) override; - int32_t UnsubscribeSwitchEvent(int32_t subscribeId) override; - int32_t QuerySwitchStatus(int32_t switchType, int32_t& state) override; - int32_t SubscribeTabletProximity(int32_t subscribeId) override; - int32_t UnsubscribetabletProximity(int32_t subscribeId) override; - int32_t SubscribeLongPressEvent(int32_t subscribeId, const LongPressRequest &longPressRequest) override; - int32_t UnsubscribeLongPressEvent(int32_t subscribeId) override; - int32_t InjectPointerEvent(const std::shared_ptr pointerEvent, bool isNativeInject) override; - int32_t InjectTouchPadEvent(const std::shared_ptr pointerEvent, const TouchpadCDG &touchpadCDG, - bool isNativeInject) override; - int32_t SetAnrObserver() override; - int32_t GetDisplayBindInfo(DisplayBindInfos &infos) override; - int32_t GetAllMmiSubscribedEvents(std::map, int32_t> &datas) override; - int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg) override; - int32_t GetFunctionKeyState(int32_t funcKey, bool &state) override; - int32_t SetFunctionKeyState(int32_t funcKey, bool enable) override; - int32_t SetPointerLocation(int32_t x, int32_t y, int32_t displayId) override; - virtual int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode) override; - int32_t GetWindowPid(int32_t windowId) override; - int32_t AppendExtraData(const ExtraData& extraData) override; - int32_t EnableCombineKey(bool enable) override; - int32_t EnableInputDevice(bool enable) override; - int32_t SetKeyDownDuration(const std::string &businessId, int32_t delay) override; - int32_t SetTouchpadScrollSwitch(bool switchFlag) override; - int32_t GetTouchpadScrollSwitch(bool &switchFlag) override; - int32_t SetTouchpadScrollDirection(bool state) override; - int32_t GetTouchpadScrollDirection(bool &state) override; - int32_t SetTouchpadTapSwitch(bool switchFlag) override; - int32_t GetTouchpadTapSwitch(bool &switchFlag) override; - int32_t SetTouchpadPointerSpeed(int32_t speed) override; - int32_t GetTouchpadPointerSpeed(int32_t &speed) override; - int32_t GetTouchpadCDG(TouchpadCDG &touchpadCDG) override; - int32_t SetTouchpadPinchSwitch(bool switchFlag) override; - int32_t GetTouchpadPinchSwitch(bool &switchFlag) override; - int32_t SetTouchpadSwipeSwitch(bool switchFlag) override; - int32_t GetTouchpadSwipeSwitch(bool &switchFlag) override; - int32_t SetTouchpadRightClickType(int32_t type) override; - int32_t GetTouchpadRightClickType(int32_t &type) override; - int32_t SetTouchpadRotateSwitch(bool rotateSwitch) override; - int32_t GetTouchpadRotateSwitch(bool &rotateSwitch) override; - int32_t SetTouchpadDoubleTapAndDragState(bool switchFlag) override; - int32_t GetTouchpadDoubleTapAndDragState(bool &switchFlag) override; - int32_t SetShieldStatus(int32_t shieldMode, bool isShield) override; - int32_t GetShieldStatus(int32_t shieldMode, bool &isShield) override; - int32_t GetKeyState(std::vector &pressedKeys, std::map &specialKeysState) override; - int32_t Authorize(bool isAuthorize) override; - int32_t CancelInjection() override; - int32_t HasIrEmitter(bool &hasIrEmitter) override; - int32_t GetInfraredFrequencies(std::vector& requencys) override; - int32_t TransmitInfrared(int64_t number, std::vector& pattern) override; -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - int32_t CreateVKeyboardDevice(sptr &vkeyboardDevice) override; -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - int32_t SetPixelMapData(int32_t infoId, void* pixelMap) override; - int32_t SetMoveEventFilters(bool flag) override; - int32_t SetCurrentUser(int32_t userId) override; - int32_t SetTouchpadThreeFingersTapSwitch(bool switchFlag) override; - int32_t GetTouchpadThreeFingersTapSwitch(bool &switchFlag) override; - - int32_t EnableHardwareCursorStats(bool enable) override; - int32_t GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount) override; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t GetPointerSnapshot(void *pixelMapPtr) override; -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t AddVirtualInputDevice(std::shared_ptr device, int32_t &deviceId) override; - int32_t RemoveVirtualInputDevice(int32_t deviceId) override; - int32_t SetTouchpadScrollRows(int32_t rows) override; - int32_t GetTouchpadScrollRows(int32_t &rows) override; - int32_t SetClientInfo(int32_t pid, uint64_t readThreadId) override; - int32_t GetIntervalSinceLastInput(int64_t &timeInterval) override; -#ifdef OHOS_BUILD_ENABLE_ANCO - int32_t AncoAddChannel(sptr channel) override; - int32_t AncoRemoveChannel(sptr channel) override; - int32_t CheckKnuckleEvent(float pointX, float pointY, bool &isKnuckleType) override; -#endif // OHOS_BUILD_ENABLE_ANCO - int32_t TransferBinderClientSrv(const sptr &binderClientObject) override; - int32_t SkipPointerLayer(bool isSkip) override; - int32_t GetAllSystemHotkeys(std::vector> &keyOptions) override; - int32_t SetInputDeviceEnabled(int32_t deviceId, bool enable, int32_t index) override; - int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown) override; - int32_t SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId) override; - int32_t SetKnuckleSwitch(bool knuckleSwitch) override; - int32_t LaunchAiScreenAbility() override; - -private: - static inline BrokerDelegator delegator_; - int32_t SetTouchpadBoolData(bool date, int32_t type); - int32_t GetTouchpadBoolData(bool &date, int32_t type); - int32_t SetTouchpadInt32Data(int32_t date, int32_t type); - int32_t GetTouchpadInt32Data(int32_t &date, int32_t type); - int32_t GetTouchpadCDGData(double &ppi, double &size, int32_t &speed, int32_t &frequency, int32_t type); - int32_t HandleGestureMonitor(uint32_t code, InputHandlerType handlerType, - HandleEventType eventType, TouchGestureType gestureType, int32_t fingers); -}; -} // namespace MMI -} // namespace OHOS -#endif // MULTIMODAL_INPUT_CONNECT_PROXY_H diff --git a/service/connect_manager/include/multimodal_input_connect_stub.h b/service/connect_manager/include/multimodal_input_connect_stub.h deleted file mode 100644 index 934e4832656e727369e65245c0b7083640c612f3..0000000000000000000000000000000000000000 --- a/service/connect_manager/include/multimodal_input_connect_stub.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2021-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 MULTIMODAL_INPUT_CONNECT_STUB_H -#define MULTIMODAL_INPUT_CONNECT_STUB_H - -#include "iremote_stub.h" - -#include "i_multimodal_input_connect.h" -#include "multimodalinput_ipc_interface_code.h" - -namespace OHOS { -namespace MMI { -struct ParseData { - int32_t actionsTypeSize; - uint32_t eventType; - int32_t priority; - int32_t deviceTags; - std::vector actionsType; - - ParseData() - { - actionsTypeSize = -1; - eventType = 0; - priority = 0; - deviceTags = 0; - } -}; -class MultimodalInputConnectStub : public IRemoteStub { -public: - MultimodalInputConnectStub() = default; - DISALLOW_COPY_AND_MOVE(MultimodalInputConnectStub); - virtual ~MultimodalInputConnectStub() = default; - - virtual bool IsRunning() const = 0; - virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, - MessageOption& options) override; - -protected: - int32_t StubHandleAllocSocketFd(MessageParcel &data, MessageParcel &reply); - int32_t StubAddInputEventFilter(MessageParcel& data, MessageParcel& reply); - int32_t StubRemoveInputEventFilter(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMouseScrollRows(MessageParcel& data, MessageParcel& reply); - int32_t StubGetMouseScrollRows(MessageParcel& data, MessageParcel& reply); - int32_t StubSetPointerSize(MessageParcel& data, MessageParcel& reply); - int32_t StubGetPointerSize(MessageParcel& data, MessageParcel& reply); - int32_t StubGetCursorSurfaceId(MessageParcel& data, MessageParcel& reply); - int32_t StubSetCustomCursor(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMouseIcon(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMouseHotSpot(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMousePrimaryButton(MessageParcel& data, MessageParcel& reply); - int32_t StubGetMousePrimaryButton(MessageParcel& data, MessageParcel& reply); - int32_t StubSetHoverScrollState(MessageParcel& data, MessageParcel& reply); - int32_t StubGetHoverScrollState(MessageParcel& data, MessageParcel& reply); - int32_t StubSetPointerVisible(MessageParcel& data, MessageParcel& reply); - int32_t StubSetPointerStyle(MessageParcel& data, MessageParcel& reply); - int32_t StubNotifyNapOnline(MessageParcel& data, MessageParcel& reply); - int32_t StubRemoveInputEventObserver(MessageParcel& data, MessageParcel& reply); - int32_t StubSetNapStatus(MessageParcel& data, MessageParcel& reply); - int32_t StubGetPointerStyle(MessageParcel& data, MessageParcel& reply); - int32_t StubIsPointerVisible(MessageParcel& data, MessageParcel& reply); - int32_t StubMarkProcessed(MessageParcel& data, MessageParcel& reply); - int32_t StubSupportKeys(MessageParcel& data, MessageParcel& reply); - int32_t StubGetDeviceIds(MessageParcel& data, MessageParcel& reply); - int32_t StubGetDevice(MessageParcel& data, MessageParcel& reply); - int32_t StubRegisterInputDeviceMonitor(MessageParcel& data, MessageParcel& reply); - int32_t StubUnregisterInputDeviceMonitor(MessageParcel& data, MessageParcel& reply); - int32_t StubGetKeyboardType(MessageParcel& data, MessageParcel& reply); - int32_t StubSetKeyboardRepeatDelay(MessageParcel& data, MessageParcel& reply); - int32_t StubSetKeyboardRepeatRate(MessageParcel& data, MessageParcel& reply); - int32_t StubGetKeyboardRepeatDelay(MessageParcel& data, MessageParcel& reply); - int32_t StubGetKeyboardRepeatRate(MessageParcel& data, MessageParcel& reply); - int32_t StubAddInputHandler(MessageParcel& data, MessageParcel& reply); - int32_t StubRemoveInputHandler(MessageParcel& data, MessageParcel& reply); - int32_t StubAddPreInputHandler(MessageParcel& data, MessageParcel& reply); - int32_t StubRemovePreInputHandler(MessageParcel& data, MessageParcel& reply); - int32_t StubAddGestureMonitor(MessageParcel& data, MessageParcel& reply); - int32_t StubRemoveGestureMonitor(MessageParcel& data, MessageParcel& reply); - int32_t StubMarkEventConsumed(MessageParcel& data, MessageParcel& reply); - int32_t StubMoveMouseEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubInjectKeyEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubSubscribeKeyEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubUnsubscribeKeyEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubSubscribeHotkey(MessageParcel& data, MessageParcel& reply); - int32_t StubUnsubscribeHotkey(MessageParcel& data, MessageParcel& reply); -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - int32_t StubSubscribeKeyMonitor(MessageParcel& data, MessageParcel& reply); - int32_t StubUnsubscribeKeyMonitor(MessageParcel& data, MessageParcel& reply); -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - int32_t StubSubscribeSwitchEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubUnsubscribeSwitchEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubQuerySwitchStatus(MessageParcel& data, MessageParcel& reply); - int32_t StubSubscribeTabletProximity(MessageParcel& data, MessageParcel& reply); - int32_t StubUnSubscribetabletProximity(MessageParcel& data, MessageParcel& reply); - int32_t StubSubscribeLongPressEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubUnsubscribeLongPressEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubInjectPointerEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubInjectTouchPadEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubSetAnrListener(MessageParcel& data, MessageParcel& reply); - int32_t StubGetDisplayBindInfo(MessageParcel& data, MessageParcel& reply); - int32_t StubGetAllMmiSubscribedEvents(MessageParcel& data, MessageParcel& reply); - int32_t StubSetDisplayBind(MessageParcel& data, MessageParcel& reply); - int32_t StubSetPointerColor(MessageParcel& data, MessageParcel& reply); - int32_t StubGetPointerColor(MessageParcel& data, MessageParcel& reply); - int32_t StubEnableCombineKey(MessageParcel& data, MessageParcel& reply); - int32_t StubSetPointerSpeed(MessageParcel& data, MessageParcel& reply); - int32_t StubGetPointerSpeed(MessageParcel& data, MessageParcel& reply); - int32_t StubGetFunctionKeyState(MessageParcel &data, MessageParcel &reply); - int32_t StubSetFunctionKeyState(MessageParcel &data, MessageParcel &reply); - int32_t StubSetPointerLocation(MessageParcel &data, MessageParcel &reply); - int32_t StubSetMouseCaptureMode(MessageParcel& data, MessageParcel& reply); - int32_t StubGetWindowPid(MessageParcel& data, MessageParcel& reply); - int32_t StubAppendExtraData(MessageParcel& data, MessageParcel& reply); - int32_t StubEnableInputDevice(MessageParcel& data, MessageParcel& reply); - int32_t StubSetKeyDownDuration(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadScrollSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadScrollSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadScrollDirection(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadScrollDirection(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadTapSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadTapSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadPointerSpeed(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadPointerSpeed(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadCDG(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadPinchSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadPinchSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadSwipeSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadSwipeSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadRightClickType(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadRightClickType(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadRotateSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadRotateSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadDoubleTapAndDragState(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadDoubleTapAndDragState(MessageParcel& data, MessageParcel& reply); - int32_t StubClearWindowPointerStyle(MessageParcel& data, MessageParcel& reply); - int32_t StubSetShieldStatus(MessageParcel& data, MessageParcel& reply); - int32_t StubGetShieldStatus(MessageParcel& data, MessageParcel& reply); - int32_t StubGetKeyState(MessageParcel& data, MessageParcel& reply); - int32_t StubAuthorize(MessageParcel& data, MessageParcel& reply); - int32_t StubCancelInjection(MessageParcel& data, MessageParcel& reply); - int32_t StubHasIrEmitter(MessageParcel& data, MessageParcel& reply); - int32_t StubGetInfraredFrequencies(MessageParcel& data, MessageParcel& reply); - int32_t StubTransmitInfrared(MessageParcel& data, MessageParcel& reply); -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - int32_t StubCreateVKeyboardDevice(MessageParcel& data, MessageParcel& reply); -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - int32_t StubSetPixelMapData(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMoveEventFilters(MessageParcel& data, MessageParcel& reply); - int32_t StubSetCurrentUser(MessageParcel& data, MessageParcel& reply); - int32_t StubSetTouchpadThreeFingersTapSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadThreeFingersTapSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubAddVirtualInputDevice(MessageParcel& data, MessageParcel& reply); - int32_t StubRemoveVirtualInputDevice(MessageParcel& data, MessageParcel& reply); - int32_t StubEnableHardwareCursorStats(MessageParcel& data, MessageParcel& reply); - int32_t StubGetHardwareCursorStats(MessageParcel& data, MessageParcel& reply); -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t StubGetPointerSnapshot(MessageParcel &data, MessageParcel &reply); -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t StubSetTouchpadScrollRows(MessageParcel& data, MessageParcel& reply); - int32_t StubGetTouchpadScrollRows(MessageParcel& data, MessageParcel& reply); - int32_t StubSetClientInfo(MessageParcel &data, MessageParcel &reply); -#ifdef OHOS_BUILD_ENABLE_ANCO - int32_t StubAncoAddChannel(MessageParcel& data, MessageParcel& reply); - int32_t StubAncoRemoveChannel(MessageParcel& data, MessageParcel& reply); - int32_t StubCheckKnuckleEvent(MessageParcel& data, MessageParcel& reply); -#endif // OHOS_BUILD_ENABLE_ANCO - int32_t StubTransferBinderClientService(MessageParcel& data, MessageParcel& reply); - int32_t StubSkipPointerLayer(MessageParcel& data, MessageParcel& reply); - int32_t StubGetIntervalSinceLastInput(MessageParcel& data, MessageParcel& reply); - int32_t StubGetAllSystemHotkeys(MessageParcel& data, MessageParcel& reply); - int32_t ParseAddInputHandlerData(MessageParcel& data, ParseData& parseData); - int32_t StubSetInputDeviceInputEnable(MessageParcel& data, MessageParcel& reply); - int32_t StubShiftAppPointerEvent(MessageParcel& data, MessageParcel& reply); - int32_t StubSetCustomMouseCursor(MessageParcel& data, MessageParcel& reply); - int32_t StubSetMultiWindowScreenId(MessageParcel& data, MessageParcel& reply); - int32_t StubSetKnuckleSwitch(MessageParcel& data, MessageParcel& reply); - int32_t StubLaunchAiScreenAbility(MessageParcel& data, MessageParcel& reply); - -private: - int32_t VerifyTouchPadSetting(void); - int32_t HandleGestureMonitor(MultimodalinputConnectInterfaceCode code, - MessageParcel& data, MessageParcel& reply); -}; -} // namespace MMI -} // namespace OHOS -#endif // MULTIMODAL_INPUT_CONNECT_STUB_H diff --git a/service/connect_manager/include/multimodalinput_ipc_interface_code.h b/service/connect_manager/include/multimodalinput_ipc_interface_code.h deleted file mode 100644 index 01bb07fbc63c068f90b76afa61c3ca9b77ca631b..0000000000000000000000000000000000000000 --- a/service/connect_manager/include/multimodalinput_ipc_interface_code.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2023-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 MULTIMODALINPUT_IPC_INTERFACE_CODE_H -#define MULTIMODALINPUT_IPC_INTERFACE_CODE_H - -/* SAID: 3101 */ -namespace OHOS { -namespace MMI { -enum class MultimodalinputConnectInterfaceCode { - ALLOC_SOCKET_FD = 0, - ADD_INPUT_EVENT_FILTER = 1, - SET_POINTER_VISIBLE = 2, - IS_POINTER_VISIBLE = 3, - MARK_PROCESSED = 4, - SUBSCRIBE_KEY_EVENT = 6, - UNSUBSCRIBE_KEY_EVENT = 7, - ADD_INPUT_HANDLER = 8, - REMOVE_INPUT_HANDLER = 9, - MARK_EVENT_CONSUMED = 10, - MOVE_MOUSE = 11, - INJECT_KEY_EVENT = 12, - INJECT_POINTER_EVENT = 13, - SET_ANR_OBSERVER = 14, - SUPPORT_KEYS = 15, - GET_DEVICE_IDS = 16, - GET_DEVICE = 17, - REGISTER_DEV_MONITOR = 18, - UNREGISTER_DEV_MONITOR = 19, - GET_KEYBOARD_TYPE = 20, - SET_POINTER_SPEED = 21, - GET_POINTER_SPEED = 22, - SET_POINTER_STYLE = 23, - GET_POINTER_STYLE = 24, - SET_FUNCTION_KEY_STATE = 25, - GET_FUNCTION_KEY_STATE = 26, - RMV_INPUT_EVENT_FILTER = 27, - SET_CAPTURE_MODE = 28, - GET_DISPLAY_BIND_INFO = 29, - SET_DISPLAY_BIND = 30, - SET_INPUT_DEVICE_TO_SCREEN = 31, - SET_POINTER_LOCATION = 32, - GET_WINDOW_PID = 33, - APPEND_EXTRA_DATA = 34, - SUBSCRIBE_SWITCH_EVENT = 35, - UNSUBSCRIBE_SWITCH_EVENT = 36, - ENABLE_INPUT_DEVICE = 37, - SET_MOUSE_PRIMARY_BUTTON = 38, - GET_MOUSE_PRIMARY_BUTTON = 39, - SET_KEY_DOWN_DURATION = 40, - SET_HOVER_SCROLL_STATE = 41, - GET_HOVER_SCROLL_STATE = 42, - SET_MOUSE_SCROLL_ROWS = 43, - GET_MOUSE_SCROLL_ROWS = 44, - SET_TP_SCROLL_SWITCH = 45, - GET_TP_SCROLL_SWITCH = 46, - SET_TP_SCROLL_DIRECT_SWITCH = 47, - GET_TP_SCROLL_DIRECT_SWITCH = 48, - SET_TP_TAP_SWITCH = 49, - GET_TP_TAP_SWITCH = 50, - SET_TP_POINTER_SPEED = 51, - GET_TP_POINTER_SPEED = 52, - SET_MOUSE_ICON = 53, - SET_KEYBOARD_REPEAT_DELAY = 54, - SET_KEYBOARD_REPEAT_RATE = 55, - SET_TP_PINCH_SWITCH = 56, - GET_TP_PINCH_SWITCH = 57, - SET_TP_SWIPE_SWITCH = 58, - GET_TP_SWIPE_SWITCH = 59, - SET_TP_RIGHT_CLICK_TYPE = 60, - GET_TP_RIGHT_CLICK_TYPE = 61, - GET_KEYBOARD_REPEAT_DELAY = 62, - GET_KEYBOARD_REPEAT_RATE = 63, - SET_MOUSE_HOT_SPOT = 64, - SET_POINTER_SIZE = 65, - GET_POINTER_SIZE = 66, - SET_POINTER_COLOR = 67, - GET_POINTER_COLOR = 68, - CLEAN_WIDNOW_STYLE = 69, - SET_CUSTOM_CURSOR = 70, - NOTIFY_NAP_ONLINE = 71, - SET_NAP_STATUS = 72, - GET_ALL_NAPSTATUS_DATA = 73, - RMV_INPUT_EVENT_OBSERVER = 74, - SET_SHIELD_STATUS = 75, - GET_SHIELD_STATUS = 76, - ENABLE_COMBINE_KEY = 77, - SET_TP_ROTATE_SWITCH = 78, - GET_TP_ROTATE_SWITCH = 79, - GET_KEY_STATE = 80, - NATIVE_AUTHORIZE = 81, - NATIVE_CANCEL_INJECTION = 82, - NATIVE_INFRARED_OWN = 83, - NATIVE_INFRARED_FREQUENCY = 84, - NATIVE_CANCEL_TRANSMIT = 85, - SET_PIXEL_MAP_DATA = 86, - SET_CURRENT_USERID = 87, - ENABLE_HARDWARE_CURSOR_STATS = 88, - GET_HARDWARE_CURSOR_STATS = 89, - ADD_VIRTUAL_INPUT_DEVICE = 90, - REMOVE_VIRTUAL_INPUT_DEVICE = 91, - SET_THREE_GINGERS_TAPSWITCH = 92, - GET_THREE_GINGERS_TAPSWITCH = 93, -#ifdef OHOS_BUILD_ENABLE_ANCO - ADD_ANCO_CHANNEL = 94, - REMOVE_ANCO_CHANNEL = 95, -#endif // OHOS_BUILD_ENABLE_ANCO - TRANSFER_BINDER_CLIENT_SERVICE = 96, - SET_TOUCHPAD_SCROLL_ROWS = 97, - GET_TOUCHPAD_SCROLL_ROWS = 98, -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - GET_POINTER_SNAPSHOT = 99, -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - SET_MOVE_EVENT_FILTERS = 100, - SKIP_POINTER_LAYER = 101, - GET_SYSTEM_EVENT_TIME_INTERVAL = 102, - GET_ALL_SYSTEM_HOT_KEY = 103, - SET_CLIENT_INFO = 104, - ADD_GESTURE_MONITOR = 105, - REMOVE_GESTURE_MONITOR = 106, - - SET_INPUT_DEVICE_ENABLE = 109, - SHIFT_APP_POINTER_EVENT = 110, - SET_CUSTOM_MOUSE_CURSOR = 120, - INJECT_TOUCHPAD_EVENT = 121, - GET_TOUCHPAD_OPTION = 122, - SET_MUILT_WINDOW_SCREEN_ID = 123, - SET_KNUCKLE_SWITCH = 124, - LAUNCH_AI_SCREEN_ABILITY = 125, -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - CREATE_VKEYBOARD_DEVICE = 153, -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - GET_CURSOR_SURFACE_ID = 205, - SUBSCRIBE_HOT_KEY = 303, - UNSUBSCRIBE_HOT_KEY = 304, - SUBSCRIBE_LONG_PRESS = 305, - UNSUBSCRIBE_LONG_PRESS = 306, - SET_DOUBLE_TAP_DRAG_STATE = 307, - GET_DOUBLE_TAP_DRAG_STATE = 308, - ADD_PRE_INPUT_HANDLER = 309, - REMOVE_PRE_INPUT_HANDLER = 310, -#ifdef OHOS_BUILD_ENABLE_ANCO - CHECK_KNUCKLE_EVENT = 311, -#endif // OHOS_BUILD_ENABLE_ANCO - SUBSCRIBE_TABLET_EVENT = 312, - UNSUBSCRIBE_TABLET_EVENT = 313, -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - SUBSCRIBE_KEY_MONITOR = 351, - UNSUBSCRIBE_KEY_MONITOR = 352, -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - QUERY_SWITCH_STATE_EVENT = 353, -}; - -enum class MultimodalinputEventObserverCode { - NOTIFY_BUNDLE_NAME = 0, -}; - -enum class MultimodalinputEventInterfaceCode { - HANDLE_KEY_EVENT = 0, - HANDLE_POINTER_EVENT = 1, -}; - -} // namespace MMI -} // namespace OHOS -#endif // MULTIMODALINPUT_IPC_INTERFACE_CODE_H diff --git a/service/connect_manager/src/multimodal_input_connect_manager.cpp b/service/connect_manager/src/multimodal_input_connect_manager.cpp index 6ebcc3e508bc10eef7d3349c00944b9e74479803..b56554d8a4b0c98361da2267d3f5da69e37f8ed6 100644 --- a/service/connect_manager/src/multimodal_input_connect_manager.cpp +++ b/service/connect_manager/src/multimodal_input_connect_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -20,6 +20,10 @@ #include "input_binder_client_server.h" #include "multimodal_input_connect_death_recipient.h" +#include "pixel_map.h" +#include "mmi_event_map.h" +#include "mmi_log.h" +#include "error_multimodal.h" #undef MMI_LOG_DOMAIN #define MMI_LOG_DOMAIN MMI_LOG_SERVER @@ -49,14 +53,12 @@ int32_t MultimodalInputConnectManager::AllocSocketPair(const int32_t moduleType) CALL_DEBUG_ENTER; std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - const std::string programName(GetProgramName()); int32_t result = multimodalInputConnectService_->AllocSocketFd(programName, moduleType, socketFd_, tokenType_); if (result != RET_OK) { MMI_HILOGE("AllocSocketFd has error:%{public}d", result); return RET_ERR; } - MMI_HILOGD("AllocSocketPair success. socketFd_:%{public}d tokenType_:%{public}d", socketFd_, tokenType_); return RET_OK; } @@ -71,7 +73,9 @@ int32_t MultimodalInputConnectManager::GetDisplayBindInfo(DisplayBindInfos &info { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetDisplayBindInfo(infos); + infos.clear(); + int32_t ret = multimodalInputConnectService_->GetDisplayBindInfo(infos); + return ret; } int32_t MultimodalInputConnectManager::GetAllMmiSubscribedEvents(std::map, @@ -79,7 +83,11 @@ int32_t MultimodalInputConnectManager::GetAllMmiSubscribedEvents(std::map guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetAllMmiSubscribedEvents(datas); + struct MmiEventMap mmiEventMap; + auto ret = multimodalInputConnectService_->GetAllMmiSubscribedEvents(mmiEventMap); + datas.clear(); + datas = mmiEventMap.datas; + return ret; } int32_t MultimodalInputConnectManager::SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg) @@ -93,7 +101,9 @@ int32_t MultimodalInputConnectManager::GetWindowPid(int32_t windowId) { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetWindowPid(windowId); + int32_t windowPid = INVALID_PID; + multimodalInputConnectService_->GetWindowPid(windowId, windowPid); + return windowPid; } int32_t MultimodalInputConnectManager::AddInputEventFilter(sptr filter, int32_t filterId, @@ -137,14 +147,20 @@ int32_t MultimodalInputConnectManager::SetCustomCursor(int32_t windowId, int32_t { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SetCustomCursor(windowId, focusX, focusY, pixelMap); + CHKPR(pixelMap, ERR_INVALID_VALUE); + CursorPixelMap curPixelMap {}; + curPixelMap.pixelMap = pixelMap; + return multimodalInputConnectService_->SetCustomCursorPixelMap(windowId, focusX, focusY, curPixelMap); } int32_t MultimodalInputConnectManager::SetMouseIcon(int32_t windowId, void* pixelMap) { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SetMouseIcon(windowId, pixelMap); + CHKPR(pixelMap, ERR_INVALID_VALUE); + CursorPixelMap curPixelMap {}; + curPixelMap.pixelMap = pixelMap; + return multimodalInputConnectService_->SetMouseIcon(windowId, curPixelMap); } int32_t MultimodalInputConnectManager::SetMouseHotSpot( @@ -321,7 +337,13 @@ int32_t MultimodalInputConnectManager::GetDevice(int32_t deviceId, std::shared_p { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetDevice(deviceId, inputDevice); + InputDevice device = {}; + auto ret = multimodalInputConnectService_->GetDevice(deviceId, device); + if (ret == RET_OK) { + inputDevice = std::make_shared(device); + CHKPR(inputDevice, ERROR_NULL_POINTER); + } + return ret; } int32_t MultimodalInputConnectManager::GetKeyboardType(int32_t deviceId, int32_t &keyboardType) @@ -418,7 +440,8 @@ int32_t MultimodalInputConnectManager::SubscribeKeyEvent(int32_t subscribeId, co { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SubscribeKeyEvent(subscribeId, option); + CHKPR(option, ERR_INVALID_VALUE); + return multimodalInputConnectService_->SubscribeKeyEvent(subscribeId, *option); } int32_t MultimodalInputConnectManager::UnsubscribeKeyEvent(int32_t subscribeId) @@ -432,7 +455,8 @@ int32_t MultimodalInputConnectManager::SubscribeHotkey(int32_t subscribeId, cons { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SubscribeHotkey(subscribeId, option); + CHKPR(option, ERR_INVALID_VALUE); + return multimodalInputConnectService_->SubscribeHotkey(subscribeId, *option); } int32_t MultimodalInputConnectManager::UnsubscribeHotkey(int32_t subscribeId) @@ -519,7 +543,8 @@ int32_t MultimodalInputConnectManager::InjectKeyEvent(const std::shared_ptr guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->InjectKeyEvent(event, isNativeInject); + CHKPR(event, ERR_INVALID_VALUE); + return multimodalInputConnectService_->InjectKeyEvent(*event, isNativeInject); } int32_t MultimodalInputConnectManager::InjectPointerEvent(const std::shared_ptr pointerEvent, @@ -527,7 +552,8 @@ int32_t MultimodalInputConnectManager::InjectPointerEvent(const std::shared_ptr< { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->InjectPointerEvent(pointerEvent, isNativeInject); + CHKPR(pointerEvent, ERR_INVALID_VALUE); + return multimodalInputConnectService_->InjectPointerEvent(*pointerEvent, isNativeInject); } int32_t MultimodalInputConnectManager::InjectTouchPadEvent(std::shared_ptr pointerEvent, @@ -535,7 +561,8 @@ int32_t MultimodalInputConnectManager::InjectTouchPadEvent(std::shared_ptr guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->InjectTouchPadEvent(pointerEvent, touchpadCDG, isNativeInject); + CHKPR(pointerEvent, ERR_INVALID_VALUE); + return multimodalInputConnectService_->InjectTouchPadEvent(*pointerEvent.get(), touchpadCDG, isNativeInject); } int32_t MultimodalInputConnectManager::SetAnrObserver() @@ -575,7 +602,7 @@ bool MultimodalInputConnectManager::ConnectMultimodalInputService() __attribute_ } auto sm = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); CHKPF(sm); - auto sa = sm->CheckSystemAbility(IMultimodalInputConnect::MULTIMODAL_INPUT_CONNECT_SERVICE_ID); + auto sa = sm->CheckSystemAbility(MultimodalInputConnectManager::MULTIMODAL_INPUT_CONNECT_SERVICE_ID); CHKPF(sa); std::weak_ptr weakPtr = shared_from_this(); @@ -836,8 +863,14 @@ int32_t MultimodalInputConnectManager::GetKeyState(std::vector &pressed std::map &specialKeysState) { std::lock_guard guard(lock_); + std::unordered_map unorderedSpecialKeysState; CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetKeyState(pressedKeys, specialKeysState); + auto ret = multimodalInputConnectService_->GetKeyState(pressedKeys, unorderedSpecialKeysState); + specialKeysState.clear(); + for (const auto& [key, value] : unorderedSpecialKeysState) { + specialKeysState[key] = value; + } + return ret; } void MultimodalInputConnectManager::AddServiceWatcher(std::shared_ptr watcher) @@ -878,7 +911,16 @@ int32_t MultimodalInputConnectManager::GetInfraredFrequencies(std::vector guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetInfraredFrequencies(requencys); + std::vector infos = {}; + auto ret = multimodalInputConnectService_->GetInfraredFrequencies(infos); + if (infos.size() < 0) { + MMI_HILOGE("GetInfraredFrequencies failed"); + return RET_ERR; + } + for (auto& info : infos) { + requencys.push_back(info); + } + return ret; } int32_t MultimodalInputConnectManager::TransmitInfrared(int64_t number, std::vector& pattern) @@ -901,7 +943,10 @@ int32_t MultimodalInputConnectManager::SetPixelMapData(int32_t infoId, void* pix { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SetPixelMapData(infoId, pixelMap); + CHKPR(pixelMap, ERR_INVALID_VALUE); + CursorPixelMap curPixelMap {}; + curPixelMap.pixelMap = pixelMap; + return multimodalInputConnectService_->SetPixelMapData(infoId, curPixelMap); } int32_t MultimodalInputConnectManager::SetCurrentUser(int32_t userId) @@ -949,7 +994,11 @@ int32_t MultimodalInputConnectManager::GetPointerSnapshot(void *pixelMapPtr) { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetPointerSnapshot(pixelMapPtr); + CursorPixelMap curPixelMap {}; + auto ret = multimodalInputConnectService_->GetPointerSnapshot(curPixelMap); + CHKPR(curPixelMap.pixelMap, ERR_INVALID_VALUE); + pixelMapPtr = curPixelMap.pixelMap; + return ret; } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR @@ -969,7 +1018,8 @@ int32_t MultimodalInputConnectManager::AddVirtualInputDevice(std::shared_ptr guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->AddVirtualInputDevice(device, deviceId); + CHKPR(device, ERROR_NULL_POINTER); + return multimodalInputConnectService_->AddVirtualInputDevice(*device, deviceId); } int32_t MultimodalInputConnectManager::RemoveVirtualInputDevice(int32_t deviceId) @@ -1028,7 +1078,13 @@ int32_t MultimodalInputConnectManager::GetAllSystemHotkeys(std::vector guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->GetAllSystemHotkeys(keyOptions); + std::vector keyOptionsArray; + auto ret = multimodalInputConnectService_->GetAllSystemHotkeys(keyOptionsArray); + for (auto& opt : keyOptionsArray) { + keyOptions.push_back(std::make_unique(std::move(opt))); + } + + return ret; } int32_t MultimodalInputConnectManager::SetInputDeviceEnabled(int32_t deviceId, bool enable, int32_t index) @@ -1050,7 +1106,11 @@ int32_t MultimodalInputConnectManager::SetCustomCursor(int32_t windowId, CustomC { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SetCustomCursor(windowId, cursor, options); + CHKPR(cursor.pixelMap, RET_ERR); + CustomCursorParcel curParcel(cursor.pixelMap, cursor.focusX, cursor.focusY); + CursorOptionsParcel cOptionParcel {}; + cOptionParcel.followSystem = options.followSystem; + return multimodalInputConnectService_->SetCustomCursor(windowId, curParcel, cOptionParcel); } int32_t MultimodalInputConnectManager::SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId) diff --git a/service/connect_manager/src/multimodal_input_connect_proxy.cpp b/service/connect_manager/src/multimodal_input_connect_proxy.cpp deleted file mode 100644 index eb0e6cf22577677bcadaea587bcb0155d15a5e20..0000000000000000000000000000000000000000 --- a/service/connect_manager/src/multimodal_input_connect_proxy.cpp +++ /dev/null @@ -1,3055 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "multimodal_input_connect_proxy.h" - -#include "pixel_map.h" - -#include "multimodalinput_ipc_interface_code.h" -#include "multimodal_input_connect_def_parcel.h" - -#undef MMI_LOG_DOMAIN -#define MMI_LOG_DOMAIN MMI_LOG_SERVER -#undef MMI_LOG_TAG -#define MMI_LOG_TAG "MultimodalInputConnectProxy" - -namespace OHOS { -namespace MMI { -namespace { -constexpr int32_t SPECIAL_KEY_SIZE { 3 }; -constexpr int32_t SPECIAL_ARRAY_INDEX0 { 0 }; -constexpr int32_t SPECIAL_ARRAY_INDEX1 { 1 }; -constexpr int32_t SPECIAL_ARRAY_INDEX2 { 2 }; -constexpr int32_t MAX_AXIS_INFO { 64 }; - -int32_t ParseInputDevice(MessageParcel &reply, std::shared_ptr &inputDevice) -{ - CHKPR(inputDevice, RET_ERR); - int32_t value = 0; - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetId(value); - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetType(value); - std::string name; - READSTRING(reply, name, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetName(name); - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetBus(value); - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetVersion(value); - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetProduct(value); - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetVendor(value); - std::string phys; - READSTRING(reply, phys, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetPhys(phys); - std::string uniq; - READSTRING(reply, uniq, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetUniq(uniq); - uint64_t caps; - READUINT64(reply, caps, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetCapabilities(static_cast(caps)); - - uint32_t size = 0; - READUINT32(reply, size, IPC_PROXY_DEAD_OBJECT_ERR); - InputDevice::AxisInfo axis; - for (uint32_t i = 0; i < size; ++i) { - int32_t val = 0; - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetMinimum(val); - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetMaximum(val); - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetAxisType(val); - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetFuzz(val); - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetFlat(val); - READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetResolution(val); - inputDevice->AddAxisInfo(axis); - } - return RET_OK; -} -} // namespace - -MultimodalInputConnectProxy::MultimodalInputConnectProxy(const sptr &impl) - : IRemoteProxy(impl) -{ - MMI_HILOGI("Construct MMI proxy"); -} - -MultimodalInputConnectProxy::~MultimodalInputConnectProxy() -{ - MMI_HILOGI("Destruct MMI proxy"); -} - -int32_t MultimodalInputConnectProxy::AllocSocketFd(const std::string &programName, - const int32_t moduleType, int32_t &socketFd, int32_t &tokenType) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - ConnectReqParcel req; - req.data.moduleId = moduleType; - req.data.clientName = programName; - if (!data.WriteParcelable(&req)) { - MMI_HILOGE("Failed to write programName"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::ALLOC_SOCKET_FD), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - socketFd = reply.ReadFileDescriptor(); - if (socketFd < RET_OK) { - MMI_HILOGE("Read file descriptor failed, fd:%{public}d", socketFd); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - READINT32(reply, tokenType, IPC_PROXY_DEAD_OBJECT_ERR); - MMI_HILOGD("socketFd:%{public}d, tokenType:%{public}d", socketFd, tokenType); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::AddInputEventFilter(sptr filter, int32_t filterId, int32_t priority, - uint32_t deviceTags) -{ - CALL_DEBUG_ENTER; - CHKPR(filter, ERR_INVALID_VALUE); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(filter->AsObject().GetRefPtr())) { - MMI_HILOGE("Failed to write filter"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, filterId, ERR_INVALID_VALUE); - WRITEINT32(data, priority, ERR_INVALID_VALUE); - WRITEUINT32(data, deviceTags, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - ADD_INPUT_EVENT_FILTER), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request message failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::RemoveInputEventFilter(int32_t filterId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, filterId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - RMV_INPUT_EVENT_FILTER), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request message failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetMouseScrollRows(int32_t rows) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, rows, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_SCROLL_ROWS), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetCustomCursor(int32_t windowId, int32_t focusX, int32_t focusY, - void* pixelMap) __attribute__((no_sanitize("cfi"))) -{ - CALL_DEBUG_ENTER; - CHKPR(pixelMap, ERR_INVALID_VALUE); - OHOS::Media::PixelMap* pixelMapPtr = static_cast(pixelMap); - if (pixelMapPtr->GetCapacity() == 0) { - MMI_HILOGE("pixelMap is empty"); - return ERR_INVALID_VALUE; - } - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - WRITEINT32(data, focusX, ERR_INVALID_VALUE); - WRITEINT32(data, focusY, ERR_INVALID_VALUE); - pixelMapPtr->Marshalling(data); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_CUSTOM_CURSOR), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetMouseIcon(int32_t windowId, void* pixelMap) __attribute__((no_sanitize("cfi"))) -{ - CALL_DEBUG_ENTER; - CHKPR(pixelMap, ERR_INVALID_VALUE); - OHOS::Media::PixelMap* pixelMapPtr = static_cast(pixelMap); - if (pixelMapPtr->GetCapacity() == 0) { - MMI_HILOGE("pixelMap is empty, we dont have to pass it to the server"); - return ERR_INVALID_VALUE; - } - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - pixelMapPtr->Marshalling(data); - MMI_HILOGD("Send windowId:%{public}d", windowId); - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_ICON), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, pid, ERR_INVALID_VALUE); - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - WRITEINT32(data, hotSpotX, ERR_INVALID_VALUE); - WRITEINT32(data, hotSpotY, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_HOT_SPOT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetMouseScrollRows(int32_t &rows) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_MOUSE_SCROLL_ROWS), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, rows, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetPointerSize(int32_t size) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, size, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_SIZE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, pid, ERR_INVALID_VALUE); - WRITEINT32(data, uid, ERR_INVALID_VALUE); - WRITESTRING(data, bundleName, ERR_INVALID_VALUE); - WRITEINT32(data, napStatus, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_NAP_STATUS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetPointerSize(int32_t &size) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SIZE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, size, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetCursorSurfaceId(uint64_t &surfaceId) -{ - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - auto ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::GET_CURSOR_SURFACE_ID), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("SendRequest fail, error:%{public}d", ret); - return ret; - } - READUINT64(reply, surfaceId, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetMousePrimaryButton(int32_t primaryButton) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, primaryButton, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_MOUSE_PRIMARY_BUTTON), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetMousePrimaryButton(int32_t &primaryButton) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_MOUSE_PRIMARY_BUTTON), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, primaryButton, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetHoverScrollState(bool state) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEBOOL(data, state, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_HOVER_SCROLL_STATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetHoverScrollState(bool &state) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_HOVER_SCROLL_STATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READBOOL(reply, state, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetPointerVisible(bool visible, int32_t priority) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEBOOL(data, visible, ERR_INVALID_VALUE); - WRITEINT32(data, priority, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_VISIBLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::IsPointerVisible(bool &visible) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::IS_POINTER_VISIBLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READBOOL(reply, visible, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::MarkProcessed(int32_t eventType, int32_t eventId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, eventType, ERR_INVALID_VALUE); - WRITEINT32(data, eventId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::MARK_PROCESSED), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGD("Send request fail, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetPointerColor(int32_t color) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, color, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_COLOR), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetPointerColor(int32_t &color) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_COLOR), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, color, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetPointerSpeed(int32_t speed) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, speed, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_SPEED), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetPointerSpeed(int32_t &speed) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SPEED), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, speed, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::NotifyNapOnline() -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::NOTIFY_NAP_ONLINE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::RemoveInputEventObserver() -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - RMV_INPUT_EVENT_OBSERVER), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - - WRITEINT32(data, windowId, RET_ERR); - WRITEINT32(data, pointerStyle.size, RET_ERR); - WRITEINT32(data, pointerStyle.color, RET_ERR); - WRITEINT32(data, pointerStyle.id, RET_ERR); - WRITEBOOL(data, isUiExtension, RET_ERR); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_STYLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::ClearWindowPointerStyle(int32_t pid, int32_t windowId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - - WRITEINT32(data, pid, RET_ERR); - WRITEINT32(data, windowId, RET_ERR); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::CLEAN_WIDNOW_STYLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - WRITEINT32(data, windowId, RET_ERR); - WRITEBOOL(data, isUiExtension, RET_ERR); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_STYLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, pointerStyle.size, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(reply, pointerStyle.color, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(reply, pointerStyle.id, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(reply, pointerStyle.options, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::RegisterDevListener() -{ - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::REGISTER_DEV_MONITOR), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnregisterDevListener() -{ - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - UNREGISTER_DEV_MONITOR), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SupportKeys(int32_t deviceId, std::vector &keys, - std::vector &keystroke) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - WRITEINT32(data, deviceId); - WRITEINT32(data, static_cast(keys.size())); - for (const auto &item : keys) { - WRITEINT32(data, item); - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SUPPORT_KEYS), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - if (!reply.ReadBoolVector(&keystroke)) { - MMI_HILOGE("Read ids failed"); - return RET_ERR; - } - MMI_HILOGE("keystroke size:%{public}zu", keystroke.size()); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetDeviceIds(std::vector &ids) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_DEVICE_IDS), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - if (!reply.ReadInt32Vector(&ids)) { - MMI_HILOGE("Read vector failed"); - return RET_ERR; - } - MMI_HILOGD("The ids size:%{public}zu", ids.size()); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetDevice(int32_t deviceId, std::shared_ptr &inputDevice) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - WRITEINT32(data, deviceId); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_DEVICE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - ret = ParseInputDevice(reply, inputDevice); - if (ret != RET_OK) { - MMI_HILOGE("ParseInputDevice failed"); - return RET_ERR; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetKeyboardType(int32_t deviceId, int32_t &keyboardType) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - WRITEINT32(data, deviceId); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_KEYBOARD_TYPE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGD("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, keyboardType, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetKeyboardRepeatDelay(int32_t delay) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, delay, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_KEYBOARD_REPEAT_DELAY), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetKeyboardRepeatRate(int32_t rate) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, rate, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_KEYBOARD_REPEAT_RATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetKeyboardRepeatDelay(int32_t &delay) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_KEYBOARD_REPEAT_DELAY), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, delay, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetKeyboardRepeatRate(int32_t &rate) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_KEYBOARD_REPEAT_RATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, rate, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::AddInputHandler(InputHandlerType handlerType, - HandleEventType eventType, int32_t priority, uint32_t deviceTags, std::vector actionsType) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - int32_t actionsTypeSize = actionsType.size(); - WRITEINT32(data, handlerType, ERR_INVALID_VALUE); - WRITEINT32(data, actionsTypeSize, ERR_INVALID_VALUE); - if (actionsTypeSize == 0) { - WRITEUINT32(data, eventType, ERR_INVALID_VALUE); - WRITEINT32(data, priority, ERR_INVALID_VALUE); - WRITEUINT32(data, deviceTags, ERR_INVALID_VALUE); - } else { - for (const auto &item : actionsType) { - WRITEINT32(data, item, ERR_INVALID_VALUE); - } - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::ADD_INPUT_HANDLER), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::RemoveInputHandler(InputHandlerType handlerType, - HandleEventType eventType, int32_t priority, uint32_t deviceTags, std::vector actionsType) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - int32_t actionsTypeSize = actionsType.size(); - WRITEINT32(data, handlerType, ERR_INVALID_VALUE); - WRITEINT32(data, actionsTypeSize, ERR_INVALID_VALUE); - if (actionsType.empty()) { - WRITEUINT32(data, eventType, ERR_INVALID_VALUE); - WRITEINT32(data, priority, ERR_INVALID_VALUE); - WRITEUINT32(data, eventType, ERR_INVALID_VALUE); - } else { - WRITEINT32(data, static_cast(actionsType.size())); - for (const auto &item : actionsType) { - WRITEINT32(data, item); - } - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::REMOVE_INPUT_HANDLER), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::AddPreInputHandler( - int32_t handlerId, HandleEventType eventType, std::vector keys) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, handlerId, ERR_INVALID_VALUE); - WRITEINT32(data, eventType, ERR_INVALID_VALUE); - WRITEINT32(data, static_cast(keys.size()), ERR_INVALID_VALUE); - for (const auto &item :keys) { - WRITEINT32(data, item); - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::ADD_PRE_INPUT_HANDLER), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::RemovePreInputHandler(int32_t handlerId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, handlerId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::REMOVE_PRE_INPUT_HANDLER), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::HandleGestureMonitor(uint32_t code, - InputHandlerType handlerType, HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) -{ - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, handlerType, ERR_INVALID_VALUE); - WRITEUINT32(data, eventType, ERR_INVALID_VALUE); - WRITEUINT32(data, static_cast(gestureType), ERR_INVALID_VALUE); - WRITEINT32(data, fingers, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(code, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::AddGestureMonitor( - InputHandlerType handlerType, HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) -{ - return HandleGestureMonitor(static_cast(MultimodalinputConnectInterfaceCode::ADD_GESTURE_MONITOR), - handlerType, eventType, gestureType, fingers); -} - -int32_t MultimodalInputConnectProxy::RemoveGestureMonitor( - InputHandlerType handlerType, HandleEventType eventType, TouchGestureType gestureType, int32_t fingers) -{ - return HandleGestureMonitor(static_cast(MultimodalinputConnectInterfaceCode::REMOVE_GESTURE_MONITOR), - handlerType, eventType, gestureType, fingers); -} - -int32_t MultimodalInputConnectProxy::MarkEventConsumed(int32_t eventId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, eventId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::MARK_EVENT_CONSUMED), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::MoveMouseEvent(int32_t offsetX, int32_t offsetY) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, offsetX, ERR_INVALID_VALUE); - WRITEINT32(data, offsetY, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::MOVE_MOUSE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::InjectKeyEvent(const std::shared_ptr keyEvent, bool isNativeInject) -{ - CALL_DEBUG_ENTER; - CHKPR(keyEvent, ERR_INVALID_VALUE); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!keyEvent->WriteToParcel(data)) { - MMI_HILOGE("Failed to write inject event"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, isNativeInject, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::INJECT_KEY_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr keyOption) -{ - CALL_DEBUG_ENTER; - CHKPR(keyOption, ERR_INVALID_VALUE); - - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - if (!keyOption->WriteToParcel(data)) { - MMI_HILOGE("Failed to write key option"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribeKeyEvent(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_KEY_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SubscribeHotkey(int32_t subscribeId, const std::shared_ptr keyOption) -{ - CALL_DEBUG_ENTER; - CHKPR(keyOption, ERR_INVALID_VALUE); - - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - if (!keyOption->WriteToParcel(data)) { - MMI_HILOGE("Failed to write key option"); - return ERR_INVALID_VALUE; - } - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_HOT_KEY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribeHotkey(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_HOT_KEY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SubscribeTabletProximity(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SUBSCRIBE_TABLET_EVENT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribetabletProximity(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - UNSUBSCRIBE_TABLET_EVENT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER -int32_t MultimodalInputConnectProxy::SubscribeKeyMonitor(const KeyMonitorOption &keyOption) -{ - CALL_DEBUG_ENTER; - MessageParcel dataParcel; - if (!dataParcel.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!keyOption.Marshalling(dataParcel)) { - MMI_HILOGE("Failed to write key option"); - return ERR_INVALID_VALUE; - } - MessageParcel replyParcel; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - auto ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_MONITOR), - dataParcel, replyParcel, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribeKeyMonitor(const KeyMonitorOption &keyOption) -{ - CALL_DEBUG_ENTER; - MessageParcel dataParcel; - if (!dataParcel.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!keyOption.Marshalling(dataParcel)) { - MMI_HILOGE("Failed to write key option"); - return ERR_INVALID_VALUE; - } - MessageParcel replyParcel; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - auto ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_KEY_MONITOR), - dataParcel, replyParcel, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - -int32_t MultimodalInputConnectProxy::SubscribeSwitchEvent(int32_t subscribeId, int32_t switchType) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - WRITEINT32(data, switchType, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SUBSCRIBE_SWITCH_EVENT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribeSwitchEvent(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - UNSUBSCRIBE_SWITCH_EVENT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::QuerySwitchStatus(int32_t switchType, int32_t& state) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, switchType, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - QUERY_SWITCH_STATE_EVENT), data, reply, option); - READINT32(reply, state, ERR_INVALID_VALUE); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SubscribeLongPressEvent(int32_t subscribeId, - const LongPressRequest &longPressRequest) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - WRITEINT32(data, longPressRequest.fingerCount, ERR_INVALID_VALUE); - WRITEINT32(data, longPressRequest.duration, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SUBSCRIBE_LONG_PRESS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::UnsubscribeLongPressEvent(int32_t subscribeId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, subscribeId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - UNSUBSCRIBE_LONG_PRESS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::InjectPointerEvent(const std::shared_ptr pointerEvent, - bool isNativeInject) -{ - CHKPR(pointerEvent, ERR_INVALID_VALUE); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!pointerEvent->WriteToParcel(data)) { - MMI_HILOGE("Failed to write inject point event"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, isNativeInject, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::INJECT_POINTER_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::InjectTouchPadEvent(std::shared_ptr pointerEvent, - const TouchpadCDG &touchpadCDG, bool isNativeInject) -{ - CHKPR(pointerEvent, ERR_INVALID_VALUE); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!pointerEvent->WriteToParcel(data)) { - MMI_HILOGE("Failed to write inject point event"); - return ERR_INVALID_VALUE; - } - WRITEDOUBLE(data, touchpadCDG.ppi, ERR_INVALID_VALUE); - WRITEDOUBLE(data, touchpadCDG.size, ERR_INVALID_VALUE); - WRITEINT32(data, touchpadCDG.speed, ERR_INVALID_VALUE); - WRITEINT32(data, touchpadCDG.frequency, ERR_INVALID_VALUE); - WRITEBOOL(data, isNativeInject, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::INJECT_TOUCHPAD_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetAnrObserver() -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_ANR_OBSERVER), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetDisplayBindInfo(DisplayBindInfos &infos) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_DISPLAY_BIND_INFO), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - int32_t size = 0; - READINT32(reply, size, ERR_INVALID_VALUE); - infos.reserve(size); - for (int32_t i = 0; i < size; ++i) { - DisplayBindInfo info; - READINT32(reply, info.inputDeviceId, ERR_INVALID_VALUE); - READSTRING(reply, info.inputDeviceName, ERR_INVALID_VALUE); - READINT32(reply, info.displayId, ERR_INVALID_VALUE); - READSTRING(reply, info.displayName, ERR_INVALID_VALUE); - infos.push_back(info); - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetAllMmiSubscribedEvents(std::map, - int32_t> &datas) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_ALL_NAPSTATUS_DATA), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - int32_t size = 0; - READINT32(reply, size, ERR_INVALID_VALUE); - for (int32_t i = 0; i < size; ++i) { - NapProcess::NapStatusData data; - int32_t syncState = 0; - READINT32(reply, data.pid, ERR_INVALID_VALUE); - READINT32(reply, data.uid, ERR_INVALID_VALUE); - READSTRING(reply, data.bundleName, ERR_INVALID_VALUE); - READINT32(reply, syncState, ERR_INVALID_VALUE); - std::tuple tuple(data.pid, data.uid, data.bundleName); - datas.emplace(tuple, syncState); - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, deviceId, ERR_INVALID_VALUE); - WRITEINT32(data, displayId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_DISPLAY_BIND), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, result:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetWindowPid(int32_t windowId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_WINDOW_PID), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, result:%{public}d", ret); - return ret; - } - int32_t windowPid = INVALID_PID; - READINT32(reply, windowPid, ERR_INVALID_VALUE); - return windowPid; -} - -int32_t MultimodalInputConnectProxy::GetFunctionKeyState(int32_t funcKey, bool &state) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEINT32(data, funcKey, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_FUNCTION_KEY_STATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READBOOL(reply, state, ERR_INVALID_VALUE); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetFunctionKeyState(int32_t funcKey, bool enable) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEINT32(data, funcKey, ERR_INVALID_VALUE); - WRITEBOOL(data, enable, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_FUNCTION_KEY_STATE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetPointerLocation(int32_t x, int32_t y, int32_t displayId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEINT32(data, x, ERR_INVALID_VALUE); - WRITEINT32(data, y, ERR_INVALID_VALUE); - WRITEINT32(data, displayId, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_LOCATION), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetMouseCaptureMode(int32_t windowId, bool isCaptureMode) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - WRITEBOOL(data, isCaptureMode, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_CAPTURE_MODE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::AppendExtraData(const ExtraData& extraData) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, extraData.appended, ERR_INVALID_VALUE); - WRITEINT32(data, static_cast(extraData.buffer.size())); - for (const auto &item : extraData.buffer) { - WRITEUINT8(data, item); - } - WRITEINT32(data, extraData.toolType, ERR_INVALID_VALUE); - WRITEINT32(data, extraData.sourceType, ERR_INVALID_VALUE); - WRITEINT32(data, extraData.pointerId, ERR_INVALID_VALUE); - WRITEINT32(data, extraData.pullId, ERR_INVALID_VALUE); - WRITEINT32(data, extraData.eventId, ERR_INVALID_VALUE); - WRITEBOOL(data, extraData.drawCursor, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::APPEND_EXTRA_DATA), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::EnableCombineKey(bool enable) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, enable, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::ENABLE_COMBINE_KEY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::EnableInputDevice(bool enable) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, enable, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::ENABLE_INPUT_DEVICE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetKeyDownDuration(const std::string &businessId, int32_t delay) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITESTRING(data, businessId, ERR_INVALID_VALUE); - WRITEINT32(data, delay, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_KEY_DOWN_DURATION), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetTouchpadBoolData(bool switchFlag, int32_t type) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEBOOL(data, switchFlag, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(type, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetTouchpadBoolData(bool &switchFlag, int32_t type) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(type, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READBOOL(reply, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetTouchpadInt32Data(int32_t value, int32_t type) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, value, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(type, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetTouchpadInt32Data(int32_t &value, int32_t type) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(type, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetTouchpadCDGData(double &ppi, double &size, int32_t &speed, int32_t &frequency, - int32_t type) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(type, data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READDOUBLE(reply, ppi, IPC_PROXY_DEAD_OBJECT_ERR); - READDOUBLE(reply, size, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(reply, speed, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(reply, frequency, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetTouchpadScrollSwitch(bool switchFlag) -{ - return SetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_SCROLL_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadScrollSwitch(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_SCROLL_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadScrollDirection(bool state) -{ - return SetTouchpadBoolData(state, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_SCROLL_DIRECT_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadScrollDirection(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_SCROLL_DIRECT_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadTapSwitch(bool switchFlag) -{ - return SetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_TAP_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadTapSwitch(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_TAP_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadPointerSpeed(int32_t speed) -{ - return SetTouchpadInt32Data(speed, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_POINTER_SPEED)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadPointerSpeed(int32_t &speed) -{ - return GetTouchpadInt32Data(speed, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_POINTER_SPEED)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadCDG(TouchpadCDG &touchpadCDG) -{ - return GetTouchpadCDGData(touchpadCDG.ppi, touchpadCDG.size, touchpadCDG.speed, touchpadCDG.frequency, - static_cast(MultimodalinputConnectInterfaceCode::GET_TOUCHPAD_OPTION)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadPinchSwitch(bool switchFlag) -{ - return SetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_PINCH_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadPinchSwitch(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_PINCH_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadSwipeSwitch(bool switchFlag) -{ - return SetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_SWIPE_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadSwipeSwitch(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_SWIPE_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadRightClickType(int32_t type) -{ - return SetTouchpadInt32Data(type, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_RIGHT_CLICK_TYPE)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadRightClickType(int32_t &type) -{ - return GetTouchpadInt32Data(type, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_RIGHT_CLICK_TYPE)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadRotateSwitch(bool rotateSwitch) -{ - return SetTouchpadBoolData(rotateSwitch, static_cast(MultimodalinputConnectInterfaceCode:: - SET_TP_ROTATE_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadRotateSwitch(bool &rotateSwitch) -{ - return GetTouchpadBoolData(rotateSwitch, static_cast(MultimodalinputConnectInterfaceCode:: - GET_TP_ROTATE_SWITCH)); -} - -int32_t MultimodalInputConnectProxy::SetTouchpadDoubleTapAndDragState(bool switchFlag) -{ - return SetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - SET_DOUBLE_TAP_DRAG_STATE)); -} - -int32_t MultimodalInputConnectProxy::GetTouchpadDoubleTapAndDragState(bool &switchFlag) -{ - return GetTouchpadBoolData(switchFlag, static_cast(MultimodalinputConnectInterfaceCode:: - GET_DOUBLE_TAP_DRAG_STATE)); -} - -int32_t MultimodalInputConnectProxy::SetShieldStatus(int32_t shieldMode, bool isShield) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEINT32(data, shieldMode, ERR_INVALID_VALUE); - WRITEBOOL(data, isShield, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_SHIELD_STATUS), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetShieldStatus(int32_t shieldMode, bool &isShield) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEINT32(data, shieldMode, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - GET_SHIELD_STATUS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READBOOL(reply, isShield, ERR_INVALID_VALUE); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetKeyState(std::vector &pressedKeys, - std::map &specialKeysState) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::GET_KEY_STATE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - if (!reply.ReadInt32Vector(&pressedKeys)) { - MMI_HILOGE("Read vector failed"); - return RET_ERR; - } - MMI_HILOGD("pressedKeys size:%{public}zu", pressedKeys.size()); - std::vector specialKeysStateTmp; - if (!reply.ReadInt32Vector(&specialKeysStateTmp)) { - MMI_HILOGE("Read vector failed"); - return RET_ERR; - } - if (specialKeysStateTmp.size() != SPECIAL_KEY_SIZE) { - MMI_HILOGE("The number of special key is not three"); - return RET_ERR; - } - specialKeysState[KeyEvent::KEYCODE_CAPS_LOCK] = specialKeysStateTmp[SPECIAL_ARRAY_INDEX0]; - specialKeysState[KeyEvent::KEYCODE_SCROLL_LOCK] = specialKeysStateTmp[SPECIAL_ARRAY_INDEX1]; - specialKeysState[KeyEvent::KEYCODE_NUM_LOCK] = specialKeysStateTmp[SPECIAL_ARRAY_INDEX2]; - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::Authorize(bool isAuthorize) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, isAuthorize, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::NATIVE_AUTHORIZE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::CancelInjection() -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::NATIVE_CANCEL_INJECTION), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::HasIrEmitter(bool &hasIrEmitter) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::NATIVE_INFRARED_OWN), - data, reply, option); - READBOOL(reply, hasIrEmitter, IPC_PROXY_DEAD_OBJECT_ERR); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::HasIrEmitter Send request fail, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::GetInfraredFrequencies(std::vector& requencys) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast( - MultimodalinputConnectInterfaceCode::NATIVE_INFRARED_FREQUENCY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::GetInfraredFrequencies Send request fail, ret:%{public}d", ret); - return ret; - } - int64_t number; - READINT64(reply, number, IPC_PROXY_DEAD_OBJECT_ERR); - int64_t min = 0; - int64_t max = 0; - for (int32_t i = 0; i < number; i++) { - READINT64(reply, max); - READINT64(reply, min); - InfraredFrequency item; - item.max_ = max; - item.min_ = min; - requencys.push_back(item); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::TransmitInfrared(int64_t number, std::vector& pattern) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT64(data, number, ERR_INVALID_VALUE); - WRITEINT32(data, static_cast(pattern.size()), ERR_INVALID_VALUE); - for (const auto &item : pattern) { - WRITEINT64(data, item); - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast( - MultimodalinputConnectInterfaceCode::NATIVE_CANCEL_TRANSMIT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::TransmitInfrared Send request fail, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD -int32_t MultimodalInputConnectProxy::CreateVKeyboardDevice(sptr &vkeyboardDevice) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::CREATE_VKEYBOARD_DEVICE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("CreateVKeyboardDevice Send request fail, ret:%{public}d", ret); - } - vkeyboardDevice = reply.ReadRemoteObject(); - CHKPR(vkeyboardDevice, ERR_INVALID_VALUE); - return ret; -} -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - -int32_t MultimodalInputConnectProxy::SetPixelMapData(int32_t infoId, void* pixelMap) - __attribute__((no_sanitize("cfi"))) -{ - CALL_DEBUG_ENTER; - CHKPR(pixelMap, RET_ERR); - if (infoId < 0) { - MMI_HILOGE("Invalid infoId"); - return RET_ERR; - } - OHOS::Media::PixelMap* pixelMapPtr = static_cast(pixelMap); - if (pixelMapPtr->GetCapacity() == 0) { - MMI_HILOGE("pixelMap is empty"); - return RET_ERR; - } - MMI_HILOGD("The byteCount:%{public}d, width:%{public}d, height:%{public}d", - pixelMapPtr->GetByteCount(), pixelMapPtr->GetWidth(), pixelMapPtr->GetHeight()); - - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, infoId, ERR_INVALID_VALUE); - pixelMapPtr->Marshalling(data); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_PIXEL_MAP_DATA), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Failed to send request, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetMoveEventFilters(bool flag) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEBOOL(data, flag, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode:: - SET_MOVE_EVENT_FILTERS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetCurrentUser(int32_t userId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, userId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_CURRENT_USERID), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::EnableHardwareCursorStats(bool enable) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - - WRITEBOOL(data, enable, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::ENABLE_HARDWARE_CURSOR_STATS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::GET_HARDWARE_CURSOR_STATS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READUINT32(reply, frameCount, IPC_PROXY_DEAD_OBJECT_ERR); - READUINT32(reply, vsyncCount, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR -int32_t MultimodalInputConnectProxy::GetPointerSnapshot(void *pixelMapPtr) -{ - CALL_DEBUG_ENTER; - CHKPR(pixelMapPtr, ERR_INVALID_VALUE); - std::shared_ptr *newPixelMapPtr = static_cast *>(pixelMapPtr); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SNAPSHOT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - (*newPixelMapPtr).reset(Media::PixelMap::Unmarshalling(reply)); - CHKPR(*newPixelMapPtr, RET_ERR); - return ret; -} -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - -int32_t MultimodalInputConnectProxy::SetTouchpadScrollRows(int32_t rows) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, rows, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_TOUCHPAD_SCROLL_ROWS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetTouchpadScrollRows(int32_t &rows) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::GET_TOUCHPAD_SCROLL_ROWS), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - return ret; - } - READINT32(reply, rows, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::AddVirtualInputDevice(std::shared_ptr device, int32_t &deviceId) -{ - CALL_DEBUG_ENTER; - CHKPR(device, ERROR_NULL_POINTER); - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - auto axisInfo = device->GetAxisInfo(); - if (axisInfo.size() > MAX_AXIS_INFO) { - return RET_ERR; - } - WRITEINT32(data, device->GetId(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, device->GetType(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(data, device->GetName(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, device->GetBus(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, device->GetVersion(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, device->GetProduct(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, device->GetVendor(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(data, device->GetPhys(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(data, device->GetUniq(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEUINT64(data, static_cast(device->GetCapabilities()), IPC_STUB_WRITE_PARCEL_ERR); - WRITEUINT32(data, static_cast(axisInfo.size()), IPC_STUB_WRITE_PARCEL_ERR); - for (const auto &item : axisInfo) { - WRITEINT32(data, item.GetMinimum(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, item.GetMaximum(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, item.GetAxisType(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, item.GetFuzz(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, item.GetFlat(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(data, item.GetResolution(), IPC_STUB_WRITE_PARCEL_ERR); - } - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - MessageParcel reply; - MessageOption option; - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::ADD_VIRTUAL_INPUT_DEVICE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return RET_ERR; - } - READINT32(reply, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::RemoveVirtualInputDevice(int32_t deviceId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, deviceId, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::REMOVE_VIRTUAL_INPUT_DEVICE), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, ret, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::SetTouchpadThreeFingersTapSwitch(bool switchFlag) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, switchFlag, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast( - MultimodalinputConnectInterfaceCode::SET_THREE_GINGERS_TAPSWITCH), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::SetTouchpadSwitch Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetTouchpadThreeFingersTapSwitch(bool &switchFlag) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast( - MultimodalinputConnectInterfaceCode::GET_THREE_GINGERS_TAPSWITCH), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::GetTouchpadThree Send request fail, ret:%{public}d", ret); - } else { - READBOOL(reply, switchFlag); - } - return RET_OK; -} - -#ifdef OHOS_BUILD_ENABLE_ANCO -int32_t MultimodalInputConnectProxy::AncoAddChannel(sptr channel) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(channel->AsObject())) { - MMI_HILOGE("Failed to write IRemoteObject"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::ADD_ANCO_CHANNEL), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, ret, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::AncoRemoveChannel(sptr channel) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(channel->AsObject())) { - MMI_HILOGE("Failed to write IRemoteObject"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::REMOVE_ANCO_CHANNEL), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, ret, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::CheckKnuckleEvent(float pointX, float pointY, bool &touchType) -{ - CALL_INFO_TRACE; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - - WRITEFLOAT(data, pointX, ERR_INVALID_VALUE); - WRITEFLOAT(data, pointY, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::CHECK_KNUCKLE_EVENT), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("SendRequest fail, error:%{public}d", ret); - return ret; - } - READBOOL(reply, touchType, RET_ERR); - return RET_OK; -} -#endif // OHOS_BUILD_ENABLE_ANCO - -int32_t MultimodalInputConnectProxy::TransferBinderClientSrv(const sptr &binderClientObject) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEREMOTEOBJECT(data, binderClientObject, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::TRANSFER_BINDER_CLIENT_SERVICE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, ret, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::SkipPointerLayer(bool isSkip) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - WRITEBOOL(data, isSkip, ERR_INVALID_VALUE); - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SKIP_POINTER_LAYER), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - return ret; - } - READINT32(reply, ret, IPC_PROXY_DEAD_OBJECT_ERR); - return ret; -} - -int32_t MultimodalInputConnectProxy::SetClientInfo(int32_t pid, uint64_t readThreadId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, pid, ERR_INVALID_VALUE); - WRITEUINT64(data, readThreadId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_CLIENT_INFO), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetIntervalSinceLastInput(int64_t &timeInterval) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest(static_cast( - MultimodalinputConnectInterfaceCode::GET_SYSTEM_EVENT_TIME_INTERVAL), data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::GetTouchpadThree Send request fail, ret:%{public}d", ret); - } else { - READINT64(reply, timeInterval); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::GetAllSystemHotkeys(std::vector> &keyOptions) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return RET_ERR; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::GET_ALL_SYSTEM_HOT_KEY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGD("Send request failed, ret:%{public}d", ret); - return ret; - } - int32_t keyOptionsCount = -1; - if (!reply.ReadInt32(keyOptionsCount)) { - MMI_HILOGE("Read keyOptionsCount failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - for (int32_t i = 0; i < keyOptionsCount; ++i) { - std::unique_ptr keyOption = std::make_unique(); - if (!keyOption->ReadFromParcel(reply)) { - MMI_HILOGE("Read keyOption failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - keyOptions.push_back(std::move(keyOption)); - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetInputDeviceEnabled(int32_t deviceId, bool enable, int32_t index) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, deviceId, ERR_INVALID_VALUE); - WRITEBOOL(data, enable, ERR_INVALID_VALUE); - WRITEINT32(data, index, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_INPUT_DEVICE_ENABLE), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, param.sourceWindowId, ERR_INVALID_VALUE); - WRITEINT32(data, param.targetWindowId, ERR_INVALID_VALUE); - WRITEINT32(data, param.x, ERR_INVALID_VALUE); - WRITEINT32(data, param.y, ERR_INVALID_VALUE); - WRITEBOOL(data, autoGenDown, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SHIFT_APP_POINTER_EVENT), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("MultimodalInputConnectProxy::ShiftAppPointerEvent Send request fail, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectProxy::SetCustomCursor(int32_t windowId, CustomCursor cursor, - CursorOptions options) __attribute__((no_sanitize("cfi"))) -{ - CALL_DEBUG_ENTER; - CHKPR(cursor.pixelMap, RET_ERR); - OHOS::Media::PixelMap* pixelMapPtr = static_cast(cursor.pixelMap); - CHKPR(pixelMapPtr, RET_ERR); - if (pixelMapPtr->GetCapacity() == 0) { - MMI_HILOGE("pixelMap is empty"); - return ERR_INVALID_VALUE; - } - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEINT32(data, windowId, ERR_INVALID_VALUE); - pixelMapPtr->Marshalling(data); - WRITEINT32(data, cursor.focusX, ERR_INVALID_VALUE); - WRITEINT32(data, cursor.focusY, ERR_INVALID_VALUE); - WRITEBOOL(data, options.followSystem, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = - remote->SendRequest(static_cast(MultimodalinputConnectInterfaceCode::SET_CUSTOM_MOUSE_CURSOR), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } else { - READINT32(reply, ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEUINT64(data, screenId, ERR_INVALID_VALUE); - WRITEUINT64(data, displayNodeScreenId, ERR_INVALID_VALUE); - - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_MUILT_WINDOW_SCREEN_ID), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::SetKnuckleSwitch(bool knuckleSwitch) -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - WRITEBOOL(data, knuckleSwitch, ERR_INVALID_VALUE); - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::SET_KNUCKLE_SWITCH), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request fail, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectProxy::LaunchAiScreenAbility() -{ - CALL_DEBUG_ENTER; - MessageParcel data; - if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { - MMI_HILOGE("Failed to write descriptor"); - return ERR_INVALID_VALUE; - } - MessageParcel reply; - MessageOption option; - sptr remote = Remote(); - CHKPR(remote, RET_ERR); - int32_t ret = remote->SendRequest( - static_cast(MultimodalinputConnectInterfaceCode::LAUNCH_AI_SCREEN_ABILITY), - data, reply, option); - if (ret != RET_OK) { - MMI_HILOGE("Send request failed, ret:%{public}d", ret); - } - return ret; -} -} // namespace MMI -} // namespace OHOS diff --git a/service/connect_manager/src/multimodal_input_connect_stub.cpp b/service/connect_manager/src/multimodal_input_connect_stub.cpp deleted file mode 100644 index e9aacfae99b13ab1304211e4a057d54dd00c2921..0000000000000000000000000000000000000000 --- a/service/connect_manager/src/multimodal_input_connect_stub.cpp +++ /dev/null @@ -1,3519 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "multimodal_input_connect_stub.h" - - -#include "string_ex.h" - -#include "bytrace_adapter.h" -#include "multimodal_input_connect_def_parcel.h" -#include "permission_helper.h" -#include "pixel_map.h" -#include "time_cost_chk.h" -#ifdef PLAYER_FRAMEWORK_EXISTS -#include "input_screen_capture_agent.h" -#endif // PLAYER_FRAMEWORK_EXISTS - -#undef MMI_LOG_DOMAIN -#define MMI_LOG_DOMAIN MMI_LOG_SERVER -#undef MMI_LOG_TAG -#define MMI_LOG_TAG "MultimodalInputConnectStub" - -namespace OHOS { -namespace MMI { -namespace { -constexpr int32_t MAX_AXIS_INFO { 64 }; -constexpr int32_t MIN_ROWS { 1 }; -constexpr int32_t MAX_ROWS { 100 }; -constexpr int32_t TOUCHPAD_SCROLL_ROWS { 3 }; -constexpr int32_t UID_TRANSFORM_DIVISOR { 200000 }; -constexpr int32_t MAX_SPEED { 20 }; -constexpr int32_t MIN_SPEED { 1 }; -constexpr int32_t KEY_MAX_LIST_SIZE { 5 }; - -int32_t g_parseInputDevice(MessageParcel &data, std::shared_ptr &inputDevice) -{ - CHKPR(inputDevice, RET_ERR); - int32_t value = 0; - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetId(value); - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetType(value); - std::string element; - READSTRING(data, element, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetName(element); - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetBus(value); - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetVersion(value); - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetProduct(value); - READINT32(data, value, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetVendor(value); - READSTRING(data, element, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetPhys(element); - READSTRING(data, element, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetUniq(element); - uint64_t caps; - READUINT64(data, caps, IPC_PROXY_DEAD_OBJECT_ERR); - inputDevice->SetCapabilities(static_cast(caps)); - uint32_t size = 0; - READUINT32(data, size, IPC_PROXY_DEAD_OBJECT_ERR); - if (size > MAX_AXIS_INFO) { - return RET_ERR; - } - InputDevice::AxisInfo axis; - for (uint32_t i = 0; i < size; ++i) { - int32_t val = 0; - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetMinimum(val); - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetMaximum(val); - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetAxisType(val); - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetFuzz(val); - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetFlat(val); - READINT32(data, val, IPC_PROXY_DEAD_OBJECT_ERR); - axis.SetResolution(val); - inputDevice->AddAxisInfo(axis); - } - return RET_OK; -} -} // namespace -const int32_t TUPLE_PID { 0 }; -const int32_t TUPLE_UID { 1 }; -const int32_t TUPLE_NAME { 2 }; -const int32_t DEFAULT_POINTER_COLOR { 0x000000 }; -constexpr int32_t MAX_N_TRANSMIT_INFRARED_PATTERN { 1024 }; - -int32_t MultimodalInputConnectStub::OnRemoteRequest(uint32_t code, MessageParcel& data, - MessageParcel& reply, MessageOption& option) -{ - int32_t pid = GetCallingPid(); - TimeCostChk chk("IPC-OnRemoteRequest", "overtime 300(us)", MAX_OVER_TIME, pid, - static_cast(code)); - MMI_HILOGD("RemoteRequest code:%{public}d, tid:%{public}" PRIu64 ", pid:%{public}d", code, GetThisThreadId(), pid); - - std::u16string descriptor = data.ReadInterfaceToken(); - if (descriptor != IMultimodalInputConnect::GetDescriptor()) { - MMI_HILOGE("Get unexpect descriptor:%{public}s", Str16ToStr8(descriptor).c_str()); - return ERR_INVALID_STATE; - } - ResetLogTrace(); - BytraceAdapter::StartIpcServer(code); - int32_t ret = RET_ERR; - switch (code) { - case static_cast(MultimodalinputConnectInterfaceCode::ALLOC_SOCKET_FD): - ret = StubHandleAllocSocketFd(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ADD_INPUT_EVENT_FILTER): - ret = StubAddInputEventFilter(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::RMV_INPUT_EVENT_FILTER): - ret = StubRemoveInputEventFilter(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_SCROLL_ROWS): - ret = StubSetMouseScrollRows(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_MOUSE_SCROLL_ROWS): - ret = StubGetMouseScrollRows(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_SIZE): - ret = StubSetPointerSize(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SIZE): - ret = StubGetPointerSize(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_CUSTOM_CURSOR): - ret = StubSetCustomCursor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_ICON): - ret = StubSetMouseIcon(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_PRIMARY_BUTTON): - ret = StubSetMousePrimaryButton(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_MOUSE_PRIMARY_BUTTON): - ret = StubGetMousePrimaryButton(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_HOVER_SCROLL_STATE): - ret = StubSetHoverScrollState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_HOVER_SCROLL_STATE): - ret = StubGetHoverScrollState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_VISIBLE): - ret = StubSetPointerVisible(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_STYLE): - ret = StubSetPointerStyle(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NOTIFY_NAP_ONLINE): - ret = StubNotifyNapOnline(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::RMV_INPUT_EVENT_OBSERVER): - ret = StubRemoveInputEventObserver(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_NAP_STATUS): - ret = StubSetNapStatus(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::CLEAN_WIDNOW_STYLE): - ret = StubClearWindowPointerStyle(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_STYLE): - ret = StubGetPointerStyle(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::IS_POINTER_VISIBLE): - ret = StubIsPointerVisible(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REGISTER_DEV_MONITOR): - ret = StubRegisterInputDeviceMonitor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNREGISTER_DEV_MONITOR): - ret = StubUnregisterInputDeviceMonitor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_DEVICE_IDS): - ret = StubGetDeviceIds(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_DEVICE): - ret = StubGetDevice(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUPPORT_KEYS): - ret = StubSupportKeys(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_KEYBOARD_TYPE): - ret = StubGetKeyboardType(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_COLOR): - ret = StubSetPointerColor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_COLOR): - ret = StubGetPointerColor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_SPEED): - ret = StubSetPointerSpeed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SPEED): - ret = StubGetPointerSpeed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_EVENT): - ret = StubSubscribeKeyEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_KEY_EVENT): - ret = StubUnsubscribeKeyEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_HOT_KEY): - ret = StubSubscribeHotkey(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_HOT_KEY): - ret = StubUnsubscribeHotkey(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_SWITCH_EVENT): - ret = StubSubscribeSwitchEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_SWITCH_EVENT): - ret = StubUnsubscribeSwitchEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_TABLET_EVENT): - ret = StubSubscribeTabletProximity(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_TABLET_EVENT): - ret = StubUnSubscribetabletProximity(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::MARK_PROCESSED): - ret = StubMarkProcessed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ADD_INPUT_HANDLER): - ret = StubAddInputHandler(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REMOVE_INPUT_HANDLER): - ret = StubRemoveInputHandler(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ADD_PRE_INPUT_HANDLER): - ret = StubAddPreInputHandler(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REMOVE_PRE_INPUT_HANDLER): - ret = StubRemovePreInputHandler(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ADD_GESTURE_MONITOR): - ret = StubAddGestureMonitor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REMOVE_GESTURE_MONITOR): - ret = StubRemoveGestureMonitor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::MARK_EVENT_CONSUMED): - ret = StubMarkEventConsumed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::MOVE_MOUSE): - ret = StubMoveMouseEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SHIFT_APP_POINTER_EVENT): - ret = StubShiftAppPointerEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::INJECT_KEY_EVENT): - ret = StubInjectKeyEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::INJECT_POINTER_EVENT): - ret = StubInjectPointerEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::INJECT_TOUCHPAD_EVENT): - ret = StubInjectTouchPadEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_ANR_OBSERVER): - ret = StubSetAnrListener(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_DISPLAY_BIND_INFO): - ret = StubGetDisplayBindInfo(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_ALL_NAPSTATUS_DATA): - ret = StubGetAllMmiSubscribedEvents(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_DISPLAY_BIND): - ret = StubSetDisplayBind(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_FUNCTION_KEY_STATE): - ret = StubGetFunctionKeyState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_FUNCTION_KEY_STATE): - ret = StubSetFunctionKeyState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_POINTER_LOCATION): - ret = StubSetPointerLocation(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_CAPTURE_MODE): - ret = StubSetMouseCaptureMode(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_WINDOW_PID): - ret = StubGetWindowPid(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::APPEND_EXTRA_DATA): - ret = StubAppendExtraData(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ENABLE_INPUT_DEVICE): - ret = StubEnableInputDevice(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ENABLE_COMBINE_KEY): - ret = StubEnableCombineKey(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_KEY_DOWN_DURATION): - ret = StubSetKeyDownDuration(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_SCROLL_SWITCH): - ret = StubSetTouchpadScrollSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_SCROLL_SWITCH): - ret = StubGetTouchpadScrollSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_SCROLL_DIRECT_SWITCH): - ret = StubSetTouchpadScrollDirection(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_SCROLL_DIRECT_SWITCH): - ret = StubGetTouchpadScrollDirection(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_TAP_SWITCH): - ret = StubSetTouchpadTapSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_TAP_SWITCH): - ret = StubGetTouchpadTapSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_POINTER_SPEED): - ret = StubSetTouchpadPointerSpeed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_POINTER_SPEED): - ret = StubGetTouchpadPointerSpeed(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TOUCHPAD_OPTION): - ret = StubGetTouchpadCDG(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_KEYBOARD_REPEAT_DELAY): - ret = StubSetKeyboardRepeatDelay(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_KEYBOARD_REPEAT_RATE): - ret = StubSetKeyboardRepeatRate(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_PINCH_SWITCH): - ret = StubSetTouchpadPinchSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_PINCH_SWITCH): - ret = StubGetTouchpadPinchSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_SWIPE_SWITCH): - ret = StubSetTouchpadSwipeSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_SWIPE_SWITCH): - ret = StubGetTouchpadSwipeSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_RIGHT_CLICK_TYPE): - ret = StubSetTouchpadRightClickType(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_RIGHT_CLICK_TYPE): - ret = StubGetTouchpadRightClickType(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TP_ROTATE_SWITCH): - ret = StubSetTouchpadRotateSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TP_ROTATE_SWITCH): - ret = StubGetTouchpadRotateSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_DOUBLE_TAP_DRAG_STATE): - ret = StubSetTouchpadDoubleTapAndDragState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_DOUBLE_TAP_DRAG_STATE): - ret = StubGetTouchpadDoubleTapAndDragState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_KEYBOARD_REPEAT_DELAY): - ret = StubGetKeyboardRepeatDelay(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_KEYBOARD_REPEAT_RATE): - ret = StubGetKeyboardRepeatRate(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_HOT_SPOT): - ret = StubSetMouseHotSpot(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_SHIELD_STATUS): - ret = StubSetShieldStatus(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_SHIELD_STATUS): - ret = StubGetShieldStatus(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_KEY_STATE): - ret = StubGetKeyState(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NATIVE_AUTHORIZE): - ret = StubAuthorize(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NATIVE_CANCEL_INJECTION): - ret = StubCancelInjection(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NATIVE_INFRARED_OWN): - ret = StubHasIrEmitter(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NATIVE_INFRARED_FREQUENCY): - ret = StubGetInfraredFrequencies(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::NATIVE_CANCEL_TRANSMIT): - ret = StubTransmitInfrared(data, reply); - break; -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - case static_cast(MultimodalinputConnectInterfaceCode::CREATE_VKEYBOARD_DEVICE): - ret = StubCreateVKeyboardDevice(data, reply); - break; -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - case static_cast(MultimodalinputConnectInterfaceCode::SET_PIXEL_MAP_DATA): - ret = StubSetPixelMapData(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MOVE_EVENT_FILTERS): - ret = StubSetMoveEventFilters(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_CURRENT_USERID): - ret = StubSetCurrentUser(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::ENABLE_HARDWARE_CURSOR_STATS): - ret = StubEnableHardwareCursorStats(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_HARDWARE_CURSOR_STATS): - ret = StubGetHardwareCursorStats(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_TOUCHPAD_SCROLL_ROWS): - ret = StubSetTouchpadScrollRows(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_TOUCHPAD_SCROLL_ROWS): - ret = StubGetTouchpadScrollRows(data, reply); - break; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - case static_cast(MultimodalinputConnectInterfaceCode::GET_POINTER_SNAPSHOT): - ret = StubGetPointerSnapshot(data, reply); - break; -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - case static_cast(MultimodalinputConnectInterfaceCode::ADD_VIRTUAL_INPUT_DEVICE): - ret = StubAddVirtualInputDevice(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REMOVE_VIRTUAL_INPUT_DEVICE): - ret = StubRemoveVirtualInputDevice(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_THREE_GINGERS_TAPSWITCH): - ret = StubSetTouchpadThreeFingersTapSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_THREE_GINGERS_TAPSWITCH): - ret = StubGetTouchpadThreeFingersTapSwitch(data, reply); - break; -#ifdef OHOS_BUILD_ENABLE_ANCO - case static_cast(MultimodalinputConnectInterfaceCode::ADD_ANCO_CHANNEL): - ret = StubAncoAddChannel(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::REMOVE_ANCO_CHANNEL): - ret = StubAncoRemoveChannel(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::CHECK_KNUCKLE_EVENT): - ret = StubCheckKnuckleEvent(data, reply); - break; -#endif // OHOS_BUILD_ENABLE_ANCO - case static_cast(MultimodalinputConnectInterfaceCode::TRANSFER_BINDER_CLIENT_SERVICE): - ret = StubTransferBinderClientService(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_CLIENT_INFO): - ret = StubSetClientInfo(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_SYSTEM_EVENT_TIME_INTERVAL): - ret = StubGetIntervalSinceLastInput(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_ALL_SYSTEM_HOT_KEY): - ret = StubGetAllSystemHotkeys(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::GET_CURSOR_SURFACE_ID): - ret = StubGetCursorSurfaceId(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_LONG_PRESS): - ret = StubSubscribeLongPressEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_LONG_PRESS): - ret = StubUnsubscribeLongPressEvent(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_INPUT_DEVICE_ENABLE): - ret = StubSetInputDeviceInputEnable(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_CUSTOM_MOUSE_CURSOR): - ret = StubSetCustomMouseCursor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_MUILT_WINDOW_SCREEN_ID): - ret = StubSetMultiWindowScreenId(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::SET_KNUCKLE_SWITCH): - ret = StubSetKnuckleSwitch(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::LAUNCH_AI_SCREEN_ABILITY): - ret = StubLaunchAiScreenAbility(data, reply); - break; -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_MONITOR): - ret = StubSubscribeKeyMonitor(data, reply); - break; - case static_cast(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_KEY_MONITOR): - ret = StubUnsubscribeKeyMonitor(data, reply); - break; -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - case static_cast(MultimodalinputConnectInterfaceCode::QUERY_SWITCH_STATE_EVENT): - ret = StubQuerySwitchStatus(data, reply); - break; - default: { - MMI_HILOGE("Unknown code:%{public}u, go switch default", code); - ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } - } - BytraceAdapter::StopIpcServer(); - return ret; -} - -int32_t MultimodalInputConnectStub::StubHandleAllocSocketFd(MessageParcel& data, MessageParcel& reply) -{ - int32_t pid = GetCallingPid(); - if (!IsRunning()) { - MMI_HILOGE("Service is not running. pid:%{public}d, go switch default", pid); - return MMISERVICE_NOT_RUNNING; - } - sptr req = data.ReadParcelable(); - CHKPR(req, ERROR_NULL_POINTER); - MMI_HILOGD("clientName:%{public}s, moduleId:%{public}d", req->data.clientName.c_str(), req->data.moduleId); - if (req->data.clientName.empty()) { - MMI_HILOGE("Invalid clientName:empty"); - return RET_ERR; - } - - int32_t clientFd = INVALID_SOCKET_FD; - int32_t tokenType = PER_HELPER->GetTokenType(); - int32_t ret = AllocSocketFd(req->data.clientName, req->data.moduleId, clientFd, tokenType); - if (ret != RET_OK) { - MMI_HILOGE("AllocSocketFd failed pid:%{public}d, go switch default", pid); - if (clientFd >= 0) { - fdsan_close_with_tag(clientFd, TAG); - } - return ret; - } - - if (!reply.WriteFileDescriptor(clientFd)) { - MMI_HILOGE("Write file descriptor failed"); - fdsan_close_with_tag(clientFd, TAG); - return IPC_STUB_WRITE_PARCEL_ERR; - } - - WRITEINT32(reply, tokenType, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGI("Send clientFd to client, clientFd:%{public}d, tokenType:%{public}d", clientFd, tokenType); - fdsan_close_with_tag(clientFd, TAG); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubAddInputEventFilter(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckInputEventFilter()) { - MMI_HILOGE("Filter permission check failed"); - return ERROR_NO_PERMISSION; - } - sptr client = data.ReadRemoteObject(); - CHKPR(client, ERR_INVALID_VALUE); - sptr filter = iface_cast(client); - CHKPR(filter, ERROR_NULL_POINTER); - int32_t filterId = -1; - READINT32(data, filterId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t priority = 0; - READINT32(data, priority, IPC_PROXY_DEAD_OBJECT_ERR); - uint32_t deviceTags = 0; - READUINT32(data, deviceTags, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = AddInputEventFilter(filter, filterId, priority, deviceTags); - if (ret != RET_OK) { - MMI_HILOGE("Call AddInputEventFilter failed:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success pid:%{public}d", GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRemoveInputEventFilter(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckInputEventFilter()) { - MMI_HILOGE("Filter permission check failed"); - return ERROR_NO_PERMISSION; - } - int32_t filterId = -1; - READINT32(data, filterId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = RemoveInputEventFilter(filterId); - if (ret != RET_OK) { - MMI_HILOGE("Call RemoveInputEventFilter failed:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success pid:%{public}d", GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetMouseScrollRows(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t rows = 3; // the initial number of scrolling rows is 3. - READINT32(data, rows, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetMouseScrollRows(rows); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMouseScrollRows failed:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success rows:%{public}d, pid:%{public}d", rows, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetCustomCursor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t windowId = 0; - int32_t focusX = 0; - int32_t focusY = 0; - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, focusX, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, focusY, IPC_PROXY_DEAD_OBJECT_ERR); - if (windowId <= 0) { - MMI_HILOGE("Invalid windowId:%{public}d", windowId); - return RET_ERR; - } - OHOS::Media::PixelMap* pixelMap = Media::PixelMap::Unmarshalling(data); - CHKPR(pixelMap, RET_ERR); - focusX = focusX < 0 ? 0 : focusX; - focusY = focusY < 0 ? 0 : focusY; - focusX = focusX > pixelMap->GetWidth() ? pixelMap->GetWidth() : focusX; - focusY = focusY > pixelMap->GetHeight() ? pixelMap->GetHeight() : focusY; - int32_t ret = SetCustomCursor(windowId, focusX, focusY, (void*)pixelMap); - if (ret != RET_OK) { - MMI_HILOGE("Call SetCustomCursor failed:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetMouseIcon(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t windowId = 0; - OHOS::Media::PixelMap *pixelMap = OHOS::Media::PixelMap::Unmarshalling(data); - CHKPR(pixelMap, RET_ERR); - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - MMI_HILOGD("Reading windowid the tlv count:%{public}d", windowId); - if (windowId <= 0) { - MMI_HILOGE("Invalid windowId:%{public}d", windowId); - return RET_ERR; - } - - int32_t ret = SetMouseIcon(windowId, (void*)pixelMap); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMouseIcon failed:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetMouseHotSpot(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t windowId = 0; - int32_t winPid = -1; - READINT32(data, winPid, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - if (windowId <= 0) { - MMI_HILOGE("Invalid windowId:%{public}d", windowId); - return RET_ERR; - } - int32_t hotSpotX = 0; - READINT32(data, hotSpotX, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t hotSpotY = 0; - READINT32(data, hotSpotY, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetMouseHotSpot(winPid, windowId, hotSpotX, hotSpotY); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMouseHotSpot failed:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetMouseScrollRows(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t rows = 3; // the initial number of scrolling rows is 3. - int32_t ret = GetMouseScrollRows(rows); - if (ret != RET_OK) { - MMI_HILOGE("Call GetMouseScrollRows failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, rows, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Mouse scroll rows:%{public}d, ret:%{public}d", rows, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetPointerSize(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t size = 1; // the initial pointer size is 1. - READINT32(data, size, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetPointerSize(size); - if (ret != RET_OK) { - MMI_HILOGE("Call SetPointerSize failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success size:%{public}d, pid:%{public}d", size, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetNapStatus(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t napPid = -1; - int32_t napUid = -1; - std::string napBundleName; - int32_t napStatus = 0; - READINT32(data, napPid, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, napUid, IPC_PROXY_DEAD_OBJECT_ERR); - READSTRING(data, napBundleName, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, napStatus, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = SetNapStatus(napPid, napUid, napBundleName, napStatus); - if (ret != RET_OK) { - MMI_HILOGE("Call StubSetNapStatus failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success set napStatus:%{public}d, pid:%{public}d", napStatus, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetPointerSize(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t size = 1; // the initial pointer size is 1. - int32_t ret = GetPointerSize(size); - if (ret != RET_OK) { - MMI_HILOGE("Call GetPoinerSize failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, size, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Pointer size:%{public}d, ret:%{public}d", size, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetCursorSurfaceId(MessageParcel& data, MessageParcel& reply) -{ - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - uint64_t surfaceId {}; - auto ret = GetCursorSurfaceId(surfaceId); - if (ret != RET_OK) { - MMI_HILOGE("GetCursorSurfaceId fail, ret:%{public}d", ret); - return ret; - } - WRITEUINT64(reply, surfaceId, IPC_STUB_WRITE_PARCEL_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetMousePrimaryButton(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t primaryButton = -1; - READINT32(data, primaryButton, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetMousePrimaryButton(primaryButton); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMousePrimaryButton failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success primaryButton:%{public}d, pid:%{public}d", primaryButton, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetMousePrimaryButton(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t primaryButton = -1; - int32_t ret = GetMousePrimaryButton(primaryButton); - if (ret != RET_OK) { - MMI_HILOGE("Call GetMousePrimaryButton failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, primaryButton, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Mouse primaryButton:%{public}d, ret:%{public}d", primaryButton, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetHoverScrollState(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - bool state = true; - READBOOL(data, state, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetHoverScrollState(state); - if (ret != RET_OK) { - MMI_HILOGE("Call SetHoverScrollState failed, ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success state:%{public}d, pid:%{public}d", state, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetHoverScrollState(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - bool state = true; - int32_t ret = GetHoverScrollState(state); - if (ret != RET_OK) { - MMI_HILOGE("Call GetHoverScrollState failed, ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, state, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Mouse hover scroll state:%{public}d, ret:%{public}d", state, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetPointerVisible(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - bool visible = false; - READBOOL(data, visible, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t priority = 0; - READINT32(data, priority, IPC_PROXY_DEAD_OBJECT_ERR); - if (priority < 0) { - MMI_HILOGE("Invalid priority:%{public}d", priority); - return RET_ERR; - } - int32_t ret = SetPointerVisible(visible, priority); - if (ret != RET_OK) { - MMI_HILOGE("Call SetPointerVisible failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success visible:%{public}d,pid:%{public}d", visible, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubIsPointerVisible(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - bool visible = false; - int32_t ret = IsPointerVisible(visible); - if (ret != RET_OK) { - MMI_HILOGE("Call IsPointerVisible failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, visible, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("visible:%{public}d, ret:%{public}d, pid:%{public}d", visible, ret, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubMarkProcessed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t eventType; - READINT32(data, eventType, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t eventId; - READINT32(data, eventId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = MarkProcessed(eventType, eventId); - if (ret != RET_OK) { - MMI_HILOGD("MarkProcessed failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetPointerColor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t color = DEFAULT_POINTER_COLOR; - READINT32(data, color, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetPointerColor(color); - if (ret != RET_OK) { - MMI_HILOGE("Call SetPointerColor failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success color:%{public}d, pid:%{public}d", color, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetPointerColor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t color = DEFAULT_POINTER_COLOR; - int32_t ret = GetPointerColor(color); - if (ret != RET_OK) { - MMI_HILOGE("Call GetPointerColor failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, color, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Pointer color:%{public}d, ret:%{public}d", color, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetPointerSpeed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t speed = 0; - READINT32(data, speed, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetPointerSpeed(speed); - if (ret != RET_OK) { - MMI_HILOGE("Set pointer speed failed ret:%{public}d", ret); - return RET_ERR; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetPointerSpeed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t speed = 0; - int32_t ret = GetPointerSpeed(speed); - if (ret != RET_OK) { - MMI_HILOGE("Call get pointer speed failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, speed, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Pointer speed:%{public}d, ret:%{public}d", speed, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubNotifyNapOnline(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = NotifyNapOnline(); - return ret; -} - -int32_t MultimodalInputConnectStub::StubRemoveInputEventObserver(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t ret = RemoveInputEventObserver(); - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetPointerStyle(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t windowId = 0; - READINT32(data, windowId, RET_ERR); - if (!PER_HELPER->VerifySystemApp()) { - if (windowId < 0) { - MMI_HILOGE("windowId is negative number and not system hap, set pointerStyle failed"); - return ERROR_NOT_SYSAPI; - } - } - PointerStyle pointerStyle; - READINT32(data, pointerStyle.size, RET_ERR); - READINT32(data, pointerStyle.color, RET_ERR); - READINT32(data, pointerStyle.id, RET_ERR); - bool isUiExtension; - READBOOL(data, isUiExtension, RET_ERR); - if (windowId == -1 && !PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Can not set global winid, because this is not sys app"); - return ERROR_NOT_SYSAPI; - } - int32_t ret = SetPointerStyle(windowId, pointerStyle, isUiExtension); - if (ret != RET_OK) { - MMI_HILOGE("Call SetPointerStyle failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Successfully set windowId:%{public}d, icon:%{public}d", windowId, pointerStyle.id); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubClearWindowPointerStyle(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t pid = GetCallingPid(); - int32_t windowId = 0; - READINT32(data, windowId, RET_ERR); - if (windowId <= 0) { - MMI_HILOGE("Invalid windowId:%{public}d", windowId); - return RET_ERR; - } - - int32_t ret = ClearWindowPointerStyle(pid, windowId); - if (ret != RET_OK) { - MMI_HILOGE("Call SetPointerStyle failed ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Successfully clean pointerStyle for windowId:%{public}d, pid:%{public}d", windowId, pid); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetPointerStyle(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t windowId = 0; - READINT32(data, windowId, RET_ERR); - bool isUiExtension; - READBOOL(data, isUiExtension, RET_ERR); - PointerStyle pointerStyle; - int32_t ret = GetPointerStyle(windowId, pointerStyle, isUiExtension); - if (ret != RET_OK) { - MMI_HILOGE("Call GetPointerStyle failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, pointerStyle.size, RET_ERR); - WRITEINT32(reply, pointerStyle.color, RET_ERR); - WRITEINT32(reply, pointerStyle.id, RET_ERR); - WRITEINT32(reply, pointerStyle.options, RET_ERR); - MMI_HILOGD("Successfully get windowId:%{public}d, icon:%{public}d", windowId, pointerStyle.id); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSupportKeys(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t deviceId = -1; - READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - if (deviceId < 0) { - MMI_HILOGE("invalid deviceId :%{public}d", deviceId); - return RET_ERR; - } - int32_t size = 0; - READINT32(data, size, IPC_PROXY_DEAD_OBJECT_ERR); - if (size < 0 || size > ExtraData::MAX_BUFFER_SIZE) { - MMI_HILOGE("Invalid size:%{public}d", size); - return RET_ERR; - } - std::vector keys; - int32_t key = 0; - for (int32_t i = 0; i < size; ++i) { - READINT32(data, key, IPC_PROXY_DEAD_OBJECT_ERR); - keys.push_back(key); - } - std::vector keystroke; - int32_t ret = SupportKeys(deviceId, keys, keystroke); - if (ret != RET_OK) { - MMI_HILOGE("Call SupportKeys failed ret:%{public}d", ret); - return RET_ERR; - } - if (!reply.WriteBoolVector(keystroke)) { - MMI_HILOGE("Write keyStroke failed"); - return RET_ERR; - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetDeviceIds(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - std::vector ids; - int32_t ret = GetDeviceIds(ids); - if (ret != RET_OK) { - MMI_HILOGE("Call GetDeviceIds failed ret:%{public}d", ret); - return RET_ERR; - } - if (!reply.WriteInt32Vector(ids)) { - MMI_HILOGE("Write ids failed"); - return RET_ERR; - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetDevice(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t deviceId = -1; - READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - std::shared_ptr inputDevice = std::make_shared(); - int32_t ret = GetDevice(deviceId, inputDevice); - if (ret != RET_OK) { - MMI_HILOGE("Call GetDevice failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, inputDevice->GetId(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, inputDevice->GetType(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(reply, inputDevice->GetName(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, inputDevice->GetBus(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, inputDevice->GetVersion(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, inputDevice->GetProduct(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, inputDevice->GetVendor(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(reply, inputDevice->GetPhys(), IPC_STUB_WRITE_PARCEL_ERR); - WRITESTRING(reply, inputDevice->GetUniq(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEUINT64(reply, static_cast(inputDevice->GetCapabilities()), IPC_STUB_WRITE_PARCEL_ERR); - WRITEUINT32(reply, static_cast(inputDevice->GetAxisInfo().size()), IPC_STUB_WRITE_PARCEL_ERR); - for (const auto &item : inputDevice->GetAxisInfo()) { - WRITEINT32(reply, item.GetMinimum(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, item.GetMaximum(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, item.GetAxisType(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, item.GetFuzz(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, item.GetFlat(), IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, item.GetResolution(), IPC_STUB_WRITE_PARCEL_ERR); - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRegisterInputDeviceMonitor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = RegisterDevListener(); - if (ret != RET_OK) { - MMI_HILOGE("Call RegisterInputDeviceMonitor failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnregisterInputDeviceMonitor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = UnregisterDevListener(); - if (ret != RET_OK) { - MMI_HILOGE("Call UnregisterInputDeviceMonitor failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetKeyboardType(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t deviceId = -1; - READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - if (deviceId < 0) { - MMI_HILOGE("invalid deviceId :%{public}d", deviceId); - return RET_ERR; - } - int32_t keyboardType = 0; - int32_t ret = GetKeyboardType(deviceId, keyboardType); - if (ret != RET_OK) { - MMI_HILOGE("Call GetKeyboardType failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, keyboardType, IPC_STUB_WRITE_PARCEL_ERR); - return ret; -} - -int32_t MultimodalInputConnectStub::ParseAddInputHandlerData(MessageParcel& data, ParseData& parseData) -{ - READINT32(data, parseData.actionsTypeSize, IPC_PROXY_DEAD_OBJECT_ERR); - std::vector actionsType; - if (parseData.actionsTypeSize == 0) { - READUINT32(data, parseData.eventType, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, parseData.priority, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, parseData.deviceTags, IPC_PROXY_DEAD_OBJECT_ERR); - } else { - if (parseData.actionsTypeSize < 0 || parseData.actionsTypeSize > ExtraData::MAX_BUFFER_SIZE) { - MMI_HILOGE("Invalid actionsTypeSize:%{public}d", parseData.actionsTypeSize); - return RET_ERR; - } - int32_t key = 0; - for (int32_t i = 0; i < parseData.actionsTypeSize; ++i) { - READINT32(data, key, IPC_PROXY_DEAD_OBJECT_ERR); - parseData.actionsType.push_back(key); - } - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubAddInputHandler(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t handlerType = 0; - READINT32(data, handlerType, IPC_PROXY_DEAD_OBJECT_ERR); - if (!PER_HELPER->VerifySystemApp()) { - if (handlerType == InputHandlerType::MONITOR) { -#ifdef PLAYER_FRAMEWORK_EXISTS - int32_t pid = GetCallingPid(); - bool ret = InputScreenCaptureAgent::GetInstance().IsScreenCaptureWorking(pid); - if (!ret) { - MMI_HILOGE("Calling pid is:%{public}d", pid); - return ERROR_NO_PERMISSION; - } -#else - return ERROR_NOT_SYSAPI; -#endif - } else if (handlerType != InputHandlerType::INTERCEPTOR) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if ((handlerType == InputHandlerType::INTERCEPTOR) && (!PER_HELPER->CheckInterceptor())) { - MMI_HILOGE("Interceptor permission check failed"); - return ERROR_NO_PERMISSION; - } - if ((handlerType == InputHandlerType::MONITOR) && (!PER_HELPER->CheckMonitor())) { - MMI_HILOGE("Monitor permission check failed"); - return ERROR_NO_PERMISSION; - } - ParseData parseData; - if (RET_ERR == ParseAddInputHandlerData(data, parseData)) { - return RET_ERR; - } - int32_t ret = AddInputHandler(static_cast(handlerType), parseData.eventType, parseData.priority, - parseData.deviceTags, parseData.actionsType); - if (ret != RET_OK) { - MMI_HILOGE("Call AddInputHandler failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubAddPreInputHandler(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->CheckMonitor()) { - MMI_HILOGE("Monitor permission check failed"); - return ERROR_NO_PERMISSION; - } - int32_t handlerId = -1; - READINT32(data, handlerId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t eventType = 0; - READINT32(data, eventType, IPC_PROXY_DEAD_OBJECT_ERR); - std::vector keys; - int32_t keysLen = 0; - int32_t key = 0; - READINT32(data, keysLen, IPC_PROXY_DEAD_OBJECT_ERR); - if (keysLen <= 0 || keysLen > KEY_MAX_LIST_SIZE) { - MMI_HILOGE("Invalid keysLen:%{public}d", keysLen); - return RET_ERR; - } - for (int32_t i = 0; i < keysLen; ++i) { - READINT32(data, key, IPC_PROXY_DEAD_OBJECT_ERR); - keys.push_back(key); - } - - int32_t ret = AddPreInputHandler(handlerId, eventType, keys); - if (ret != RET_OK) { - MMI_HILOGE("Call AddPreInputHandler failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRemovePreInputHandler(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->CheckMonitor()) { - MMI_HILOGE("Monitor permission check failed"); - return ERROR_NO_PERMISSION; - } - int32_t handlerId = -1; - READINT32(data, handlerId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = RemovePreInputHandler(handlerId); - if (ret != RET_OK) { - MMI_HILOGE("Call RemovePreInputHandler failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRemoveInputHandler(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t handlerType = 0; - READINT32(data, handlerType, IPC_PROXY_DEAD_OBJECT_ERR); - if (!PER_HELPER->VerifySystemApp()) { - if (handlerType != InputHandlerType::MONITOR && handlerType != InputHandlerType::INTERCEPTOR) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if ((handlerType == InputHandlerType::INTERCEPTOR) && (!PER_HELPER->CheckInterceptor())) { - MMI_HILOGE("Interceptor permission check failed"); - return ERROR_NO_PERMISSION; - } - if ((handlerType == InputHandlerType::MONITOR) && (!PER_HELPER->CheckMonitor())) { - MMI_HILOGE("Monitor permission check failed"); - return ERROR_NO_PERMISSION; - } - ParseData parseData; - if (RET_ERR == ParseAddInputHandlerData(data, parseData)) { - return RET_ERR; - } - int32_t ret = RemoveInputHandler(static_cast(handlerType), parseData.eventType, - parseData.priority, parseData.deviceTags, parseData.actionsType); - if (ret != RET_OK) { - MMI_HILOGE("Call RemoveInputHandler failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRemoveGestureMonitor(MessageParcel& data, MessageParcel& reply) -{ - return HandleGestureMonitor(MultimodalinputConnectInterfaceCode::REMOVE_GESTURE_MONITOR, data, reply); -} - -int32_t MultimodalInputConnectStub::StubAddGestureMonitor(MessageParcel& data, MessageParcel& reply) -{ - return HandleGestureMonitor(MultimodalinputConnectInterfaceCode::ADD_GESTURE_MONITOR, data, reply); -} - -int32_t MultimodalInputConnectStub::HandleGestureMonitor( - MultimodalinputConnectInterfaceCode code, MessageParcel& data, MessageParcel& reply) -{ - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->CheckMonitor()) { - MMI_HILOGE("Monitor permission check failed"); - return ERROR_NO_PERMISSION; - } - int32_t handlerType = 0; - READINT32(data, handlerType, IPC_PROXY_DEAD_OBJECT_ERR); - if (handlerType != InputHandlerType::MONITOR) { - MMI_HILOGE("Illegal type:%{public}d", handlerType); - return RET_ERR; - } - uint32_t eventType = 0; - READUINT32(data, eventType, IPC_PROXY_DEAD_OBJECT_ERR); - uint32_t gestureType = 0u; - READUINT32(data, gestureType, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t fingers = 0; - READINT32(data, fingers, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = RET_OK; - if (MultimodalinputConnectInterfaceCode::ADD_GESTURE_MONITOR == code) { - ret = AddGestureMonitor(static_cast(handlerType), - eventType, static_cast(gestureType), fingers); - } else { - ret = RemoveGestureMonitor(static_cast(handlerType), - eventType, static_cast(gestureType), fingers); - } - if (ret != RET_OK) { - MMI_HILOGE("Call AddGestureMonitor/RemoveGestureMonitor failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubMarkEventConsumed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->CheckMonitor()) { - MMI_HILOGE("Permission check failed"); - return ERROR_NO_PERMISSION; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t eventId = 0; - READINT32(data, eventId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = MarkEventConsumed(eventId); - if (ret != RET_OK) { - MMI_HILOGE("Call MarkEventConsumed failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSubscribeKeyEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - - auto keyOption = std::make_shared(); - if (!keyOption->ReadFromParcel(data)) { - MMI_HILOGE("Read keyOption failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - int32_t ret = SubscribeKeyEvent(subscribeId, keyOption); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeKeyEvent failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubUnsubscribeKeyEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - if (subscribeId < 0) { - MMI_HILOGE("Invalid subscribe"); - return RET_ERR; - } - int32_t ret = UnsubscribeKeyEvent(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeKeyEvent failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSubscribeHotkey(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - if (subscribeId < 0) { - MMI_HILOGE("Invalid subscribe"); - return RET_ERR; - } - auto keyOption = std::make_shared(); - if (!keyOption->ReadFromParcel(data)) { - MMI_HILOGE("Read keyOption failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - int32_t ret = SubscribeHotkey(subscribeId, keyOption); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeHotkey failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnsubscribeHotkey(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - if (subscribeId < 0) { - MMI_HILOGE("Invalid subscribe"); - return RET_ERR; - } - int32_t ret = UnsubscribeHotkey(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeHotkey failed, ret:%{public}d", ret); - } - return ret; -} - -#ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER -int32_t MultimodalInputConnectStub::StubSubscribeKeyMonitor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - KeyMonitorOption keyOption {}; - - if (!keyOption.Unmarshalling(data)) { - MMI_HILOGE("Read KeyMonitorOption failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - auto ret = SubscribeKeyMonitor(keyOption); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeKeyMonitor failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnsubscribeKeyMonitor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - KeyMonitorOption keyOption {}; - - if (!keyOption.Unmarshalling(data)) { - MMI_HILOGE("Read KeyMonitorOption failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - auto ret = UnsubscribeKeyMonitor(keyOption); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeKeyMonitor failed, ret:%{public}d", ret); - } - return ret; -} -#endif // OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER - -int32_t MultimodalInputConnectStub::StubSubscribeSwitchEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - int32_t switchType = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, switchType, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = SubscribeSwitchEvent(subscribeId, switchType); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeSwitchEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnsubscribeSwitchEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - if (subscribeId < 0) { - MMI_HILOGE("Invalid subscribeId"); - return RET_ERR; - } - int32_t ret = UnsubscribeSwitchEvent(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeSwitchEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubQuerySwitchStatus(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t type = 0; - int32_t state = 0; - READINT32(data, type, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = QuerySwitchStatus(type, state); - WRITEINT32(reply, state, ERR_INVALID_VALUE); - if (ret != RET_OK) { - MMI_HILOGE("QuerySwitchStatus failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSubscribeTabletProximity(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = SubscribeTabletProximity(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeTabletProximity failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnSubscribetabletProximity(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - if (subscribeId < 0) { - MMI_HILOGE("Invalid subscribeId"); - return RET_ERR; - } - int32_t ret = UnsubscribetabletProximity(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeTabletProximity failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSubscribeLongPressEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - int32_t fingerCount = 0; - int32_t duration = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, fingerCount, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, duration, IPC_PROXY_DEAD_OBJECT_ERR); - LongPressRequest longPressRequest = { - .fingerCount = fingerCount, - .duration = duration, - }; - int32_t ret = SubscribeLongPressEvent(subscribeId, longPressRequest); - if (ret != RET_OK) { - MMI_HILOGE("SubscribeLongPressEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubUnsubscribeLongPressEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t subscribeId = 0; - READINT32(data, subscribeId, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = UnsubscribeLongPressEvent(subscribeId); - if (ret != RET_OK) { - MMI_HILOGE("UnsubscribeLongPressEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubMoveMouseEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckMouseCursor()) { - MMI_HILOGE("Mouse cursor permission check failed"); - return ERROR_NO_PERMISSION; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t offsetX = 0; - READINT32(data, offsetX, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t offsetY = 0; - READINT32(data, offsetY, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = MoveMouseEvent(offsetX, offsetY); - if (ret != RET_OK) { - MMI_HILOGE("MoveMouseEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubInjectKeyEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - auto event = KeyEvent::Create(); - CHKPR(event, ERROR_NULL_POINTER); - if (!event->ReadFromParcel(data)) { - MMI_HILOGE("Read Key Event failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - LogTracer lt(event->GetId(), event->GetEventType(), event->GetKeyAction()); - bool isNativeInject { false }; - READBOOL(data, isNativeInject, IPC_PROXY_DEAD_OBJECT_ERR); - if (!isNativeInject && !PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - EndLogTraceId(event->GetId()); - event->UpdateId(); - LogTracer lt1(event->GetId(), event->GetEventType(), event->GetKeyAction()); - int32_t ret = InjectKeyEvent(event, isNativeInject); - if (ret != RET_OK) { - MMI_HILOGE("InjectKeyEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubInjectPointerEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - auto pointerEvent = PointerEvent::Create(); - CHKPR(pointerEvent, ERROR_NULL_POINTER); - if (!pointerEvent->ReadFromParcel(data)) { - MMI_HILOGE("Read Pointer Event failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - bool isNativeInject { false }; - READBOOL(data, isNativeInject, IPC_PROXY_DEAD_OBJECT_ERR); - if (!isNativeInject && !PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t ret = InjectPointerEvent(pointerEvent, isNativeInject); - if (ret != RET_OK) { - MMI_HILOGE("Call InjectPointerEvent failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubInjectTouchPadEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - auto pointerEvent = PointerEvent::Create(); - CHKPR(pointerEvent, ERROR_NULL_POINTER); - if (!pointerEvent->ReadFromParcel(data)) { - MMI_HILOGE("Read Pointer Event failed"); - return IPC_PROXY_DEAD_OBJECT_ERR; - } - double ppi = 0.0; - double size = 0.0; - int32_t speed = 0; - int32_t frequency = 0; - bool isNativeInject { false }; - READDOUBLE(data, ppi, IPC_PROXY_DEAD_OBJECT_ERR); - READDOUBLE(data, size, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, speed, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, frequency, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, isNativeInject, IPC_PROXY_DEAD_OBJECT_ERR); - TouchpadCDG touchpadCDG = { - .ppi = ppi, - .size = size, - .speed = speed, - .frequency = frequency, - }; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t ret = InjectTouchPadEvent(pointerEvent, touchpadCDG, isNativeInject); - if (ret != RET_OK) { - MMI_HILOGE("Call InjectTouchPadEvent failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetAnrListener(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t ret = SetAnrObserver(); - if (ret != RET_OK) { - MMI_HILOGE("Call SetAnrObserver failed, ret:%{public}d", ret); - } - return ret; -} - - -int32_t MultimodalInputConnectStub::StubGetDisplayBindInfo(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - DisplayBindInfos infos; - int32_t ret = GetDisplayBindInfo(infos); - if (ret != RET_OK) { - MMI_HILOGE("Call GetDisplayBindInfo failed, ret:%{public}d", ret); - return ret; - } - int32_t size = static_cast(infos.size()); - WRITEINT32(reply, size, ERR_INVALID_VALUE); - infos.reserve(size); - for (const auto &info : infos) { - WRITEINT32(reply, info.inputDeviceId, ERR_INVALID_VALUE); - WRITESTRING(reply, info.inputDeviceName, ERR_INVALID_VALUE); - WRITEINT32(reply, info.displayId, ERR_INVALID_VALUE); - WRITESTRING(reply, info.displayName, ERR_INVALID_VALUE); - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetAllMmiSubscribedEvents(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - std::map, int32_t> datas; - int32_t ret = GetAllMmiSubscribedEvents(datas); - if (ret != RET_OK) { - MMI_HILOGE("Call GetDisplayBindInfo failed, ret:%{public}d", ret); - return ret; - } - int32_t size = static_cast(datas.size()); - WRITEINT32(reply, size, ERR_INVALID_VALUE); - for (const auto &data : datas) { - WRITEINT32(reply, std::get(data.first), ERR_INVALID_VALUE); - WRITEINT32(reply, std::get(data.first), ERR_INVALID_VALUE); - WRITESTRING(reply, std::get(data.first), ERR_INVALID_VALUE); - WRITEINT32(reply, data.second, ERR_INVALID_VALUE); - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetDisplayBind(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t inputDeviceId = -1; - READINT32(data, inputDeviceId, ERR_INVALID_VALUE); - int32_t displayId = -1; - READINT32(data, displayId, ERR_INVALID_VALUE); - std::string msg; - int32_t ret = SetDisplayBind(inputDeviceId, displayId, msg); - if (ret != RET_OK) { - MMI_HILOGE("Call SetDisplayBind failed, ret:%{public}d", ret); - } - WRITESTRING(reply, msg, ERR_INVALID_VALUE); - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetFunctionKeyState(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t funcKey { 0 }; - bool state { false }; - READINT32(data, funcKey, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = GetFunctionKeyState(funcKey, state); - if (ret != RET_OK) { - MMI_HILOGE("Call GetKeyboardEnableState failed ret:%{public}d", ret); - return ret; - } - - WRITEBOOL(reply, state, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetFunctionKeyState(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->CheckFunctionKeyEnabled()) { - MMI_HILOGE("Set function key state permission check failed"); - return ERROR_KEYBOARD_NO_PERMISSION; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t funcKey { 0 }; - bool enable { false }; - READINT32(data, funcKey, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, enable, IPC_PROXY_DEAD_OBJECT_ERR); - if (funcKey != KeyEvent::NUM_LOCK_FUNCTION_KEY && funcKey != KeyEvent::CAPS_LOCK_FUNCTION_KEY && - funcKey != KeyEvent::SCROLL_LOCK_FUNCTION_KEY) { - MMI_HILOGE("Invalid funcKey:%{public}d", funcKey); - return RET_ERR; - } - - int32_t ret = SetFunctionKeyState(funcKey, enable); - if (ret != RET_OK) { - MMI_HILOGE("Call SetFunctionKeyState failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetPointerLocation(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubSetPointerLocation Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckMouseCursor()) { - MMI_HILOGE("Mouse cursor permission check failed"); - return ERROR_NO_PERMISSION; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t x = 0; - int32_t y = 0; - int32_t displayId = 0; - READINT32(data, x, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, y, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, displayId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetPointerLocation(x, y, displayId); - if (ret != RET_OK) { - MMI_HILOGE("Call SetFunctionKeyState failed ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetMouseCaptureMode(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t windowId = -1; - bool isCaptureMode = false; - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, isCaptureMode, IPC_PROXY_DEAD_OBJECT_ERR); - if (windowId <= 0) { - MMI_HILOGE("Invalid windowId:%{public}d", windowId); - return RET_ERR; - } - int32_t ret = SetMouseCaptureMode(windowId, isCaptureMode); - if (ret != RET_OK) { - MMI_HILOGE("Fail to call SetMouseCaptureMode, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetWindowPid(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t windowId = 0; - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = GetWindowPid(windowId); - if (ret == RET_ERR) { - MMI_HILOGE("Get window pid failed"); - } - WRITEINT32(reply, ret, ERR_INVALID_VALUE); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubAppendExtraData(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - ExtraData extraData; - READBOOL(data, extraData.appended, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t size = 0; - READINT32(data, size, IPC_PROXY_DEAD_OBJECT_ERR); - if (size > ExtraData::MAX_BUFFER_SIZE) { - MMI_HILOGE("Append extra data failed, buffer is oversize:%{public}d", size); - return ERROR_OVER_SIZE_BUFFER; - } - uint8_t buffer = 0; - for (int32_t i = 0; i < size; ++i) { - READUINT8(data, buffer, IPC_PROXY_DEAD_OBJECT_ERR); - extraData.buffer.push_back(buffer); - } - READINT32(data, extraData.toolType, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, extraData.sourceType, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, extraData.pointerId, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, extraData.pullId, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, extraData.eventId, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, extraData.drawCursor, IPC_PROXY_DEAD_OBJECT_ERR); - if (extraData.sourceType != InputEvent::SOURCE_TYPE_TOUCHSCREEN && - extraData.sourceType != InputEvent::SOURCE_TYPE_MOUSE) { - MMI_HILOGE("Invalid extraData.sourceType:%{public}d", extraData.sourceType); - return RET_ERR; - } - if (extraData.pointerId < 0 || extraData.pullId < 0) { - MMI_HILOGE("Invalid extraData.pointerId or extraData.pullId or extraData.eventId, pointerId:%{public}d," - "pullId:%{public}d, eventId:%{public}d", extraData.pointerId, extraData.pullId, extraData.eventId); - return RET_ERR; - } - - int32_t ret = AppendExtraData(extraData); - if (ret != RET_OK) { - MMI_HILOGE("Fail to call AppendExtraData, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubEnableCombineKey(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - bool enable; - READBOOL(data, enable, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = EnableCombineKey(enable); - if (ret != RET_OK) { - MMI_HILOGE("Call EnableCombineKey failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubEnableInputDevice(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - MMI_HILOGW("EnableInputDevice is not supported yet"); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetKeyDownDuration(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - std::string businessId; - READSTRING(data, businessId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t delay = 0; - READINT32(data, delay, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetKeyDownDuration(businessId, delay); - if (ret != RET_OK) { - MMI_HILOGE("Set key down duration failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::VerifyTouchPadSetting(void) -{ - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadScrollSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - READBOOL(data, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadScrollSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad scroll switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadScrollSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - ret = GetTouchpadScrollSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadScrollSwitch failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, switchFlag, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad scroll switch :%{public}d, ret:%{public}d", switchFlag, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadScrollDirection(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool state = true; - READBOOL(data, state, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadScrollDirection(state); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad scroll direction switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadScrollDirection(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool state = true; - ret = GetTouchpadScrollDirection(state); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadScrollDirection failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, state, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad scroll direction switch state:%{public}d, ret:%{public}d", state, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadTapSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - READBOOL(data, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadTapSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad tap switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadTapSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - ret = GetTouchpadTapSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadTapSwitch failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, switchFlag, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad tap switchFlag:%{public}d, ret:%{public}d", switchFlag, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadPointerSpeed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - int32_t speed = 1; - READINT32(data, speed, IPC_PROXY_DEAD_OBJECT_ERR); - if (speed < MIN_SPEED) { - speed = MIN_SPEED; - } else if (speed > MAX_SPEED) { - speed = MAX_SPEED; - } - ret = SetTouchpadPointerSpeed(speed); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad pointer speed failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadPointerSpeed(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - int32_t speed = 1; - ret = GetTouchpadPointerSpeed(speed); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadPointerSpeed failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, speed, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad pointer speed:%{public}d, ret:%{public}d", speed, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadCDG(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - TouchpadCDG touchpadCDG; - touchpadCDG.ppi = 0.0; - touchpadCDG.size = 0.0; - touchpadCDG.speed = 0; - touchpadCDG.frequency = 0; - ret = GetTouchpadCDG(touchpadCDG); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadCDG failed ret:%{public}d", ret); - return ret; - } - WRITEDOUBLE(reply, touchpadCDG.ppi, IPC_STUB_WRITE_PARCEL_ERR); - WRITEDOUBLE(reply, touchpadCDG.size, IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, touchpadCDG.speed, IPC_STUB_WRITE_PARCEL_ERR); - WRITEINT32(reply, touchpadCDG.frequency, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad option ppi:%{public}lf size:%{public}lf speed:%{public}d, ret:%{public}d", - touchpadCDG.ppi, touchpadCDG.size, touchpadCDG.speed, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetKeyboardRepeatDelay(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t delay = 0; - READINT32(data, delay, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetKeyboardRepeatDelay(delay); - if (ret != RET_OK) { - MMI_HILOGE("Set keyboard repeat delay failed ret:%{public}d", ret); - return RET_ERR; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetKeyboardRepeatRate(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t rate = 0; - READINT32(data, rate, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetKeyboardRepeatRate(rate); - if (ret != RET_OK) { - MMI_HILOGE("Set keyboard repeat rate failed ret:%{public}d", ret); - return RET_ERR; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetKeyboardRepeatDelay(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t delay = 0; - int32_t ret = GetKeyboardRepeatDelay(delay); - if (ret != RET_OK) { - MMI_HILOGE("Get keyboard repeat delay failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, delay, IPC_STUB_WRITE_PARCEL_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetKeyboardRepeatRate(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t rate = 0; - int32_t ret = GetKeyboardRepeatRate(rate); - if (ret != RET_OK) { - MMI_HILOGE("Get keyboard repeat rate failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, rate, IPC_STUB_WRITE_PARCEL_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadPinchSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - READBOOL(data, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadPinchSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad pinch switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadPinchSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - ret = GetTouchpadPinchSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadPinchSwitch failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, switchFlag, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad pinch switchFlag:%{public}d, ret:%{public}d", switchFlag, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadSwipeSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - READBOOL(data, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadSwipeSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad swipe switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadSwipeSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - ret = GetTouchpadSwipeSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadSwipeSwitch failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, switchFlag, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad swipe switchFlag:%{public}d, ret:%{public}d", switchFlag, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadRightClickType(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - int32_t type = 1; - READINT32(data, type, IPC_PROXY_DEAD_OBJECT_ERR); - if (type != RightClickType::TOUCHPAD_RIGHT_BUTTON && type != RightClickType::TOUCHPAD_LEFT_BUTTON && - type != RightClickType::TOUCHPAD_TWO_FINGER_TAP && - type != RightClickType::TOUCHPAD_TWO_FINGER_TAP_OR_RIGHT_BUTTON && - type != RightClickType::TOUCHPAD_TWO_FINGER_TAP_OR_LEFT_BUTTON) { - MMI_HILOGE("Invalid type:%{public}d", type); - return RET_ERR; - } - ret = SetTouchpadRightClickType(type); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad right button menu type failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadRightClickType(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - int32_t type = 1; - ret = GetTouchpadRightClickType(type); - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadRightClickType failed ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, type, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad right button menu type:%{public}d, ret:%{public}d", type, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadRotateSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool rotateSwitch = true; - READBOOL(data, rotateSwitch, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadRotateSwitch(rotateSwitch); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad rotate switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadRotateSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool rotateSwitch = true; - ret = GetTouchpadRotateSwitch(rotateSwitch); - if (ret != RET_OK) { - MMI_HILOGE("GetTouchpadRotateSwitch failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, rotateSwitch, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad rotate switch:%{public}d, ret:%{public}d", rotateSwitch, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadDoubleTapAndDragState(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - READBOOL(data, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR); - ret = SetTouchpadDoubleTapAndDragState(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Set touchpad double tap and drag switch failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadDoubleTapAndDragState(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = VerifyTouchPadSetting(); - if (ret != RET_OK) { - MMI_HILOGE("Verify touchpad setting failed"); - return ret; - } - - bool switchFlag = true; - ret = GetTouchpadDoubleTapAndDragState(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("GetTouchpadDoubleTapAndDragState failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, switchFlag, IPC_STUB_WRITE_PARCEL_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetShieldStatus(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckDispatchControl()) { - MMI_HILOGE("Input dispatch control permission check failed"); - return ERROR_NO_PERMISSION; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t shieldMode { 0 }; - bool isShield { false }; - READINT32(data, shieldMode, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, isShield, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetShieldStatus(shieldMode, isShield); - if (ret != RET_OK) { - MMI_HILOGE("Call SetShieldStatus failed, ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success shieldMode:%{public}d, isShield:%{public}d", shieldMode, isShield); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetShieldStatus(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckDispatchControl()) { - MMI_HILOGE("Input dispatch control permission check failed"); - return ERROR_NO_PERMISSION; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - - int32_t shieldMode { 0 }; - bool state { false }; - READINT32(data, shieldMode, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = GetShieldStatus(shieldMode, state); - if (ret != RET_OK) { - MMI_HILOGE("Call GetShieldStatus failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, state, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetKeyState(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - std::vector pressedKeys; - std::map specialKeysState; - int32_t ret = GetKeyState(pressedKeys, specialKeysState); - if (ret != RET_OK) { - MMI_HILOGE("Call GetKeyState failed ret:%{public}d", ret); - return RET_ERR; - } - if (!reply.WriteInt32Vector(pressedKeys)) { - MMI_HILOGE("Write pressedKeys failed"); - return RET_ERR; - } - std::vector specialKeysStateTmp; - for (const auto &item : specialKeysState) { - specialKeysStateTmp.push_back(item.second); - } - if (!reply.WriteInt32Vector(specialKeysStateTmp)) { - MMI_HILOGE("Write specialKeysStateTmp failed"); - return RET_ERR; - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubAuthorize(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckAuthorize()) { - MMI_HILOGE("Input authorize permission check failed"); - return ERROR_NO_PERMISSION; - } - bool isAuthorize { false }; - READBOOL(data, isAuthorize, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = Authorize(isAuthorize); - if (ret != RET_OK) { - MMI_HILOGE("Call Authorize failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubCancelInjection(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = CancelInjection(); - if (ret != RET_OK) { - MMI_HILOGE("Call CancelInjection failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubHasIrEmitter(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool hasIrEmitter = false; - int32_t ret = HasIrEmitter(hasIrEmitter); - if (ret != RET_OK) { - MMI_HILOGE("Call StubHasIrEmitter failed ret:%{public}d", ret); - return ret; - } - WRITEBOOL(reply, hasIrEmitter, IPC_STUB_WRITE_PARCEL_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetInfraredFrequencies(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->CheckInfraredEmmit()) { - MMI_HILOGE("Infrared permission check failed"); - return ERROR_NO_PERMISSION; - } - std::vector requencys; - int32_t ret = GetInfraredFrequencies(requencys); - if (ret != RET_OK) { - MMI_HILOGE("Call StubGetInfraredFrequencies failed returnCode:%{public}d", ret); - return ret; - } - WRITEINT64(reply, requencys.size()); - for (const auto &item : requencys) { - WRITEINT64(reply, item.max_); - WRITEINT64(reply, item.min_); - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubTransmitInfrared(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->CheckInfraredEmmit()) { - MMI_HILOGE("StubTransmitInfrared permission check failed. returnCode:%{public}d", ERROR_NO_PERMISSION); - return ERROR_NO_PERMISSION; - } - int64_t number = 0; - READINT64(data, number, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t patternLen = 0; - std::vector pattern; - READINT32(data, patternLen, IPC_PROXY_DEAD_OBJECT_ERR); - if (patternLen > MAX_N_TRANSMIT_INFRARED_PATTERN || patternLen <= 0) { - MMI_HILOGE("Transmit infrared pattern len is invalid"); - return false; - } - for (int32_t i = 0; i < patternLen; i++) { - int64_t value = 0; - READINT64(data, value); - pattern.push_back(value); - } - if (number < 0) { - MMI_HILOGE("Transmit infrared number is invalid"); - return false; - } - int32_t ret = TransmitInfrared(number, pattern); - if (ret != RET_OK) { - MMI_HILOGE("Call StubTransmitInfrared failed returnCode:%{public}d", ret); - return ret; - } - WRITEINT32(reply, ret); - return RET_OK; -} - -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD -int32_t MultimodalInputConnectStub::StubCreateVKeyboardDevice(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubCreateVKeyboardDevice Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - sptr vkeyboardDevice = nullptr; - int32_t ret = CreateVKeyboardDevice(vkeyboardDevice); - if (ret != RET_OK) { - MMI_HILOGE("Call StubCreateVKeyboardDevice failed ret:%{public}d", ret); - } - WRITEREMOTEOBJECT(reply, vkeyboardDevice, ERR_INVALID_VALUE); - return ret; -} -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - -int32_t MultimodalInputConnectStub::StubSetPixelMapData(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t infoId = -1; - READINT32(data, infoId, IPC_PROXY_DEAD_OBJECT_ERR); - if (infoId <= 0) { - MMI_HILOGE("Invalid infoId:%{public}d", infoId); - return RET_ERR; - } - OHOS::Media::PixelMap* pixelMap = Media::PixelMap::Unmarshalling(data); - CHKPR(pixelMap, RET_ERR); - int32_t ret = SetPixelMapData(infoId, static_cast(pixelMap)); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call SetPixelMapData, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetMoveEventFilters(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubSetMoveEventFilters Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - bool flag = false; - READBOOL(data, flag, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetMoveEventFilters(flag); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMoveEventFilters failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetCurrentUser(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubSetCurrentUser Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t userId = 0; - READINT32(data, userId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t callingUid = GetCallingUid(); - if (callingUid < UID_TRANSFORM_DIVISOR) { - MMI_HILOGE("CallingUid is not within the range:%{public}d", callingUid); - return RET_ERR; - } - if (callingUid / UID_TRANSFORM_DIVISOR != userId) { - MMI_HILOGE("Invalid CallingUid:%{public}d", callingUid); - return RET_ERR; - } - int32_t ret = SetCurrentUser(userId); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call SetCurrentUser ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadThreeFingersTapSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubSetTouchpadThreeFingersTapSwitch Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool threeFingersTapSwitch = true; - READBOOL(data, threeFingersTapSwitch, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetTouchpadThreeFingersTapSwitch(threeFingersTapSwitch); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call StubSetTouchpadThreeFingersTapSwitch ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadThreeFingersTapSwitch(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("StubGetTouchpadThreeFingersTapSwitch Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool switchFlag = true; - int32_t ret = GetTouchpadThreeFingersTapSwitch(switchFlag); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call StubGetTouchpadThreeFingersTapSwitch ret:%{public}d", ret); - } else { - WRITEBOOL(reply, switchFlag); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubEnableHardwareCursorStats(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool enable = false; - READBOOL(data, enable, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = EnableHardwareCursorStats(enable); - if (ret != RET_OK) { - MMI_HILOGE("Call EnableHardwareCursorStats failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubGetHardwareCursorStats(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - uint32_t frameCount = 0; - uint32_t vsyncCount = 0; - int32_t ret = GetHardwareCursorStats(frameCount, vsyncCount); - if (ret != RET_OK) { - MMI_HILOGE("Call GetHardwareCursorStats failed ret:%{public}d", ret); - return ret; - } - WRITEUINT32(reply, frameCount, IPC_PROXY_DEAD_OBJECT_ERR); - WRITEUINT32(reply, vsyncCount, IPC_PROXY_DEAD_OBJECT_ERR); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetTouchpadScrollRows(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t rows = TOUCHPAD_SCROLL_ROWS; - READINT32(data, rows, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t newRows = std::clamp(rows, MIN_ROWS, MAX_ROWS); - int32_t ret = SetTouchpadScrollRows(newRows); - if (ret != RET_OK) { - MMI_HILOGE("Call SetTouchpadScrollRows failed ret:%{public}d, pid:%{public}d", ret, GetCallingPid()); - } - MMI_HILOGD("Success rows:%{public}d, pid:%{public}d", newRows, GetCallingPid()); - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetTouchpadScrollRows(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t rows = TOUCHPAD_SCROLL_ROWS; - int32_t ret = GetTouchpadScrollRows(rows); - if (rows < MIN_ROWS || rows > MAX_ROWS) { - MMI_HILOGD("Invalid touchpad scroll rows:%{public}d, ret:%{public}d", rows, ret); - return ret; - } - if (ret != RET_OK) { - MMI_HILOGE("Call GetTouchpadScrollRows failed, ret:%{public}d", ret); - return ret; - } - WRITEINT32(reply, rows, IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("Touchpad scroll rows:%{public}d, ret:%{public}d", rows, ret); - return RET_OK; -} - -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR -int32_t MultimodalInputConnectStub::StubGetPointerSnapshot(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - std::shared_ptr pixelMap; - int32_t ret = GetPointerSnapshot(&pixelMap); - if (ret != RET_OK) { - MMI_HILOGE("Call GetPointerSnapshot failed ret:%{public}d", ret); - return ret; - } - CHKPR(pixelMap, ERR_INVALID_VALUE); - if (pixelMap->GetCapacity() == 0) { - MMI_HILOGE("pixelMap is empty, we dont have to pass it to the server"); - return ERR_INVALID_VALUE; - } - pixelMap->Marshalling(reply); - return RET_OK; -} -#endif // OHOS_BUILD_ENABLE_MAGICCURSOR - -int32_t MultimodalInputConnectStub::StubAddVirtualInputDevice(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - auto device = std::make_shared(); - if (g_parseInputDevice(data, device) != RET_OK) { - MMI_HILOGE("ParseInputDevice failed"); - return RET_ERR; - } - int32_t deviceId { -1 }; - int32_t ret = AddVirtualInputDevice(device, deviceId); - if (ret != RET_OK) { - MMI_HILOGE("AddVirtualInputDevice failed"); - return ret; - } - WRITEINT32(reply, deviceId); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubRemoveVirtualInputDevice(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - int32_t deviceId { -1 }; - READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - if (deviceId < 0) { - MMI_HILOGE("invalid deviceId :%{public}d", deviceId); - return RET_ERR; - } - int32_t ret = RemoveVirtualInputDevice(deviceId); - if (ret != RET_OK) { - MMI_HILOGE("RemoveVirtualInputDevice failed"); - return ret; - } - WRITEINT32(reply, ret); - return RET_OK; -} - -#ifdef OHOS_BUILD_ENABLE_ANCO -int32_t MultimodalInputConnectStub::StubAncoAddChannel(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - sptr remoteObj = data.ReadRemoteObject(); - CHKPR(remoteObj, ERR_INVALID_VALUE); - sptr channel = iface_cast(remoteObj); - CHKPR(channel, ERROR_NULL_POINTER); - int32_t ret = AncoAddChannel(channel); - if (ret != RET_OK) { - MMI_HILOGE("AncoAddChannel fail, error:%{public}d", ret); - } - WRITEINT32(reply, ret); - return ret; -} - -int32_t MultimodalInputConnectStub::StubAncoRemoveChannel(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - sptr remoteObj = data.ReadRemoteObject(); - CHKPR(remoteObj, ERR_INVALID_VALUE); - sptr channel = iface_cast(remoteObj); - CHKPR(channel, ERROR_NULL_POINTER); - int32_t ret = AncoRemoveChannel(channel); - if (ret != RET_OK) { - MMI_HILOGE("AncoRemoveChannel fail, error:%{public}d", ret); - } - WRITEINT32(reply, ret); - return ret; -} - -int32_t MultimodalInputConnectStub::StubCheckKnuckleEvent(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - float pointX = 0; - float pointY = 0; - bool touchType = false; - READFLOAT(data, pointX, RET_ERR); - READFLOAT(data, pointY, RET_ERR); - int32_t ret = CheckKnuckleEvent(pointX, pointY, touchType); - if (ret != RET_OK) { - MMI_HILOGE("Call CheckKnuckleEvent failed:%{public}d", ret); - return ret; - } - - WRITEBOOL(reply, touchType, RET_ERR); - return RET_OK; -} -#endif // OHOS_BUILD_ENABLE_ANCO - -int32_t MultimodalInputConnectStub::StubTransferBinderClientService(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - sptr remoteObj = data.ReadRemoteObject(); - CHKPR(remoteObj, ERROR_NULL_POINTER); - int32_t ret = TransferBinderClientSrv(remoteObj); - if (ret != RET_OK) { - MMI_HILOGE("TransferBinderClientSrv failed"); - return ret; - } - WRITEINT32(reply, ret); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSkipPointerLayer(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool isSkip = true; - READBOOL(data, isSkip, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SkipPointerLayer(isSkip); - if (ret != RET_OK) { - MMI_HILOGE("Call SkipPointerLayer failed, ret:%{public}d", ret); - return ret; - } - MMI_HILOGD("Success isSkip:%{public}d, pid:%{public}d", isSkip, GetCallingPid()); - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetClientInfo(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t pid = GetCallingPid(); - uint64_t readThreadId = 0; - READUINT64(data, readThreadId, IPC_PROXY_DEAD_OBJECT_ERR); - if (readThreadId < 0) { - MMI_HILOGE("invalid readThreadId :%{public}llu", readThreadId); - return RET_ERR; - } - int32_t ret = SetClientInfo(pid, readThreadId); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call SetClientInfo, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetIntervalSinceLastInput(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int64_t timeInterval = 0; - int32_t ret = GetIntervalSinceLastInput(timeInterval); - if (ret != RET_OK) { - MMI_HILOGE("Failed to call StubGetIntervalSinceLastInput ret:%{public}d", ret); - } else { - WRITEINT64(reply, timeInterval); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubGetAllSystemHotkeys(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - std::vector> keyOptions; - int32_t ret = GetAllSystemHotkeys(keyOptions); - if (ret != RET_OK) { - MMI_HILOGD("Call GetAllSystemHotkeys failed ret:%{public}d", ret); - return RET_ERR; - } - WRITEINT32(reply, static_cast(keyOptions.size()), IPC_STUB_WRITE_PARCEL_ERR); - MMI_HILOGD("keyOptionsCount size:%{public}d", static_cast(keyOptions.size())); - for (const auto &item : keyOptions) { - if (!item->WriteToParcel(reply)) { - MMI_HILOGE("Write keyOption failed"); - return IPC_STUB_WRITE_PARCEL_ERR; - } - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetInputDeviceInputEnable(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!PER_HELPER->CheckInputDeviceController()) { - MMI_HILOGE("Controller permission check failed"); - return ERROR_NO_PERMISSION; - } - int32_t deviceId = 0; - bool enable = true; - int32_t index = 0; - READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, enable, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, index, IPC_PROXY_DEAD_OBJECT_ERR); - if (deviceId < 0) { - MMI_HILOGE("invalid deviceId :%{public}d", deviceId); - return RET_ERR; - } - int32_t ret = SetInputDeviceEnabled(deviceId, enable, index); - if (ret != RET_OK) { - MMI_HILOGE("Set inputdevice device input failed ret:%{public}d", ret); - return ERROR_DEVICE_NOT_EXIST; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubShiftAppPointerEvent(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - ShiftWindowParam param; - READINT32(data, param.sourceWindowId, ERR_INVALID_VALUE); - READINT32(data, param.targetWindowId, ERR_INVALID_VALUE); - READINT32(data, param.x, ERR_INVALID_VALUE); - READINT32(data, param.y, ERR_INVALID_VALUE); - bool autoGenDown = true; - READBOOL(data, autoGenDown, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = ShiftAppPointerEvent(param, autoGenDown); - if (ret != RET_OK) { - MMI_HILOGE("shift AppPointerEvent failed, ret:%{public}d", ret); - } - return ret; -} - -int32_t MultimodalInputConnectStub::StubSetCustomMouseCursor(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - if (!IsRunning()) { - MMI_HILOGE("Service is not running"); - return MMISERVICE_NOT_RUNNING; - } - int32_t windowId = 0; - CustomCursor cursor; - CursorOptions options; - READINT32(data, windowId, IPC_PROXY_DEAD_OBJECT_ERR); - OHOS::Media::PixelMap* pixelMapPtr = Media::PixelMap::Unmarshalling(data); - CHKPR(pixelMapPtr, RET_ERR); - cursor.pixelMap = (void*)pixelMapPtr; - READINT32(data, cursor.focusX, IPC_PROXY_DEAD_OBJECT_ERR); - READINT32(data, cursor.focusY, IPC_PROXY_DEAD_OBJECT_ERR); - READBOOL(data, options.followSystem, IPC_PROXY_DEAD_OBJECT_ERR); - - int32_t ret = SetCustomCursor(windowId, cursor, options); - if (ret != RET_OK) { - MMI_HILOGE("Call SetCustomCursor failed:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetMultiWindowScreenId(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - if (!PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - uint64_t screenId = 0; - uint64_t displayNodeScreenId = 0; - READUINT64(data, screenId, IPC_PROXY_DEAD_OBJECT_ERR); - READUINT64(data, displayNodeScreenId, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetMultiWindowScreenId(screenId, displayNodeScreenId); - if (ret != RET_OK) { - MMI_HILOGE("Call SetMultiWindowScreenId failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubSetKnuckleSwitch(MessageParcel &data, MessageParcel &reply) -{ - CALL_DEBUG_ENTER; - int32_t callingUid = GetCallingUid(); - int32_t gameUid = 7011 ; - if (callingUid != gameUid || !PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return ERROR_NOT_SYSAPI; - } - bool knuckleSwitch = true; - READBOOL(data, knuckleSwitch, IPC_PROXY_DEAD_OBJECT_ERR); - int32_t ret = SetKnuckleSwitch(knuckleSwitch); - if (ret != RET_OK) { - MMI_HILOGE("Call SetKnuckleSwitch failed, ret:%{public}d", ret); - return ret; - } - return RET_OK; -} - -int32_t MultimodalInputConnectStub::StubLaunchAiScreenAbility(MessageParcel& data, MessageParcel& reply) -{ - CALL_DEBUG_ENTER; - int32_t ret = LaunchAiScreenAbility(); - if (ret != RET_OK) { - MMI_HILOGE("Call LaunchAiScreenAbility failed ret:%{public}d", ret); - return ret; - } - return RET_OK; -} -} // namespace MMI -} // namespace OHOS diff --git a/service/connect_manager/test/multimodal_input_connect_proxy_ex_test.cpp b/service/connect_manager/test/multimodal_input_connect_proxy_ex_test.cpp index c8d8da0431e9cc3543496ed5adcc504bf53fd216..08ecf78f6e086f44cd2d0eb68830f45c6ad43786 100644 --- a/service/connect_manager/test/multimodal_input_connect_proxy_ex_test.cpp +++ b/service/connect_manager/test/multimodal_input_connect_proxy_ex_test.cpp @@ -15,6 +15,7 @@ #include #include +#include #include "anco_channel_death_recipient.h" #include "anco_channel_proxy.h" @@ -263,12 +264,12 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SetMou } /** - * @tc.name: MultimodalInputConnectProxyTest_SyncInputEvent_001 - * @tc.desc: Test the function SyncInputEvent + * @tc.name: MultimodalInputConnectProxyTest_SyncInputPointEvent_001 + * @tc.desc: Test the function SyncInputPointEvent * @tc.type: FUNC * @tc.require: */ -HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputEvent_001, TestSize.Level1) +HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputPointEvent_001, TestSize.Level1) { CALL_TEST_DEBUG; sptr remoteObject; @@ -276,20 +277,20 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncIn auto pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(false)); - int32_t ret = ancoChannelProxy.SyncInputEvent(pointerEvent); - EXPECT_EQ(ret, RET_ERR); + int32_t ret = ancoChannelProxy.SyncInputPointEvent(*pointerEvent); + EXPECT_EQ(ret, ERR_INVALID_VALUE); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(true)); - ret = ancoChannelProxy.SyncInputEvent(pointerEvent); - EXPECT_EQ(ret, RET_ERR); + ret = ancoChannelProxy.SyncInputPointEvent(*pointerEvent); + EXPECT_EQ(ret, ERR_INVALID_DATA); } /** - * @tc.name: MultimodalInputConnectProxyTest_SyncInputEvent_002 - * @tc.desc: Test the function SyncInputEvent + * @tc.name: MultimodalInputConnectProxyTest_SyncInputPointEvent_002 + * @tc.desc: Test the function SyncInputPointEvent * @tc.type: FUNC * @tc.require: */ -HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputEvent_002, TestSize.Level1) +HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputPointEvent_002, TestSize.Level1) { CALL_TEST_DEBUG; sptr remoteObject; @@ -298,17 +299,17 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncIn int32_t eventType = 1; auto pointerEvent = std::make_shared(eventType); EXPECT_CALL(*pointerEvent, WriteToParcel(_)).WillRepeatedly(Return(true)); - int32_t ret = ancoChannelProxy.SyncInputEvent(pointerEvent); - EXPECT_EQ(ret, RET_ERR); + int32_t ret = ancoChannelProxy.SyncInputPointEvent(*pointerEvent); + EXPECT_EQ(ret, ERR_INVALID_DATA); } /** - * @tc.name: MultimodalInputConnectProxyTest_SyncInputEvent_003 - * @tc.desc: Test the function SyncInputEvent + * @tc.name: MultimodalInputConnectProxyTest_SyncInputKeyEvent_003 + * @tc.desc: Test the function SyncInputKeyEvent * @tc.type: FUNC * @tc.require: */ -HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputEvent_003, TestSize.Level1) +HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputKeyEvent_003, TestSize.Level1) { CALL_TEST_DEBUG; sptr remoteObject; @@ -316,20 +317,20 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncIn auto keyEvent = KeyEvent::Create(); ASSERT_NE(keyEvent, nullptr); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(false)); - int32_t ret = ancoChannelProxy.SyncInputEvent(keyEvent); - EXPECT_EQ(ret, RET_ERR); + int32_t ret = ancoChannelProxy.SyncInputKeyEvent(*keyEvent); + EXPECT_EQ(ret, ERR_INVALID_VALUE); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(true)); - ret = ancoChannelProxy.SyncInputEvent(keyEvent); - EXPECT_EQ(ret, RET_ERR); + ret = ancoChannelProxy.SyncInputKeyEvent(*keyEvent); + EXPECT_EQ(ret, ERR_INVALID_DATA); } /** - * @tc.name: MultimodalInputConnectProxyTest_SyncInputEvent_004 - * @tc.desc: Test the function SyncInputEvent + * @tc.name: MultimodalInputConnectProxyTest_SyncInputKeyEvent_004 + * @tc.desc: Test the function SyncInputKeyEvent * @tc.type: FUNC * @tc.require: */ -HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputEvent_004, TestSize.Level1) +HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncInputKeyEvent_004, TestSize.Level1) { CALL_TEST_DEBUG; sptr remoteObject; @@ -347,8 +348,8 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_SyncIn item.SetPressed(true); keyEvent->AddKeyItem(item); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(true)); - int32_t ret = ancoChannelProxy.SyncInputEvent(keyEvent); - EXPECT_EQ(ret, RET_ERR); + int32_t ret = ancoChannelProxy.SyncInputKeyEvent(*keyEvent); + EXPECT_EQ(ret, ERR_INVALID_DATA); } /** @@ -364,11 +365,11 @@ HWTEST_F(MultimodalInputConnectProxyTest, MultimodalInputConnectProxyTest_Update OHOS::MMI::AncoChannelProxy ancoChannelProxy(remoteObject); auto windows = std::make_shared(); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(false)); - int32_t ret = ancoChannelProxy.UpdateWindowInfo(windows); - EXPECT_EQ(ret, RET_ERR); + int32_t ret = ancoChannelProxy.UpdateWindowInfo(*windows); + EXPECT_EQ(ret, ERR_INVALID_VALUE); EXPECT_CALL(*messageParcelMock_, WriteInterfaceToken(_)).WillRepeatedly(Return(true)); - ret = ancoChannelProxy.UpdateWindowInfo(windows); - EXPECT_EQ(ret, RET_ERR); + ret = ancoChannelProxy.UpdateWindowInfo(*windows); + EXPECT_EQ(ret, ERR_INVALID_DATA); } /** diff --git a/service/crown_transform_processor/test/BUILD.gn b/service/crown_transform_processor/test/BUILD.gn index 582f71bb83f28798c4c2094a80448522651ea62f..c685b9d735323125adc8da104321ca2b6a95dcc2 100644 --- a/service/crown_transform_processor/test/BUILD.gn +++ b/service/crown_transform_processor/test/BUILD.gn @@ -22,6 +22,8 @@ ohos_unittest("CrownTransformProcessorTest") { configs = [ "${mmi_path}:coverage_flags", "${mmi_path}/service:libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ diff --git a/service/fingerprint_event_processor/test/BUILD.gn b/service/fingerprint_event_processor/test/BUILD.gn index 934383512fb34ccc67234d244296952b7ad73116..360640264dbf6c7e7f7089de7cc8f01f25964752 100644 --- a/service/fingerprint_event_processor/test/BUILD.gn +++ b/service/fingerprint_event_processor/test/BUILD.gn @@ -26,6 +26,8 @@ ohos_unittest("FingerprintEventProcessorTest") { configs = [ "${mmi_path}:coverage_flags", "${mmi_path}/service:libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ @@ -52,6 +54,7 @@ ohos_unittest("FingerprintEventProcessorTest") { ] sources = [ + "${mmi_path}/frameworks/proxy/events/src/input_event.cpp", "${mmi_path}/frameworks/proxy/events/src/pointer_event.cpp", "${mmi_path}/service/event_handler/src/input_event_handler.cpp", "${mmi_path}/service/fingerprint_event_processor/src/fingerprint_event_processor.cpp", diff --git a/service/ipc_blocklist.txt b/service/ipc_blocklist.txt index 40c37817d481c6589069d52133e9390b238dc33a..38b620ed4633a9398b1a99803a0f8474f47db56d 100644 --- a/service/ipc_blocklist.txt +++ b/service/ipc_blocklist.txt @@ -15,4 +15,6 @@ src:*third_party/googletest/* src:*third_party/cJSON/* src:*foundation/multimodalinput/input/service/window_manager/test/* -src:*foundation/multimodalinput/input/service/touch_event_normalize/test/* \ No newline at end of file +src:*foundation/multimodalinput/input/service/touch_event_normalize/test/* +src:*foundation/multimodalinput/input/service/filter/test/* +src:*foundation/multimodalinput/input/service/connect_manager/test/* \ No newline at end of file diff --git a/service/key_command/test/long_press_subscriber_handler_test.cpp b/service/key_command/test/long_press_subscriber_handler_test.cpp index 72a71ed456f2d4abaa7395fa8200d5fedd15d4b1..012e378a3a6626091877aff80f52c3e4f109e598 100644 --- a/service/key_command/test/long_press_subscriber_handler_test.cpp +++ b/service/key_command/test/long_press_subscriber_handler_test.cpp @@ -162,10 +162,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_SubscribeL SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = -1; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret < 0); } @@ -182,10 +181,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_SubscribeL SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); ret = LONG_PRESS_EVENT_HANDLER->UnsubscribeLongPressEvent(sess, subscribeId); @@ -220,10 +218,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_Unsubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); subscribeId = -1; @@ -243,10 +240,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_Unsubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); sess = nullptr; @@ -266,10 +262,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_Unsubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); sess = nullptr; @@ -290,18 +285,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_Unsubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 900, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -321,18 +314,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_AddDuratio SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 2, - .duration = 300, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 2; + longPressRequest2.duration = 300; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -352,18 +343,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_RemoveDura SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 2, - .duration = 300, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 2; + longPressRequest2.duration = 300; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -383,18 +372,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_RemoveDura SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 300; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -414,18 +401,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_RemoveDura SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 900, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -459,10 +444,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_OnSubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t fingerCount = 1; @@ -484,18 +468,16 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_InsertSubS SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); int32_t subscribeId2 = 0; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 900, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -515,20 +497,18 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_InsertSubS SessionPtr sess1 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess1, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); SessionPtr sess2 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId2 = 0; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 900, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess2, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -548,20 +528,18 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_InsertSubS SessionPtr sess1 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess1, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); SessionPtr sess2 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 900, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess2, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -581,10 +559,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_OnSessionD SessionPtr sess1 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess1, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); @@ -605,20 +582,18 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_OnSessionD SessionPtr sess1 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId1 = 0; - LongPressRequest longPressRequest1 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest1; + longPressRequest1.fingerCount = 1; + longPressRequest1.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess1, subscribeId1, longPressRequest1); EXPECT_TRUE(ret >= 0); SessionPtr sess2 = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId2 = 1; - LongPressRequest longPressRequest2 { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 300; ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess2, subscribeId2, longPressRequest2); EXPECT_TRUE(ret >= 0); @@ -874,10 +849,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_CheckFinge SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); @@ -917,11 +891,17 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_CheckFinge SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { .fingerCount = 1, .duration = 300, }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t subscribeId2 = 0; - LongPressRequest longPressRequest2 { .fingerCount = 1, .duration = 900, }; + LongPressRequest longPressRequest2; + longPressRequest2.fingerCount = 1; + longPressRequest2.duration = 900; int32_t subscribeId3 = 0; - LongPressRequest longPressRequest3 { .fingerCount = 1, .duration = 1500, }; + LongPressRequest longPressRequest3; + longPressRequest3.fingerCount = 1; + longPressRequest3.duration = 1500; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId2, longPressRequest2); @@ -987,10 +967,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_OnSubscrib SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); @@ -1027,10 +1006,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_StartFinge SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); @@ -1054,10 +1032,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_StartFinge SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); @@ -1320,10 +1297,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_NotifySubs SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; auto subscriber = std::make_shared(subscribeId, sess, longPressRequest.fingerCount, longPressRequest.duration); auto pair = std::make_pair(longPressRequest.fingerCount, longPressRequest.duration); @@ -1348,10 +1324,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_NotifySubs SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; auto subscriber = std::make_shared(subscribeId, sess, longPressRequest.fingerCount, longPressRequest.duration); auto pair = std::make_pair(longPressRequest.fingerCount, longPressRequest.duration); @@ -1376,10 +1351,9 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_NotifySubs SessionPtr sess = std::make_shared("LongPressSubscribeHandlerTest", MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID); int32_t subscribeId = 0; - LongPressRequest longPressRequest { - .fingerCount = 1, - .duration = 300, - }; + LongPressRequest longPressRequest; + longPressRequest.fingerCount = 1; + longPressRequest.duration = 300; WindowInfo windowInfo; windowInfo.id = 10000; diff --git a/service/message_handle/include/server_msg_handler.h b/service/message_handle/include/server_msg_handler.h index 1b9e7fc14678ef0480a69082d0f2904d5d24d134..b83af532b3459fbf6218029fab1146f0ce1f794a 100644 --- a/service/message_handle/include/server_msg_handler.h +++ b/service/message_handle/include/server_msg_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -18,7 +18,7 @@ #include "client_death_handler.h" #include "event_dispatch_handler.h" -#include "i_event_filter.h" +#include "ievent_filter.h" #include "inject_notice_manager.h" #include "key_option.h" #include "long_press_event.h" diff --git a/service/touch_event_normalize/test/BUILD.gn b/service/touch_event_normalize/test/BUILD.gn index 4ba9693b885cb82332f327404f0c1dc1eeab6a39..71f5514d7627bc8452dd57d5b083332b5fde2dce 100644 --- a/service/touch_event_normalize/test/BUILD.gn +++ b/service/touch_event_normalize/test/BUILD.gn @@ -852,6 +852,8 @@ ohos_unittest("TouchGestureAdapterTest") { configs = [ "${mmi_path}:coverage_flags", "${mmi_path}/service:libmmi_server_config", + "${mmi_path}/service/filter:mmi_event_filter_config", + "${mmi_path}/common/anco/comm:mmi_anco_channel_config", ] cflags = [ diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 282bfa91a05fedf36673799b525f3fe219e6780b..c796c2c8f973348b4cd1305160f33a7ed47b0cbd 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -22,7 +22,7 @@ #include "libinput.h" #include "extra_data.h" #ifdef OHOS_BUILD_ENABLE_ANCO -#include "i_anco_channel.h" +#include "ianco_channel.h" #endif #include "key_event.h" #include "pointer_event.h" diff --git a/service/window_manager/include/i_pointer_drawing_manager.h b/service/window_manager/include/i_pointer_drawing_manager.h index c8b4489ee7eee7893e4b280dd7e227f9678755a5..98575873f63d66aaa9fcfd3e01a1231f72a7f3ca 100644 --- a/service/window_manager/include/i_pointer_drawing_manager.h +++ b/service/window_manager/include/i_pointer_drawing_manager.h @@ -79,7 +79,8 @@ public: { return false; } - virtual int32_t SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) + virtual int32_t SetCustomCursor(CursorPixelMap curPixelMap, + int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) { return 0; } @@ -87,7 +88,7 @@ public: { return 0; } - virtual int32_t SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) + virtual int32_t SetMouseIcon(int32_t pid, int32_t windowId, CursorPixelMap curPixelMap) { return 0; } diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index d4ca94216a68036b639fe2790e8893e7c105c939..7081a490976466c2caea9552620f74e704cd2ee1 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -462,8 +462,8 @@ private: mutable std::shared_mutex displayGroupInfoMtx; std::map windowsPerDisplay_; std::map> windowsPerDisplayMap_; - PointerStyle lastPointerStyle_ {.id = -1}; - PointerStyle dragPointerStyle_ {.id = -1}; + PointerStyle lastPointerStyle_; + PointerStyle dragPointerStyle_; MouseLocation mouseLocation_ = { -1, -1 }; std::map mouseLocationMap_; CursorPosition cursorPos_ {}; diff --git a/service/window_manager/include/pointer_drawing_manager.h b/service/window_manager/include/pointer_drawing_manager.h index e9bbd49a10a230460f056b408ee5b78dcffdebaf..ef4f9db41c1b2c3f6ad9ccbb14b43acd4e9c81b4 100644 --- a/service/window_manager/include/pointer_drawing_manager.h +++ b/service/window_manager/include/pointer_drawing_manager.h @@ -104,9 +104,10 @@ public: void AdjustMouseFocus(Direction direction, ICON_TYPE iconType, int32_t &physicalX, int32_t &physicalY); void SetMouseDisplayState(bool state) override; bool GetMouseDisplayState() const override; - int32_t SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) override; + int32_t SetCustomCursor(CursorPixelMap curPixelMap, + int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) override; int32_t SetCustomCursor(int32_t pid, int32_t windowId, CustomCursor cursor, CursorOptions options) override; - int32_t SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) override; + int32_t SetMouseIcon(int32_t pid, int32_t windowId, CursorPixelMap curPixelMap) override; int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) override; PointerStyle GetLastMouseStyle() override; const std::map& GetMouseIconPath() override; @@ -174,7 +175,7 @@ private: int32_t InitLayer(const MOUSE_ICON mouseStyle); int32_t SetPointerStylePreference(PointerStyle pointerStyle); void UpdateMouseStyle(); - int32_t UpdateCursorProperty(void* pixelMap, const int32_t &focusX, const int32_t &focusY); + int32_t UpdateCursorProperty(CursorPixelMap curPixelMap, const int32_t &focusX, const int32_t &focusY); int32_t UpdateCursorProperty(CustomCursor cursor); void RotateDegree(Direction direction); int32_t DrawMovePointer(int32_t displayId, int32_t physicalX, int32_t physicalY, diff --git a/service/window_manager/src/input_display_bind_helper.cpp b/service/window_manager/src/input_display_bind_helper.cpp index 80c18953cfe81cf44dea19b4797d5e6e48a93c6d..e6f7fc1d9f0f936b7c8aac105ec688aa7c66a289 100644 --- a/service/window_manager/src/input_display_bind_helper.cpp +++ b/service/window_manager/src/input_display_bind_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 @@ -559,12 +559,12 @@ int32_t InputDisplayBindHelper::GetDisplayBindInfo(DisplayBindInfos &infos) CALL_DEBUG_ENTER; CHKPR(infos_, RET_ERR); for (const auto &item : infos_->GetInfos()) { - infos.push_back({ - .inputDeviceId = item.GetInputDeviceId(), - .inputDeviceName = item.GetInputDeviceName(), - .displayId = item.GetDisplayId(), - .displayName = item.GetDisplayName(), - }); + DisplayBindInfo info; + info.inputDeviceId = item.GetInputDeviceId(); + info.inputDeviceName = item.GetInputDeviceName(); + info.displayId = item.GetDisplayId(); + info.displayName = item.GetDisplayName(); + infos.push_back(info); } return RET_OK; } diff --git a/service/window_manager/src/knuckle_drawing_manager.cpp b/service/window_manager/src/knuckle_drawing_manager.cpp index 11ea9e5ff56867be0d1de2474804bea4702c7994..614a334cf4ce6eb3aef1f6eed8acc39f542d990f 100644 --- a/service/window_manager/src/knuckle_drawing_manager.cpp +++ b/service/window_manager/src/knuckle_drawing_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -23,12 +23,14 @@ #else #include "ui/rs_canvas_drawing_node.h" #endif // USE_ROSEN_DRAWING -#include "i_multimodal_input_connect.h" +#include "imultimodal_input_connect.h" #include "input_windows_manager.h" #include "setting_datashare.h" #ifdef OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC #include "timer_manager.h" #endif // OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC +#include "touch_drawing_manager.h" +#include #undef MMI_LOG_TAG #define MMI_LOG_TAG "KnuckleDrawingManager" diff --git a/service/window_manager/src/pointer_drawing_manager.cpp b/service/window_manager/src/pointer_drawing_manager.cpp index 5f44e0f4111a33b1ba20fc1374a17f7989da240e..35512e3a4ba1997c7c38a0dcca960d84059133cc 100644 --- a/service/window_manager/src/pointer_drawing_manager.cpp +++ b/service/window_manager/src/pointer_drawing_manager.cpp @@ -31,7 +31,7 @@ #include "bytrace_adapter.h" #include "define_multimodal.h" -#include "i_multimodal_input_connect.h" +#include "mmi_service.h" #include "input_device_manager.h" #include "i_input_windows_manager.h" #include "ipc_skeleton.h" @@ -603,7 +603,8 @@ void PointerDrawingManager::CreateMagicCursorChangeObserver() // Listening enabling cursor deformation and color inversion SettingObserver::UpdateFunc func = [](const std::string& key) { bool statusValue = false; - auto ret = SettingDataShare::GetInstance(MULTIMODAL_INPUT_SERVICE_ID).GetBoolValue(key, statusValue); + auto ret = SettingDataShare::GetInstance( + MMIService::MULTIMODAL_INPUT_CONNECT_SERVICE_ID).GetBoolValue(key, statusValue); if (ret != RET_OK) { MMI_HILOGE("Get value from setting date fail"); return; @@ -1933,21 +1934,21 @@ void PointerDrawingManager::DrawPixelmap(OHOS::Rosen::Drawing::Canvas &canvas, c } } -int32_t PointerDrawingManager::SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, int32_t focusX, - int32_t focusY) +int32_t PointerDrawingManager::SetCustomCursor(CursorPixelMap curPixelMap, + int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) { CALL_DEBUG_ENTER; followSystem_ = false; #ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR userIconFollowSystem_ = true; #endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR - CHKPR(pixelMap, RET_ERR); + CHKPR(curPixelMap.pixelMap, RET_ERR); if (pid == -1) { MMI_HILOGE("The pid is invalid"); return RET_ERR; } if (windowId < 0) { - int32_t ret = UpdateCursorProperty(pixelMap, focusX, focusY); + int32_t ret = UpdateCursorProperty(curPixelMap, focusX, focusY); if (ret != RET_OK) { MMI_HILOGE("UpdateCursorProperty is failed"); return ret; @@ -1968,7 +1969,7 @@ int32_t PointerDrawingManager::SetCustomCursor(void* pixelMap, int32_t pid, int3 MMI_HILOGE("The windowId not in right pid"); return RET_ERR; } - int32_t ret = UpdateCursorProperty(pixelMap, focusX, focusY); + int32_t ret = UpdateCursorProperty(curPixelMap, focusX, focusY); if (ret != RET_OK) { MMI_HILOGE("UpdateCursorProperty is failed"); return ret; @@ -1988,13 +1989,20 @@ int32_t PointerDrawingManager::SetCustomCursor(void* pixelMap, int32_t pid, int3 } -int32_t PointerDrawingManager::UpdateCursorProperty(void* pixelMap, const int32_t &focusX, const int32_t &focusY) +int32_t PointerDrawingManager::UpdateCursorProperty(CursorPixelMap curPixelMap, + const int32_t &focusX, const int32_t &focusY) { - CHKPR(pixelMap, RET_ERR); - Media::PixelMap* newPixelMap = static_cast(pixelMap); + CHKPR(curPixelMap.pixelMap, RET_ERR); + Media::PixelMap* newPixelMap = static_cast(curPixelMap.pixelMap); CHKPR(newPixelMap, RET_ERR); Media::ImageInfo imageInfo; newPixelMap->GetImageInfo(imageInfo); + int32_t newFocusX = 0; + int32_t newFocusY = 0; + newFocusX = focusX < 0 ? 0 : focusX; + newFocusY = focusY < 0 ? 0 : focusY; + newFocusX = newFocusX > newPixelMap->GetWidth() ? newPixelMap->GetWidth() : newFocusX; + newFocusY = newFocusY > newPixelMap->GetHeight() ? newPixelMap->GetHeight() : newFocusY; int32_t cursorSize = GetPointerSize(); cursorWidth_ = pow(INCREASE_RATIO, cursorSize - 1) * displayInfo_.dpi * GetIndependentPixels() / BASELINE_DENSITY; @@ -2009,16 +2017,16 @@ int32_t PointerDrawingManager::UpdateCursorProperty(void* pixelMap, const int32_ std::lock_guard guard(mtx_); userIcon_.reset(newPixelMap); } - userIconHotSpotX_ = static_cast((float)focusX * xAxis); - userIconHotSpotY_ = static_cast((float)focusY * yAxis); + userIconHotSpotX_ = static_cast((float)newFocusX * xAxis); + userIconHotSpotY_ = static_cast((float)newFocusY * yAxis); MMI_HILOGI("cursorWidth:%{public}d, cursorHeight:%{public}d, imageWidth:%{public}d, imageHeight:%{public}d," "focusX:%{public}d, focuxY:%{public}d, xAxis:%{public}f, yAxis:%{public}f, userIconHotSpotX_:%{public}d," "userIconHotSpotY_:%{public}d", cursorWidth_, cursorHeight_, imageInfo.size.width, imageInfo.size.height, - focusX, focusY, xAxis, yAxis, userIconHotSpotX_, userIconHotSpotY_); + newFocusX, newFocusY, xAxis, yAxis, userIconHotSpotX_, userIconHotSpotY_); return RET_OK; } -int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) +int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, CursorPixelMap curPixelMap) __attribute__((no_sanitize("cfi"))) { CALL_DEBUG_ENTER; @@ -2026,7 +2034,7 @@ int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, void* MMI_HILOGE("pid is invalid return -1"); return RET_ERR; } - CHKPR(pixelMap, RET_ERR); + CHKPR(curPixelMap.pixelMap, RET_ERR); if (windowId < 0) { MMI_HILOGE("Get invalid windowId, %{public}d", windowId); return RET_ERR; @@ -2035,7 +2043,7 @@ int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, void* MMI_HILOGE("windowId not in right pid"); return RET_ERR; } - OHOS::Media::PixelMap* pixelMapPtr = static_cast(pixelMap); + OHOS::Media::PixelMap* pixelMapPtr = static_cast(curPixelMap.pixelMap); { std::lock_guard guard(mtx_); userIcon_.reset(pixelMapPtr); @@ -2124,7 +2132,6 @@ std::shared_ptr PointerDrawingManager::LoadCursorSvgWithC decodeOpts.SVGOpts.strokeColor = {.isValidColor = true, .color = MAX_POINTER_COLOR}; } } - std::shared_ptr pixelMap = imageSource->CreatePixelMap(decodeOpts, ret); CHKPL(pixelMap); return pixelMap; @@ -2547,7 +2554,9 @@ bool PointerDrawingManager::Init() std::lock_guard guard(mousePixelMapMutex_); mousePixelMap_.clear(); } - InitPixelMaps(); + initLoadingAndLoadingRightPixelTimerId_ = TimerMgr->AddTimer(REPEAT_COOLING_TIME, REPEAT_ONCE, [this]() { + InitPixelMaps(); + }); return true; } diff --git a/service/window_manager/src/touch_drawing_manager.cpp b/service/window_manager/src/touch_drawing_manager.cpp index 1ebaa73516515ca33a5f0440236c987e1af182d7..c4b8575c66358a4b3d13a35750c60690d2e38490 100644 --- a/service/window_manager/src/touch_drawing_manager.cpp +++ b/service/window_manager/src/touch_drawing_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 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 @@ -19,7 +19,7 @@ #include "parameters.h" #include "setting_datashare.h" -#include "i_multimodal_input_connect.h" +#include #include "input_windows_manager.h" #include "table_dump.h" #include "timer_manager.h" diff --git a/service/window_manager/test/input_windows_manager_test.cpp b/service/window_manager/test/input_windows_manager_test.cpp index c7a1176c1ae855193d7c00c213e880afa8faa534..e2c69e783c734120f76c9978c29788df4b7a10ad 100644 --- a/service/window_manager/test/input_windows_manager_test.cpp +++ b/service/window_manager/test/input_windows_manager_test.cpp @@ -7394,10 +7394,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; std::shared_ptr pointerEvent = PointerEvent::Create(); EXPECT_NE(pointerEvent, nullptr); @@ -7423,10 +7422,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; int32_t displayId = 0; std::shared_ptr pointerEvent = PointerEvent::Create(); @@ -7459,10 +7457,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; int32_t displayId = -1; std::shared_ptr pointerEvent = PointerEvent::Create(); @@ -7495,10 +7492,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; int32_t displayId = 0; std::shared_ptr pointerEvent = PointerEvent::Create(); @@ -7533,10 +7529,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; int32_t displayId = 0; std::shared_ptr pointerEvent = PointerEvent::Create(); @@ -7571,10 +7566,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 inputWindowsManager.lastPointerEvent_ = nullptr; int32_t sourceWindowId = 50; int32_t targetWindowId = 51; - ShiftWindowParam param { - .sourceWindowId = sourceWindowId, - .targetWindowId = targetWindowId, - }; + ShiftWindowParam param; + param.sourceWindowId = sourceWindowId; + param.targetWindowId = targetWindowId; bool autoGenDown = true; int32_t displayId = 0; WindowGroupInfo windowGroupInfo; diff --git a/service/window_manager/test/mock.cpp b/service/window_manager/test/mock.cpp index c61306b37b6582994ab4e0262f89fb2335b447d5..651c559122c4c80e025a15dbd6ad81a5a6e840a5 100644 --- a/service/window_manager/test/mock.cpp +++ b/service/window_manager/test/mock.cpp @@ -274,12 +274,12 @@ bool PointerDrawingManager::GetMouseDisplayState() const } return DfsMessageParcel::messageParcel->GetMouseDisplayState(); } -int32_t PointerDrawingManager::SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, +int32_t PointerDrawingManager::SetCustomCursor(CursorPixelMap curPixelMap, int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) { return 0; } -int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) +int32_t PointerDrawingManager::SetMouseIcon(int32_t pid, int32_t windowId, CursorPixelMap curPixelMap) { return 0; } diff --git a/service/window_manager/test/pointer_drawing_manager_ex_test.cpp b/service/window_manager/test/pointer_drawing_manager_ex_test.cpp index f8c1b1e617e63fcf39118faef6f430e269460a06..ee211806a52dfebd2427675d398201151275912a 100644 --- a/service/window_manager/test/pointer_drawing_manager_ex_test.cpp +++ b/service/window_manager/test/pointer_drawing_manager_ex_test.cpp @@ -30,6 +30,7 @@ #include "pixel_map.h" #include "pointer_drawing_manager.h" #include "pointer_event.h" +#include "pointer_style.h" #undef MMI_LOG_TAG #define MMI_LOG_TAG "PointerDrawingManagerExTest" @@ -880,8 +881,8 @@ HWTEST_F(PointerDrawingManagerExTest, InputWindowsManagerTest_SetMouseIcon_01, T PointerDrawingManager pointerDrawingManager; int32_t pid = -1; int32_t windowId = -2; - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -897,8 +898,8 @@ HWTEST_F(PointerDrawingManagerExTest, InputWindowsManagerTest_SetMouseIcon_02, T PointerDrawingManager pointerDrawingManager; int32_t pid = 1; int32_t windowId = -2; - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -918,8 +919,8 @@ HWTEST_F(PointerDrawingManagerExTest, InputWindowsManagerTest_SetMouseIcon_03, T int32_t ret1 = pointerDrawingManager.SetPointerStyle(pid, windowId, style); EXPECT_EQ(ret1, RET_OK); - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -1127,7 +1128,9 @@ HWTEST_F(PointerDrawingManagerExTest, InputWindowsManagerTest_SetCustomCursor_00 int32_t windowId = 1; int32_t focusX = 2; int32_t focusY = 3; - int32_t ret = pointerDrawingManager.SetCustomCursor((void *)pixelMap.get(), pid, windowId, focusX, focusY); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetCustomCursor(curPixelMap, pid, windowId, focusX, focusY); ASSERT_EQ(ret, RET_ERR); } @@ -1148,7 +1151,9 @@ HWTEST_F(PointerDrawingManagerExTest, InputWindowsManagerTest_SetCustomCursor_00 int32_t windowId = 1; int32_t focusX = 2; int32_t focusY = 3; - int32_t ret = pointerDrawingManager.SetCustomCursor((void *)pixelMap.get(), pid, windowId, focusX, focusY); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetCustomCursor(curPixelMap, pid, windowId, focusX, focusY); EXPECT_EQ(ret, RET_ERR); } @@ -1568,7 +1573,9 @@ HWTEST_F(PointerDrawingManagerExTest, PointerDrawingManagerExTest_SetCustomCurso int32_t windowId = 100; int32_t focusX = 300; int32_t focusY = 300; - EXPECT_EQ(pointerDrawMgr.SetCustomCursor((void *)pixelMapPtr.get(), pid, windowId, focusX, focusY), RET_ERR); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMapPtr.get(); + EXPECT_EQ(pointerDrawMgr.SetCustomCursor(curPixelMap, pid, windowId, focusX, focusY), RET_ERR); testing::Mock::AllowLeak(winmgrmock.get()); } @@ -1585,7 +1592,9 @@ HWTEST_F(PointerDrawingManagerExTest, PointerDrawingManagerExTest_SetMouseIcon, std::shared_ptr pixelMapPtr = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT); int32_t pid = 50; int32_t windowId = -1; - EXPECT_EQ(pointerDrawMgr.SetMouseIcon(pid, windowId, (void *)pixelMapPtr.get()), RET_ERR); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMapPtr.get(); + EXPECT_EQ(pointerDrawMgr.SetMouseIcon(pid, windowId, curPixelMap), RET_ERR); } /** diff --git a/service/window_manager/test/pointer_drawing_manager_test.cpp b/service/window_manager/test/pointer_drawing_manager_test.cpp index c914f9a4d76c8fbae75bf5b65c2b17060836475d..f7ed0cb8dc1ca1f915bc1d9df24d5845c6d96cc9 100644 --- a/service/window_manager/test/pointer_drawing_manager_test.cpp +++ b/service/window_manager/test/pointer_drawing_manager_test.cpp @@ -378,8 +378,8 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_01, Tes PointerDrawingManager pointerDrawingManager; int32_t pid = -1; int32_t windowId = -2; - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -395,8 +395,8 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_02, Tes PointerDrawingManager pointerDrawingManager; int32_t pid = 1; int32_t windowId = -2; - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -416,8 +416,8 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_03, Tes int32_t ret1 = pointerDrawingManager.SetPointerStyle(pid, windowId, style); EXPECT_EQ(ret1, RET_OK); - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -669,7 +669,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetPointerVisible_00 CALL_TEST_DEBUG; auto winmgrmock = std::make_shared(); auto* pointerDrawingManager = static_cast(IPointerDrawingManager::GetInstance()); - EXPECT_CALL(*winmgrmock, GetExtraData).WillRepeatedly(testing::Return(ExtraData{true})); + ExtraData data1; + data1.appended = true; + EXPECT_CALL(*winmgrmock, GetExtraData).WillRepeatedly(testing::Return(data1)); int32_t pid = 1; bool visible = true; int32_t priority = 0; @@ -687,7 +689,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetPointerVisible_00 priority = 1; ret = pointerDrawingManager->SetPointerVisible(pid, visible, priority, false); ASSERT_EQ(ret, RET_OK); - EXPECT_CALL(*winmgrmock, GetExtraData).WillRepeatedly(testing::Return(ExtraData{false})); + ExtraData data2; + data2.appended = true; + EXPECT_CALL(*winmgrmock, GetExtraData).WillRepeatedly(testing::Return(data2)); visible = false; priority = 0; ret = pointerDrawingManager->SetPointerVisible(pid, visible, priority, false); @@ -1283,11 +1287,11 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_001, Te PointerDrawingManager pointerDrawingManager; int32_t pid = -1; int32_t windowId = 1; - void* pixelMap = nullptr; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + CursorPixelMap curPixelMap; + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); EXPECT_EQ(ret, RET_ERR); pid = 1; - ret = pointerDrawingManager.SetMouseIcon(pid, windowId, pixelMap); + ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); EXPECT_EQ(ret, RET_ERR); } @@ -1564,7 +1568,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetCustomCursor_001, int32_t windowId = 1; int32_t focusX = 2; int32_t focusY = 3; - int32_t ret = pointerDrawingManager.SetCustomCursor((void *)pixelMap.get(), pid, windowId, focusX, focusY); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetCustomCursor(curPixelMap, pid, windowId, focusX, focusY); ASSERT_EQ(ret, RET_ERR); } @@ -1585,7 +1591,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetCustomCursor_002, int32_t windowId = 1; int32_t focusX = 2; int32_t focusY = 3; - int32_t ret = pointerDrawingManager.SetCustomCursor((void *)pixelMap.get(), pid, windowId, focusX, focusY); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetCustomCursor(curPixelMap, pid, windowId, focusX, focusY); ASSERT_EQ(ret, RET_ERR); } @@ -1625,7 +1633,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_002, Te ASSERT_NE(pixelMap, nullptr); int32_t pid = -1; int32_t windowId = 2; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, (void *)pixelMap.get()); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); } @@ -1644,7 +1654,9 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_SetMouseIcon_003, Te ASSERT_NE(pixelMap, nullptr); int32_t pid = 1; int32_t windowId = -2; - int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, (void *)pixelMap.get()); + CursorPixelMap curPixelMap; + curPixelMap.pixelMap = (void *)pixelMap.get(); + int32_t ret = pointerDrawingManager.SetMouseIcon(pid, windowId, curPixelMap); ASSERT_EQ(ret, RET_ERR); }