# Copyright (c) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("os_account_service.gni") ohos_prebuilt_etc("accountmgr.init") { source = "accountmgr.cfg" relative_install_dir = "init" subsystem_name = "account" part_name = "os_account" } ohos_prebuilt_etc("osaccount_constraint") { source = "osaccount_constraints.json" relative_install_dir = "account" subsystem_name = "account" part_name = "os_account" } ohos_prebuilt_etc("os_account_config") { source = "os_account_config.json" relative_install_dir = "account" subsystem_name = "account" part_name = "os_account" } ohos_prebuilt_etc("constraints_list_collection") { source = "constraints_list_collection.json" relative_install_dir = "account" subsystem_name = "account" part_name = "os_account" } config("accountmgr_config") { include_dirs = [ "./include", "./include/ability_manager_adapter", "./include/appaccount", "./include/osaccount", "${innerkits_path}/include", "${os_account_dfx_path}/hidumper_adapter", "${app_account_interfaces_native_path}/include", "${os_account_dfx_path}/hisysevent_adapter", "${os_account_dfx_path}/hitrace_adapter", "${app_account_innerkits_native_path}/include", ] if (ohos_indep_compiler_enable) { include_dirs += [ "${binarys_path}/foundation/bundlemanager/bundle_framework/innerapis/appexecfwk_core/includes/app_control", "${binarys_path}/third_party/jsoncpp/innerapis/jsoncpp/includes", "${binarys_path}/base/useriam/user_auth_framework/innerapis/userauth_client/includes", ] } } config("account_iam_config") { include_dirs = [ "${account_iam_interfaces_native_path}/include" ] } config("domain_account_config") { include_dirs = [ "include/domain_account", "${domain_account_framework_path}/include", "${domain_account_interfaces_native_path}/include", ] } config("ability_manager_config") { include_dirs = [ "${ability_runtime_path}/interfaces/inner_api/ability_manager/include", "${ability_runtime_path}/ability_base/interfaces/inner_api/want/include", "${ability_runtime_path}/services/abilitymgr/include", "${ability_runtime_path}/services/common/include", ] } config("accountmgr_public_config") { visibility = [ ":*" ] include_dirs = [ "${services_path}/accountmgr/include", "${services_path}/accountmgr/include/appaccount", "${services_path}/accountmgr/include/osaccount", "${services_path}/accountmgr/include/domain_account", ] if (has_user_auth_part) { include_dirs += [ "${services_path}/accountmgr/include/account_iam" ] } } config("bundle_manager_config") { include_dirs = [ "${services_path}/accountmgr/include/bundle_manager_adapter" ] } ability_manager_sources = [ "src/ability_manager_adapter/ability_manager_adapter.cpp" ] if (has_kv_store_part) { app_account_sources = [ "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp", "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp", "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp", "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_service.cpp", "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp", "${app_account_innerkits_native_path}/src/app_account_common.cpp", "${app_account_innerkits_native_path}/src/app_account_info.cpp", "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp", "src/appaccount/app_account_app_state_observer.cpp", "src/appaccount/app_account_authenticator_callback.cpp", "src/appaccount/app_account_authenticator_manager.cpp", "src/appaccount/app_account_authenticator_proxy.cpp", "src/appaccount/app_account_authenticator_session.cpp", "src/appaccount/app_account_authenticator_session_manager.cpp", "src/appaccount/app_account_authorization_extension_proxy.cpp", "src/appaccount/app_account_check_labels_callback.cpp", "src/appaccount/app_account_check_labels_session.cpp", "src/appaccount/app_account_common_event_observer.cpp", "src/appaccount/app_account_common_event_subscriber.cpp", "src/appaccount/app_account_control_manager.cpp", "src/appaccount/app_account_data_storage.cpp", "src/appaccount/app_account_event_proxy.cpp", "src/appaccount/app_account_manager_service.cpp", "src/appaccount/app_account_stub.cpp", "src/appaccount/app_account_subscribe_death_recipient.cpp", "src/appaccount/app_account_subscribe_manager.cpp", "src/appaccount/inner_app_account_manager.cpp", ] } if (has_user_auth_part && !ohos_indep_compiler_enable) { account_iam_sources = [ "src/account_iam/account_iam_callback.cpp", "src/account_iam/account_iam_client_callback_proxy.cpp", "src/account_iam/account_iam_mgr_stub.cpp", "src/account_iam/account_iam_service.cpp", "src/account_iam/inner_account_iam_manager.cpp", ] } bundle_manager_sources = [ "src/bundle_manager_adapter/bundle_manager_adapter.cpp", "src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp", "src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp", ] ohos_shared_library("accountmgr") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "./account_cfi_blocklist.txt" } visibility = [ "${os_account_path}/*" ] cflags = [ "-pipe" ] if (!use_clang_coverage) { version_script = "libaccountmgr.map" } cflags_cc = [ "-Wdate-time", "-Wformat=2", "-Wfloat-equal", "-Wshadow", ] if (os_account_multiple_active_accounts) { cflags += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ] } if (os_account_support_deactivate_main_os_account) { cflags += [ "-DSUPPORT_STOP_MAIN_OS_ACCOUNT" ] } if (os_account_distributed_feature) { cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] } if (os_account_enable_multiple_os_accounts || use_clang_coverage) { cflags += [ "-DENABLE_MULTIPLE_OS_ACCOUNTS" ] } if (os_account_enable_default_admin_name) { cflags += [ "-DENABLE_DEFAULT_ADMIN_NAME" ] } if (os_account_enable_account_short_name) { cflags += [ "-DENABLE_ACCOUNT_SHORT_NAME" ] } if (os_account_activate_last_logged_in_account) { cflags += [ "-DACTIVATE_LAST_LOGGED_IN_ACCOUNT" ] } sources = [ "${common_path}/utils/src/account_permission_manager.cpp", "${domain_account_framework_path}/src/domain_account_callback_proxy.cpp", "${domain_account_framework_path}/src/domain_account_callback_service.cpp", "${domain_account_framework_path}/src/domain_account_callback_stub.cpp", "${domain_account_framework_path}/src/domain_account_common.cpp", "${innerkits_native_path}/src/account_info_parcel.cpp", "${os_account_core_path}/src/os_account_event_proxy.cpp", "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", ] sources += account_service_sources sources += ability_manager_sources sources += bundle_manager_sources defines = [ "ACCOUNT_LOG_TAG = \"AccountMgrService\"", "LOG_DOMAIN = 0xD001B00", ] if (target_cpu == "arm64") { defines += [ "_ARM64_" ] } configs = [ ":accountmgr_config", ":bundle_manager_config", ":domain_account_config", ] public_configs = [ ":accountmgr_public_config", ":domain_account_config", ] use_exceptions = true deps = [ "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "${os_account_innerkits_native_path}:os_account_innerkits", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:ability_connect_callback_stub", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", "json:nlohmann_json_static", "mbedtls:mbedtls_shared", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_huks_part) { external_deps += [ "huks:libhukssdk" ] cflags_cc += [ "-DHAS_HUKS_PART" ] } if (ohos_indep_compiler_enable) { external_deps += [ "ability_base:session_info", "ability_runtime:ability_connect_callback_stub", ] } if (has_theme_mar_part) { external_deps += [ "theme_mgr:theme_manager_client" ] cflags_cc += [ "-DHAS_THEME_SERVICE_PART" ] } configs += [ ":account_iam_config" ] if (has_user_auth_part && !ohos_indep_compiler_enable) { cflags_cc += [ "-DHAS_USER_AUTH_PART", "-DHAS_USER_IDM_PART", ] sources += account_iam_sources external_deps += [ "access_token:libtokensetproc_shared", "user_auth_framework:userauth_client", ] } if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_kv_store_part) { cflags_cc += [ "-DHAS_APP_ACCOUNT_PART", "-DHAS_KV_STORE_PART", ] sources += app_account_sources sources += [ "src/account_data_storage.cpp", "src/osaccount/os_account_data_storage.cpp", "src/osaccount/os_account_database_operator.cpp", ] external_deps += [ "kv_store:distributeddata_inner" ] } if (has_storage_service_part) { cflags += [ "-DHAS_STORAGE_PART" ] external_deps += [ "storage_service:storage_manager_sa_proxy" ] } if (build_selinux) { external_deps += [ "selinux_adapter:librestorecon" ] cflags += [ "-DWITH_SELINUX" ] } if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } if (has_hiviewdfx_hisysevent_part) { cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] external_deps += [ "hisysevent:libhisysevent" ] } if (use_musl) { cflags_cc += [ "-DUSE_MUSL" ] } if (hicollie_enable == true) { external_deps += [ "hicollie:libhicollie" ] cflags_cc += [ "-DHICOLLIE_ENABLE" ] } if (security_guard_enabled && !ohos_indep_compiler_enable) { external_deps += [ "security_guard:libsg_collect_sdk", "time_service:time_client", ] cflags_cc += [ "-DSECURITY_GUARDE_ENABLE" ] } if (has_hiviewdfx_hitrace_part) { external_deps += [ "hitrace:hitrace_meter" ] cflags_cc += [ "-DHAS_HITRACE_PART" ] } if (has_asset_part) { external_deps += [ "asset:asset_sdk" ] cflags_cc += [ "-DHAS_ASSET_PART" ] } if (has_config_policy_part && !ohos_indep_compiler_enable) { external_deps += [ "config_policy:configpolicy_util" ] cflags_cc += [ "-DHAS_CONFIG_POLICY_PART" ] } if (build_variant == "user") { cflags_cc += [ "-DIS_RELEASE_VERSION" ] } if (use_clang_coverage) { cflags_cc += [ "-DACCOUNT_COVERAGE_TEST" ] } if (!use_clang_coverage) { shlib_type = "sa" } subsystem_name = "account" part_name = "os_account" } group("accountmgr_target") { deps = [ ":accountmgr", ":accountmgr.init", ":constraints_list_collection", ":os_account_config", ":osaccount_constraint", ] }