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 include_dirs = [ 43 "include", 44 "src/ipc/controller", 45 "src/ipc/tags", 46 "src/ipc/card_emulation", 47 "src/nci_adapter", 48 "src/utils", 49 "src/card_emulation", 50 "src/external_deps", 51 "src/tag", 52 "$NFC_DIR/interfaces/inner_api/common", 53 ] 54} 55 56ohos_prebuilt_etc("nfc_prebuilt_config_apdu") { 57 source = "res/nfc_card_apdu.json" 58 relative_install_dir = "nfc" 59 part_name = "nfc" 60 subsystem_name = "communication" 61} 62 63ohos_prebuilt_etc("nfc_prebuilt_config_string_en") { 64 source = "res/en/string_en.json" 65 relative_install_dir = "nfc" 66 part_name = "nfc" 67 subsystem_name = "communication" 68} 69 70ohos_prebuilt_etc("nfc_prebuilt_config_string_zh") { 71 source = "res/zh/string_zh.json" 72 relative_install_dir = "nfc" 73 part_name = "nfc" 74 subsystem_name = "communication" 75} 76 77ohos_prebuilt_etc("nfc_prebuilt_config_notification_icon") { 78 source = "res/nfc_icon.png" 79 relative_install_dir = "nfc" 80 part_name = "nfc" 81 subsystem_name = "communication" 82} 83 84nfc_service_source = [ 85 "src/card_emulation/ce_service.cpp", 86 "src/card_emulation/host_card_emulation_manager.cpp", 87 "src/card_emulation/nfc_ability_connection_callback.cpp", 88 "src/card_emulation/setting_data_share_impl.cpp", 89 "src/external_deps/app_data_parser.cpp", 90 "src/external_deps/external_deps_proxy.cpp", 91 "src/external_deps/nfc_data_share_impl.cpp", 92 "src/external_deps/nfc_event_publisher.cpp", 93 "src/external_deps/nfc_hisysevent.cpp", 94 "src/external_deps/nfc_notification_publisher.cpp", 95 "src/external_deps/nfc_param_util.cpp", 96 "src/external_deps/nfc_permission_checker.cpp", 97 "src/external_deps/nfc_preferences.cpp", 98 "src/external_deps/tag_ability_dispatcher.cpp", 99 "src/ipc/controller/ndef_msg_callback_proxy.cpp", 100 "src/ipc/controller/nfc_controller_callback_proxy.cpp", 101 "src/ipc/controller/nfc_controller_death_recipient.cpp", 102 "src/ipc/controller/nfc_controller_impl.cpp", 103 "src/ipc/controller/nfc_controller_stub.cpp", 104 "src/ipc/tags/foreground_callback_proxy.cpp", 105 "src/ipc/tags/foreground_death_recipient.cpp", 106 "src/ipc/tags/reader_mode_callback_proxy.cpp", 107 "src/ipc/tags/reader_mode_death_recipient.cpp", 108 "src/ipc/tags/tag_session.cpp", 109 "src/ipc/tags/tag_session_stub.cpp", 110 "src/nci_adapter/nci_ce_proxy.cpp", 111 "src/nci_adapter/nci_native_selector.cpp", 112 "src/nci_adapter/nci_nfcc_proxy.cpp", 113 "src/nci_adapter/nci_tag_proxy.cpp", 114 "src/nfc_event_handler.cpp", 115 "src/nfc_polling_manager.cpp", 116 "src/nfc_polling_params.cpp", 117 "src/nfc_routing_manager.cpp", 118 "src/nfc_sa_manager.cpp", 119 "src/nfc_service.cpp", 120 "src/utils/app_state_observer.cpp", 121 "src/utils/nfc_timer.cpp", 122 "src/utils/nfc_watch_dog.cpp", 123 "src/ipc/card_emulation/hce_cmd_callback_proxy.cpp", 124 "src/ipc/card_emulation/hce_cmd_death_recipient.cpp", 125 "src/ipc/card_emulation/hce_session.cpp", 126 "src/ipc/card_emulation/hce_session_stub.cpp", 127 "src/tag/isodep_card_handler.cpp", 128 "src/tag/ndef_har_data_parser.cpp", 129 "src/tag/ndef_har_dispatch.cpp", 130 "src/tag/tag_dispatcher.cpp", 131] 132 133if (nfc_service_feature_vendor_applications_enabled) { 134 nfc_service_source += [ 135 "src/ipc/controller/on_card_emulation_notify_cb_proxy.cpp", 136 "src/ipc/controller/query_app_info_callback_proxy.cpp", 137 ] 138} 139 140nfc_service_external_deps = [ 141 "ability_base:want", 142 "ability_base:zuri", 143 "ability_runtime:ability_manager", 144 "ability_runtime:app_manager", 145 "ability_runtime:dataobs_manager", 146 "access_token:libaccesstoken_sdk", 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 "eventhandler:libeventhandler", 154 "hilog:libhilog", 155 "hisysevent:libhisysevent", 156 "ipc:ipc_core", 157 "miscdevice:vibrator_interface_native", 158 "power_manager:powermgr_client", 159 "preferences:native_preferences", 160 "safwk:system_ability_fwk", 161 "samgr:samgr_proxy", 162 "screenlock_mgr:screenlock_client", 163] 164 165if (nfc_service_feature_ndef_wifi_enabled) { 166 nfc_service_source += [ 167 "src/tag/ndef_wifi_data_parser.cpp", 168 "src/tag/wifi_connection_manager.cpp", 169 ] 170 nfc_service_external_deps += [ "wifi:wifi_sdk" ] 171} 172 173if (nfc_service_feature_ndef_bt_enabled) { 174 nfc_service_source += [ 175 "src/tag/ndef_bt_data_parser.cpp", 176 "src/tag/bt_connection_manager.cpp", 177 ] 178 nfc_service_external_deps += [ "bluetooth:btframework" ] 179} 180 181####################### nfc_service ################ 182ohos_shared_library("nfc_service") { 183 sanitize = { 184 cfi = true 185 boundary_sanitize = true 186 integer_overflow = true 187 cfi_cross_dso = true 188 debug = false 189 ubsan = true 190 } 191 branch_protector_ret = "pac_ret" 192 sources = nfc_service_source 193 194 public_configs = [ ":nfc_config" ] 195 196 # Used to control the export of dynamic library symbols. 197 version_script = "libnfc_service_version_script.txt" 198 199 deps = [ 200 ":nfc_prebuilt_config_apdu", 201 ":nfc_prebuilt_config_notification_icon", 202 ":nfc_prebuilt_config_string_en", 203 ":nfc_prebuilt_config_string_zh", 204 "$NFC_DIR/interfaces/inner_api/common:nfc_inner_kits_common", 205 "etc/init:etc", 206 "src/notification:nfc_notification", 207 "//third_party/cJSON:cjson_static", 208 ] 209 210 if (!nfc_use_vendor_nci_native) { 211 deps += [ "src/nci_adapter/nci_native_default:nci_native_default" ] 212 } 213 214 external_deps = nfc_service_external_deps 215 216 part_name = "nfc" 217 subsystem_name = "communication" 218} 219 220####################### nfc_service_static ################ 221# Only used for unittest 222ohos_static_library("nfc_service_static") { 223 sanitize = { 224 cfi = true 225 boundary_sanitize = true 226 integer_overflow = true 227 cfi_cross_dso = true 228 debug = false 229 } 230 sources = nfc_service_source 231 public_configs = [ ":nfc_config" ] 232 233 deps = [ 234 "$NFC_DIR/interfaces/inner_api/common:nfc_inner_kits_common", 235 "etc/init:etc", 236 "//third_party/cJSON:cjson_static", 237 ] 238 239 if (!nfc_use_vendor_nci_native) { 240 deps += [ "src/nci_adapter/nci_native_default:nci_native_default" ] 241 } 242 243 external_deps = nfc_service_external_deps 244 245 part_name = "nfc" 246 subsystem_name = "communication" 247} 248