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("//foundation/ability/ability_runtime/ability_runtime.gni") 16 17config("upms_config") { 18 visibility = [ ":*" ] 19 visibility += [ "${ability_runtime_test_path}/unittest/*" ] 20 include_dirs = [ 21 "include", 22 "${ability_runtime_utils_path}/global/constant", 23 ] 24 cflags = [] 25 if (target_cpu == "arm") { 26 cflags += [ "-DBINDER_IPC_32BIT" ] 27 } 28} 29 30libupms_sources = [ 31 "src/batch_uri.cpp", 32 "src/file_permission_manager.cpp", 33 "src/tokenid_permission.cpp", 34 "src/uri_permission_manager_service.cpp", 35 "src/uri_permission_manager_stub_impl.cpp", 36 "src/uri_permission_utils.cpp", 37] 38 39#build so 40ohos_shared_library("libupms") { 41 sanitize = { 42 cfi = true 43 cfi_cross_dso = true 44 debug = false 45 } 46 branch_protector_ret = "pac_ret" 47 shlib_type = "sa" 48 configs = [ 49 "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config", 50 "${ability_runtime_services_path}/common:common_config", 51 "${ability_runtime_services_path}/abilitymgr:abilityms_config", 52 ] 53 public_configs = [ ":upms_config" ] 54 55 include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ] 56 57 sources = libupms_sources 58 59 deps = [ 60 "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", 61 "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", 62 "${ability_runtime_native_path}/appkit:appkit_manager_helper", 63 "${ability_runtime_services_path}/common:app_util", 64 "${ability_runtime_services_path}/common:event_report", 65 "${ability_runtime_services_path}/common:perm_verification", 66 ] 67 68 external_deps = [ 69 "ability_base:configuration", 70 "ability_base:want", 71 "ability_base:zuri", 72 "access_token:libaccesstoken_sdk", 73 "access_token:libtokenid_sdk", 74 "app_file_service:fileuri_native", 75 "background_task_mgr:bgtaskmgr_innerkits", 76 "bundle_framework:appexecfwk_base", 77 "bundle_framework:appexecfwk_core", 78 "c_utils:utils", 79 "common_event_service:cesfwk_core", 80 "common_event_service:cesfwk_innerkits", 81 "data_share:datashare_consumer", 82 "eventhandler:libeventhandler", 83 "graphic_2d:color_manager", 84 "hilog:libhilog", 85 "hisysevent:libhisysevent", 86 "hitrace:hitrace_meter", 87 "init:libbeget_proxy", 88 "init:libbegetutil", 89 "ipc:ipc_core", 90 "relational_store:native_dataability", 91 "relational_store:native_rdb", 92 "safwk:system_ability_fwk", 93 "samgr:samgr_proxy", 94 "storage_service:storage_manager_sa_proxy", 95 ] 96 97 defines = [] 98 if (ability_runtime_feature_sandboxmanager) { 99 external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ] 100 defines += [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ] 101 } 102 if (ability_runtime_graphics) { 103 external_deps += [ "i18n:intl_util" ] 104 } 105 106 if (ability_runtime_media_library_enable) { 107 sources += [ "src/media_permission_manager.cpp" ] 108 external_deps += [ "media_library:media_library_extend_manager" ] 109 defines += [ "ABILITY_RUNTIME_MEDIA_LIBRARY_ENABLE" ] 110 } 111 112 subsystem_name = "ability" 113 part_name = "ability_runtime" 114} 115 116# Note: Just for test 117ohos_static_library("libupms_static") { 118 sanitize = { 119 cfi = true 120 cfi_cross_dso = true 121 debug = false 122 blocklist = "../../test/cfi_blocklist.txt" 123 } 124 branch_protector_ret = "pac_ret" 125 configs = [ 126 "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config", 127 "${ability_runtime_services_path}/common:common_config", 128 ] 129 public_configs = [ ":upms_config" ] 130 131 include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ] 132 133 sources = libupms_sources 134 135 deps = [ 136 "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", 137 "${ability_runtime_services_path}/common:app_util", 138 "${ability_runtime_services_path}/common:perm_verification", 139 ] 140 141 external_deps = [ 142 "ability_base:configuration", 143 "ability_base:want", 144 "ability_base:zuri", 145 "access_token:libaccesstoken_sdk", 146 "app_file_service:fileuri_native", 147 "bundle_framework:appexecfwk_base", 148 "bundle_framework:appexecfwk_core", 149 "c_utils:utils", 150 "common_event_service:cesfwk_core", 151 "common_event_service:cesfwk_innerkits", 152 "data_share:datashare_consumer", 153 "hilog:libhilog", 154 "hisysevent:libhisysevent", 155 "hitrace:hitrace_meter", 156 "init:libbeget_proxy", 157 "init:libbegetutil", 158 "ipc:ipc_core", 159 "safwk:system_ability_fwk", 160 "samgr:samgr_proxy", 161 "storage_service:storage_manager_sa_proxy", 162 ] 163 if (ability_runtime_upms) { 164 deps += [ 165 "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", 166 ] 167 } 168 169 defines = [] 170 171 if (ability_runtime_feature_sandboxmanager) { 172 external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ] 173 defines += [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ] 174 } 175 176 if (ability_runtime_media_library_enable) { 177 sources += [ "src/media_permission_manager.cpp" ] 178 external_deps += [ "media_library:media_library_extend_manager" ] 179 defines += [ "ABILITY_RUNTIME_MEDIA_LIBRARY_ENABLE" ] 180 } 181 182 subsystem_name = "ability" 183 part_name = "ability_runtime" 184} 185