1# Copyright (c) 2022-2024 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("../../access_token.gni") 16 17ohos_prebuilt_etc("privacy.rc") { 18 source = "privacy.cfg" 19 relative_install_dir = "init" 20 subsystem_name = "security" 21 part_name = "access_token" 22} 23 24group("privacymanager") { 25 if (is_standard_system && ability_base_enable == true) { 26 deps = [ 27 "${access_token_path}/services/privacymanager:privacy_manager_service", 28 "${access_token_path}/services/privacymanager/sa_profile:privacy_sa_profile_standard", 29 ] 30 } 31} 32 33if (is_standard_system && ability_base_enable == true) { 34 ohos_shared_library("privacy_manager_service") { 35 subsystem_name = "security" 36 part_name = "access_token" 37 sanitize = { 38 cfi = true 39 cfi_cross_dso = true 40 debug = false 41 } 42 branch_protector_ret = "pac_ret" 43 44 if (!use_clang_coverage) { 45 version_script = "libprivacy_map" 46 shlib_type = "sa" 47 } 48 49 include_dirs = [ 50 "include/active", 51 "include/common", 52 "include/database", 53 "include/proxy", 54 "include/record", 55 "include/service", 56 "include/sensitive", 57 "include/sensitive/audio_manager/", 58 "include/sensitive/camera_manager/", 59 "${access_token_path}/frameworks/privacy/include", 60 "${access_token_path}/frameworks/common/include", 61 "${access_token_path}/interfaces/innerkits/accesstoken/include", 62 "${access_token_path}/interfaces/innerkits/privacy/include", 63 "${access_token_path}/interfaces/innerkits/privacy/src", 64 "${access_token_path}/services/common/app_manager/include", 65 "${access_token_path}/services/common/json_parse/include", 66 "${access_token_path}/services/common/database/include", 67 "${access_token_path}/services/common/handler/include", 68 "${access_token_path}/services/common/libraryloader/include", 69 "${access_token_path}/services/common/screenlock_manager/include", 70 "${access_token_path}/services/common/utils/include", 71 "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", 72 ] 73 74 sources = [ 75 "src/active/active_status_callback_manager.cpp", 76 "src/active/perm_active_status_callback_death_recipient.cpp", 77 "src/active/perm_active_status_change_callback_proxy.cpp", 78 "src/active/state_change_callback_proxy.cpp", 79 "src/common/constant.cpp", 80 "src/database/data_translator.cpp", 81 "src/database/permission_used_record_db.cpp", 82 "src/database/privacy_field_const.cpp", 83 "src/proxy/privacy_manager_proxy_death_param.cpp", 84 "src/record/on_permission_used_record_callback_proxy.cpp", 85 "src/record/permission_record.cpp", 86 "src/record/permission_record_manager.cpp", 87 "src/record/permission_record_set.cpp", 88 "src/sensitive/audio_manager/audio_manager_adapter.cpp", 89 "src/sensitive/camera_manager/camera_manager_adapter.cpp", 90 "src/service/privacy_manager_service.cpp", 91 "src/service/privacy_manager_stub.cpp", 92 ] 93 94 cflags_cc = [ 95 "-DHILOG_ENABLE", 96 "-fvisibility=hidden", 97 ] 98 configs = [ 99 "${access_token_path}/config:access_token_compile_flags", 100 "${access_token_path}/config:coverage_flags", 101 ] 102 defines = [ "FEATURE_DTMF_TONE" ] 103 104 deps = [ 105 "${access_token_path}/frameworks/common:accesstoken_common_cxx", 106 "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx", 107 "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", 108 "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", 109 "${access_token_path}/services/common:accesstoken_service_common", 110 "${access_token_path}/services/common/proxy_death:proxy_death_handler", 111 "${access_token_path}/services/privacymanager:privacy.rc", 112 ] 113 114 external_deps = [ 115 "ability_base:want", 116 "c_utils:utils", 117 "hilog:libhilog", 118 "hisysevent:libhisysevent", 119 "init:libbegetutil", 120 "ipc:ipc_single", 121 "safwk:system_ability_fwk", 122 "samgr:samgr_proxy", 123 "sqlite:sqlite", 124 ] 125 126 if (audio_framework_enable) { 127 cflags_cc += [ "-DAUDIO_FRAMEWORK_ENABLE" ] 128 external_deps += [ "audio_framework:audio_client" ] 129 } 130 131 if (camera_framework_enable) { 132 cflags_cc += [ "-DCAMERA_FRAMEWORK_ENABLE" ] 133 external_deps += [ "camera_framework:camera_framework" ] 134 } 135 136 if (ohos_indep_compiler_enable) { 137 external_deps += [ "bounds_checking_function:libsec_shared" ] 138 } 139 if (eventhandler_enable == true) { 140 cflags_cc += [ "-DEVENTHANDLER_ENABLE" ] 141 external_deps += [ "eventhandler:libeventhandler" ] 142 } 143 144 if (common_event_service_enable) { 145 cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ] 146 external_deps += [ "common_event_service:cesfwk_innerkits" ] 147 sources += [ "src/common/privacy_common_event_subscriber.cpp" ] 148 } 149 150 if (security_component_enhance_enable == true) { 151 cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] 152 include_dirs += [ "include/seccomp" ] 153 sources += [ "src/seccomp/privacy_sec_comp_enhance_agent.cpp" ] 154 } 155 156 if (window_manager_enable && access_token_camera_float_window_enable) { 157 cflags_cc += [ "-DCAMERA_FLOAT_WINDOW_ENABLE" ] 158 include_dirs += 159 [ "${access_token_path}/services/common/window_manager/include" ] 160 sources += [ 161 "${access_token_path}/services/common/window_manager/src/privacy_mock_session_manager_proxy.cpp", 162 "${access_token_path}/services/common/window_manager/src/privacy_scene_session_manager_lite_proxy.cpp", 163 "${access_token_path}/services/common/window_manager/src/privacy_scene_session_manager_proxy.cpp", 164 "${access_token_path}/services/common/window_manager/src/privacy_session_manager_proxy.cpp", 165 "${access_token_path}/services/common/window_manager/src/privacy_window_manager_agent.cpp", 166 "${access_token_path}/services/common/window_manager/src/privacy_window_manager_client.cpp", 167 "${access_token_path}/services/common/window_manager/src/privacy_window_manager_death_recipient.cpp", 168 "${access_token_path}/services/common/window_manager/src/privacy_window_manager_proxy.cpp", 169 ] 170 external_deps += [ "window_manager:libwsutils" ] 171 } 172 173 if (access_token_app_security_privacy_service_enable) { 174 cflags_cc += [ "-DAPP_SECURITY_PRIVACY_SERVICE" ] 175 } else { 176 include_dirs += 177 [ "${access_token_path}/services/common/ability_manager/include" ] 178 } 179 } 180} 181