• 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/ohos.gni")
15import("../../common/config/common.gni")
16
17config("edm_plugin_config") {
18  cflags = [
19    "-Wno-error=implicit-fallthrough",
20    "-fvisibility=hidden",
21  ]
22  include_dirs = [
23    "./include",
24    "./include/network",
25    "./include/network/executer",
26    "./include/network/rule",
27    "./include/utils",
28  ]
29}
30
31ohos_shared_library("device_core_plugin") {
32  sources = [
33    "./src/utils/installer_callback.cpp",
34    "./src/utils/uninstall_param_serializer.cpp",
35  ]
36
37  public_configs = [
38    ":edm_plugin_config",
39    "../../common/config:coverage_flags",
40  ]
41
42  defines = []
43
44  if (target_cpu == "arm64") {
45    defines += [ "_ARM64_" ]
46    print("defines _ARM64_")
47  }
48
49  if (target_cpu == "x86_64") {
50    defines += [ "_X86_64_" ]
51    print("defines _X86_64_")
52  }
53
54  external_deps = [
55    "ability_base:want",
56    "ability_runtime:app_manager",
57    "access_token:libaccesstoken_sdk",
58    "access_token:libtokenid_sdk",
59    "cJSON:cjson",
60    "c_utils:utils",
61    "distributed_notification_service:ans_innerkits",
62    "file_api:securitylabel",
63    "hilog:libhilog",
64    "init:libbegetutil",
65    "ipc:ipc_core",
66    "samgr:samgr_proxy",
67    "window_manager:libwm",
68    "window_manager:session_manager_lite",
69    "window_manager:sms",
70  ]
71
72  if (enterprise_device_management_support_all) {
73    defines += [ "EDM_SUPPORT_ALL_ENABLE" ]
74    sources += [
75      "./src/allowed_app_distribution_types_plugin.cpp",
76      "./src/allowed_install_bundles_plugin.cpp",
77      "./src/bundle_install_plugin.cpp",
78      "./src/disable_hdc_plugin.cpp",
79      "./src/disable_maintenance_mode_plugin.cpp",
80      "./src/disable_mtp_server_plugin.cpp",
81      "./src/disable_printer_plugin.cpp",
82      "./src/disallow_modify_datetime_plugin.cpp",
83      "./src/disable_set_biometrics_and_screenLock_plugin.cpp",
84      "./src/disable_set_device_name_plugin.cpp",
85      "./src/disallow_distributed_transmission_plugin.cpp",
86      "./src/disallowed_install_bundles_plugin.cpp",
87      "./src/disallowed_uninstall_bundles_plugin.cpp",
88      "./src/inactive_user_freeze_plugin.cpp",
89      "./src/install_plugin.cpp",
90      "./src/installed_bundle_info_list_plugin.cpp",
91      "./src/kiosk_feature_plugin.cpp",
92      "./src/ntp_server_plugin.cpp",
93      "./src/power_policy_plugin.cpp",
94      "./src/screen_off_time_plugin.cpp",
95      "./src/snapshot_skip_plugin.cpp",
96      "./src/uninstall_plugin.cpp",
97      "./src/utils/allowed_app_distribution_types_utils.cpp",
98      "./src/utils/battery_utils.cpp",
99      "./src/utils/bluetooth_config_utils.cpp",
100      "./src/set_allowed_kiosk_apps_plugin.cpp",
101    ]
102
103    if (enterprise_device_management_feature_pc_only) {
104      sources += [
105      "./src/disallow_export_recovery_key_plugin.cpp",
106      "./src/disallowed_nearlink_protocols_plugin.cpp",
107      "./src/utils/nearlink_config_utils.cpp",
108      "./src/utils/nearlink_protocol_utils.cpp",
109      ]
110    }
111
112    if (os_account_edm_enable) {
113      external_deps += [
114        "graphic_2d:librender_service_base",
115        "graphic_2d:librender_service_client",
116        "os_account:libaccountkits",
117        "os_account:os_account_innerkits",
118      ]
119      sources += [
120        "./src/add_os_account_plugin.cpp",
121        "./src/disable_mtp_client_plugin.cpp",
122        "./src/disable_user_mtp_client_plugin.cpp",
123        "./src/disallow_add_local_account_plugin.cpp",
124        "./src/disallow_add_os_account_by_user_plugin.cpp",
125        "./src/set_watermark_image_plugin.cpp",
126      ]
127      defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
128    }
129
130    if (os_account_edm_enable && enterprise_device_management_feature_pc_only) {
131      external_deps += [ "os_account:domain_account_innerkits" ]
132      sources += [
133        "./src/set_domain_account_policy_plugin.cpp",
134        "./src/disable_print_plugin.cpp",
135        "./src/disable_sudo_plugin.cpp",
136        "./src/disallowed_usb_storage_device_write_plugin.cpp",
137        "./src/utils/array_usb_device_type_serializer.cpp",
138      ]
139      defines += [
140        "SUDO_EDM_ENABLE",
141        "FEATURE_PC_ONLY"
142      ]
143      external_deps += [ "usb_manager:usbsrv_client" ]
144    }
145
146    if (enterprise_device_management_feature_pc_only) {
147      sources += [
148        "./src/set_auto_unlock_after_reboot_plugin.cpp",
149        "./src/install_local_enterprise_app_enabled_plugin.cpp",
150      ]
151    }
152
153    if (audio_framework_edm_enable) {
154      external_deps += [ "audio_framework:audio_client" ]
155      sources += [ "./src/disable_microphone_plugin.cpp" ]
156    }
157
158    if (bluetooth_edm_enable) {
159      external_deps += [ "bluetooth:btframework" ]
160      sources += [
161        "./src/allowed_bluetooth_devices_plugin.cpp",
162        "./src/disable_bluetooth_plugin.cpp",
163        "./src/disallowed_bluetooth_devices_plugin.cpp",
164        "./src/disallowed_bluetooth_protocols_plugin.cpp",
165        "./src/get_bluetooth_info_plugin.cpp",
166        "./src/switch_bluetooth_plugin.cpp",
167        "./src/utils/bt_protocol_utils.cpp",
168      ]
169    }
170
171    if (camera_framework_edm_enable) {
172      external_deps += [ "camera_framework:camera_framework" ]
173      sources += [ "./src/disable_camera_plugin.cpp" ]
174    }
175
176    if (power_manager_edm_enable) {
177      external_deps += [ "power_manager:powermgr_client" ]
178      sources += [
179        "./src/reboot_plugin.cpp",
180        "./src/shutdown_plugin.cpp",
181      ]
182    }
183
184    if (screenlock_mgr_edm_enable) {
185      external_deps += [ "screenlock_mgr:screenlock_client" ]
186      sources += [ "./src/lock_screen_plugin.cpp" ]
187    }
188
189    if (!enterprise_device_management_feature_pc_only) {
190      sources += [
191        "./src/disable_backup_and_restore_plugin.cpp",
192        "./src/disable_private_space_plugin.cpp",
193      ]
194    }
195
196    if (enterprise_device_management_feature_charging_type_setting) {
197      defines += [ "FEATURE_CHARGING_TYPE_SETTING" ]
198    }
199
200    if (power_manager_edm_enable && !enterprise_device_management_feature_pc_only) {
201      sources += [ "./src/disallow_power_long_press_plugin.cpp" ]
202    }
203  }
204
205  deps = [
206    "../../common/external:edm_external_adapters",
207    "../../common/native:edm_commom",
208    "../../interfaces/inner_api:edmservice_kits",
209    "../../interfaces/inner_api/plugin_kits:plugin_kits",
210  ]
211
212  sanitize = {
213    boundary_sanitize = true
214    cfi = true
215    cfi_cross_dso = true
216    debug = false
217    integer_overflow = true
218    ubsan = true
219  }
220  relative_install_dir = "edm_plugin"
221  branch_protector_ret = "pac_ret"
222  subsystem_name = "customization"
223  part_name = "enterprise_device_management"
224}
225
226ohos_shared_library("communication_plugin") {
227  sources = []
228
229  public_configs = [
230    ":edm_plugin_config",
231    "../../common/config:coverage_flags",
232  ]
233
234  defines = []
235
236  if (target_cpu == "arm64") {
237    defines += [ "_ARM64_" ]
238    print("defines _ARM64_")
239  }
240
241  if (target_cpu == "x86_64") {
242    defines += [ "_X86_64_" ]
243    print("defines _X86_64_")
244  }
245
246  external_deps = [
247    "ability_base:want",
248    "ability_runtime:app_manager",
249    "access_token:libaccesstoken_sdk",
250    "access_token:libtokenid_sdk",
251    "cJSON:cjson",
252    "c_utils:utils",
253    "file_api:securitylabel",
254    "hilog:libhilog",
255    "init:libbegetutil",
256    "ipc:ipc_core",
257    "samgr:samgr_proxy",
258    "window_manager:libwm",
259    "window_manager:sms",
260  ]
261
262  if (enterprise_device_management_support_all) {
263    sources += [ "./src/disallowed_tethering_plugin.cpp" ]
264    defines += [ "EDM_SUPPORT_ALL_ENABLE" ]
265    if (wifi_edm_enable) {
266      external_deps += [ "wifi:wifi_sdk" ]
267      sources += [
268        "./src/allowed_wifi_list_plugin.cpp",
269        "./src/disallowed_wifi_list_plugin.cpp",
270        "./src/is_wifi_active_plugin.cpp",
271        "./src/set_wifi_disabled_plugin.cpp",
272        "./src/set_wifi_profile_plugin.cpp",
273        "./src/switch_wifi_plugin.cpp",
274        "./src/utils/wifi_device_config_serializer.cpp",
275        "./src/utils/wifi_policy_utils.cpp",
276      ]
277      defines += [ "WIFI_EDM_ENABLE" ]
278    }
279
280    if (!enterprise_device_management_feature_pc_only &&
281        cellular_data_edm_enable && telephony_core_edm_enable) {
282      external_deps += [
283        "call_manager:tel_call_manager_api",
284        "cellular_data:tel_cellular_data_api",
285        "core_service:tel_core_service_api",
286        "data_share:datashare_consumer",
287        "telephony_data:tel_telephony_data",
288      ]
289      sources += [
290        "./src/disallow_mobile_data_plugin.cpp",
291        "./src/disallow_modify_apn_plugin.cpp",
292        "./src/disallowed_sim_plugin.cpp",
293        "./src/disallowed_telephony_call_plugin.cpp",
294        "./src/telephony_call_policy_plugin.cpp",
295        "./src/set_apn_plugin.cpp",
296        "./src/turnonoff_mobile_data_plugin.cpp",
297        "./src/utils/apn_utils.cpp",
298      ]
299      defines += [
300        "CELLULAR_DATA_EDM_ENABLE",
301        "TELEPHONY_EDM_ENABLE",
302      ]
303    }
304
305    if (enterprise_device_management_feature_pc_only) {
306      sources += [
307        "./src/disable_samba_client_plugin.cpp",
308        "./src/disable_samba_server_plugin.cpp",
309        "./src/disallow_modify_ethernet_ip_plugin.cpp",
310      ]
311      defines += [ "FEATURE_PC_ONLY" ]
312    }
313
314    if (netmanager_base_edm_enable) {
315      defines += [ "NET_MANAGER_BASE_EDM_ENABLE" ]
316      external_deps += [
317        "netmanager_base:net_conn_manager_if",
318        "netmanager_base:net_policy_manager_if",
319        "netmanager_base:netsys_controller",
320      ]
321      sources += [
322        "./src/disabled_network_interface_plugin.cpp",
323        "./src/disallowed_airplane_mode_plugin.cpp",
324        "./src/domain_filter_rule_plugin.cpp",
325        "./src/firewall_rule_plugin.cpp",
326        "./src/global_proxy_plugin.cpp",
327        "./src/iptables_rule_plugin.cpp",
328        "./src/network/executer/domain_executer.cpp",
329        "./src/network/executer/executer_factory.cpp",
330        "./src/network/executer/executer_utils.cpp",
331        "./src/network/executer/firewall_executer.cpp",
332        "./src/network/executer/iexecuter.cpp",
333        "./src/network/iptables_manager.cpp",
334        "./src/network/rule/chain_rule.cpp",
335        "./src/network/rule/domain_chain_rule.cpp",
336        "./src/network/rule/firewall_chain_rule.cpp",
337        "./src/network/rule/rule_utils.cpp",
338        "./src/utils/domain_filter_rule_serializer.cpp",
339        "./src/utils/firewall_rule_serializer.cpp",
340        "./src/utils/http_proxy_serializer.cpp",
341      ]
342    }
343
344    if (netmanager_ext_edm_enable) {
345      external_deps += [
346        "netmanager_ext:ethernet_manager_if",
347        "netmanager_ext:net_vpn_manager_if",
348      ]
349      sources += [
350        "./src/get_all_network_interfaces_plugin.cpp",
351        "./src/get_ip_address_plugin.cpp",
352        "./src/get_mac_plugin.cpp",
353        "./src/disallow_vpn_plugin.cpp"
354      ]
355    }
356
357    if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) {
358      external_deps += [ "usb_manager:usbsrv_client" ]
359      sources += [
360        "./src/allowed_usb_devices_plugin.cpp",
361        "./src/disable_usb_plugin.cpp",
362        "./src/disallowed_usb_devices_plugin.cpp",
363        "./src/utils/array_usb_device_type_serializer.cpp",
364        "./src/utils/usb_policy_utils.cpp",
365      ]
366    }
367
368    if (os_account_edm_enable) {
369      external_deps += [
370        "os_account:domain_account_innerkits",
371        "os_account:os_account_innerkits",
372      ]
373      defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
374    }
375
376    if (drivers_interface_usb_edm_enable && storage_service_edm_enable &&
377        usb_manager_edm_enable) {
378      external_deps += [ "storage_service:storage_manager_sa_proxy" ]
379      sources += [ "./src/usb_read_only_plugin.cpp" ]
380      defines += [ "USB_STORAGE_SERVICE_EDM_ENABLE" ]
381    }
382
383    if (common_event_service_edm_enable) {
384      external_deps += [ "common_event_service:cesfwk_innerkits" ]
385      sources += [
386        "./src/managed_browser_policy_plugin.cpp",
387        "./src/set_browser_policies_plugin.cpp",
388        "./src/utils/managed_browser_policy_serializer.cpp",
389      ]
390      defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ]
391    }
392
393    if (!enterprise_device_management_feature_pc_only) {
394      sources += [
395        "./src/disallowed_mms_plugin.cpp",
396        "./src/disallowed_sms_plugin.cpp",
397      ]
398    }
399  }
400
401  deps = [
402    "../../common/external:edm_external_adapters",
403    "../../common/native:edm_commom",
404    "../../interfaces/inner_api:edmservice_kits",
405    "../../interfaces/inner_api/plugin_kits:plugin_kits",
406  ]
407
408  sanitize = {
409    boundary_sanitize = true
410    cfi = true
411    cfi_cross_dso = true
412    debug = false
413    integer_overflow = true
414    ubsan = true
415  }
416  relative_install_dir = "edm_plugin"
417  branch_protector_ret = "pac_ret"
418  subsystem_name = "customization"
419  part_name = "enterprise_device_management"
420}
421
422ohos_shared_library("sys_service_plugin") {
423  sources = []
424  public_configs = [
425    ":edm_plugin_config",
426    "../../common/config:coverage_flags",
427  ]
428
429  defines = []
430
431  if (target_cpu == "arm64") {
432    defines += [ "_ARM64_" ]
433    print("defines _ARM64_")
434  }
435
436  if (target_cpu == "x86_64") {
437    defines += [ "_X86_64_" ]
438    print("defines _X86_64_")
439  }
440
441  external_deps = [
442    "ability_base:want",
443    "ability_runtime:app_manager",
444    "access_token:libaccesstoken_sdk",
445    "access_token:libtokenid_sdk",
446    "bundle_framework:appexecfwk_core",
447    "cJSON:cjson",
448    "c_utils:utils",
449    "file_api:securitylabel",
450    "hilog:libhilog",
451    "init:libbegetutil",
452    "ipc:ipc_core",
453    "samgr:samgr_proxy",
454    "telephony_data:tel_telephony_data",
455    "window_manager:libwm",
456    "window_manager:sms",
457  ]
458
459  if (enterprise_device_management_support_all) {
460    sources += [
461      "./src/clear_up_application_data_plugin.cpp",
462      "./src/utils/clear_up_application_data_param_serializer.cpp",
463    ]
464    defines += [ "EDM_SUPPORT_ALL_ENABLE" ]
465    if (update_service_edm_enable) {
466      external_deps += [ "update_service:updateservicekits" ]
467      sources += [ "./src/reset_factory_plugin.cpp" ]
468    }
469
470    if (ability_runtime_edm_enable) {
471      external_deps += [ "ability_runtime:ability_manager" ]
472      sources += [
473        "./src/disallowed_running_bundles_plugin.cpp",
474        "./src/manage_auto_start_apps_plugin.cpp",
475        "./src/manage_keep_alive_apps_plugin.cpp",
476        "./src/utils/manage_keep_alive_apps_info.cpp",
477        "./src/utils/manage_auto_start_app_info.cpp",
478        "./src/utils/manage_auto_start_apps_serializer.cpp",
479        "./src/utils/manage_keep_alive_apps_serializer.cpp",
480      ]
481    }
482
483    if (certificate_manager_edm_enable) {
484      external_deps += [ "certificate_manager:cert_manager_sdk" ]
485      sources += [ "./src/user_cert_plugin.cpp" ]
486    }
487
488    if (pasteboard_edm_enable) {
489      external_deps += [ "pasteboard:pasteboard_client" ]
490      defines += [ "PASTEBOARD_EDM_ENABLE" ]
491      sources += [ "./src/clipboard_policy_plugin.cpp" ]
492    }
493
494    sources += [
495      "./src/set_permission_managed_state_plugin.cpp",
496      "./src/utils/permission_managed_state_serializer.cpp"
497    ]
498
499    if (useriam_edm_enable) {
500      external_deps += [ "user_auth_framework:userauth_client" ]
501      defines += [ "USERIAM_EDM_ENABLE" ]
502      sources += [
503        "./src/fingerprint_auth_plugin.cpp",
504        "./src/password_policy_plugin.cpp",
505      ]
506    }
507
508    if (location_edm_enable) {
509      external_deps += [ "location:locator_sdk" ]
510      sources += [ "./src/location_policy_plugin.cpp" ]
511    }
512
513    if (time_service_edm_enable) {
514      external_deps += [ "time_service:time_client" ]
515      sources += [ "./src/set_datetime_plugin.cpp" ]
516    }
517
518    if (notification_edm_enable) {
519      sources += [ "./src/disallowed_notification_plugin.cpp" ]
520    }
521  }
522  deps = [
523    "../../common/external:edm_external_adapters",
524    "../../common/native:edm_commom",
525    "../../interfaces/inner_api:edmservice_kits",
526    "../../interfaces/inner_api/plugin_kits:plugin_kits",
527  ]
528
529  sanitize = {
530    boundary_sanitize = true
531    cfi = true
532    cfi_cross_dso = true
533    debug = false
534    integer_overflow = true
535    ubsan = true
536  }
537  relative_install_dir = "edm_plugin"
538  branch_protector_ret = "pac_ret"
539  subsystem_name = "customization"
540  part_name = "enterprise_device_management"
541}
542
543ohos_shared_library("need_extra_plugin") {
544  sources = [
545    "./src/utils/operate_device_param_serializer.cpp",
546    "./src/utils/uninstall_param_serializer.cpp",
547    "./src/utils/update_policy_serializer.cpp",
548    "./src/utils/upgrade_package_info_serializer.cpp",
549  ]
550  public_configs = [
551    ":edm_plugin_config",
552    "../../common/config:coverage_flags",
553  ]
554
555  defines = []
556
557  if (target_cpu == "arm64") {
558    defines += [ "_ARM64_" ]
559    print("defines _ARM64_")
560  }
561
562  if (target_cpu == "x86_64") {
563    defines += [ "_X86_64_" ]
564    print("defines _X86_64_")
565  }
566
567  external_deps = [
568    "ability_base:want",
569    "ability_runtime:app_manager",
570    "access_token:libaccesstoken_sdk",
571    "access_token:libtokenid_sdk",
572    "cJSON:cjson",
573    "c_utils:utils",
574    "hilog:libhilog",
575    "init:libbegetutil",
576    "ipc:ipc_core",
577    "samgr:samgr_proxy",
578    "window_manager:libwm",
579    "window_manager:sms",
580  ]
581
582  if (enterprise_device_management_support_all) {
583    defines += [ "EDM_SUPPORT_ALL_ENABLE" ]
584    sources += [
585      "./src/get_adminprovision_info_plugin.cpp",
586      "./src/get_device_info_plugin.cpp",
587      "./src/notify_update_packages_plugin.cpp",
588      "./src/set_update_policy_plugin.cpp",
589      "./src/set_wall_paper_plugin.cpp",
590    ]
591  }
592
593  if (power_manager_edm_enable && screenlock_mgr_edm_enable &&
594      update_service_edm_enable) {
595    external_deps += [
596      "power_manager:powermgr_client",
597      "screenlock_mgr:screenlock_client",
598      "update_service:updateservicekits",
599    ]
600    sources += [ "./src/operate_device_plugin.cpp" ]
601  }
602
603  if (telephony_core_edm_enable) {
604    external_deps += [ "core_service:tel_core_service_api" ]
605    defines += [ "TELEPHONY_CORE_EDM_ENABLE" ]
606  }
607
608  deps = [
609    "../../common/external:edm_external_adapters",
610    "../../common/native:edm_commom",
611    "../../interfaces/inner_api:edmservice_kits",
612    "../../interfaces/inner_api/plugin_kits:plugin_kits",
613  ]
614
615  sanitize = {
616    boundary_sanitize = true
617    cfi = true
618    cfi_cross_dso = true
619    debug = false
620    integer_overflow = true
621    ubsan = true
622  }
623  relative_install_dir = "edm_plugin"
624  branch_protector_ret = "pac_ret"
625  subsystem_name = "customization"
626  part_name = "enterprise_device_management"
627}
628