• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/config/components/multimodalinput/cursor_config.gni")
15import("//build/ohos.gni")
16
17mmi_part_name = "input"
18mmi_subsystem_name = "multimodalinput"
19mmi_path = "//foundation/multimodalinput/input"
20graphics_path = "//foundation/graphic/graphic_2d/rosen/modules"
21preferences_path = "//foundation/distributeddatamgr/preferences"
22ability_runtime_path = "//foundation/ability/ability_runtime"
23security_component_path = "//base/security"
24c_utils_root = "//commonlibrary/c_utils"
25hilog_root = "//base/hiviewdfx/hilog"
26
27declare_args() {
28  hitrace_enabled = false
29  call_manager_service_enabled = false
30  resource_schedule_service_enabled = false
31  screenlock_manager_enabled = false
32  input_feature_product = "default"
33  input_feature_enable_pgo = false
34  input_feature_pgo_path = ""
35  input_feature_combination_key = false
36  input_feature_pointer_drawing = true
37  input_feature_interceptor = true
38  input_feature_monitor = true
39  input_feature_keyboard = false
40  input_feature_switch = true
41  input_feature_mouse = true
42  input_feature_joystick = true
43  input_feature_touchscreen = true
44  input_feature_input_device = true
45  input_feature_short_key = true
46  input_feature_coverage = false
47  input_ext_feature_anco = false
48  input_ext_feature_fingersense = true
49  input_ext_feature_gesturesense = true
50  input_feature_fingerprint = false
51  input_feature_crown = false
52  input_feature_move_event_filters = false
53  input_shortcut_key_manager_enabled = true
54  input_shortcut_key_rules_enabled = true
55  input_new_knuckle_dynamic_enabled = true
56  input_feature_virtual_keyboard = false
57  input_feature_dfx_radar_enable = false
58  input_feature_one_hand_mode_enable = false
59  input_feature_touch_drawing = true
60
61  if (defined(global_parts_info) &&
62      defined(global_parts_info.resourceschedule_resource_schedule_service)) {
63    resource_schedule_service_enabled = true
64  }
65
66  if (defined(global_parts_info) &&
67      defined(global_parts_info.theme_screenlock_mgr)) {
68    screenlock_manager_enabled = true
69  }
70
71  if (is_emulator) {
72    input_feature_pointer_drawing = false
73  }
74
75  uinput_inject_sources = [
76    "uinput/hdf_device_event_dispatch.cpp",
77    "uinput/hdf_device_event_manager.cpp",
78    "uinput/inject_thread.cpp",
79    "uinput/keyboard_inject.cpp",
80    "uinput/virtual_device.cpp",
81    "uinput/virtual_keyboard.cpp",
82    "uinput/virtual_touch_screen.cpp",
83  ]
84
85  libmmi_common_sources = [
86    "events/src/axis_event.cpp",
87    "events/src/input_device.cpp",
88    "events/src/input_event.cpp",
89    "events/src/key_event.cpp",
90    "events/src/key_option.cpp",
91    "events/src/pointer_event.cpp",
92  ]
93
94  libmmi_client_sources = [
95    "event_handler/src/anr_handler.cpp",
96    "event_handler/src/bytrace_adapter.cpp",
97    "event_handler/src/client_msg_handler.cpp",
98    "event_handler/src/input_device_impl.cpp",
99    "event_handler/src/input_handler_manager.cpp",
100    "event_handler/src/input_manager_impl.cpp",
101    "event_handler/src/long_press_event_subscribe_manager.cpp",
102    "event_handler/src/multimodal_event_handler.cpp",
103    "event_handler/src/pre_monitor_manager.cpp",
104    "event_handler/src/scene_board_judgement.cpp",
105    "events/src/input_manager.cpp",
106    "module_loader/src/mmi_client.cpp",
107    "module_loader/src/mmi_fd_listener.cpp",
108  ]
109
110  libmmi_service_sources = [
111    "$mmi_path/frameworks/proxy/event_handler/src/bytrace_adapter.cpp",
112    "$mmi_path/frameworks/proxy/event_handler/src/scene_board_judgement.cpp",
113    "app_state_manager/src/app_state_observer.cpp",
114    "delegate_task/src/delegate_interface.cpp",
115    "delegate_task/src/delegate_tasks.cpp",
116    "device_manager/src/input_device_manager.cpp",
117    "device_state_manager/src/device_event_monitor.cpp",
118    "dfx/src/api_duration_statistics.cpp",
119    "dfx/src/dfx_hisysevent.cpp",
120    "dfx/src/dfx_hisysevent_device.cpp",
121    "event_dispatch/src/event_dispatch_handler.cpp",
122    "event_dump/src/event_dump.cpp",
123    "event_dump/src/event_statistic.cpp",
124    "event_handler/src/anr_manager.cpp",
125    "event_handler/src/event_normalize_handler.cpp",
126    "event_handler/src/input_event_handler.cpp",
127    "event_handler/src/key_auto_repeat.cpp",
128    "event_handler/src/key_event_value_transformation.cpp",
129    "event_handler/src/key_map_manager.cpp",
130    "event_handler/src/touchpad_settings_handler.cpp",
131    "key_command/src/setting_datashare.cpp",
132    "key_command/src/setting_observer.cpp",
133    "libinput_adapter/src/hotplug_detector.cpp",
134    "libinput_adapter/src/libinput_adapter.cpp",
135    "libinput_adapter/src/property_reader.cpp",
136    "message_handle/src/authorization_dialog.cpp",
137    "message_handle/src/authorize_helper.cpp",
138    "message_handle/src/client_death_handler.cpp",
139    "message_handle/src/inject_notice_manager.cpp",
140    "message_handle/src/server_msg_handler.cpp",
141    "module_loader/src/app_debug_listener.cpp",
142    "module_loader/src/mmi_service.cpp",
143    "module_loader/src/multimodal_input_preferences_manager.cpp",
144    "module_loader/src/uds_server.cpp",
145    "module_loader/src/watchdog_task.cpp",
146    "nap_process/src/nap_process.cpp",
147    "permission_helper/src/permission_helper.cpp",
148    "timer_manager/src/timer_manager.cpp",
149    "window_manager/src/input_display_bind_helper.cpp",
150    "window_manager/src/input_windows_manager.cpp",
151  ]
152
153  infraredemitter_sources = [ "src/js_register_module.cpp" ]
154
155  inputdevice_sources = [
156    "src/js_event_target.cpp",
157    "src/js_input_device_context.cpp",
158    "src/js_input_device_manager.cpp",
159    "src/js_util.cpp",
160    "src/native_register_module.cpp",
161  ]
162
163  inputmonitor_sources = [
164    "src/js_input_monitor.cpp",
165    "src/js_input_monitor_manager.cpp",
166    "src/js_input_monitor_module.cpp",
167  ]
168
169  patch_gen_libinput_third_mmi_sources = [
170    root_out_dir + "/diff_libinput_mmi/src/evdev-debounce.c",
171    root_out_dir + "/diff_libinput_mmi/src/evdev-fallback.c",
172    root_out_dir + "/diff_libinput_mmi/src/evdev-joystick.c",
173    root_out_dir + "/diff_libinput_mmi/src/evdev-privacy-switch.c",
174    root_out_dir + "/diff_libinput_mmi/src/evdev-middle-button.c",
175    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-buttons.c",
176    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-edge-scroll.c",
177    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-gestures.c",
178    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-tap.c",
179    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-thumb.c",
180    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad.c",
181    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet-pad-leds.c",
182    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet-pad.c",
183    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet.c",
184    root_out_dir + "/diff_libinput_mmi/src/evdev-totem.c",
185    root_out_dir + "/diff_libinput_mmi/src/evdev-wheel.c",
186    root_out_dir + "/diff_libinput_mmi/src/evdev.c",
187    root_out_dir + "/diff_libinput_mmi/src/filter-custom.c",
188    root_out_dir + "/diff_libinput_mmi/src/filter-flat.c",
189    root_out_dir + "/diff_libinput_mmi/src/filter-low-dpi.c",
190    root_out_dir + "/diff_libinput_mmi/src/filter-mouse.c",
191    root_out_dir + "/diff_libinput_mmi/src/filter-tablet.c",
192    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad-flat.c",
193    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad-x230.c",
194    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad.c",
195    root_out_dir + "/diff_libinput_mmi/src/filter-trackpoint-flat.c",
196    root_out_dir + "/diff_libinput_mmi/src/filter-trackpoint.c",
197    root_out_dir + "/diff_libinput_mmi/src/filter.c",
198    root_out_dir + "/diff_libinput_mmi/src/libinput-util.c",
199    root_out_dir + "/diff_libinput_mmi/src/libinput.c",
200    root_out_dir + "/diff_libinput_mmi/src/path-seat.c",
201    root_out_dir + "/diff_libinput_mmi/src/quirks.c",
202    root_out_dir + "/diff_libinput_mmi/src/timer.c",
203    root_out_dir + "/diff_libinput_mmi/src/util-list.c",
204    root_out_dir + "/diff_libinput_mmi/src/util-prop-parsers.c",
205    root_out_dir + "/diff_libinput_mmi/src/util-ratelimit.c",
206    root_out_dir + "/diff_libinput_mmi/src/util-strings.c",
207  ]
208
209  patch_gen_libmtdev_third_mmi_sources = [
210    root_out_dir + "/diff_libmtdev_mmi/src/caps.c",
211    root_out_dir + "/diff_libmtdev_mmi/src/core.c",
212    root_out_dir + "/diff_libmtdev_mmi/src/iobuf.c",
213    root_out_dir + "/diff_libmtdev_mmi/src/match.c",
214    root_out_dir + "/diff_libmtdev_mmi/src/match_four.c",
215  ]
216
217  event_injection_sources = [
218    "src/device_base.cpp",
219    "src/get_device_node.cpp",
220    "src/get_device_object.cpp",
221    "src/injection_event_dispatch.cpp",
222    "src/injection_tools_help_func.cpp",
223    "src/input_parse.cpp",
224    "src/manage_inject_device.cpp",
225    "src/processing_finger_device.cpp",
226    "src/processing_game_pad_device.cpp",
227    "src/processing_joystick_device.cpp",
228    "src/processing_keyboard_device.cpp",
229    "src/processing_mouse_device.cpp",
230    "src/processing_pad_device.cpp",
231    "src/processing_pen_device.cpp",
232    "src/processing_touch_screen_device.cpp",
233  ]
234
235  libmmi_virtual_device_sources = [
236    "src/virtual_crown.cpp",
237    "src/virtual_device.cpp",
238    "src/virtual_finger.cpp",
239    "src/virtual_fingerprint_key.cpp",
240    "src/virtual_fingerprint_mouse.cpp",
241    "src/virtual_gamepad.cpp",
242    "src/virtual_joystick.cpp",
243    "src/virtual_keyboard.cpp",
244    "src/virtual_keyboard_consumer_ctrl.cpp",
245    "src/virtual_keyboard_ext.cpp",
246    "src/virtual_keyboard_sys_ctrl.cpp",
247    "src/virtual_knob.cpp",
248    "src/virtual_knob_consumer_ctrl.cpp",
249    "src/virtual_knob_mouse.cpp",
250    "src/virtual_knob_sys_ctrl.cpp",
251    "src/virtual_mouse.cpp",
252    "src/virtual_pc_switch.cpp",
253    "src/virtual_pc_touchpad.cpp",
254    "src/virtual_pen.cpp",
255    "src/virtual_pen_keyboard.cpp",
256    "src/virtual_pen_mouse.cpp",
257    "src/virtual_remote_control.cpp",
258    "src/virtual_single_finger.cpp",
259    "src/virtual_single_touchscreen.cpp",
260    "src/virtual_stylus.cpp",
261    "src/virtual_touchpad.cpp",
262    "src/virtual_touchscreen.cpp",
263    "src/virtual_trackball.cpp",
264    "src/virtual_trackpad.cpp",
265    "src/virtual_trackpad_mouse.cpp",
266    "src/virtual_trackpad_sys_ctrl.cpp",
267    "src/virtual_uwb_remote_control.cpp",
268  ]
269
270  libmmi_util_sources = [
271    "common/src/input_event_data_transformation.cpp",
272    "common/src/klog.cpp",
273    "common/src/util.cpp",
274    "network/src/circle_stream_buffer.cpp",
275    "network/src/net_packet.cpp",
276    "network/src/stream_buffer.cpp",
277    "socket/src/uds_client.cpp",
278    "socket/src/uds_session.cpp",
279    "socket/src/uds_socket.cpp",
280  ]
281}
282
283if (input_feature_joystick) {
284  input_feature_mouse = true
285}
286
287print("input_feature_combination_key = ${input_feature_combination_key}")
288print("input_feature_pointer_drawing = ${input_feature_pointer_drawing}")
289print("input_feature_monitor = ${input_feature_monitor}")
290print("input_feature_interceptor = ${input_feature_interceptor}")
291print("input_feature_keyboard = ${input_feature_keyboard}")
292print("input_feature_switch = ${input_feature_switch}")
293print("input_feature_mouse = ${input_feature_mouse}")
294print("input_feature_joystick = ${input_feature_joystick}")
295print("input_feature_touchscreen = ${input_feature_touchscreen}")
296print("input_feature_input_device = ${input_feature_input_device}")
297print("input_feature_short_key = ${input_feature_short_key}")
298print(
299    "input_feature_one_hand_mode_enable = ${input_feature_one_hand_mode_enable}")
300print("input_feature_move_event_filters = ${input_feature_move_event_filters}")
301
302input_default_defines = []
303
304if (input_feature_pointer_drawing) {
305  input_default_defines += [ "OHOS_BUILD_ENABLE_POINTER_DRAWING" ]
306}
307
308if (input_feature_interceptor) {
309  input_default_defines += [ "OHOS_BUILD_ENABLE_INTERCEPTOR" ]
310}
311
312if (input_feature_keyboard) {
313  input_default_defines += [ "OHOS_BUILD_ENABLE_KEYBOARD" ]
314}
315
316if (input_feature_switch) {
317  input_default_defines += [ "OHOS_BUILD_ENABLE_SWITCH" ]
318}
319
320if (input_feature_monitor) {
321  input_default_defines += [ "OHOS_BUILD_ENABLE_MONITOR" ]
322}
323
324if (input_feature_touchscreen) {
325  input_default_defines += [ "OHOS_BUILD_ENABLE_TOUCH" ]
326}
327
328if (input_feature_mouse) {
329  input_default_defines += [ "OHOS_BUILD_ENABLE_POINTER" ]
330}
331
332if (input_feature_joystick) {
333  input_default_defines += [ "OHOS_BUILD_ENABLE_JOYSTICK" ]
334}
335
336if (input_feature_short_key) {
337  input_default_defines += [ "OHOS_BUILD_ENABLE_SHORT_KEY" ]
338}
339
340if (input_feature_fingerprint) {
341  input_default_defines += [ "OHOS_BUILD_ENABLE_FINGERPRINT" ]
342}
343
344if (input_feature_crown) {
345  input_default_defines += [ "OHOS_BUILD_ENABLE_CROWN" ]
346}
347
348if (input_feature_one_hand_mode_enable) {
349  input_default_defines += [ "OHOS_BUILD_ENABLE_ONE_HAND_MODE" ]
350}
351
352if (!defined(global_parts_info) ||
353    defined(global_parts_info.security_security_component_manager)) {
354  security_component_enable = true
355} else {
356  security_component_enable = false
357}
358
359if (security_component_enable) {
360  input_default_defines += [ "OHOS_BUILD_ENABLE_SECURITY_COMPONENT" ]
361}
362
363if (input_ext_feature_fingersense) {
364  input_default_defines += [ "OHOS_BUILD_ENABLE_FINGERSENSE_WRAPPER" ]
365}
366
367if (input_ext_feature_gesturesense) {
368  input_default_defines += [ "OHOS_BUILD_ENABLE_GESTURESENSE_WRAPPER" ]
369}
370
371if (input_feature_move_event_filters) {
372  input_default_defines += [ "OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS" ]
373}
374
375if (input_ext_feature_anco) {
376  mmi_ext_path = "//vendor/huawei/foundation/multimodalinput/input_ext"
377  input_default_defines += [ "OHOS_BUILD_ENABLE_ANCO" ]
378  libmmi_client_sources +=
379      [ "${mmi_ext_path}/anco_uds_manager/src/input_manager_ext.cpp" ]
380
381  libmmi_service_sources += [
382    "${mmi_ext_path}/anco_uds_manager/src/anco_uds_manager.cpp",
383    "${mmi_ext_path}/anco_uds_manager/src/input_windows_manager_ext.cpp",
384    "${mmi_ext_path}/anco_uds_manager/src/mmi_service_ext.cpp",
385  ]
386
387  if (input_feature_product != "pc") {
388    libmmi_service_sources += [ "${mmi_path}/service/infrared_emitter/src/infrared_emitter_controller.cpp" ]
389  }
390}
391
392if (input_feature_product == "pc") {
393  input_default_defines += [ "OHOS_BUILD_ENABLE_HARDWARE_CURSOR" ]
394  input_default_defines += [ "OHOS_BUILD_PC_PRIORITY" ]
395  input_default_defines += [ "OHOS_BUILD_PC_UNIT_TEST" ]
396  input_default_defines += [ "OHOS_BUILD_MOUSE_REPORTING_RATE" ]
397}
398
399if (input_feature_product == "watch") {
400  input_default_defines += [ "OHOS_BUILD_ENABLE_WATCH" ]
401} else {
402  libmmi_service_sources += [
403    "device_config/src/device_config_file_parser.cpp",
404    "fingersense_wrapper/src/fingersense_wrapper.cpp",
405    "gesturesense_wrapper/src/gesturesense_wrapper.cpp",
406    "hardware_cursor_pointer_manager/src/hardware_cursor_pointer_manager.cpp",
407  ]
408
409  if (input_new_knuckle_dynamic_enabled) {
410    input_default_defines += [ "OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC" ]
411  }
412}
413
414if (input_ext_feature_magiccursor) {
415  mmi_ext_path = "//vendor/huawei/foundation/multimodalinput/input_ext"
416  g2d_ext_path = "//foundation/graphic/graphic_2d_ext"
417  g2d_path = "//foundation/graphic/graphic_2d"
418  surface_path = "//foundation/graphic/graphic_surface"
419  input_default_defines += [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ]
420  libmmi_service_sources += [
421    "${mmi_ext_path}/magic_cursor/src/dfx_hisysevent_ext.cpp",
422    "${mmi_ext_path}/magic_cursor/src/lru_cache.cpp",
423    "${mmi_ext_path}/magic_cursor/src/magic_pointer_drawing_manager.cpp",
424    "${mmi_ext_path}/magic_cursor/src/magic_pointer_drawing_manager_ext.cpp",
425    "${mmi_ext_path}/magic_cursor/src/magic_pointer_velocity_tracker.cpp",
426    "${mmi_ext_path}/magic_cursor/src/render_context_gl.cpp",
427  ]
428}
429
430if (defined(global_parts_info.multimedia_player_framework)) {
431  enable_player_framework = true
432  input_default_defines += [ "PLAYER_FRAMEWORK_EXISTS" ]
433} else {
434  enable_player_framework = false
435}
436
437if (enable_player_framework) {
438  libmmi_service_sources +=
439      [ "module_loader/src/input_screen_capture_agent.cpp" ]
440}
441
442if (input_shortcut_key_rules_enabled) {
443  input_shortcut_key_manager_enabled = true
444}
445
446if (defined(global_parts_info) &&
447    defined(global_parts_info.telephony_call_manager)) {
448  call_manager_service_enabled = true
449  input_default_defines += [ "CALL_MANAGER_SERVICE_ENABLED" ]
450}
451
452if (defined(global_parts_info) &&
453    defined(global_parts_info.hiviewdfx_hitrace)) {
454  hitrace_enabled = true
455  input_default_defines += [ "HITRACE_ENABLED" ]
456}
457
458if (input_feature_virtual_keyboard) {
459  input_default_defines += [ "OHOS_BUILD_ENABLE_VKEYBOARD" ]
460}
461
462if (input_feature_dfx_radar_enable) {
463  input_default_defines += [ "OHOS_BUILD_ENABLE_DFX_RADAR" ]
464}
465
466if (input_feature_touch_drawing) {
467  input_default_defines += [ "OHOS_BUILD_ENABLE_TOUCH_DRAWING" ]
468}
469