• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2024 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("edmplugin") {
32  sources = [
33    "./src/utils/installer_callback.cpp",
34    "./src/utils/managed_browser_policy_serializer.cpp",
35    "./src/utils/operate_device_param_serializer.cpp",
36    "./src/utils/uninstall_param_serializer.cpp",
37    "./src/utils/update_policy_serializer.cpp",
38    "./src/utils/upgrade_package_info_serializer.cpp",
39  ]
40  public_configs = [
41    ":edm_plugin_config",
42    "../../common/config:coverage_flags",
43  ]
44
45  defines = []
46
47  if (target_cpu == "arm64") {
48    defines += [ "_ARM64_" ]
49    print("defines _ARM64_")
50  }
51
52  if (target_cpu == "x86_64") {
53    defines += [ "_X86_64_" ]
54    print("defines _X86_64_")
55  }
56
57  external_deps = [
58    "ability_base:want",
59    "ability_runtime:app_manager",
60    "access_token:libaccesstoken_sdk",
61    "access_token:libtokenid_sdk",
62    "cJSON:cjson",
63    "c_utils:utils",
64    "file_api:securitylabel",
65    "hilog:libhilog",
66    "init:libbegetutil",
67    "ipc:ipc_core",
68    "jsoncpp:jsoncpp",
69    "samgr:samgr_proxy",
70    "window_manager:sms",
71  ]
72
73  if (enterprise_device_management_support_all) {
74    defines += [ "EDM_SUPPORT_ALL_ENABLE" ]
75    sources += [
76      "./src/allowed_install_bundles_plugin.cpp",
77      "./src/bundle_install_plugin.cpp",
78      "./src/disable_mtp_client_plugin.cpp",
79      "./src/disable_mtp_server_plugin.cpp",
80      "./src/disallow_modify_datetime_plugin.cpp",
81      "./src/disallowed_install_bundles_plugin.cpp",
82      "./src/disallowed_tethering_plugin.cpp",
83      "./src/disallowed_uninstall_bundles_plugin.cpp",
84      "./src/get_adminprovision_info_plugin.cpp",
85      "./src/get_device_info_plugin.cpp",
86      "./src/inactive_user_freeze_plugin.cpp",
87      "./src/install_plugin.cpp",
88      "./src/notify_update_packages_plugin.cpp",
89      "./src/ntp_server_plugin.cpp",
90      "./src/operate_device_plugin.cpp",
91      "./src/power_policy_plugin.cpp",
92      "./src/screen_off_time_plugin.cpp",
93      "./src/set_update_policy_plugin.cpp",
94      "./src/snapshot_skip_plugin.cpp",
95      "./src/uninstall_plugin.cpp",
96      "./src/utils/battery_utils.cpp",
97    ]
98    if (time_service_edm_enable) {
99      external_deps += [ "time_service:time_client" ]
100      sources += [ "./src/set_datetime_plugin.cpp" ]
101    }
102
103    if (os_account_edm_enable) {
104      external_deps += [
105        "os_account:libaccountkits",
106        "os_account:os_account_innerkits",
107      ]
108      sources += [
109        "./src/add_os_account_plugin.cpp",
110        "./src/disallow_add_local_account_plugin.cpp",
111        "./src/disallow_add_os_account_by_user_plugin.cpp",
112      ]
113      defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
114    }
115
116    if (os_account_edm_enable && enterprise_device_management_feature_pc_only) {
117      external_deps += [ "os_account:domain_account_innerkits" ]
118      sources += [ "./src/set_domain_account_policy_plugin.cpp" ]
119    }
120
121    if (screenlock_mgr_edm_enable) {
122      external_deps += [ "screenlock_mgr:screenlock_client" ]
123      sources += [ "./src/lock_screen_plugin.cpp" ]
124    }
125
126    if (power_manager_edm_enable) {
127      external_deps += [ "power_manager:powermgr_client" ]
128      sources += [
129        "./src/reboot_plugin.cpp",
130        "./src/shutdown_plugin.cpp",
131      ]
132    }
133
134    if (update_service_edm_enable) {
135      external_deps += [ "update_service:updateservicekits" ]
136      sources += [ "./src/reset_factory_plugin.cpp" ]
137    }
138
139    if (wifi_edm_enable) {
140      external_deps += [ "wifi:wifi_sdk" ]
141      sources += [
142        "./src/is_wifi_active_plugin.cpp",
143        "./src/set_wifi_disabled_plugin.cpp",
144        "./src/set_wifi_profile_plugin.cpp",
145        "./src/utils/wifi_device_config_serializer.cpp",
146      ]
147      defines += [ "WIFI_EDM_ENABLE" ]
148    }
149
150    if (netmanager_base_edm_enable) {
151      defines += [ "NET_MANAGER_BASE_EDM_ENABLE" ]
152      external_deps += [
153        "netmanager_base:net_conn_manager_if",
154        "netmanager_base:net_native_manager_if",
155        "netmanager_base:net_policy_manager_if",
156        "netmanager_base:netsys_controller",
157      ]
158      sources += [
159        "./src/disabled_network_interface_plugin.cpp",
160        "./src/domain_filter_rule_plugin.cpp",
161        "./src/firewall_rule_plugin.cpp",
162        "./src/global_proxy_plugin.cpp",
163        "./src/iptables_rule_plugin.cpp",
164        "./src/network/executer/domain_executer.cpp",
165        "./src/network/executer/executer_factory.cpp",
166        "./src/network/executer/executer_utils.cpp",
167        "./src/network/executer/firewall_executer.cpp",
168        "./src/network/executer/iexecuter.cpp",
169        "./src/network/iptables_manager.cpp",
170        "./src/network/rule/chain_rule.cpp",
171        "./src/network/rule/domain_chain_rule.cpp",
172        "./src/network/rule/firewall_chain_rule.cpp",
173        "./src/network/rule/rule_utils.cpp",
174        "./src/utils/domain_filter_rule_serializer.cpp",
175        "./src/utils/firewall_rule_serializer.cpp",
176        "./src/utils/http_proxy_serializer.cpp",
177      ]
178    }
179
180    if (netmanager_ext_edm_enable) {
181      external_deps += [ "netmanager_ext:ethernet_manager_if" ]
182      sources += [
183        "./src/get_all_network_interfaces_plugin.cpp",
184        "./src/get_ip_address_plugin.cpp",
185        "./src/get_mac_plugin.cpp",
186      ]
187    }
188
189    if (ability_runtime_edm_enable) {
190      external_deps += [ "ability_runtime:ability_manager" ]
191      sources += [
192        "./src/disallowed_running_bundles_plugin.cpp",
193        "./src/manage_auto_start_apps_plugin.cpp",
194        "./src/manage_keep_alive_apps_plugin.cpp",
195      ]
196    }
197
198    if (certificate_manager_edm_enable) {
199      external_deps += [ "certificate_manager:cert_manager_sdk" ]
200      sources += [ "./src/user_cert_plugin.cpp" ]
201    }
202
203    if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) {
204      external_deps += [ "usb_manager:usbsrv_client" ]
205      sources += [
206        "./src/allowed_usb_devices_plugin.cpp",
207        "./src/disable_usb_plugin.cpp",
208        "./src/disallowed_usb_devices_plugin.cpp",
209        "./src/utils/array_usb_device_type_serializer.cpp",
210        "./src/utils/usb_policy_utils.cpp",
211      ]
212    }
213
214    if (drivers_interface_usb_edm_enable && storage_service_edm_enable &&
215        usb_manager_edm_enable) {
216      external_deps += [ "storage_service:storage_manager_sa_proxy" ]
217      sources += [ "./src/usb_read_only_plugin.cpp" ]
218    }
219
220    if (audio_framework_edm_enable) {
221      external_deps += [ "audio_framework:audio_client" ]
222      sources += [
223        "./src/disable_hdc_plugin.cpp",
224        "./src/disable_microphone_plugin.cpp",
225        "./src/disable_printer_plugin.cpp",
226      ]
227    }
228
229    if (common_event_service_edm_enable) {
230      external_deps += [ "common_event_service:cesfwk_innerkits" ]
231      sources += [
232        "./src/managed_browser_policy_plugin.cpp",
233        "./src/set_browser_policies_plugin.cpp",
234      ]
235      defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ]
236    }
237
238    if (bluetooth_edm_enable) {
239      external_deps += [ "bluetooth:btframework" ]
240      sources += [
241        "./src/allowed_bluetooth_devices_plugin.cpp",
242        "./src/disable_bluetooth_plugin.cpp",
243        "./src/get_bluetooth_info_plugin.cpp",
244      ]
245    }
246
247    if (location_edm_enable) {
248      external_deps += [ "location:locator_sdk" ]
249      sources += [ "./src/location_policy_plugin.cpp" ]
250    }
251
252    if (telephony_core_edm_enable) {
253      external_deps += [ "core_service:tel_core_service_api" ]
254      defines += [ "TELEPHONY_CORE_EDM_ENABLE" ]
255    }
256  }
257
258  if (pasteboard_edm_enable) {
259    external_deps += [ "pasteboard:pasteboard_client" ]
260    defines += [ "PASTEBOARD_EDM_ENABLE" ]
261    sources += [ "./src/clipboard_policy_plugin.cpp" ]
262  }
263
264  if (useriam_edm_enable) {
265    external_deps += [ "user_auth_framework:userauth_client" ]
266    defines += [ "USERIAM_EDM_ENABLE" ]
267    sources += [
268      "./src/fingerprint_auth_plugin.cpp",
269      "./src/password_policy_plugin.cpp",
270    ]
271  }
272
273  if (enterprise_device_management_feature_charging_type_setting) {
274    defines += [ "FEATURE_CHARGING_TYPE_SETTING" ]
275  }
276
277  if (camera_framework_edm_enable) {
278    external_deps += [ "camera_framework:camera_framework" ]
279    sources += [ "./src/disable_camera_plugin.cpp" ]
280  }
281
282  deps = [
283    "../../common/external:edm_external_adapters",
284    "../../common/native:edm_commom",
285    "../../interfaces/inner_api:edmservice_kits",
286    "../../interfaces/inner_api/plugin_kits:plugin_kits",
287  ]
288
289  sanitize = {
290    boundary_sanitize = true
291    cfi = true
292    cfi_cross_dso = true
293    debug = false
294    integer_overflow = true
295    ubsan = true
296  }
297  relative_install_dir = "edm_plugin"
298  branch_protector_ret = "pac_ret"
299  subsystem_name = "customization"
300  part_name = "enterprise_device_management"
301}
302