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/ohos.gni") 15import("os_account_service.gni") 16 17ohos_prebuilt_etc("accountmgr.init") { 18 source = "accountmgr.cfg" 19 relative_install_dir = "init" 20 subsystem_name = "account" 21 part_name = "os_account" 22} 23 24ohos_prebuilt_etc("osaccount_constraint") { 25 source = "osaccount_constraints.json" 26 relative_install_dir = "account" 27 subsystem_name = "account" 28 part_name = "os_account" 29} 30 31ohos_prebuilt_etc("os_account_config") { 32 source = "os_account_config.json" 33 relative_install_dir = "account" 34 subsystem_name = "account" 35 part_name = "os_account" 36} 37 38ohos_prebuilt_etc("constraints_list_collection") { 39 source = "constraints_list_collection.json" 40 relative_install_dir = "account" 41 subsystem_name = "account" 42 part_name = "os_account" 43} 44 45config("accountmgr_config") { 46 include_dirs = [ 47 "./include", 48 "./include/ability_manager_adapter", 49 "./include/appaccount", 50 "./include/osaccount", 51 "${innerkits_path}/include", 52 "${os_account_dfx_path}/hidumper_adapter", 53 "${app_account_interfaces_native_path}/include", 54 "${os_account_dfx_path}/hisysevent_adapter", 55 "${os_account_dfx_path}/hitrace_adapter", 56 "${app_account_innerkits_native_path}/include", 57 ] 58} 59 60config("account_iam_config") { 61 include_dirs = [ "${account_iam_interfaces_native_path}/include" ] 62} 63 64config("domain_account_config") { 65 include_dirs = [ 66 "include/domain_account", 67 "${domain_account_framework_path}/include", 68 "${domain_account_interfaces_native_path}/include", 69 ] 70} 71 72config("ability_manager_config") { 73 include_dirs = [ 74 "${ability_runtime_path}/interfaces/inner_api/ability_manager/include", 75 "${ability_runtime_path}/ability_base/interfaces/inner_api/want/include", 76 "${ability_runtime_path}/services/abilitymgr/include", 77 "${ability_runtime_path}/services/common/include", 78 ] 79} 80 81config("accountmgr_public_config") { 82 visibility = [ ":*" ] 83 84 include_dirs = [ 85 "${services_path}/accountmgr/include", 86 "${services_path}/accountmgr/include/appaccount", 87 "${services_path}/accountmgr/include/osaccount", 88 "${services_path}/accountmgr/include/domain_account", 89 ] 90 91 if (has_user_auth_part) { 92 include_dirs += [ "${services_path}/accountmgr/include/account_iam" ] 93 } 94} 95 96config("bundle_manager_config") { 97 include_dirs = 98 [ "${services_path}/accountmgr/include/bundle_manager_adapter" ] 99} 100 101ability_manager_sources = 102 [ "src/ability_manager_adapter/ability_manager_adapter.cpp" ] 103 104if (has_kv_store_part) { 105 app_account_sources = [ 106 "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp", 107 "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp", 108 "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp", 109 "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_service.cpp", 110 "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp", 111 "${app_account_innerkits_native_path}/src/app_account_common.cpp", 112 "${app_account_innerkits_native_path}/src/app_account_info.cpp", 113 "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp", 114 "src/appaccount/app_account_app_state_observer.cpp", 115 "src/appaccount/app_account_authenticator_callback.cpp", 116 "src/appaccount/app_account_authenticator_manager.cpp", 117 "src/appaccount/app_account_authenticator_proxy.cpp", 118 "src/appaccount/app_account_authenticator_session.cpp", 119 "src/appaccount/app_account_authenticator_session_manager.cpp", 120 "src/appaccount/app_account_authorization_extension_proxy.cpp", 121 "src/appaccount/app_account_check_labels_callback.cpp", 122 "src/appaccount/app_account_check_labels_session.cpp", 123 "src/appaccount/app_account_common_event_observer.cpp", 124 "src/appaccount/app_account_common_event_subscriber.cpp", 125 "src/appaccount/app_account_control_manager.cpp", 126 "src/appaccount/app_account_data_storage.cpp", 127 "src/appaccount/app_account_event_proxy.cpp", 128 "src/appaccount/app_account_manager_service.cpp", 129 "src/appaccount/app_account_stub.cpp", 130 "src/appaccount/app_account_subscribe_death_recipient.cpp", 131 "src/appaccount/app_account_subscribe_manager.cpp", 132 "src/appaccount/inner_app_account_manager.cpp", 133 ] 134} 135 136if (has_user_auth_part) { 137 account_iam_sources = [ 138 "src/account_iam/account_iam_callback.cpp", 139 "src/account_iam/account_iam_client_callback_proxy.cpp", 140 "src/account_iam/account_iam_mgr_stub.cpp", 141 "src/account_iam/account_iam_service.cpp", 142 "src/account_iam/inner_account_iam_manager.cpp", 143 ] 144} 145 146bundle_manager_sources = [ 147 "src/bundle_manager_adapter/bundle_manager_adapter.cpp", 148 "src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp", 149 "src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp", 150] 151 152ohos_shared_library("accountmgr") { 153 branch_protector_ret = "pac_ret" 154 155 sanitize = { 156 cfi = true 157 cfi_cross_dso = true 158 debug = false 159 blocklist = "./account_cfi_blocklist.txt" 160 } 161 162 visibility = [ "${os_account_path}/*" ] 163 cflags = [ "-pipe" ] 164 if (!use_clang_coverage) { 165 version_script = "libaccountmgr.map" 166 } 167 cflags_cc = [ 168 "-Wdate-time", 169 "-Wformat=2", 170 "-Wfloat-equal", 171 "-Wshadow", 172 ] 173 if (os_account_multiple_active_accounts) { 174 cflags += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ] 175 } 176 177 if (os_account_support_deactivate_main_os_account) { 178 cflags += [ "-DSUPPORT_STOP_MAIN_OS_ACCOUNT" ] 179 } 180 181 if (os_account_distributed_feature) { 182 cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] 183 } 184 185 if (os_account_enable_multiple_os_accounts || use_clang_coverage) { 186 cflags += [ "-DENABLE_MULTIPLE_OS_ACCOUNTS" ] 187 } 188 189 if (os_account_enable_default_admin_name) { 190 cflags += [ "-DENABLE_DEFAULT_ADMIN_NAME" ] 191 } 192 193 if (os_account_enable_account_short_name) { 194 cflags += [ "-DENABLE_ACCOUNT_SHORT_NAME" ] 195 } 196 197 if (os_account_activate_last_logged_in_account) { 198 cflags += [ "-DACTIVATE_LAST_LOGGED_IN_ACCOUNT" ] 199 } 200 201 sources = [ 202 "${common_path}/utils/src/account_permission_manager.cpp", 203 "${domain_account_framework_path}/src/domain_account_callback_proxy.cpp", 204 "${domain_account_framework_path}/src/domain_account_callback_service.cpp", 205 "${domain_account_framework_path}/src/domain_account_callback_stub.cpp", 206 "${domain_account_framework_path}/src/domain_account_common.cpp", 207 "${innerkits_native_path}/src/account_info_parcel.cpp", 208 "${os_account_core_path}/src/os_account_event_proxy.cpp", 209 "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", 210 "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", 211 "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", 212 ] 213 sources += account_service_sources 214 sources += ability_manager_sources 215 sources += bundle_manager_sources 216 217 defines = [ 218 "ACCOUNT_LOG_TAG = \"AccountMgrService\"", 219 "LOG_DOMAIN = 0xD001B00", 220 ] 221 if (target_cpu == "arm64") { 222 defines += [ "_ARM64_" ] 223 } 224 configs = [ 225 ":accountmgr_config", 226 ":bundle_manager_config", 227 ":domain_account_config", 228 ] 229 230 public_configs = [ 231 ":accountmgr_public_config", 232 ":domain_account_config", 233 ] 234 235 use_exceptions = true 236 237 deps = [ 238 "${common_path}:libaccount_common", 239 "${innerkits_native_path}:libaccountkits", 240 "${os_account_innerkits_native_path}:os_account_innerkits", 241 ] 242 243 external_deps = [ 244 "ability_base:base", 245 "ability_base:want", 246 "ability_runtime:ability_connect_callback_stub", 247 "ability_runtime:app_manager", 248 "ability_runtime:wantagent_innerkits", 249 "access_token:libaccesstoken_sdk", 250 "access_token:libtokenid_sdk", 251 "bundle_framework:appexecfwk_base", 252 "bundle_framework:appexecfwk_core", 253 "c_utils:utils", 254 "hilog:libhilog", 255 "init:libbegetutil", 256 "ipc:ipc_single", 257 "json:nlohmann_json_static", 258 "mbedtls:mbedtls_shared", 259 "safwk:system_ability_fwk", 260 "samgr:samgr_proxy", 261 ] 262 if (has_huks_part) { 263 external_deps += [ "huks:libhukssdk" ] 264 cflags_cc += [ "-DHAS_HUKS_PART" ] 265 } 266 267 if (has_theme_mar_part) { 268 external_deps += [ "theme_mgr:theme_manager_client" ] 269 cflags_cc += [ "-DHAS_THEME_SERVICE_PART" ] 270 } 271 272 configs += [ ":account_iam_config" ] 273 if (has_user_auth_part) { 274 cflags_cc += [ 275 "-DHAS_USER_AUTH_PART", 276 "-DHAS_USER_IDM_PART", 277 ] 278 sources += account_iam_sources 279 external_deps += [ 280 "access_token:libtokensetproc_shared", 281 "user_auth_framework:userauth_client", 282 ] 283 } 284 285 if (has_pin_auth_part) { 286 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 287 external_deps += [ "pin_auth:pinauth_framework" ] 288 } 289 290 if (has_kv_store_part) { 291 cflags_cc += [ 292 "-DHAS_APP_ACCOUNT_PART", 293 "-DHAS_KV_STORE_PART", 294 ] 295 sources += app_account_sources 296 sources += [ 297 "src/account_data_storage.cpp", 298 "src/osaccount/os_account_data_storage.cpp", 299 "src/osaccount/os_account_database_operator.cpp", 300 ] 301 external_deps += [ "kv_store:distributeddata_inner" ] 302 } 303 304 if (has_storage_service_part) { 305 cflags += [ "-DHAS_STORAGE_PART" ] 306 external_deps += [ "storage_service:storage_manager_sa_proxy" ] 307 } 308 309 if (build_selinux) { 310 external_deps += [ "selinux_adapter:librestorecon" ] 311 cflags += [ "-DWITH_SELINUX" ] 312 } 313 314 if (has_ces_part) { 315 cflags_cc += [ "-DHAS_CES_PART" ] 316 external_deps += [ "common_event_service:cesfwk_innerkits" ] 317 } 318 319 if (has_hiviewdfx_hisysevent_part) { 320 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 321 external_deps += [ "hisysevent:libhisysevent" ] 322 } 323 324 if (use_musl) { 325 cflags_cc += [ "-DUSE_MUSL" ] 326 } 327 328 if (hicollie_enable == true) { 329 external_deps += [ "hicollie:libhicollie" ] 330 cflags_cc += [ "-DHICOLLIE_ENABLE" ] 331 } 332 333 if (security_guard_enabled) { 334 external_deps += [ 335 "security_guard:libsg_collect_sdk", 336 "time_service:time_client", 337 ] 338 cflags_cc += [ "-DSECURITY_GUARDE_ENABLE" ] 339 } 340 341 if (has_hiviewdfx_hitrace_part) { 342 external_deps += [ "hitrace:hitrace_meter" ] 343 cflags_cc += [ "-DHAS_HITRACE_PART" ] 344 } 345 346 if (has_asset_part) { 347 external_deps += [ "asset:asset_sdk" ] 348 cflags_cc += [ "-DHAS_ASSET_PART" ] 349 } 350 351 if (has_config_policy_part) { 352 external_deps += [ "config_policy:configpolicy_util" ] 353 cflags_cc += [ "-DHAS_CONFIG_POLICY_PART" ] 354 } 355 356 if (build_variant == "user") { 357 cflags_cc += [ "-DIS_RELEASE_VERSION" ] 358 } 359 360 if (use_clang_coverage) { 361 cflags_cc += [ "-DACCOUNT_COVERAGE_TEST" ] 362 } 363 364 if (!use_clang_coverage) { 365 shlib_type = "sa" 366 } 367 subsystem_name = "account" 368 part_name = "os_account" 369} 370 371group("accountmgr_target") { 372 deps = [ 373 ":accountmgr", 374 ":accountmgr.init", 375 ":constraints_list_collection", 376 ":os_account_config", 377 ":osaccount_constraint", 378 ] 379} 380