1# Copyright (c) 2022-2025 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/config/components/idl_tool/idl.gni") 15import("//build/ohos.gni") 16import("../../access_token.gni") 17 18idl_gen_interface("privacy_manager_interface") { 19 sources = [ "./idl/IPrivacyManager.idl" ] 20 log_domainid = "0xD005A02" 21 log_tag = "PRIVACY" 22 subsystem_name = "security" 23 part_name = "access_token" 24} 25 26config("privacy_manager_gen_config") { 27 include_dirs = [ "${target_gen_dir}" ] 28} 29 30ohos_source_set("privacy_manager_proxy") { 31 sanitize = { 32 cfi = true 33 cfi_cross_dso = true 34 debug = false 35 } 36 37 output_values = get_target_outputs(":privacy_manager_interface") 38 39 include_dirs = [ 40 "${access_token_path}/frameworks/privacy/include", 41 "${access_token_path}/frameworks/common/include", 42 "${access_token_path}/interfaces/innerkits/accesstoken/include", 43 "${access_token_path}/interfaces/innerkits/privacy/include", 44 "${access_token_path}/interfaces/innerkits/privacy/src", 45 "include", 46 "src", 47 ] 48 49 sources = filter_include(output_values, [ "*_proxy.cpp" ]) 50 51 deps = [ 52 ":privacy_manager_interface", 53 "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", 54 ] 55 56 external_deps = [ 57 "c_utils:utils", 58 "hilog:libhilog", 59 "ipc:ipc_single", 60 "samgr:samgr_proxy", 61 ] 62 63 cflags_cc = [] 64 65 subsystem_name = "security" 66 part_name = "access_token" 67} 68 69ohos_source_set("privacy_manager_stub") { 70 sanitize = { 71 cfi = true 72 cfi_cross_dso = true 73 debug = false 74 } 75 76 output_values = get_target_outputs(":privacy_manager_interface") 77 78 include_dirs = [ 79 "${access_token_path}/frameworks/privacy/include", 80 "${access_token_path}/frameworks/common/include", 81 "${access_token_path}/interfaces/innerkits/accesstoken/include", 82 "${access_token_path}/interfaces/innerkits/privacy/include", 83 "${access_token_path}/interfaces/innerkits/privacy/src", 84 "include", 85 "src", 86 ] 87 88 sources = filter_include(output_values, [ "*_stub.cpp" ]) 89 90 deps = [ 91 ":privacy_manager_interface", 92 "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", 93 ] 94 95 external_deps = [ 96 "c_utils:utils", 97 "hilog:libhilog", 98 "ipc:ipc_single", 99 "samgr:samgr_proxy", 100 ] 101 102 cflags_cc = [] 103 104 subsystem_name = "security" 105 part_name = "access_token" 106} 107 108ohos_prebuilt_etc("privacy.rc") { 109 source = "privacy.cfg" 110 relative_install_dir = "init" 111 subsystem_name = "security" 112 part_name = "access_token" 113} 114 115group("privacymanager") { 116 if (is_standard_system && ability_base_enable == true) { 117 deps = [ 118 "${access_token_path}/services/privacymanager:privacy_manager_service", 119 "${access_token_path}/services/privacymanager/sa_profile:privacy_sa_profile_standard", 120 ] 121 } 122} 123 124if (is_standard_system && ability_base_enable == true) { 125 ohos_shared_library("privacy_manager_service") { 126 subsystem_name = "security" 127 part_name = "access_token" 128 sanitize = { 129 cfi = true 130 cfi_cross_dso = true 131 debug = false 132 } 133 branch_protector_ret = "pac_ret" 134 135 if (!use_clang_coverage) { 136 version_script = "libprivacy_map" 137 shlib_type = "sa" 138 } 139 140 include_dirs = [ 141 "include/active", 142 "include/common", 143 "include/database", 144 "include/proxy", 145 "include/record", 146 "include/service", 147 "include/sensitive", 148 "include/sensitive/audio_manager/", 149 "include/sensitive/camera_manager/", 150 "${access_token_path}/frameworks/privacy/include", 151 "${access_token_path}/frameworks/common/include", 152 "${access_token_path}/interfaces/innerkits/accesstoken/include", 153 "${access_token_path}/interfaces/innerkits/privacy/include", 154 "${access_token_path}/interfaces/innerkits/privacy/src", 155 "${access_token_path}/services/common/app_manager/include", 156 "${access_token_path}/services/common/json_parse/include", 157 "${access_token_path}/services/common/database/include", 158 "${access_token_path}/services/common/dfx/include", 159 "${access_token_path}/services/common/handler/include", 160 "${access_token_path}/services/common/libraryloader/include", 161 "${access_token_path}/services/common/screenlock_manager/include", 162 "${access_token_path}/services/common/utils/include", 163 "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", 164 ] 165 166 sources = [ 167 "src/active/active_status_callback_manager.cpp", 168 "src/active/perm_active_status_callback_death_recipient.cpp", 169 "src/active/perm_active_status_change_callback_proxy.cpp", 170 "src/active/state_change_callback_proxy.cpp", 171 "src/common/access_token_helper.cpp", 172 "src/common/constant.cpp", 173 "src/database/data_translator.cpp", 174 "src/database/permission_used_record_db.cpp", 175 "src/database/privacy_field_const.cpp", 176 "src/proxy/privacy_manager_proxy_death_param.cpp", 177 "src/record/on_permission_used_record_callback_proxy.cpp", 178 "src/record/permission_record.cpp", 179 "src/record/permission_record_manager.cpp", 180 "src/record/permission_record_set.cpp", 181 "src/sensitive/audio_manager/audio_manager_adapter.cpp", 182 "src/sensitive/camera_manager/camera_manager_adapter.cpp", 183 "src/service/privacy_manager_service.cpp", 184 ] 185 186 cflags_cc = [ 187 "-DHILOG_ENABLE", 188 "-fvisibility=hidden", 189 ] 190 configs = [ 191 "${access_token_path}/config:access_token_compile_flags", 192 "${access_token_path}/config:coverage_flags", 193 "${access_token_path}/services/privacymanager:privacy_manager_gen_config", 194 ] 195 defines = [ "FEATURE_DTMF_TONE" ] 196 197 deps = [ 198 "${access_token_path}/frameworks/common:accesstoken_common_cxx", 199 "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", 200 "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 201 "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 202 "${access_token_path}/services/common:accesstoken_service_common", 203 "${access_token_path}/services/common/proxy_death:proxy_death_handler", 204 "${access_token_path}/services/privacymanager:privacy.rc", 205 "${access_token_path}/services/privacymanager:privacy_manager_stub", 206 ] 207 208 external_deps = [ 209 "ability_base:want", 210 "c_utils:utils", 211 "hilog:libhilog", 212 "hisysevent:libhisysevent", 213 "init:libbegetutil", 214 "ipc:ipc_single", 215 "safwk:system_ability_fwk", 216 "samgr:samgr_proxy", 217 "sqlite:sqlite", 218 ] 219 220 if (audio_framework_enable) { 221 cflags_cc += [ "-DAUDIO_FRAMEWORK_ENABLE" ] 222 external_deps += [ "audio_framework:audio_client" ] 223 } 224 225 if (camera_framework_enable) { 226 cflags_cc += [ "-DCAMERA_FRAMEWORK_ENABLE" ] 227 external_deps += [ "camera_framework:camera_framework" ] 228 } 229 230 if (ohos_indep_compiler_enable) { 231 external_deps += [ "bounds_checking_function:libsec_shared" ] 232 } 233 if (eventhandler_enable == true) { 234 cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 235 external_deps += [ "eventhandler:libeventhandler" ] 236 } 237 238 if (common_event_service_enable) { 239 cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 240 external_deps += [ "common_event_service:cesfwk_innerkits" ] 241 sources += [ "src/common/privacy_common_event_subscriber.cpp" ] 242 } 243 244 if (access_token_camera_float_window_enable) { 245 cflags_cc += [ "-DCAMERA_FLOAT_WINDOW_ENABLE" ] 246 } 247 if (access_token_app_security_privacy_service_enable) { 248 cflags_cc += [ "-DAPP_SECURITY_PRIVACY_SERVICE" ] 249 } else { 250 include_dirs += 251 [ "${access_token_path}/services/common/ability_manager/include" ] 252 } 253 } 254} 255