• 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"
26mmi_ext_path = "//vendor/huawei/foundation/multimodalinput/input_ext"
27
28declare_args() {
29  hitrace_enabled = false
30  call_manager_service_enabled = false
31  resource_schedule_service_enabled = false
32  screenlock_manager_enabled = false
33  input_feature_product = "default"
34  input_feature_enable_pgo = false
35  input_feature_pgo_path = ""
36  input_feature_combination_key = false
37  input_feature_pointer_drawing = true
38  input_feature_interceptor = true
39  input_feature_monitor = true
40  input_feature_keyboard = false
41  input_feature_switch = true
42  input_feature_mouse = true
43  input_feature_joystick = true
44  input_feature_touchscreen = true
45  input_feature_input_device = true
46  input_feature_short_key = true
47  input_feature_coverage = false
48  input_ext_feature_anco = false
49  input_ext_feature_fingersense = true
50  input_ext_feature_gesturesense = true
51  input_feature_fingerprint = false
52  input_feature_crown = false
53  input_feature_move_event_filters = false
54  input_shortcut_key_manager_enabled = true
55  input_shortcut_key_rules_enabled = true
56  input_new_knuckle_dynamic_enabled = true
57  input_feature_virtual_keyboard = false
58  input_feature_dfx_radar_enable = false
59  input_feature_one_hand_mode_enable = false
60  input_feature_touch_drawing = true
61  input_feature_key_pressed_handler = true
62  input_feature_event_recorder = true
63  input_ext_feature_keyboard_ext_flag = false
64  input_feature_watch_cfg_source = false
65  input_feature_upgrade_skia = false
66  input_feature_mistouch_prevention = false
67
68  if (defined(global_parts_info) &&
69      defined(global_parts_info.resourceschedule_resource_schedule_service)) {
70    resource_schedule_service_enabled = true
71  }
72
73  if (defined(global_parts_info) &&
74      defined(global_parts_info.theme_screenlock_mgr)) {
75    screenlock_manager_enabled = true
76  }
77
78  if (is_emulator) {
79    input_feature_pointer_drawing = false
80  }
81
82  uinput_inject_sources = [
83    "uinput/hdf_device_event_dispatch.cpp",
84    "uinput/hdf_device_event_manager.cpp",
85    "uinput/inject_thread.cpp",
86    "uinput/keyboard_inject.cpp",
87    "uinput/virtual_device.cpp",
88    "uinput/virtual_keyboard.cpp",
89    "uinput/virtual_touch_screen.cpp",
90  ]
91
92  libmmi_common_sources = [
93    "events/src/axis_event.cpp",
94    "events/src/input_device.cpp",
95    "events/src/input_event.cpp",
96    "events/src/key_event.cpp",
97    "events/src/key_option.cpp",
98    "events/src/pointer_event.cpp",
99    "events/src/pointer_style.cpp",
100  ]
101
102  libmmi_client_sources = [
103    "event_handler/src/anr_handler.cpp",
104    "event_handler/src/bytrace_adapter.cpp",
105    "event_handler/src/client_msg_handler.cpp",
106    "event_handler/src/input_active_subscribe_manager.cpp",
107    "event_handler/src/input_device_impl.cpp",
108    "event_handler/src/input_handler_manager.cpp",
109    "event_handler/src/input_manager_impl.cpp",
110    "event_handler/src/long_press_event_subscribe_manager.cpp",
111    "event_handler/src/multimodal_event_handler.cpp",
112    "event_handler/src/pre_monitor_manager.cpp",
113    "event_handler/src/scene_board_judgement.cpp",
114    "events/src/input_manager.cpp",
115    "module_loader/src/mmi_client.cpp",
116    "module_loader/src/mmi_fd_listener.cpp",
117  ]
118
119  libmmi_service_sources = [
120    "$mmi_path/frameworks/proxy/event_handler/src/bytrace_adapter.cpp",
121    "$mmi_path/frameworks/proxy/event_handler/src/scene_board_judgement.cpp",
122    "$mmi_path/service/touch_event_normalize/src/input_device_consumer_handler.cpp",
123    "app_state_manager/src/app_state_observer.cpp",
124    "delegate_task/src/delegate_interface.cpp",
125    "delegate_task/src/delegate_tasks.cpp",
126    "device_manager/src/input_device_manager.cpp",
127    "device_manager/src/pointer_device_manager.cpp",
128    "device_state_manager/src/device_event_monitor.cpp",
129    "dfx/src/api_duration_statistics.cpp",
130    "dfx/src/dfx_hisysevent.cpp",
131    "dfx/src/dfx_hisysevent_device.cpp",
132    "event_dispatch/src/event_dispatch_handler.cpp",
133    "event_dump/src/event_dump.cpp",
134    "event_dump/src/event_statistic.cpp",
135    "event_handler/src/anr_manager.cpp",
136    "event_handler/src/event_normalize_handler.cpp",
137    "event_handler/src/input_event_handler.cpp",
138    "event_handler/src/key_auto_repeat.cpp",
139    "event_handler/src/key_event_value_transformation.cpp",
140    "event_handler/src/key_map_manager.cpp",
141    "event_handler/src/touchpad_settings_handler.cpp",
142    "key_command/src/setting_datashare.cpp",
143    "key_command/src/setting_observer.cpp",
144    "libinput_adapter/src/hotplug_detector.cpp",
145    "libinput_adapter/src/libinput_adapter.cpp",
146    "libinput_adapter/src/property_reader.cpp",
147    "message_handle/src/authorization_dialog.cpp",
148    "message_handle/src/authorize_helper.cpp",
149    "message_handle/src/client_death_handler.cpp",
150    "message_handle/src/inject_notice_manager.cpp",
151    "message_handle/src/server_msg_handler.cpp",
152    "module_loader/src/app_debug_listener.cpp",
153    "module_loader/src/mmi_service.cpp",
154    "module_loader/src/multimodal_input_preferences_manager.cpp",
155    "module_loader/src/multimodal_input_plugin_manager.cpp",
156    "module_loader/src/uds_server.cpp",
157    "module_loader/src/watchdog_task.cpp",
158    "nap_process/src/nap_process.cpp",
159    "permission_helper/src/permission_helper.cpp",
160    "subscriber/src/input_active_subscriber_handler.cpp",
161    "timer_manager/src/timer_manager.cpp",
162    "window_manager/src/input_display_bind_helper.cpp",
163    "window_manager/src/input_windows_manager.cpp",
164  ]
165
166  infraredemitter_sources = [ "src/js_register_module.cpp" ]
167
168  inputdevice_sources = [
169    "src/js_event_target.cpp",
170    "src/js_input_device_context.cpp",
171    "src/js_input_device_manager.cpp",
172    "src/js_util.cpp",
173    "src/native_register_module.cpp",
174  ]
175
176  inputmonitor_sources = [
177    "src/js_input_monitor.cpp",
178    "src/js_input_monitor_manager.cpp",
179    "src/js_input_monitor_module.cpp",
180  ]
181
182  patch_gen_libinput_third_mmi_sources = [
183    root_out_dir + "/diff_libinput_mmi/src/evdev-debounce.c",
184    root_out_dir + "/diff_libinput_mmi/src/evdev-fallback.c",
185    root_out_dir + "/diff_libinput_mmi/src/evdev-joystick.c",
186    root_out_dir + "/diff_libinput_mmi/src/evdev-privacy-switch.c",
187    root_out_dir + "/diff_libinput_mmi/src/evdev-middle-button.c",
188    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-buttons.c",
189    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-edge-scroll.c",
190    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-gestures.c",
191    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-tap.c",
192    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad-thumb.c",
193    root_out_dir + "/diff_libinput_mmi/src/evdev-mt-touchpad.c",
194    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet-pad-leds.c",
195    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet-pad.c",
196    root_out_dir + "/diff_libinput_mmi/src/evdev-tablet.c",
197    root_out_dir + "/diff_libinput_mmi/src/evdev-totem.c",
198    root_out_dir + "/diff_libinput_mmi/src/evdev-wheel.c",
199    root_out_dir + "/diff_libinput_mmi/src/evdev.c",
200    root_out_dir + "/diff_libinput_mmi/src/filter-custom.c",
201    root_out_dir + "/diff_libinput_mmi/src/filter-flat.c",
202    root_out_dir + "/diff_libinput_mmi/src/filter-low-dpi.c",
203    root_out_dir + "/diff_libinput_mmi/src/filter-mouse.c",
204    root_out_dir + "/diff_libinput_mmi/src/filter-tablet.c",
205    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad-flat.c",
206    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad-x230.c",
207    root_out_dir + "/diff_libinput_mmi/src/filter-touchpad.c",
208    root_out_dir + "/diff_libinput_mmi/src/filter-trackpoint-flat.c",
209    root_out_dir + "/diff_libinput_mmi/src/filter-trackpoint.c",
210    root_out_dir + "/diff_libinput_mmi/src/filter.c",
211    root_out_dir + "/diff_libinput_mmi/src/libinput-util.c",
212    root_out_dir + "/diff_libinput_mmi/src/libinput.c",
213    root_out_dir + "/diff_libinput_mmi/src/path-seat.c",
214    root_out_dir + "/diff_libinput_mmi/src/quirks.c",
215    root_out_dir + "/diff_libinput_mmi/src/timer.c",
216    root_out_dir + "/diff_libinput_mmi/src/util-list.c",
217    root_out_dir + "/diff_libinput_mmi/src/util-prop-parsers.c",
218    root_out_dir + "/diff_libinput_mmi/src/util-ratelimit.c",
219    root_out_dir + "/diff_libinput_mmi/src/util-strings.c",
220  ]
221
222  patch_gen_libmtdev_third_mmi_sources = [
223    root_out_dir + "/diff_libmtdev_mmi/src/caps.c",
224    root_out_dir + "/diff_libmtdev_mmi/src/core.c",
225    root_out_dir + "/diff_libmtdev_mmi/src/iobuf.c",
226    root_out_dir + "/diff_libmtdev_mmi/src/match.c",
227    root_out_dir + "/diff_libmtdev_mmi/src/match_four.c",
228  ]
229
230  event_injection_sources = [
231    "src/device_base.cpp",
232    "src/get_device_node.cpp",
233    "src/get_device_object.cpp",
234    "src/injection_event_dispatch.cpp",
235    "src/injection_tools_help_func.cpp",
236    "src/input_parse.cpp",
237    "src/manage_inject_device.cpp",
238    "src/processing_finger_device.cpp",
239    "src/processing_game_pad_device.cpp",
240    "src/processing_joystick_device.cpp",
241    "src/processing_keyboard_device.cpp",
242    "src/processing_mouse_device.cpp",
243    "src/processing_pad_device.cpp",
244    "src/processing_pen_device.cpp",
245    "src/processing_touch_screen_device.cpp",
246  ]
247
248  libmmi_virtual_device_sources = [
249    "src/virtual_crown.cpp",
250    "src/virtual_device.cpp",
251    "src/virtual_finger.cpp",
252    "src/virtual_fingerprint_key.cpp",
253    "src/virtual_fingerprint_mouse.cpp",
254    "src/virtual_gamepad.cpp",
255    "src/virtual_joystick.cpp",
256    "src/virtual_keyboard.cpp",
257    "src/virtual_keyboard_consumer_ctrl.cpp",
258    "src/virtual_keyboard_ext.cpp",
259    "src/virtual_keyboard_sys_ctrl.cpp",
260    "src/virtual_knob.cpp",
261    "src/virtual_knob_consumer_ctrl.cpp",
262    "src/virtual_knob_mouse.cpp",
263    "src/virtual_knob_sys_ctrl.cpp",
264    "src/virtual_mouse.cpp",
265    "src/virtual_pc_switch.cpp",
266    "src/virtual_pc_touchpad.cpp",
267    "src/virtual_pen.cpp",
268    "src/virtual_pen_keyboard.cpp",
269    "src/virtual_pen_mouse.cpp",
270    "src/virtual_remote_control.cpp",
271    "src/virtual_single_finger.cpp",
272    "src/virtual_single_touchscreen.cpp",
273    "src/virtual_stylus.cpp",
274    "src/virtual_touchpad.cpp",
275    "src/virtual_touchscreen.cpp",
276    "src/virtual_trackball.cpp",
277    "src/virtual_trackpad.cpp",
278    "src/virtual_trackpad_mouse.cpp",
279    "src/virtual_trackpad_sys_ctrl.cpp",
280    "src/virtual_uwb_remote_control.cpp",
281  ]
282
283  libmmi_util_sources = [
284    "common/src/input_event_data_transformation.cpp",
285    "common/src/klog.cpp",
286    "common/src/util.cpp",
287    "network/src/circle_stream_buffer.cpp",
288    "network/src/net_packet.cpp",
289    "network/src/stream_buffer.cpp",
290    "socket/src/uds_client.cpp",
291    "socket/src/uds_session.cpp",
292    "socket/src/uds_socket.cpp",
293  ]
294}
295
296if (input_feature_joystick) {
297  input_feature_mouse = true
298}
299
300print("input_feature_combination_key = ${input_feature_combination_key}")
301print("input_feature_pointer_drawing = ${input_feature_pointer_drawing}")
302print("input_feature_monitor = ${input_feature_monitor}")
303print("input_feature_interceptor = ${input_feature_interceptor}")
304print("input_feature_keyboard = ${input_feature_keyboard}")
305print("input_feature_switch = ${input_feature_switch}")
306print("input_feature_mouse = ${input_feature_mouse}")
307print("input_feature_joystick = ${input_feature_joystick}")
308print("input_feature_touchscreen = ${input_feature_touchscreen}")
309print("input_feature_input_device = ${input_feature_input_device}")
310print("input_feature_short_key = ${input_feature_short_key}")
311print("input_ext_feature_keyboard_ext_flag = ${input_ext_feature_keyboard_ext_flag}")
312print(
313    "input_feature_one_hand_mode_enable = ${input_feature_one_hand_mode_enable}")
314print("input_feature_move_event_filters = ${input_feature_move_event_filters}")
315
316input_default_defines = []
317
318if (input_feature_pointer_drawing) {
319  input_default_defines += [ "OHOS_BUILD_ENABLE_POINTER_DRAWING" ]
320}
321
322if (input_feature_interceptor) {
323  input_default_defines += [ "OHOS_BUILD_ENABLE_INTERCEPTOR" ]
324}
325
326if (input_feature_keyboard) {
327  input_default_defines += [ "OHOS_BUILD_ENABLE_KEYBOARD" ]
328}
329
330if (input_feature_switch) {
331  input_default_defines += [ "OHOS_BUILD_ENABLE_SWITCH" ]
332}
333
334if (input_feature_monitor) {
335  input_default_defines += [ "OHOS_BUILD_ENABLE_MONITOR" ]
336}
337
338if (input_feature_touchscreen) {
339  input_default_defines += [ "OHOS_BUILD_ENABLE_TOUCH" ]
340}
341
342if (input_feature_mouse) {
343  input_default_defines += [ "OHOS_BUILD_ENABLE_POINTER" ]
344}
345
346if (input_feature_joystick) {
347  input_default_defines += [ "OHOS_BUILD_ENABLE_JOYSTICK" ]
348}
349
350if (input_feature_short_key) {
351  input_default_defines += [ "OHOS_BUILD_ENABLE_SHORT_KEY" ]
352}
353
354if (input_feature_fingerprint) {
355  input_default_defines += [ "OHOS_BUILD_ENABLE_FINGERPRINT" ]
356  input_default_defines += [ "OHOS_BUILD_ENABLE_X_KEY" ]
357}
358
359if (input_feature_crown) {
360  input_default_defines += [ "OHOS_BUILD_ENABLE_CROWN" ]
361  input_feature_event_recorder = false
362}
363
364if (input_feature_one_hand_mode_enable) {
365  input_default_defines += [ "OHOS_BUILD_ENABLE_ONE_HAND_MODE" ]
366}
367
368if (call_manager_service_enabled) {
369  input_default_defines += [ "OHOS_BUILD_ENABLE_CALL_MANAGER" ]
370}
371
372if (!defined(global_parts_info) ||
373    defined(global_parts_info.security_security_component_manager)) {
374  security_component_enable = true
375} else {
376  security_component_enable = false
377}
378
379if (security_component_enable) {
380  input_default_defines += [ "OHOS_BUILD_ENABLE_SECURITY_COMPONENT" ]
381}
382
383if (input_ext_feature_fingersense) {
384  input_default_defines += [ "OHOS_BUILD_ENABLE_FINGERSENSE_WRAPPER" ]
385}
386
387if (input_ext_feature_gesturesense) {
388  input_default_defines += [ "OHOS_BUILD_ENABLE_GESTURESENSE_WRAPPER" ]
389}
390
391if (input_feature_move_event_filters) {
392  input_default_defines += [ "OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS" ]
393}
394
395if (input_ext_feature_anco) {
396  input_default_defines += [ "OHOS_BUILD_ENABLE_ANCO" ]
397  libmmi_client_sources +=
398      [ "${mmi_ext_path}/anco_uds_manager/src/input_manager_ext.cpp" ]
399
400  libmmi_service_sources += [
401    "${mmi_ext_path}/anco_uds_manager/src/anco_uds_manager.cpp",
402    "${mmi_ext_path}/anco_uds_manager/src/input_common_monitor.cpp",
403    "${mmi_ext_path}/anco_uds_manager/src/input_windows_manager_ext.cpp",
404    "${mmi_ext_path}/anco_uds_manager/src/mmi_service_ext.cpp",
405  ]
406
407  if (input_feature_product != "pc") {
408    libmmi_service_sources += [ "${mmi_path}/service/infrared_emitter/src/infrared_emitter_controller.cpp" ]
409  }
410}
411
412if (input_ext_feature_keyboard_ext_flag) {
413  input_default_defines += [ "OHOS_BUILD_ENABLE_KEYBOARD_EXT_FLAG" ]
414
415  libmmi_service_sources += [
416    "${mmi_ext_path}/keyboard_ext_flag/src/input_device_manager_ext.cpp",
417  ]
418}
419
420if (input_feature_product == "pc") {
421  input_default_defines += [ "OHOS_BUILD_PC_PRIORITY" ]
422  input_default_defines += [ "OHOS_BUILD_PC_UNIT_TEST" ]
423  input_default_defines += [ "OHOS_BUILD_MOUSE_REPORTING_RATE" ]
424}
425
426if (input_feature_product == "watch") {
427  input_default_defines += [ "OHOS_BUILD_ENABLE_WATCH" ]
428} else {
429  libmmi_service_sources += [
430    "device_config/src/device_config_file_parser.cpp",
431    "fingersense_wrapper/src/fingersense_wrapper.cpp",
432    "gesturesense_wrapper/src/gesturesense_wrapper.cpp",
433  ]
434
435  if (input_new_knuckle_dynamic_enabled) {
436    input_default_defines += [ "OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC" ]
437  }
438}
439
440if (input_ext_feature_magiccursor) {
441  g2d_ext_path = "//foundation/graphic/graphic_2d_ext"
442  g2d_path = "//foundation/graphic/graphic_2d"
443  surface_path = "//foundation/graphic/graphic_surface"
444  input_default_defines += [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ]
445  libmmi_service_sources += [
446    "${mmi_ext_path}/magic_cursor/src/dfx_hisysevent_ext.cpp",
447    "${mmi_ext_path}/magic_cursor/src/lru_cache.cpp",
448    "${mmi_ext_path}/magic_cursor/src/magic_pointer_drawing_manager.cpp",
449    "${mmi_ext_path}/magic_cursor/src/magic_pointer_drawing_manager_ext.cpp",
450    "${mmi_ext_path}/magic_cursor/src/magic_pointer_velocity_tracker.cpp",
451    "${mmi_ext_path}/magic_cursor/src/render_context_gl.cpp",
452  ]
453}
454
455if (defined(global_parts_info.multimedia_player_framework)) {
456  enable_player_framework = true
457  input_default_defines += [ "PLAYER_FRAMEWORK_EXISTS" ]
458} else {
459  enable_player_framework = false
460}
461
462if (enable_player_framework) {
463  libmmi_service_sources +=
464      [ "module_loader/src/input_screen_capture_agent.cpp" ]
465}
466
467if (input_shortcut_key_rules_enabled) {
468  input_shortcut_key_manager_enabled = true
469}
470
471if (defined(global_parts_info) &&
472    defined(global_parts_info.telephony_call_manager)) {
473  call_manager_service_enabled = true
474  input_default_defines += [ "CALL_MANAGER_SERVICE_ENABLED" ]
475}
476
477if (defined(global_parts_info) &&
478    defined(global_parts_info.hiviewdfx_hitrace)) {
479  hitrace_enabled = true
480  input_default_defines += [ "HITRACE_ENABLED" ]
481}
482
483if (input_feature_virtual_keyboard) {
484  input_default_defines += [ "OHOS_BUILD_ENABLE_VKEYBOARD" ]
485  libmmi_service_sources += [ "libinput_adapter/src/folding_area_toast.cpp" ]
486}
487
488if (input_feature_dfx_radar_enable) {
489  input_default_defines += [ "OHOS_BUILD_ENABLE_DFX_RADAR" ]
490}
491
492if (input_feature_touch_drawing) {
493  input_default_defines += [ "OHOS_BUILD_ENABLE_TOUCH_DRAWING" ]
494}
495
496if (!input_feature_keyboard) {
497  input_feature_key_pressed_handler = false
498}
499
500if (input_feature_key_pressed_handler) {
501  input_default_defines += [ "OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER" ]
502}
503
504if (input_feature_event_recorder) {
505  input_default_defines += [ "OHOS_BUILD_ENABLE_EVENT_RECORDER" ]
506}
507
508if (input_feature_mistouch_prevention) {
509  input_default_defines += [ "OHOS_BUILD_ENABLE_MISTOUCH_PREVENTION" ]
510}
511