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