1# Copyright (c) 2021-2022 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("//base/account/os_account/os_account.gni") 15import("//build/ohos.gni") 16 17ohos_prebuilt_etc("accountmgr.init") { 18 source = "accountmgr.cfg" 19 relative_install_dir = "init" 20 part_name = "os_account" 21} 22 23ohos_prebuilt_etc("osaccount_constraint") { 24 source = "osaccount_constraints.json" 25 relative_install_dir = "account" 26 part_name = "os_account" 27} 28 29ohos_prebuilt_etc("constraints_list_collection") { 30 source = "constraints_list_collection.json" 31 relative_install_dir = "account" 32 part_name = "os_account" 33} 34 35config("accountmgr_config") { 36 include_dirs = [ 37 "./include", 38 "./include/ability_manager_adapter", 39 "./include/appaccount", 40 "./include/osaccount", 41 "${common_path}/log/include", 42 "${common_path}/perf_stat/include", 43 "${common_path}/account_error/include", 44 "${innerkits_path}/include", 45 "${os_account_dfx_path}/hidumper_adapter", 46 "${os_account_dfx_path}/hisysevent_adapter", 47 "${app_account_innerkits_native_path}/include", 48 "//third_party/json/include", 49 "//third_party/mbedtls/include", 50 "//commonlibrary/c_utils/base/include", 51 "//utils/system/safwk/native/include", 52 ] 53 54 if (has_storage_service_part) { 55 include_dirs += [ 56 "//foundation/storage/storage_manager/interfaces/innerkits/storage_manager/native", 57 "//foundation/filemanagement/storage_service/services/storage_manager/include/ipc", 58 "//foundation/storage/storage_manager/services/storage_manager/include/ipc", 59 ] 60 } 61} 62 63config("account_iam_config") { 64 include_dirs = [ 65 "${account_iam_interfaces_native_path}/include", 66 "//base/useriam/user_auth_framework/interfaces/inner_api", 67 ] 68} 69 70config("domain_account_config") { 71 include_dirs = [ 72 "include/domain_account", 73 "${domain_account_framework_path}/include", 74 "${domain_account_interfaces_native_path}/include", 75 ] 76} 77 78config("ability_manager_config") { 79 include_dirs = [ 80 "${ability_runtime_path}/interfaces/inner_api/ability_manager/include", 81 "${ability_runtime_path}/ability_base/interfaces/inner_api/want/include", 82 "${ability_runtime_path}/services/abilitymgr/include", 83 "${ability_runtime_path}/services/common/include", 84 ] 85} 86 87config("accountmgr_public_config") { 88 visibility = [ ":*" ] 89 90 include_dirs = [ 91 "${services_path}/accountmgr/include", 92 "${services_path}/accountmgr/include/appaccount", 93 "${services_path}/accountmgr/include/osaccount", 94 "${services_path}/accountmgr/include/domain_account", 95 ] 96 97 if (has_user_auth_part) { 98 include_dirs += [ "${services_path}/accountmgr/include/account_iam" ] 99 } 100} 101 102ability_manager_sources = [ 103 "${ability_runtime_path}/services/abilitymgr/src/ability_connect_callback_stub.cpp", 104 "${ability_runtime_path}/services/abilitymgr/src/stop_user_callback_stub.cpp", 105 "src/ability_manager_adapter/ability_manager_adapter.cpp", 106] 107 108config("bundle_manager_config") { 109 include_dirs = [ 110 "${services_path}/accountmgr/include/bundle_manager_adapter", 111 "${bundle_framework_path}/common/log/include", 112 "${bundle_framework_path}/interfaces/inner_api/appexecfwk_core/include/bundlemgr", 113 ] 114} 115 116bundle_manager_sources = [ 117 "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp", 118 "src/bundle_manager_adapter/bundle_manager_adapter.cpp", 119 "src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp", 120 "src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp", 121] 122 123group("accountmgr_target") { 124 deps = [ 125 ":accountmgr", 126 ":accountmgr.init", 127 ":constraints_list_collection", 128 ":osaccount_constraint", 129 ] 130} 131 132ohos_shared_library("accountmgr") { 133 visibility = [ "${os_account_path}/*" ] 134 135 cflags = [ "-pipe" ] 136 version_script = "libaccountmgr.map" 137 cflags_cc = [ 138 "-Wdate-time", 139 "-Wformat=2", 140 "-Wfloat-equal", 141 "-Wshadow", 142 ] 143 if (os_account_multiple_active_accounts) { 144 cflags += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ] 145 } 146 147 if (os_account_distributed_feature) { 148 cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] 149 } 150 151 sources = [ 152 "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp", 153 "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp", 154 "${app_account_innerkits_native_path}/src/app_account_common.cpp", 155 "${app_account_innerkits_native_path}/src/app_account_info.cpp", 156 "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp", 157 "${domain_account_framework_path}/src/domain_auth_callback_proxy.cpp", 158 "${domain_account_framework_path}/src/domain_auth_callback_service.cpp", 159 "${domain_account_framework_path}/src/domain_auth_callback_stub.cpp", 160 "${innerkits_native_path}/src/account_info_parcel.cpp", 161 "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", 162 "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp", 163 "src/account_data_storage.cpp", 164 "src/account_event_provider.cpp", 165 "src/account_helper_data.cpp", 166 "src/account_mgr_service.cpp", 167 "src/account_permission_manager.cpp", 168 "src/account_state_machine.cpp", 169 "src/account_stub.cpp", 170 "src/appaccount/app_account_app_state_observer.cpp", 171 "src/appaccount/app_account_authenticator_callback.cpp", 172 "src/appaccount/app_account_authenticator_manager.cpp", 173 "src/appaccount/app_account_authenticator_proxy.cpp", 174 "src/appaccount/app_account_authenticator_session.cpp", 175 "src/appaccount/app_account_authenticator_session_manager.cpp", 176 "src/appaccount/app_account_check_labels_callback.cpp", 177 "src/appaccount/app_account_check_labels_session.cpp", 178 "src/appaccount/app_account_common_event_observer.cpp", 179 "src/appaccount/app_account_common_event_subscriber.cpp", 180 "src/appaccount/app_account_control_manager.cpp", 181 "src/appaccount/app_account_data_storage.cpp", 182 "src/appaccount/app_account_event_proxy.cpp", 183 "src/appaccount/app_account_manager_service.cpp", 184 "src/appaccount/app_account_stub.cpp", 185 "src/appaccount/app_account_subscribe_death_recipient.cpp", 186 "src/appaccount/app_account_subscribe_manager.cpp", 187 "src/appaccount/inner_app_account_manager.cpp", 188 "src/domain_account/domain_account_manager_service.cpp", 189 "src/domain_account/domain_account_plugin_death_recipient.cpp", 190 "src/domain_account/domain_account_plugin_proxy.cpp", 191 "src/domain_account/domain_account_stub.cpp", 192 "src/domain_account/inner_domain_account_manager.cpp", 193 "src/ohos_account_data_deal.cpp", 194 "src/ohos_account_manager.cpp", 195 "src/osaccount/inner_os_account_manager.cpp", 196 "src/osaccount/os_account_control_file_manager.cpp", 197 "src/osaccount/os_account_data_storage.cpp", 198 "src/osaccount/os_account_database_operator.cpp", 199 "src/osaccount/os_account_delete_user_idm_callback.cpp", 200 "src/osaccount/os_account_file_operator.cpp", 201 "src/osaccount/os_account_interface.cpp", 202 "src/osaccount/os_account_manager_service.cpp", 203 "src/osaccount/os_account_photo_operator.cpp", 204 "src/osaccount/os_account_stop_user_callback.cpp", 205 "src/osaccount/os_account_subscribe_death_recipient.cpp", 206 "src/osaccount/os_account_subscribe_manager.cpp", 207 ] 208 209 sources += ability_manager_sources 210 sources += bundle_manager_sources 211 212 if (has_user_auth_part) { 213 sources += [ 214 "src/account_iam/account_iam_callback.cpp", 215 "src/account_iam/account_iam_client_callback_proxy.cpp", 216 "src/account_iam/account_iam_mgr_stub.cpp", 217 "src/account_iam/account_iam_service.cpp", 218 "src/account_iam/inner_account_iam_manager.cpp", 219 ] 220 } 221 222 defines = [ 223 "ACCOUNT_LOG_TAG = \"AccountMgrService\"", 224 "LOG_DOMAIN = 0xD001B00", 225 ] 226 227 configs = [ 228 ":accountmgr_config", 229 ":ability_manager_config", 230 ":bundle_manager_config", 231 ":domain_account_config", 232 "${account_coverage_config_path}:coverage_flags", 233 ] 234 235 if (has_user_auth_part) { 236 configs += [ ":account_iam_config" ] 237 } 238 239 public_configs = [ 240 ":accountmgr_public_config", 241 ":domain_account_config", 242 ] 243 244 use_exceptions = true 245 246 deps = [ 247 "${common_path}:libaccount_common", 248 "${os_account_core_path}:os_account_core", 249 "${os_account_innerkits_native_path}:os_account_innerkits", 250 "//third_party/mbedtls:mbedtls", 251 ] 252 253 if (has_user_auth_part) { 254 cflags_cc += [ 255 "-DHAS_USER_AUTH_PART", 256 "-DHAS_USER_IDM_PART", 257 ] 258 deps += [ 259 "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", 260 "//base/useriam/user_auth_framework/frameworks/native/client:userauth_client", 261 "//base/useriam/user_auth_framework/frameworks/native/ipc:userauth_client_ipc", 262 ] 263 } 264 265 external_deps = [ 266 "ability_base:want", 267 "ability_runtime:app_manager", 268 "ability_runtime:wantagent_innerkits", 269 "access_token:libaccesstoken_sdk", 270 "bundle_framework:appexecfwk_base", 271 "c_utils:utils", 272 "eventhandler:libeventhandler", 273 "hiviewdfx_hilog_native:libhilog", 274 "init:libbegetutil", 275 "ipc:ipc_core", 276 "kv_store:distributeddata_inner", 277 "safwk:system_ability_fwk", 278 "samgr:samgr_proxy", 279 ] 280 281 if (has_storage_service_part && os_account_storage_feature) { 282 cflags += [ "-DHAS_STORAGE_PART" ] 283 external_deps += [ "storage_service:storage_manager_sa_proxy" ] 284 } 285 286 if (build_selinux) { 287 external_deps += [ "selinux:librestorecon" ] 288 cflags += [ "-DWITH_SELINUX" ] 289 } 290 291 if (has_ces_part) { 292 cflags_cc += [ "-DHAS_CES_PART" ] 293 external_deps += [ "common_event_service:cesfwk_innerkits" ] 294 } 295 296 if (has_hiviewdfx_hisysevent_part) { 297 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 298 external_deps += [ "hisysevent_native:libhisysevent" ] 299 } 300 301 if (use_musl) { 302 cflags_cc += [ "-DUSE_MUSL" ] 303 } 304 305 external_deps += [ "hitrace_native:hitrace_meter" ] 306 307 part_name = "os_account" 308} 309