• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2025 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/test.gni")
15import("../../../../common/config/common.gni")
16
17module_output_path = "enterprise_device_management/enterprise_device_management"
18
19config("module_private_config") {
20  visibility = [ ":*" ]
21}
22
23ohos_unittest("EdmPluginTest") {
24  module_out_path = module_output_path
25
26  include_dirs = [
27    "../../common/mock/include",
28    "../../external_mock/include",
29    "../../../../common/native/include/plugin_kits",
30    "../../../../services/edm_plugin/include",
31    "../../../../services/edm_plugin/include/utils",
32    "../../../../services/edm_plugin/include/network",
33    "../../../../services/edm_plugin/include/network/executer",
34    "../../../../services/edm_plugin/include/network/rule",
35    "./include",
36    "./include/network",
37    "./include/network/executer",
38    "./include/utils",
39  ]
40
41  sources = [
42    "../../common/mock/src/edm_data_ability_utils_mock.cpp",
43    "./src/allowed_app_distribution_types_plugin_test.cpp",
44    "./src/bundle_install_plugin_test.cpp",
45    "./src/device_info_plugin_test.cpp",
46    "./src/disable_maintenance_mode_plugin_test.cpp",
47    "./src/disable_mtp_client_plugin_test.cpp",
48    "./src/disable_mtp_server_plugin_test.cpp",
49    "./src/disable_user_mtp_client_plugin_test.cpp",
50    "./src/disable_samba_client_plugin_test.cpp",
51    "./src/disable_samba_server_plugin_test.cpp",
52    "./src/disable_set_biometrics_and_screenLock_plugin_test.cpp",
53    "./src/disable_set_device_name_plugin_test.cpp",
54    "./src/disallow_export_recovery_key_plugin_test.cpp",
55    "./src/disallow_distributed_transmission_plugin_test.cpp",
56    "./src/disallow_modify_datetime_plugin_test.cpp",
57    "./src/disallowed_policy_plugin_test.cpp",
58    "./src/install_plugin_test.cpp",
59    "./src/kiosk_feature_plugin_test.cpp",
60    "./src/managed_browser_policy_plugin_test.cpp",
61    "./src/network/executer/executer_utils_mock.cpp",
62    "./src/ntp_server_plugin_test.cpp",
63    "./src/power_policy_plugin_test.cpp",
64    "./src/screen_off_time_plugin_test.cpp",
65    "./src/snapshot_skip_plugin_test.cpp",
66    "./src/uninstall_plugin_test.cpp",
67    "./src/utils/allowed_app_distribution_types_utils_test.cpp",
68    "./src/utils/managed_browser_policy_serializer_test.cpp",
69    "./src/utils/password_policy_serializer_test.cpp",
70    "./src/disallowed_sms_plugin_test.cpp",
71    "./src/disallowed_mms_plugin_test.cpp",
72    "./src/set_allowed_kiosk_apps_plugin_test.cpp",
73    "./src/clear_up_application_data_plugin_test.cpp",
74  ]
75
76  configs = [
77    ":module_private_config",
78    "../../../../common/config:coverage_flags",
79  ]
80
81  deps = [
82    ":edm_all_plugin_static",
83    "../../../../common/external:edm_external_adapters",
84    "../../../../common/native:edm_commom",
85    "../../../../interfaces/inner_api:edmservice_kits",
86    "../../../../interfaces/inner_api/plugin_kits:plugin_kits",
87    "../../test_bundle/ohos_test:copy_ohos_test",
88    "../../test_bundle/right_hap:right",
89    "../../utils:edm_unittest_utils",
90  ]
91
92  external_deps = [
93    "ability_base:want",
94    "access_token:libaccesstoken_sdk",
95    "access_token:libnativetoken",
96    "access_token:libnativetoken_shared",
97    "access_token:libtoken_setproc",
98    "bundle_framework:appexecfwk_base",
99    "bundle_framework:appexecfwk_core",
100    "cJSON:cjson",
101    "c_utils:utils",
102    "googletest:gmock_main",
103    "hilog:libhilog",
104    "init:libbegetutil",
105    "ipc:ipc_core",
106    "jsoncpp:jsoncpp",
107    "netmanager_base:netsys_controller",
108    "safwk:system_ability_fwk",
109    "samgr:samgr_proxy",
110    "data_share:datashare_consumer",
111  ]
112
113  defines = []
114  if (os_account_edm_enable) {
115    external_deps += [
116      "ability_runtime:app_manager",
117      "os_account:libaccountkits",
118      "os_account:os_account_innerkits",
119    ]
120    sources += [
121      "./src/add_os_account_plugin_test.cpp",
122      "./src/disallow_add_local_account_plugin_test.cpp",
123      "./src/disallow_add_os_account_by_user_plugin_test.cpp",
124      "./src/operate_device_plugin_test.cpp",
125    ]
126    defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
127  }
128
129  if (ability_runtime_edm_enable) {
130    sources += [
131      "./src/disallowed_running_bundles_plugin_test.cpp",
132      "./src/manage_auto_start_apps_plugin_test.cpp",
133      "./src/manage_keep_alive_apps_plugin_test.cpp",
134      "./src/utils/manage_keep_alive_apps_serializer_test.cpp",
135      "./src/utils/manage_auto_start_apps_serializer_test.cpp",
136    ]
137  }
138
139  if (screenlock_mgr_edm_enable) {
140    external_deps += [ "screenlock_mgr:screenlock_client" ]
141  }
142
143  if (os_account_edm_enable && screenlock_mgr_edm_enable) {
144    sources += [ "./src/lock_screen_plugin_test.cpp" ]
145  }
146
147  if (power_manager_edm_enable && screenlock_mgr_edm_enable) {
148    external_deps += [ "power_manager:powermgr_client" ]
149    sources += [
150      "./src/reboot_plugin_test.cpp",
151      "./src/shutdown_plugin_test.cpp",
152    ]
153  }
154
155  if (power_manager_edm_enable && !enterprise_device_management_feature_pc_only) {
156    external_deps += [ "power_manager:powermgr_client" ]
157    sources += [
158      "./src/disallow_power_long_press_plugin_test.cpp",
159    ]
160  }
161
162  if (wifi_edm_enable) {
163    external_deps += [ "wifi:wifi_sdk" ]
164    sources += [
165      "./src/allowed_wifi_list_plugin_test.cpp",
166      "./src/disallowed_wifi_list_plugin_test.cpp",
167      "./src/is_wifi_active_plugin_test.cpp",
168      "./src/message_parcel_utils_test.cpp",
169      "./src/set_wifi_disabled_plugin_test.cpp",
170      "./src/set_wifi_profile_plugin_test.cpp",
171      "./src/switch_wifi_plugin_test.cpp",
172      "./src/utils/array_wifi_id_serializer_test.cpp",
173    ]
174    defines += [ "WIFI_EDM_ENABLE" ]
175  }
176
177  if (netmanager_base_edm_enable && netmanager_ext_edm_enable) {
178    external_deps += [
179      "netmanager_base:net_conn_manager_if",
180      "core_service:tel_core_service_api",
181    ]
182    sources += [
183      "./src/disallowed_airplane_mode_plugin_test.cpp",
184      "./src/domain_filter_rule_plugin_test.cpp",
185      "./src/firewall_rule_plugin_test.cpp",
186      "./src/global_proxy_plugin_test.cpp",
187      "./src/iptables_rule_plugin_test.cpp",
188      "./src/network/executer/domain_executer_test.cpp",
189      "./src/network/executer/executer_factory_test.cpp",
190      "./src/network/executer/executer_utils_test.cpp",
191      "./src/network/executer/firewall_executer_test.cpp",
192      "./src/network/executer/iexecuter_test.cpp",
193      "./src/network/iptables_manager_test.cpp",
194      "./src/network/rule/chain_rule_test.cpp",
195      "./src/network/rule/domain_chain_rule_test.cpp",
196      "./src/network/rule/firewall_chain_rule_test.cpp",
197      "./src/network_manager_plugin_test.cpp",
198    ]
199  }
200
201  if (certificate_manager_edm_enable) {
202    external_deps += [ "certificate_manager:cert_manager_sdk" ]
203    sources += [ "./src/user_cert_plugin_test.cpp" ]
204  }
205
206  if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) {
207    external_deps += [ "usb_manager:usbsrv_client" ]
208    sources += [
209      "./src/allowed_usb_devices_plugin_test.cpp",
210      "./src/disable_usb_plugin_test.cpp",
211      "./src/disallowed_usb_devices_plugin_test.cpp",
212      "./src/utils/array_usb_device_id_serializer_test.cpp",
213    ]
214  }
215
216  if (drivers_interface_usb_edm_enable && storage_service_edm_enable &&
217      usb_manager_edm_enable) {
218    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
219    sources += [ "./src/usb_read_only_plugin_test.cpp" ]
220  }
221
222  if (audio_framework_edm_enable) {
223    external_deps += [ "audio_framework:audio_client" ]
224    sources += [
225      "./src/disable_hdc_plugin_test.cpp",
226      "./src/disable_microphone_plugin_test.cpp",
227      "./src/disable_printer_plugin_test.cpp",
228    ]
229  }
230
231  if (common_event_service_edm_enable) {
232    external_deps += [ "common_event_service:cesfwk_innerkits" ]
233    sources += [ "./src/set_browser_policies_plugin_test.cpp" ]
234  }
235
236  if (bluetooth_edm_enable) {
237    external_deps += [ "bluetooth:btframework" ]
238    sources += [
239      "./src/allowed_bluetooth_devices_plugin_test.cpp",
240      "./src/disable_bluetooth_plugin_test.cpp",
241      "./src/disallowed_bluetooth_devices_plugin_test.cpp",
242      "./src/disallowed_bluetooth_protocols_plugin_test.cpp",
243      "./src/get_bluetooth_info_plugin_test.cpp",
244      "./src/switch_bluetooth_plugin_test.cpp",
245      "./src/utils/bt_protocol_utils_test.cpp",
246    ]
247  }
248
249  if (location_edm_enable) {
250    sources += [ "./src/location_policy_plugin_test.cpp" ]
251  }
252
253  if (update_service_edm_enable) {
254    external_deps += [ "update_service:updateservicekits" ]
255  }
256
257  if (pasteboard_edm_enable) {
258    sources += [ "./src/clipboard_policy_plugin_test.cpp" ]
259  }
260
261  if (useriam_edm_enable) {
262    sources += [
263      "./src/fingerprint_auth_plugin_test.cpp",
264      "./src/password_policy_plugin_test.cpp",
265    ]
266  }
267
268  if (camera_framework_edm_enable) {
269    sources += [ "./src/disable_camera_plugin_test.cpp" ]
270  }
271
272  if (enterprise_device_management_feature_pc_only) {
273    sources += [
274      "./src/set_auto_unlock_after_reboot_plugin_test.cpp",
275      "./src/disallow_modify_ethernet_ip_plugin_test.cpp",
276      "./src/set_install_local_enterprise_app_enabled_plugin_test.cpp",
277      "./src/disallowed_nearlink_protocols_plugin_test.cpp",
278      "./src/disallowed_usb_storage_device_write_plugin_test.cpp",
279    ]
280    defines += [ "FEATURE_PC_ONLY" ]
281  }
282
283  if (os_account_edm_enable && enterprise_device_management_feature_pc_only) {
284    external_deps += [ "os_account:domain_account_innerkits" ]
285    sources += [
286      "../../../../services/edm_plugin/src/set_domain_account_policy_plugin.cpp",
287      "./src/set_domain_account_policy_plugin_test.cpp",
288      "./src/set_watermark_plugin_test.cpp",
289      "./src/disable_print_plugin_test.cpp",
290      "./src/disable_sudo_plugin_test.cpp",
291    ]
292  }
293
294  if (!enterprise_device_management_feature_pc_only && cellular_data_edm_enable) {
295    external_deps += [
296      "cellular_data:tel_cellular_data_api",
297      "core_service:tel_core_service_api"
298    ]
299    sources += [
300      "./src/disallow_mobile_data_plugin_test.cpp",
301      "./src/disallow_modify_apn_plugin_test.cpp",
302      "./src/disallowed_sim_plugin_test.cpp",
303      "./src/disallowed_telephony_call_plugin_test.cpp",
304      "./src/set_apn_plugin_test.cpp",
305      "./src/telephony_call_policy_plugin_test.cpp",
306      "./src/turnonoff_mobile_data_plugin_test.cpp",
307      "./src/utils/telephony_call_policy_serializer_test.cpp",
308    ]
309    defines += [
310      "CELLULAR_DATA_EDM_ENABLE",
311      "TELEPHONY_EDM_ENABLE",
312    ]
313  }
314
315  if (!enterprise_device_management_feature_pc_only) {
316    sources += [
317      "../../../../services/edm_plugin/src/disable_private_space_plugin.cpp",
318      "./src/disable_backup_and_restore_plugin_test.cpp",
319      "./src/disable_private_space_plugin_test.cpp",
320    ]
321  }
322
323  if (notification_edm_enable) {
324    sources += [ "./src/disallowed_notification_plugin_test.cpp" ]
325  }
326
327  if (netmanager_ext_edm_enable) {
328    sources += [
329      "./src/disallow_vpn_plugin_test.cpp"
330    ]
331  }
332
333  sanitize = {
334    boundary_sanitize = true
335    cfi = true
336    cfi_cross_dso = true
337    debug = false
338    integer_overflow = true
339    ubsan = true
340    blocklist = "../../cfi_blocklist.txt"
341  }
342  branch_protector_ret = "pac_ret"
343  subsystem_name = "customization"
344  part_name = "enterprise_device_management"
345}
346
347ohos_unittest("EdmFingerPrintPluginTest") {
348  module_out_path = module_output_path
349
350  include_dirs = [
351    "../../../../services/edm_plugin/include",
352    "../../../../services/edm_plugin/include/utils"
353  ]
354
355  sources = [ "./src/fingerprint_auth_plugin_test.cpp" ]
356
357  configs = [
358    ":module_private_config",
359    "../../../../common/config:coverage_flags",
360  ]
361
362  deps = [
363    ":edm_all_plugin_static",
364    "../../../../common/native:edm_commom",
365    "../../../../interfaces/inner_api:edmservice_kits",
366    "../../../../interfaces/inner_api/plugin_kits:plugin_kits",
367    "../../utils:edm_unittest_utils",
368  ]
369
370  external_deps = [
371    "access_token:libaccesstoken_sdk",
372    "access_token:libnativetoken",
373    "access_token:libnativetoken_shared",
374    "access_token:libtoken_setproc",
375    "cJSON:cjson",
376    "c_utils:utils",
377    "googletest:gmock_main",
378    "hilog:libhilog",
379    "init:libbegetutil",
380    "ipc:ipc_core",
381  ]
382
383  sanitize = {
384    boundary_sanitize = true
385    cfi = true
386    cfi_cross_dso = true
387    debug = false
388    integer_overflow = true
389    ubsan = true
390    blocklist = "../../cfi_blocklist.txt"
391  }
392  branch_protector_ret = "pac_ret"
393  subsystem_name = "customization"
394  part_name = "enterprise_device_management"
395}
396
397ohos_static_library("edm_all_plugin_static") {
398  visibility = [ ":*" ]
399  testonly = true
400  sources = [
401    "../../../../services/edm/src/permission_manager.cpp",
402    "../../../../services/edm/src/plugin_manager.cpp",
403    "../../../../services/edm/src/strategy/enhance_execute_strategy.cpp",
404    "../../../../services/edm/src/strategy/replace_execute_strategy.cpp",
405    "../../../../services/edm/src/strategy/single_execute_strategy.cpp",
406    "../../../../services/edm_plugin/src/allowed_app_distribution_types_plugin.cpp",
407    "../../../../services/edm_plugin/src/allowed_install_bundles_plugin.cpp",
408    "../../../../services/edm_plugin/src/bundle_install_plugin.cpp",
409    "../../../../services/edm_plugin/src/disable_backup_and_restore_plugin.cpp",
410    "../../../../services/edm_plugin/src/disable_maintenance_mode_plugin.cpp",
411    "../../../../services/edm_plugin/src/disable_mtp_client_plugin.cpp",
412    "../../../../services/edm_plugin/src/disable_mtp_server_plugin.cpp",
413    "../../../../services/edm_plugin/src/disable_user_mtp_client_plugin.cpp",
414    "../../../../services/edm_plugin/src/disable_samba_client_plugin.cpp",
415    "../../../../services/edm_plugin/src/disable_samba_server_plugin.cpp",
416    "../../../../services/edm_plugin/src/disable_set_biometrics_and_screenLock_plugin.cpp",
417    "../../../../services/edm_plugin/src/disable_set_device_name_plugin.cpp",
418    "../../../../services/edm_plugin/src/disallow_export_recovery_key_plugin.cpp",
419    "../../../../services/edm_plugin/src/disallow_distributed_transmission_plugin.cpp",
420    "../../../../services/edm_plugin/src/disallow_modify_datetime_plugin.cpp",
421    "../../../../services/edm_plugin/src/disallowed_install_bundles_plugin.cpp",
422    "../../../../services/edm_plugin/src/disallowed_tethering_plugin.cpp",
423    "../../../../services/edm_plugin/src/disallowed_uninstall_bundles_plugin.cpp",
424    "../../../../services/edm_plugin/src/get_device_info_plugin.cpp",
425    "../../../../services/edm_plugin/src/inactive_user_freeze_plugin.cpp",
426    "../../../../services/edm_plugin/src/install_plugin.cpp",
427    "../../../../services/edm_plugin/src/installed_bundle_info_list_plugin.cpp",
428    "../../../../services/edm_plugin/src/kiosk_feature_plugin.cpp",
429    "../../../../services/edm_plugin/src/managed_browser_policy_plugin.cpp",
430    "../../../../services/edm_plugin/src/ntp_server_plugin.cpp",
431    "../../../../services/edm_plugin/src/operate_device_plugin.cpp",
432    "../../../../services/edm_plugin/src/power_policy_plugin.cpp",
433    "../../../../services/edm_plugin/src/screen_off_time_plugin.cpp",
434    "../../../../services/edm_plugin/src/set_allowed_kiosk_apps_plugin.cpp",
435    "../../../../services/edm_plugin/src/snapshot_skip_plugin.cpp",
436    "../../../../services/edm_plugin/src/uninstall_plugin.cpp",
437    "../../../../services/edm_plugin/src/utils/installer_callback.cpp",
438    "../../../../services/edm_plugin/src/utils/managed_browser_policy_serializer.cpp",
439    "../../../../services/edm_plugin/src/utils/operate_device_param_serializer.cpp",
440    "../../../../services/edm_plugin/src/utils/uninstall_param_serializer.cpp",
441    "../../../../services/edm_plugin/src/disallowed_sms_plugin.cpp",
442    "../../../../services/edm_plugin/src/disallowed_mms_plugin.cpp",
443    "../../../../services/edm_plugin/src/clear_up_application_data_plugin.cpp",
444    "../../../../services/edm_plugin/src/utils/allowed_app_distribution_types_utils.cpp",
445    "../../../../services/edm_plugin/src/utils/clear_up_application_data_param_serializer.cpp",
446  ]
447
448  configs = [ "../../../../common/config:coverage_flags" ]
449
450  include_dirs = [
451    "../../../../services/edm/include",
452    "../../../../services/edm/include/database",
453    "../../../../services/edm/include/strategy",
454    "../../../../services/edm_plugin/include",
455    "../../../../services/edm_plugin/include/utils",
456    "../../../../services/edm_plugin/include/network",
457    "../../../../services/edm_plugin/include/network/executer",
458    "../../../../services/edm_plugin/include/network/rule",
459  ]
460
461  deps = [
462    "../../../../common/external:edm_external_adapters",
463    "../../../../common/native:edm_commom",
464    "../../../../interfaces/inner_api:edmservice_kits",
465    "../../../../interfaces/inner_api/plugin_kits:plugin_kits",
466  ]
467
468  external_deps = [
469    "ability_base:want",
470    "ability_runtime:app_manager",
471    "access_token:libaccesstoken_sdk",
472    "bounds_checking_function:libsec_shared",
473    "bundle_framework:appexecfwk_base",
474    "bundle_framework:appexecfwk_core",
475    "cJSON:cjson",
476    "c_utils:utils",
477    "distributed_notification_service:ans_innerkits",
478    "file_api:securitylabel",
479    "graphic_2d:librender_service_client",
480    "hilog:libhilog",
481    "init:libbegetutil",
482    "ipc:ipc_core",
483    "samgr:samgr_proxy",
484    "window_manager:libwm",
485    "window_manager:sms",
486    "window_manager:session_manager_lite",
487  ]
488  defines = []
489  if (update_service_edm_enable) {
490    external_deps += [ "update_service:updateservicekits" ]
491    sources +=
492        [ "../../../../services/edm_plugin/src/reset_factory_plugin.cpp" ]
493  }
494
495  if (os_account_edm_enable) {
496    external_deps += [
497      "os_account:libaccountkits",
498      "os_account:os_account_innerkits",
499    ]
500    sources += [
501      "../../../../services/edm_plugin/src/add_os_account_plugin.cpp",
502      "../../../../services/edm_plugin/src/disallow_add_local_account_plugin.cpp",
503      "../../../../services/edm_plugin/src/disallow_add_os_account_by_user_plugin.cpp",
504      "../../../../services/edm_plugin/src/set_watermark_image_plugin.cpp",
505    ]
506    defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
507  }
508
509  if (screenlock_mgr_edm_enable) {
510    external_deps += [ "screenlock_mgr:screenlock_client" ]
511    sources += [ "../../../../services/edm_plugin/src/lock_screen_plugin.cpp" ]
512  }
513
514  if (power_manager_edm_enable && screenlock_mgr_edm_enable) {
515    external_deps += [ "power_manager:powermgr_client" ]
516    sources += [
517      "../../../../services/edm_plugin/src/reboot_plugin.cpp",
518      "../../../../services/edm_plugin/src/shutdown_plugin.cpp",
519    ]
520  }
521
522  if (power_manager_edm_enable && !enterprise_device_management_feature_pc_only) {
523    external_deps += [ "power_manager:powermgr_client" ]
524    sources += [
525      "../../../../services/edm_plugin/src/disallow_power_long_press_plugin.cpp",
526    ]
527  }
528
529  if (wifi_edm_enable) {
530    external_deps += [ "wifi:wifi_sdk" ]
531    sources += [
532      "../../../../common/native/src/plugin_utils/message_parcel_utils.cpp",
533      "../../../../services/edm_plugin/src/allowed_wifi_list_plugin.cpp",
534      "../../../../services/edm_plugin/src/disallowed_wifi_list_plugin.cpp",
535      "../../../../services/edm_plugin/src/is_wifi_active_plugin.cpp",
536      "../../../../services/edm_plugin/src/set_wifi_disabled_plugin.cpp",
537      "../../../../services/edm_plugin/src/set_wifi_profile_plugin.cpp",
538      "../../../../services/edm_plugin/src/switch_wifi_plugin.cpp",
539      "../../../../services/edm_plugin/src/utils/wifi_device_config_serializer.cpp",
540      "../../../../services/edm_plugin/src/utils/wifi_policy_utils.cpp",
541    ]
542    defines += [ "WIFI_EDM_ENABLE" ]
543  }
544
545  if (netmanager_base_edm_enable && netmanager_ext_edm_enable) {
546    external_deps += [
547      "netmanager_base:net_conn_manager_if",
548      "netmanager_base:net_policy_manager_if",
549      "netmanager_base:netsys_controller",
550      "netmanager_ext:ethernet_manager_if",
551    ]
552    sources += [
553      "../../../../services/edm_plugin/src/disabled_network_interface_plugin.cpp",
554      "../../../../services/edm_plugin/src/disallowed_airplane_mode_plugin.cpp",
555      "../../../../services/edm_plugin/src/domain_filter_rule_plugin.cpp",
556      "../../../../services/edm_plugin/src/firewall_rule_plugin.cpp",
557      "../../../../services/edm_plugin/src/get_all_network_interfaces_plugin.cpp",
558      "../../../../services/edm_plugin/src/get_ip_address_plugin.cpp",
559      "../../../../services/edm_plugin/src/get_mac_plugin.cpp",
560      "../../../../services/edm_plugin/src/global_proxy_plugin.cpp",
561      "../../../../services/edm_plugin/src/iptables_rule_plugin.cpp",
562      "../../../../services/edm_plugin/src/network/executer/domain_executer.cpp",
563      "../../../../services/edm_plugin/src/network/executer/executer_factory.cpp",
564      "../../../../services/edm_plugin/src/network/executer/executer_utils.cpp",
565      "../../../../services/edm_plugin/src/network/executer/firewall_executer.cpp",
566      "../../../../services/edm_plugin/src/network/executer/iexecuter.cpp",
567      "../../../../services/edm_plugin/src/network/iptables_manager.cpp",
568      "../../../../services/edm_plugin/src/network/rule/chain_rule.cpp",
569      "../../../../services/edm_plugin/src/network/rule/domain_chain_rule.cpp",
570      "../../../../services/edm_plugin/src/network/rule/firewall_chain_rule.cpp",
571      "../../../../services/edm_plugin/src/network/rule/rule_utils.cpp",
572      "../../../../services/edm_plugin/src/utils/domain_filter_rule_serializer.cpp",
573      "../../../../services/edm_plugin/src/utils/firewall_rule_serializer.cpp",
574      "../../../../services/edm_plugin/src/utils/http_proxy_serializer.cpp",
575      "../../../../services/edm_plugin/src/utils/permission_managed_state_serializer.cpp",
576      "../../../../services/edm_plugin/src/set_permission_managed_state_plugin.cpp",
577    ]
578  }
579
580  if (ability_runtime_edm_enable) {
581    external_deps += [ "ability_runtime:ability_manager" ]
582    sources += [
583      "../../../../services/edm_plugin/src/disallowed_running_bundles_plugin.cpp",
584      "../../../../services/edm_plugin/src/manage_auto_start_apps_plugin.cpp",
585      "../../../../services/edm_plugin/src/manage_keep_alive_apps_plugin.cpp",
586      "../../../../services/edm_plugin/src/utils/manage_keep_alive_apps_serializer.cpp",
587      "../../../../services/edm_plugin/src/utils/manage_keep_alive_apps_info.cpp",
588      "../../../../services/edm_plugin/src/utils/manage_auto_start_app_info.cpp",
589      "../../../../services/edm_plugin/src/utils/manage_auto_start_apps_serializer.cpp",
590    ]
591  }
592
593  if (certificate_manager_edm_enable) {
594    external_deps += [ "certificate_manager:cert_manager_sdk" ]
595    sources += [ "../../../../services/edm_plugin/src/user_cert_plugin.cpp" ]
596  }
597
598  if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) {
599    external_deps += [ "usb_manager:usbsrv_client" ]
600    sources += [
601      "../../../../services/edm_plugin/src/allowed_usb_devices_plugin.cpp",
602      "../../../../services/edm_plugin/src/disable_usb_plugin.cpp",
603      "../../../../services/edm_plugin/src/disallowed_usb_devices_plugin.cpp",
604      "../../../../services/edm_plugin/src/utils/array_usb_device_type_serializer.cpp",
605      "../../../../services/edm_plugin/src/utils/usb_policy_utils.cpp",
606    ]
607  }
608
609  if (drivers_interface_usb_edm_enable && storage_service_edm_enable &&
610      usb_manager_edm_enable) {
611    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
612    sources +=
613        [ "../../../../services/edm_plugin/src/usb_read_only_plugin.cpp" ]
614  }
615
616  if (audio_framework_edm_enable) {
617    external_deps += [ "audio_framework:audio_client" ]
618    sources += [
619      "../../../../services/edm_plugin/src/disable_hdc_plugin.cpp",
620      "../../../../services/edm_plugin/src/disable_microphone_plugin.cpp",
621      "../../../../services/edm_plugin/src/disable_printer_plugin.cpp",
622    ]
623  }
624
625  if (common_event_service_edm_enable) {
626    external_deps += [ "common_event_service:cesfwk_innerkits" ]
627    sources += [
628      "../../../../services/edm_plugin/src/set_browser_policies_plugin.cpp",
629    ]
630  }
631
632  if (bluetooth_edm_enable) {
633    external_deps += [ "bluetooth:btframework" ]
634    sources += [
635      "../../../../services/edm_plugin/src/allowed_bluetooth_devices_plugin.cpp",
636      "../../../../services/edm_plugin/src/disable_bluetooth_plugin.cpp",
637      "../../../../services/edm_plugin/src/disallowed_bluetooth_devices_plugin.cpp",
638      "../../../../services/edm_plugin/src/disallowed_bluetooth_protocols_plugin.cpp",
639      "../../../../services/edm_plugin/src/get_bluetooth_info_plugin.cpp",
640      "../../../../services/edm_plugin/src/switch_bluetooth_plugin.cpp",
641      "../../../../services/edm_plugin/src/utils/bluetooth_config_utils.cpp",
642      "../../../../services/edm_plugin/src/utils/bt_protocol_utils.cpp",
643    ]
644  }
645
646  if (location_edm_enable) {
647    external_deps += [ "location:locator_sdk" ]
648    sources +=
649        [ "../../../../services/edm_plugin/src/location_policy_plugin.cpp" ]
650  }
651
652  if (telephony_core_edm_enable) {
653    external_deps += [ "core_service:tel_core_service_api" ]
654    defines += [ "TELEPHONY_CORE_EDM_ENABLE_TEST" ]
655  }
656
657  if (pasteboard_edm_enable) {
658    external_deps += [ "pasteboard:pasteboard_client" ]
659    sources +=
660        [ "../../../../services/edm_plugin/src/clipboard_policy_plugin.cpp" ]
661  }
662
663  if (useriam_edm_enable) {
664    external_deps += [ "user_auth_framework:userauth_client" ]
665    sources += [
666      "../../../../services/edm_plugin/src/fingerprint_auth_plugin.cpp",
667      "../../../../services/edm_plugin/src/password_policy_plugin.cpp",
668    ]
669  }
670
671  if (camera_framework_edm_enable) {
672    external_deps += [ "camera_framework:camera_framework" ]
673    sources +=
674        [ "../../../../services/edm_plugin/src/disable_camera_plugin.cpp" ]
675  }
676
677  if (enterprise_device_management_feature_pc_only) {
678    sources += [
679      "../../../../services/edm_plugin/src/set_auto_unlock_after_reboot_plugin.cpp",
680      "../../../../services/edm_plugin/src/disallow_modify_ethernet_ip_plugin.cpp",
681      "../../../../services/edm_plugin/src/install_local_enterprise_app_enabled_plugin.cpp",
682      "../../../../services/edm_plugin/src/disallowed_nearlink_protocols_plugin.cpp",
683      "../../../../services/edm_plugin/src/utils/nearlink_config_utils.cpp",
684      "../../../../services/edm_plugin/src/utils/nearlink_protocol_utils.cpp",
685    ]
686  }
687
688if (os_account_edm_enable && enterprise_device_management_feature_pc_only) {
689    sources += [
690      "../../../../services/edm_plugin/src/disable_print_plugin.cpp",
691      "../../../../services/edm_plugin/src/disable_sudo_plugin.cpp"
692    ]
693    defines += [
694      "FEATURE_PC_ONLY",
695      "SUDO_EDM_ENABLE"
696      ]
697  }
698
699  if (!enterprise_device_management_feature_pc_only && cellular_data_edm_enable) {
700    external_deps += [
701      "cellular_data:tel_cellular_data_api",
702      "core_service:tel_core_service_api",
703      "call_manager:tel_call_manager_api",
704      "telephony_data:tel_telephony_data",
705    ]
706    sources += [
707      "../../../../services/edm_plugin/src/disallow_mobile_data_plugin.cpp",
708      "../../../../services/edm_plugin/src/disallow_modify_apn_plugin.cpp",
709      "../../../../services/edm_plugin/src/disallowed_telephony_call_plugin.cpp",
710      "../../../../services/edm_plugin/src/disallowed_sim_plugin.cpp",
711      "../../../../services/edm_plugin/src/set_apn_plugin.cpp",
712      "../../../../services/edm_plugin/src/telephony_call_policy_plugin.cpp",
713      "../../../../services/edm_plugin/src/turnonoff_mobile_data_plugin.cpp",
714      "../../../../services/edm_plugin/src/utils/apn_utils.cpp",
715    ]
716    defines += [
717      "CELLULAR_DATA_EDM_ENABLE",
718      "TELEPHONY_EDM_ENABLE",
719    ]
720  }
721
722  if (notification_edm_enable) {
723    sources += [ "../../../../services/edm_plugin/src/disallowed_notification_plugin.cpp" ]
724  }
725
726  if (netmanager_ext_edm_enable) {
727    external_deps += [ "netmanager_ext:net_vpn_manager_if" ]
728    sources += [
729      "../../../../services/edm_plugin/src/disallow_vpn_plugin.cpp",
730    ]
731  }
732
733  sanitize = {
734    boundary_sanitize = true
735    cfi = true
736    cfi_cross_dso = true
737    debug = false
738    integer_overflow = true
739    ubsan = true
740  }
741  branch_protector_ret = "pac_ret"
742  subsystem_name = "customization"
743  part_name = "enterprise_device_management"
744}
745
746group("unittest") {
747  testonly = true
748
749  deps = [
750    # deps file
751    ":EdmFingerPrintPluginTest",
752    ":EdmPluginTest",
753  ]
754}
755