# Copyright (c) 2021-2022 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("//build/ohos/sa_profile/sa_profile.gni") import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni") config("storage_manager_config") { include_dirs = [ "include", "../../interfaces/innerkits/storage_manager/native", "../storage_daemon/include", "../common/include", ] cflags = [ "-D_FORTIFY_SOURCE=2", "-fstack-protector-strong", ] } ohos_shared_library("storage_manager") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true ubsan = true boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false } sources = [ "ipc/src/storage_manager.cpp", "ipc/src/storage_manager_stub.cpp", "storage_daemon_communication/src/storage_daemon_communication.cpp", "user/src/multi_user_manager_service.cpp", "utils/src/storage_utils.cpp", ] defines = [ "STORAGE_LOG_TAG = \"StorageManager\"", "LOG_DOMAIN = 0xD004300", ] if (storage_service_user_crypto_manager) { defines += [ "USER_CRYPTO_MANAGER" ] sources += [ "crypto/filesystem_crypto.cpp" ] } if (storage_service_external_storage_manager) { defines += [ "EXTERNAL_STORAGE_MANAGER" ] sources += [ "disk/src/disk_manager_service.cpp", "volume/src/notification.cpp", "volume/src/volume_manager_service.cpp", ] } configs = [ ":storage_manager_config" ] deps = [ "${storage_daemon_path}:storage_common_utils", "${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:extensionkit_native", "access_token:libaccesstoken_sdk", "cJSON:cjson", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (storage_service_storage_statistics_manager) { defines += [ "STORAGE_STATISTICS_MANAGER" ] sources += [ "account_subscriber/account_subscriber.cpp", "storage/src/bundle_manager_connector.cpp", "storage/src/storage_monitor_service.cpp", "storage/src/storage_status_service.cpp", "storage/src/storage_total_status_service.cpp", "storage/src/volume_storage_status_service.cpp", ] external_deps += [ "ability_runtime:abilitykit_native", "ability_runtime:dataobs_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "data_share:datashare_consumer", "eventhandler:libeventhandler", "init:libbegetutil", "relational_store:native_rdb", ] deps += [ ":storage_manager_monitor_config" ] if (storage_service_graphic) { defines += [ "STORAGE_SERVICE_GRAPHIC" ] external_deps += [ "data_share:datashare_common" ] } } if (enable_screenlock_manager) { defines += [ "ENABLE_SCREENLOCK_MANAGER" ] external_deps += [ "screenlock_mgr:screenlock_client" ] } subsystem_name = "filemanagement" part_name = "storage_service" install_enable = true } ohos_prebuilt_etc("storage_manager_config.para") { source = "storage_manager_config.para" part_name = "storage_service" subsystem_name = "filemanagement" module_install_dir = "etc/param" } ohos_prebuilt_etc("storage_manager_config.para.dac") { source = "storage_manager_config.para.dac" part_name = "storage_service" subsystem_name = "filemanagement" module_install_dir = "etc/param" } group("storage_manager_monitor_config") { deps = [ ":storage_manager_config.para", ":storage_manager_config.para.dac", ] } group("storage_manager_unit_test") { testonly = true deps = [ "client/test:storage_manager_client_test", "innerkits_impl/test:storage_manager_innerkits_test", "ipc/test:storage_manager_ipc_test", "storage_daemon_communication/test:storage_manager_communication_test", "user/test:storage_manager_user_test", ] if (storage_service_user_crypto_manager) { deps += [ "crypto/test:storage_manager_crypto_test" ] } if (storage_service_storage_statistics_manager) { deps += [ "storage/test:storage_manager_storage_test" ] } if (storage_service_external_storage_manager) { deps += [ "disk/test:storage_manager_disk_test", "volume/test:storage_manager_volume_test", ] } }