1// 2// Copyright (C) 2019 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21java_defaults { 22 name: "TetheringAndroidLibraryDefaults", 23 sdk_version: "module_current", 24 min_sdk_version: "30", 25 srcs: [ 26 "apishim/**/*.java", 27 "src/**/*.java", 28 ":framework-connectivity-shared-srcs", 29 ":tethering-module-utils-srcs", 30 ":services-tethering-shared-srcs", 31 ], 32 static_libs: [ 33 "NetworkStackApiStableShims", 34 "androidx.annotation_annotation", 35 "modules-utils-build", 36 "netlink-client", 37 "networkstack-client", 38 "android.hardware.tetheroffload.config-V1.0-java", 39 "android.hardware.tetheroffload.control-V1.0-java", 40 "android.hardware.tetheroffload.control-V1.1-java", 41 "net-utils-framework-common", 42 "net-utils-device-common", 43 "netd-client", 44 "NetworkStackApiCurrentShims", 45 ], 46 libs: [ 47 "framework-connectivity", 48 "framework-statsd.stubs.module_lib", 49 "framework-tethering.impl", 50 "framework-wifi", 51 "unsupportedappusage", 52 ], 53 plugins: ["java_api_finder"], 54 manifest: "AndroidManifestBase.xml", 55} 56 57// Build tethering static library, used to compile both variants of the tethering. 58android_library { 59 name: "TetheringApiCurrentLib", 60 defaults: ["TetheringAndroidLibraryDefaults"], 61} 62 63// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). 64cc_library { 65 name: "libtetherutilsjni", 66 sdk_version: "current", 67 apex_available: [ 68 "//apex_available:platform", // Used by InProcessTethering 69 "com.android.tethering", 70 ], 71 min_sdk_version: "30", 72 header_libs: [ 73 "bpf_syscall_wrappers", 74 "bpf_tethering_headers", 75 ], 76 srcs: [ 77 "jni/*.cpp", 78 ], 79 shared_libs: [ 80 "liblog", 81 "libnativehelper_compat_libc++", 82 ], 83 static_libs: [ 84 "libnetjniutils", 85 ], 86 87 // We cannot use plain "libc++" here to link libc++ dynamically because it results in: 88 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found 89 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't 90 // build because soong complains of: 91 // module Tethering missing dependencies: libc++_shared 92 // 93 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries 94 // we depend on do not dynamically link libc++. This is currently the case, because liblog is 95 // C-only and libnativehelper_compat_libc also uses stl: "c++_static". 96 stl: "c++_static", 97 98 cflags: [ 99 "-Wall", 100 "-Werror", 101 "-Wno-unused-parameter", 102 "-Wthread-safety", 103 ], 104 105 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"], 106} 107 108// Common defaults for compiling the actual APK. 109java_defaults { 110 name: "TetheringAppDefaults", 111 sdk_version: "module_current", 112 privileged: true, 113 jni_libs: [ 114 "libtetherutilsjni", 115 ], 116 resource_dirs: [ 117 "res", 118 ], 119 libs: [ 120 "framework-tethering", 121 "framework-wifi", 122 ], 123 jarjar_rules: "jarjar-rules.txt", 124 optimize: { 125 proguard_flags_files: ["proguard.flags"], 126 }, 127} 128 129// Non-updatable tethering running in the system server process for devices not using the module 130android_app { 131 name: "InProcessTethering", 132 defaults: ["TetheringAppDefaults"], 133 static_libs: ["TetheringApiCurrentLib"], 134 certificate: "platform", 135 manifest: "AndroidManifest_InProcess.xml", 136 // InProcessTethering is a replacement for Tethering 137 overrides: ["Tethering"], 138 apex_available: ["com.android.tethering"], 139 min_sdk_version: "30", 140} 141 142// Updatable tethering packaged as an application 143android_app { 144 name: "Tethering", 145 defaults: ["TetheringAppDefaults"], 146 static_libs: ["TetheringApiCurrentLib"], 147 certificate: "networkstack", 148 manifest: "AndroidManifest.xml", 149 use_embedded_native_libs: true, 150 // The permission configuration *must* be included to ensure security of the device 151 required: [ 152 "NetworkPermissionConfig", 153 "privapp_whitelist_com.android.networkstack.tethering", 154 ], 155 apex_available: ["com.android.tethering"], 156 min_sdk_version: "30", 157} 158 159sdk { 160 name: "tethering-module-sdk", 161 bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"], 162} 163