1# Copyright (C) 2022-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("//build/ohos_var.gni") 16import("../nfc.gni") 17 18config("nfc_config") { 19 visibility = [ ":*" ] 20 21 defines = [ "DEBUG" ] 22 if (nfc_use_vendor_nci_native) { 23 defines += [ "USE_VENDOR_NCI_NATIVE" ] 24 } 25 26 if (nfc_service_feature_vendor_applications_enabled) { 27 defines += [ "VENDOR_APPLICATIONS_ENABLED" ] 28 } 29 30 if (nfc_sim_feature) { 31 defines += [ "NFC_SIM_FEATURE" ] 32 } 33 34 if (nfc_service_feature_ndef_wifi_enabled) { 35 defines += [ "NDEF_WIFI_ENABLED" ] 36 } 37 38 if (nfc_service_feature_ndef_bt_enabled) { 39 defines += [ "NDEF_BT_ENABLED" ] 40 } 41 42 if (nfc_vibrator_disabled) { 43 defines += [ "NFC_VIBRATOR_DISABLED" ] 44 } 45 46 if (nfc_handle_screen_lock) { 47 defines += [ "NFC_HANDLE_SCREEN_LOCK" ] 48 } 49 50 if (is_asan || use_clang_coverage) { 51 defines += [ "DTFUZZ_TEST" ] 52 } 53 54 include_dirs = [ 55 "include", 56 "src/ipc/controller", 57 "src/ipc/tags", 58 "src/ipc/card_emulation", 59 "src/nci_adapter", 60 "src/utils", 61 "src/card_emulation", 62 "src/external_deps", 63 "src/tag", 64 "$NFC_DIR/interfaces/inner_api/common", 65 ] 66} 67 68ohos_prebuilt_etc("nfc_prebuilt_config") { 69 source = "resources" 70 relative_install_dir = "nfc" 71 part_name = "nfc" 72 subsystem_name = "communication" 73} 74 75nfc_service_source = [ 76 "src/card_emulation/ce_service.cpp", 77 "src/card_emulation/host_card_emulation_manager.cpp", 78 "src/card_emulation/nfc_ability_connection_callback.cpp", 79 "src/card_emulation/setting_data_share_impl.cpp", 80 "src/external_deps/app_data_parser.cpp", 81 "src/external_deps/external_deps_proxy.cpp", 82 "src/external_deps/nfc_data_share_impl.cpp", 83 "src/external_deps/nfc_event_publisher.cpp", 84 "src/external_deps/nfc_hisysevent.cpp", 85 "src/external_deps/nfc_notification_publisher.cpp", 86 "src/external_deps/nfc_param_util.cpp", 87 "src/external_deps/nfc_permission_checker.cpp", 88 "src/external_deps/nfc_preferences.cpp", 89 "src/external_deps/tag_ability_dispatcher.cpp", 90 "src/ipc/controller/ndef_msg_callback_proxy.cpp", 91 "src/ipc/controller/nfc_controller_callback_proxy.cpp", 92 "src/ipc/controller/nfc_controller_death_recipient.cpp", 93 "src/ipc/controller/nfc_controller_impl.cpp", 94 "src/ipc/tags/foreground_callback_proxy.cpp", 95 "src/ipc/tags/foreground_death_recipient.cpp", 96 "src/ipc/tags/reader_mode_callback_proxy.cpp", 97 "src/ipc/tags/reader_mode_death_recipient.cpp", 98 "src/ipc/tags/tag_session.cpp", 99 "src/nci_adapter/nci_ce_proxy.cpp", 100 "src/nci_adapter/nci_native_selector.cpp", 101 "src/nci_adapter/nci_nfcc_proxy.cpp", 102 "src/nci_adapter/nci_tag_proxy.cpp", 103 "src/nfc_event_handler.cpp", 104 "src/nfc_polling_manager.cpp", 105 "src/nfc_polling_params.cpp", 106 "src/nfc_routing_manager.cpp", 107 "src/nfc_sa_manager.cpp", 108 "src/nfc_service.cpp", 109 "src/utils/app_state_observer.cpp", 110 "src/utils/nfc_timer.cpp", 111 "src/utils/nfc_watch_dog.cpp", 112 "src/ipc/card_emulation/hce_cmd_callback_proxy.cpp", 113 "src/ipc/card_emulation/hce_cmd_death_recipient.cpp", 114 "src/ipc/card_emulation/hce_session.cpp", 115 "src/tag/isodep_card_handler.cpp", 116 "src/tag/ndef_har_data_parser.cpp", 117 "src/tag/ndef_har_dispatch.cpp", 118 "src/tag/tag_dispatcher.cpp", 119] 120 121if (nfc_service_feature_vendor_applications_enabled) { 122 nfc_service_source += [ 123 "src/ipc/controller/on_card_emulation_notify_cb_proxy.cpp", 124 "src/ipc/controller/query_app_info_callback_proxy.cpp", 125 ] 126} 127 128nfc_service_external_deps = [ 129 "ability_base:want", 130 "ability_base:zuri", 131 "ability_runtime:ability_manager", 132 "ability_runtime:app_manager", 133 "ability_runtime:dataobs_manager", 134 "access_token:libaccesstoken_sdk", 135 "bundle_framework:appexecfwk_base", 136 "bundle_framework:appexecfwk_core", 137 "cJSON:cjson_static", 138 "c_utils:utils", 139 "common_event_service:cesfwk_core", 140 "common_event_service:cesfwk_innerkits", 141 "data_share:datashare_consumer", 142 "eventhandler:libeventhandler", 143 "ffrt:libffrt", 144 "hilog:libhilog", 145 "hisysevent:libhisysevent", 146 "init:libbegetutil", 147 "ipc:ipc_core", 148 "miscdevice:vibrator_interface_native", 149 "power_manager:powermgr_client", 150 "preferences:native_preferences", 151 "safwk:system_ability_fwk", 152 "samgr:samgr_proxy", 153 "screenlock_mgr:screenlock_client", 154] 155 156if (nfc_service_feature_ndef_wifi_enabled) { 157 nfc_service_source += [ 158 "src/tag/ndef_wifi_data_parser.cpp", 159 "src/tag/wifi_connection_manager.cpp", 160 ] 161 nfc_service_external_deps += [ "wifi:wifi_sdk" ] 162} 163 164if (nfc_service_feature_ndef_bt_enabled) { 165 nfc_service_source += [ 166 "src/tag/ndef_bt_data_parser.cpp", 167 "src/tag/bt_connection_manager.cpp", 168 ] 169 nfc_service_external_deps += [ "bluetooth:btframework" ] 170} 171 172####################### nfc_service ################ 173ohos_shared_library("nfc_service") { 174 sanitize = { 175 cfi = true 176 boundary_sanitize = true 177 integer_overflow = true 178 cfi_cross_dso = true 179 debug = false 180 ubsan = true 181 } 182 branch_protector_ret = "pac_ret" 183 sources = nfc_service_source 184 185 public_configs = [ ":nfc_config" ] 186 187 # Used to control the export of dynamic library symbols. 188 version_script = "libnfc_service_version_script.txt" 189 190 deps = [ 191 ":nfc_prebuilt_config", 192 "$NFC_DIR/interfaces/inner_api/cardEmulation:libnfc_hce_interface_stub", 193 "$NFC_DIR/interfaces/inner_api/controller:libnfc_controller_interface_stub", 194 "$NFC_DIR/interfaces/inner_api/common:nfc_inner_kits_common", 195 "$NFC_DIR/interfaces/inner_api/tags:libnfc_tag_interface_stub", 196 "etc/init:etc", 197 "src/notification:nfc_notification", 198 ] 199 200 if (!nfc_use_vendor_nci_native) { 201 deps += [ "src/nci_adapter/nci_native_default:nci_native_default" ] 202 } 203 204 external_deps = nfc_service_external_deps 205 206 part_name = "nfc" 207 subsystem_name = "communication" 208} 209 210####################### nfc_service_static ################ 211# Only used for unittest 212ohos_static_library("nfc_service_static") { 213 sanitize = { 214 cfi = true 215 boundary_sanitize = true 216 integer_overflow = true 217 cfi_cross_dso = true 218 debug = false 219 } 220 sources = nfc_service_source 221 public_configs = [ ":nfc_config" ] 222 223 deps = [ 224 "$NFC_DIR/interfaces/inner_api/cardEmulation:libnfc_hce_interface_proxy", 225 "$NFC_DIR/interfaces/inner_api/cardEmulation:libnfc_hce_interface_stub", 226 "$NFC_DIR/interfaces/inner_api/common:nfc_inner_kits_common", 227 "$NFC_DIR/interfaces/inner_api/controller:libnfc_controller_interface_proxy", 228 "$NFC_DIR/interfaces/inner_api/controller:libnfc_controller_interface_stub", 229 "$NFC_DIR/interfaces/inner_api/tags:libnfc_tag_interface_proxy", 230 "$NFC_DIR/interfaces/inner_api/tags:libnfc_tag_interface_stub", 231 "etc/init:etc", 232 ] 233 234 if (!nfc_use_vendor_nci_native) { 235 deps += [ "src/nci_adapter/nci_native_default:nci_native_default" ] 236 } 237 238 external_deps = nfc_service_external_deps 239 240 part_name = "nfc" 241 subsystem_name = "communication" 242} 243