1# Copyright (c) 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("../../../dlp_permission_service.gni") 16 17ohos_prebuilt_etc("dlp_permission_service.rc") { 18 source = "dlp_permission_service.cfg" 19 relative_install_dir = "init" 20 subsystem_name = "security" 21 part_name = "dlp_permission_service" 22} 23 24ohos_static_library("dlp_hex_string_static") { 25 branch_protector_ret = "pac_ret" 26 27 sanitize = { 28 cfi = true 29 cfi_cross_dso = true 30 debug = false 31 } 32 33 subsystem_name = "security" 34 part_name = "dlp_permission_service" 35 36 include_dirs = [ 37 "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include", 38 "${dlp_root_dir}/frameworks/common/include", 39 ] 40 41 sources = [ "${dlp_root_dir}/frameworks/common/src/hex_string.cpp" ] 42 43 configs = [ "${dlp_root_dir}/config:coverage_flags" ] 44 45 cflags_cc = [ "-DHILOG_ENABLE" ] 46 47 external_deps = [ "hilog:libhilog" ] 48} 49 50ohos_static_library("dlp_permission_serializer_static") { 51 branch_protector_ret = "pac_ret" 52 53 sanitize = { 54 cfi = true 55 cfi_cross_dso = true 56 debug = false 57 } 58 59 subsystem_name = "security" 60 part_name = "dlp_permission_service" 61 62 include_dirs = [ 63 "sa_common", 64 "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include", 65 "${dlp_root_dir}/frameworks/common/include", 66 "${dlp_root_dir}/frameworks/dlp_permission/include", 67 ] 68 69 sources = [ "sa_common/dlp_permission_serializer.cpp" ] 70 71 cflags_cc = [ "-DHILOG_ENABLE" ] 72 73 configs = [ "${dlp_root_dir}/config:coverage_flags" ] 74 75 deps = [ ":dlp_hex_string_static" ] 76 77 external_deps = [ 78 "c_utils:utils", 79 "hilog:libhilog", 80 "json:nlohmann_json_static", 81 ] 82 83 if (dlp_credential_enable == true) { 84 external_deps += [ "dlp_credential_service:dlp_credential_sdk" ] 85 } else { 86 include_dirs += [ "mock" ] 87 } 88} 89 90ohos_shared_library("dlp_permission_service") { 91 branch_protector_ret = "pac_ret" 92 93 sanitize = { 94 cfi = true 95 cfi_cross_dso = true 96 debug = false 97 } 98 99 subsystem_name = "security" 100 part_name = "dlp_permission_service" 101 102 include_dirs = [ 103 "adapt", 104 "callback/dlp_sandbox_change_callback", 105 "callback/open_dlp_file_callback", 106 "sa_main", 107 "sa_common", 108 "storage/include", 109 "${dlp_root_dir}/frameworks/common/include", 110 "${dlp_root_dir}/frameworks/dlp_permission/include", 111 "${dlp_root_dir}/interfaces/inner_api/dlp_parse/include", 112 "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include", 113 ] 114 115 sources = [ 116 "${dlp_root_dir}/frameworks/common/src/cert_parcel.cpp", 117 "${dlp_root_dir}/frameworks/common/src/permission_policy.cpp", 118 "${dlp_root_dir}/frameworks/common/src/retention_sandbox_info.cpp", 119 "${dlp_root_dir}/frameworks/common/src/visited_dlp_file_info.cpp", 120 "${dlp_root_dir}/frameworks/dlp_permission/src/auth_user_info_parcel.cpp", 121 "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_permission_info_parcel.cpp", 122 "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_policy_parcel.cpp", 123 "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_sandbox_callback_info_parcel.cpp", 124 "${dlp_root_dir}/frameworks/dlp_permission/src/open_dlp_file_callback_info_parcel.cpp", 125 "adapt/account_adapt.cpp", 126 "adapt/app_state_observer.cpp", 127 "adapt/app_uninstall_observer.cpp", 128 "adapt/file_operator.cpp", 129 "adapt/retention_file_manager.cpp", 130 "adapt/sandbox_json_manager.cpp", 131 "adapt/visit_record_file_manager.cpp", 132 "adapt/visit_record_json_manager.cpp", 133 "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_death_recipient.cpp", 134 "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_manager.cpp", 135 "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_proxy.cpp", 136 "callback/open_dlp_file_callback/open_dlp_file_callback_death_recipient.cpp", 137 "callback/open_dlp_file_callback/open_dlp_file_callback_manager.cpp", 138 "callback/open_dlp_file_callback/open_dlp_file_callback_proxy.cpp", 139 "sa_common/bundle_manager_adapter.cpp", 140 "sa_main/dlp_credential.cpp", 141 "sa_main/dlp_permission_async_proxy.cpp", 142 "sa_main/dlp_permission_service.cpp", 143 "sa_main/dlp_permission_stub.cpp", 144 "storage/src/dlp_kv_data_storage.cpp", 145 "storage/src/sandbox_config_kv_data_storage.cpp", 146 ] 147 148 cflags_cc = [ "-DHILOG_ENABLE" ] 149 cflags = [ "-DHILOG_ENABLE" ] 150 151 if (build_variant == "user") { 152 cflags_cc += [ "-DDLP_DEBUG_ENABLE=0" ] 153 cflags += [ "-DDLP_DEBUG_ENABLE=0" ] 154 } else if (build_variant == "root") { 155 cflags_cc += [ "-DDLP_DEBUG_ENABLE=1" ] 156 cflags += [ "-DDLP_DEBUG_ENABLE=1" ] 157 } else { 158 cflags_cc += [ "-DDLP_DEBUG_ENABLE=1" ] 159 cflags += [ "-DDLP_DEBUG_ENABLE=1" ] 160 } 161 162 if (dlp_permission_service_gathering_policy) { 163 cflags_cc += [ "-DDLP_GATHERING_SANDBOX" ] 164 cflags += [ "-DDLP_GATHERING_SANDBOX" ] 165 } 166 167 deps = [ 168 ":dlp_hex_string_static", 169 ":dlp_permission_serializer_static", 170 ":dlp_permission_service.rc", 171 ] 172 173 deps += [ "etc:param_files" ] 174 175 configs = [ "${dlp_root_dir}/config:coverage_flags" ] 176 177 external_deps = [ 178 "ability_base:want", 179 "ability_runtime:app_manager", 180 "access_token:libaccesstoken_sdk", 181 "bundle_framework:appexecfwk_base", 182 "bundle_framework:appexecfwk_core", 183 "c_utils:utils", 184 "common_event_service:cesfwk_core", 185 "common_event_service:cesfwk_innerkits", 186 "config_policy:configpolicy_util", 187 "hilog:libhilog", 188 "hisysevent:libhisysevent", 189 "init:libbegetutil", 190 "ipc:ipc_core", 191 "json:nlohmann_json_static", 192 "kv_store:distributeddata_inner", 193 "os_account:libaccountkits", 194 "os_account:os_account_innerkits", 195 "safwk:system_ability_fwk", 196 "samgr:samgr_proxy", 197 ] 198 199 if (dlp_credential_enable == true) { 200 cflags_cc += [ "-DSUPPORT_DLP_CREDENTIAL" ] 201 external_deps += [ "dlp_credential_service:dlp_credential_sdk" ] 202 } else { 203 include_dirs += [ "mock" ] 204 sources += [ 205 "mock/dlp_credential_service.c", 206 "mock/mock_utils.cpp", 207 ] 208 } 209} 210