1package { 2 default_applicable_licenses: ["packages_modules_DnsResolver_license"], 3} 4 5// Added automatically by a large-scale-change that took the approach of 6// 'apply every license found to every target'. While this makes sure we respect 7// every license restriction, it may not be entirely correct. 8// 9// e.g. GPL in an MIT project might only apply to the contrib/ directory. 10// 11// Please consider splitting the single license below into multiple licenses, 12// taking care not to lose any license_kind information, and overriding the 13// default license using the 'licenses: [...]' property on targets as needed. 14// 15// For unused files, consider creating a 'fileGroup' with "//visibility:private" 16// to attach the license to, and including a comment whether the files may be 17// used in the current project. 18// See: http://go/android-license-faq 19license { 20 name: "packages_modules_DnsResolver_license", 21 visibility: [":__subpackages__"], 22 license_kinds: [ 23 "SPDX-license-identifier-Apache-2.0", 24 "SPDX-license-identifier-BSD", 25 "SPDX-license-identifier-ISC", 26 "SPDX-license-identifier-MIT", 27 ], 28 license_text: [ 29 "NOTICE", 30 ], 31} 32 33cc_library_headers { 34 name: "libnetd_resolv_headers", 35 export_include_dirs: ["include"], 36} 37 38// Used only by dns_responder_client_ndk.cpp for ResolverStats.h 39// TODO: refactor stats to use a Parcel and eliminate this dependency 40cc_library_headers { 41 name: "libnetd_resolv_internal_headers", 42 export_include_dirs: ["."], 43} 44 45cc_library_headers { 46 name: "dnsproxyd_protocol_headers", 47 sdk_version: "29", 48 min_sdk_version: "29", 49 export_include_dirs: ["include/dnsproxyd_protocol"], 50 apex_available: [ 51 "//apex_available:platform", 52 "com.android.tethering", 53 ], 54} 55 56dnsresolver_aidl_interface_lateststable_version = "V9" 57 58cc_library_static { 59 name: "dnsresolver_aidl_interface-lateststable-ndk_platform", 60 whole_static_libs: [ 61 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk_platform", 62 ], 63 apex_available: [ 64 "com.android.resolv", 65 ], 66 min_sdk_version: "29", 67} 68 69aidl_interface { 70 name: "dnsresolver_aidl_interface", 71 local_include_dir: "binder", 72 srcs: [ 73 "binder/android/net/IDnsResolver.aidl", 74 "binder/android/net/ResolverHostsParcel.aidl", 75 "binder/android/net/ResolverOptionsParcel.aidl", 76 "binder/android/net/ResolverParamsParcel.aidl", 77 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified 78 "binder/android/net/resolv/aidl/**/*.aidl", 79 ], 80 imports: [ 81 "netd_event_listener_interface", 82 ], 83 backend: { 84 java: { 85 apex_available: [ 86 "com.android.bluetooth.updatable", 87 "com.android.tethering", 88 "com.android.wifi", 89 ], 90 min_sdk_version: "30", 91 }, 92 ndk: { 93 gen_log: true, 94 apex_available: [ 95 "com.android.resolv", 96 ], 97 min_sdk_version: "29", 98 }, 99 }, 100 versions: [ 101 "1", 102 "2", 103 "3", 104 "4", 105 "5", 106 "6", 107 "7", 108 "8", 109 "9", 110 ], 111 dumpapi: { 112 no_license: true, 113 }, 114} 115 116cc_defaults { 117 name: "resolv_test_defaults", 118 cflags: [ 119 // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6. 120 "-Wno-error=deprecated-declarations", 121 ], 122 // Note that, static link liblog and libbase is a hard requirement for resolv related tests 123 // because libbase is not compatible between Q and R for general platform build due 124 // to its log revelant functions changing. And most of resolv related tests must be able to run 125 // in Q. 126 static_libs: [ 127 "libbase", 128 "liblog", 129 ], 130 // This field is required to make test compatible with Q devices. 131 min_sdk_version: "29", 132} 133 134cc_defaults { 135 // This is necessary to have the coverage tests run on cf_x86_phone. 136 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test 137 // suite on cf_x86_phone (32-bit) for coverage. 138 // See b/147785146 for details. 139 // TODO: Remove this target after coverage test switched to 64-bit device. 140 name: "resolv_test_mts_coverage_defaults", 141 test_config_template: ":resolv_test_config_template", 142 compile_multilib: "both", 143 multilib: { 144 lib32: { 145 suffix: "32", 146 }, 147 lib64: { 148 suffix: "64", 149 }, 150 }, 151} 152 153cc_library { 154 name: "libnetd_resolv", 155 version_script: "libnetd_resolv.map.txt", 156 stubs: { 157 versions: [ 158 "1", 159 ], 160 symbol_file: "libnetd_resolv.map.txt", 161 }, 162 defaults: ["netd_defaults"], 163 srcs: [ 164 "getaddrinfo.cpp", 165 "gethnamaddr.cpp", 166 "sethostent.cpp", 167 "res_cache.cpp", 168 "res_comp.cpp", 169 "res_debug.cpp", 170 "res_mkquery.cpp", 171 "res_query.cpp", 172 "res_send.cpp", 173 "res_stats.cpp", 174 "util.cpp", 175 "Dns64Configuration.cpp", 176 "DnsProxyListener.cpp", 177 "DnsQueryLog.cpp", 178 "DnsResolver.cpp", 179 "DnsResolverService.cpp", 180 "DnsStats.cpp", 181 "DnsTlsDispatcher.cpp", 182 "DnsTlsQueryMap.cpp", 183 "DnsTlsTransport.cpp", 184 "DnsTlsServer.cpp", 185 "DnsTlsSessionCache.cpp", 186 "DnsTlsSocket.cpp", 187 "Experiments.cpp", 188 "PrivateDnsConfiguration.cpp", 189 "ResolverController.cpp", 190 "ResolverEventReporter.cpp", 191 ], 192 // Link most things statically to minimize our dependence on system ABIs. 193 stl: "libc++_static", 194 static_libs: [ 195 "dnsresolver_aidl_interface-lateststable-ndk_platform", 196 "libbase", 197 "libcutils", 198 "libnetdutils", 199 "libprotobuf-cpp-lite", 200 "libstatslog_resolv", 201 "libstatspush_compat", 202 "libsysutils", 203 "netd_event_listener_interface-lateststable-ndk_platform", 204 "server_configurable_flags", 205 "stats_proto", 206 ], 207 // libcrypto needs to be used as a shared library because it performs an 208 // integrity check (against a checksum) that is not supported for static 209 // libs. See http://b/141248879 210 // We're also adding libssl here to treat it consistently. 211 // liblog is added as a shared library because it provides stable C API 212 // from the platform; we don't need to include it in this module by 213 // statically linking to it. Doing so is even dangerous because the socket 214 // protocol to logd implemented in the library isn't guaranteed to be 215 // stable. See b/151051671 216 shared_libs: [ 217 "libbinder_ndk", 218 "libcrypto", 219 "liblog", //Used by libstatslog_resolv 220 "libssl", 221 ], 222 header_libs: [ 223 "libnetdbinder_utils_headers", 224 ], 225 runtime_libs: [ 226 // Causes the linkerconfig to create a namespace link from resolv to the 227 // libstatssocket library within the statsd apex 228 "libstatssocket", 229 ], 230 export_include_dirs: ["include"], 231 232 product_variables: { 233 debuggable: { 234 cppflags: [ 235 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1", 236 ], 237 }, 238 }, 239 header_abi_checker: { 240 enabled: true, 241 symbol_file: "libnetd_resolv.map.txt", 242 }, 243 sanitize: { 244 cfi: true, 245 }, 246 apex_available: ["com.android.resolv"], 247 min_sdk_version: "29", 248} 249 250cc_library_static { 251 name: "stats_proto", 252 defaults: ["netd_defaults"], 253 proto: { 254 export_proto_headers: true, 255 type: "lite", 256 }, 257 srcs: [ 258 "stats.proto", 259 ], 260 apex_available: ["com.android.resolv"], 261 min_sdk_version: "29", 262} 263 264genrule { 265 name: "statslog_resolv.h", 266 tools: ["stats-log-api-gen"], 267 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats", 268 out: [ 269 "statslog_resolv.h", 270 ], 271} 272 273genrule { 274 name: "statslog_resolv.cpp", 275 tools: ["stats-log-api-gen"], 276 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h --supportQ", 277 out: [ 278 "statslog_resolv.cpp", 279 ], 280} 281 282cc_library_static { 283 name: "libstatslog_resolv", 284 generated_sources: ["statslog_resolv.cpp"], 285 generated_headers: ["statslog_resolv.h"], 286 defaults: ["netd_defaults"], 287 export_generated_headers: ["statslog_resolv.h"], 288 static_libs: [ 289 "libcutils", 290 "libstatspush_compat", 291 ], 292 header_libs: [ 293 "libgtest_prod_headers", // Used by libstatspush_compat 294 ], 295 apex_available: ["com.android.resolv"], 296 min_sdk_version: "29", 297} 298 299filegroup { 300 name: "resolv_rust_test_config_template", 301 srcs: [ 302 "resolv_rust_test_config_template.xml", 303 ], 304} 305 306filegroup { 307 name: "resolv_test_config_template", 308 srcs: [ 309 "resolv_test_config_template.xml", 310 ], 311} 312 313filegroup { 314 name: "resolv_unit_test_files", 315 srcs: [ 316 "DnsQueryLogTest.cpp", 317 "DnsStatsTest.cpp", 318 "ExperimentsTest.cpp", 319 "OperationLimiterTest.cpp", 320 "PrivateDnsConfigurationTest.cpp", 321 ], 322} 323 324rust_ffi_static { 325 name: "libdoh_ffi", 326 crate_name: "doh", 327 srcs: ["doh.rs"], 328 edition: "2018", 329 330 rlibs: [ 331 "libandroid_logger", 332 "libanyhow", 333 "liblazy_static", 334 "liblibc", 335 "liblog_rust", 336 "libquiche", 337 "libring", 338 "libtokio", 339 "liburl", 340 ], 341 prefer_rlib: true, 342 343 shared_libs: [ 344 "libcrypto", 345 "libssl", 346 ], 347 348 apex_available: [ 349 "//apex_available:platform", // Needed by doh_ffi_test 350 "com.android.resolv" 351 ], 352 min_sdk_version: "29", 353} 354 355rust_test { 356 name: "doh_unit_test", 357 crate_name: "doh", 358 srcs: ["doh.rs"], 359 edition: "2018", 360 test_suites: ["general-tests"], 361 auto_gen_config: true, 362 // Used to enable root permission for the test. 363 // TODO: remove after 'require_root' is supported in rust_test. 364 test_config_template: ":resolv_rust_test_config_template", 365 rustlibs: [ 366 "libandroid_logger", 367 "libanyhow", 368 "liblazy_static", 369 "liblibc", 370 "liblog_rust", 371 "libquiche_static", 372 "libring", 373 "libtokio", 374 "liburl", 375 ], 376 min_sdk_version: "29", 377} 378