markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 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 | |
Bob Badour | 97e6be2 | 2021-02-12 14:45:04 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 19 | } |
| 20 | |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 21 | java_defaults { |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 22 | name: "TetheringApiLevel", |
Anton Hansson | bbe4af1 | 2020-03-18 14:15:42 +0000 | [diff] [blame] | 23 | sdk_version: "module_current", |
markchien | bf62258 | 2021-11-04 01:09:26 +0800 | [diff] [blame] | 24 | target_sdk_version: "31", |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 25 | min_sdk_version: "30", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | java_defaults { |
| 29 | name: "TetheringAndroidLibraryDefaults", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 30 | srcs: [ |
Hungming Chen | dd55b91 | 2020-12-26 17:13:22 +0800 | [diff] [blame] | 31 | "apishim/**/*.java", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 32 | "src/**/*.java", |
Aaron Huang | b401e58 | 2021-01-22 18:35:00 +0800 | [diff] [blame] | 33 | ":framework-connectivity-shared-srcs", |
markchien | 12c5bb8 | 2020-01-07 14:43:17 +0800 | [diff] [blame] | 34 | ":tethering-module-utils-srcs", |
markchien | 43e97e0 | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 35 | ":services-tethering-shared-srcs", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 36 | ], |
| 37 | static_libs: [ |
| 38 | "androidx.annotation_annotation", |
Hungming Chen | dd55b91 | 2020-12-26 17:13:22 +0800 | [diff] [blame] | 39 | "modules-utils-build", |
William Escande | ea9e22e | 2021-08-19 12:26:52 +0200 | [diff] [blame] | 40 | "modules-utils-statemachine", |
Jeongik Cha | d05f990 | 2021-01-26 22:35:02 +0900 | [diff] [blame] | 41 | "networkstack-client", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 42 | "android.hardware.tetheroffload.config-V1.0-java", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 43 | "android.hardware.tetheroffload.control-V1.0-java", |
junyulai | 177dc86 | 2021-03-10 15:26:50 +0800 | [diff] [blame] | 44 | "android.hardware.tetheroffload.control-V1.1-java", |
markchien | 75fc6ab | 2020-01-14 17:28:47 +0800 | [diff] [blame] | 45 | "net-utils-framework-common", |
Chalard Jean | bdcca92 | 2020-06-26 00:19:33 +0900 | [diff] [blame] | 46 | "net-utils-device-common", |
markchien | 782a568 | 2021-11-10 01:11:33 +0800 | [diff] [blame] | 47 | "net-utils-device-common-bpf", |
Xiao Ma | 09c0727 | 2021-07-01 14:00:34 +0000 | [diff] [blame] | 48 | "net-utils-device-common-netlink", |
lucaslin | ee661df | 2020-12-28 16:44:49 +0800 | [diff] [blame] | 49 | "netd-client", |
Wayne Ma | 71d6639 | 2022-03-03 10:15:09 +0800 | [diff] [blame] | 50 | "tetheringstatsprotos", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 51 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 52 | libs: [ |
Remi NGUYEN VAN | 74b2744 | 2021-01-15 20:26:28 +0900 | [diff] [blame] | 53 | "framework-connectivity", |
paulhu | 537f720 | 2022-02-08 21:25:28 +0800 | [diff] [blame] | 54 | "framework-connectivity-t.stubs.module_lib", |
waynema | b7048af | 2020-06-19 19:48:56 +0800 | [diff] [blame] | 55 | "framework-statsd.stubs.module_lib", |
Paul Duffin | 2dae272 | 2020-05-13 12:28:49 +0100 | [diff] [blame] | 56 | "framework-tethering.impl", |
Paul Duffin | 6812c1b | 2020-05-31 11:35:50 +0100 | [diff] [blame] | 57 | "framework-wifi", |
Roopa Sattiraju | 27acf0b | 2022-01-11 20:39:21 -0800 | [diff] [blame] | 58 | "framework-bluetooth", |
Artur Satayev | 4784fb0 | 2019-12-10 17:47:53 +0000 | [diff] [blame] | 59 | "unsupportedappusage", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 60 | ], |
markchien | 84a9282 | 2020-01-16 11:21:53 +0800 | [diff] [blame] | 61 | plugins: ["java_api_finder"], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 62 | manifest: "AndroidManifestBase.xml", |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 63 | lint: { strict_updatability_linting: true }, |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 64 | } |
| 65 | |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 66 | // build tethering static library, used to compile both variants of the tethering. |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 67 | android_library { |
| 68 | name: "TetheringApiCurrentLib", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 69 | defaults: [ |
Remi NGUYEN VAN | f826bce | 2022-01-26 17:43:53 +0900 | [diff] [blame] | 70 | "ConnectivityNextEnableDefaults", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 71 | "TetheringAndroidLibraryDefaults", |
| 72 | "TetheringApiLevel" |
| 73 | ], |
| 74 | static_libs: [ |
| 75 | "NetworkStackApiCurrentShims", |
| 76 | ], |
| 77 | apex_available: ["com.android.tethering"], |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 78 | lint: { strict_updatability_linting: true }, |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | android_library { |
| 82 | name: "TetheringApiStableLib", |
| 83 | defaults: [ |
| 84 | "TetheringAndroidLibraryDefaults", |
| 85 | "TetheringApiLevel" |
| 86 | ], |
| 87 | static_libs: [ |
| 88 | "NetworkStackApiStableShims", |
| 89 | ], |
| 90 | apex_available: ["com.android.tethering"], |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 91 | lint: { strict_updatability_linting: true }, |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 92 | } |
| 93 | |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 94 | // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). |
| 95 | cc_library { |
markchien | f967b11 | 2021-11-09 16:56:23 +0800 | [diff] [blame] | 96 | name: "libcom_android_networkstack_tethering_util_jni", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 97 | sdk_version: "30", |
Jooyung Han | 8182d8b | 2020-04-29 02:43:30 +0900 | [diff] [blame] | 98 | apex_available: [ |
| 99 | "//apex_available:platform", // Used by InProcessTethering |
| 100 | "com.android.tethering", |
| 101 | ], |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 102 | min_sdk_version: "30", |
Lorenzo Colitti | 734b14e | 2021-02-05 23:56:09 +0900 | [diff] [blame] | 103 | header_libs: [ |
Ken Chen | bb57fa9 | 2021-10-22 00:49:13 +0800 | [diff] [blame] | 104 | "bpf_connectivity_headers", |
Lorenzo Colitti | 734b14e | 2021-02-05 23:56:09 +0900 | [diff] [blame] | 105 | ], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 106 | srcs: [ |
markchien | 7052688 | 2020-11-12 00:17:15 +0800 | [diff] [blame] | 107 | "jni/*.cpp", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 108 | ], |
| 109 | shared_libs: [ |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 110 | "liblog", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 111 | "libnativehelper_compat_libc++", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 112 | ], |
Orion Hodson | e5bd0db | 2020-12-08 09:57:42 +0000 | [diff] [blame] | 113 | static_libs: [ |
markchien | 782a568 | 2021-11-10 01:11:33 +0800 | [diff] [blame] | 114 | "libnet_utils_device_common_bpfjni", |
Orion Hodson | e5bd0db | 2020-12-08 09:57:42 +0000 | [diff] [blame] | 115 | "libnetjniutils", |
| 116 | ], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 117 | |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 118 | // We cannot use plain "libc++" here to link libc++ dynamically because it results in: |
| 119 | // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found |
| 120 | // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't |
| 121 | // build because soong complains of: |
| 122 | // module Tethering missing dependencies: libc++_shared |
| 123 | // |
| 124 | // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries |
| 125 | // we depend on do not dynamically link libc++. This is currently the case, because liblog is |
| 126 | // C-only and libnativehelper_compat_libc also uses stl: "c++_static". |
| 127 | stl: "c++_static", |
| 128 | |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 129 | cflags: [ |
| 130 | "-Wall", |
| 131 | "-Werror", |
| 132 | "-Wno-unused-parameter", |
| 133 | "-Wthread-safety", |
| 134 | ], |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 135 | |
| 136 | ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 137 | } |
| 138 | |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 139 | // Common defaults for compiling the actual APK. |
| 140 | java_defaults { |
| 141 | name: "TetheringAppDefaults", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 142 | privileged: true, |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 143 | jni_libs: [ |
markchien | f967b11 | 2021-11-09 16:56:23 +0800 | [diff] [blame] | 144 | "libcom_android_networkstack_tethering_util_jni", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 145 | ], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 146 | resource_dirs: [ |
| 147 | "res", |
| 148 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 149 | libs: [ |
| 150 | "framework-tethering", |
Anton Hansson | b8a342e | 2020-10-02 16:38:21 +0100 | [diff] [blame] | 151 | "framework-wifi", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 152 | ], |
| 153 | jarjar_rules: "jarjar-rules.txt", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 154 | optimize: { |
| 155 | proguard_flags_files: ["proguard.flags"], |
| 156 | }, |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 157 | lint: { strict_updatability_linting: true }, |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | // Non-updatable tethering running in the system server process for devices not using the module |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 161 | android_app { |
| 162 | name: "InProcessTethering", |
Remi NGUYEN VAN | f826bce | 2022-01-26 17:43:53 +0900 | [diff] [blame] | 163 | defaults: ["TetheringAppDefaults", "TetheringApiLevel", "ConnectivityNextEnableDefaults"], |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 164 | static_libs: ["TetheringApiCurrentLib"], |
| 165 | certificate: "platform", |
| 166 | manifest: "AndroidManifest_InProcess.xml", |
| 167 | // InProcessTethering is a replacement for Tethering |
| 168 | overrides: ["Tethering"], |
markchien | dbaff66 | 2020-05-05 17:42:44 +0800 | [diff] [blame] | 169 | apex_available: ["com.android.tethering"], |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 170 | lint: { strict_updatability_linting: true }, |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 171 | } |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 172 | |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 173 | // Updatable tethering packaged for finalized API |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 174 | android_app { |
| 175 | name: "Tethering", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 176 | defaults: ["TetheringAppDefaults", "TetheringApiLevel"], |
| 177 | static_libs: ["TetheringApiStableLib"], |
| 178 | certificate: "networkstack", |
| 179 | manifest: "AndroidManifest.xml", |
| 180 | use_embedded_native_libs: true, |
| 181 | // The permission configuration *must* be included to ensure security of the device |
| 182 | required: [ |
| 183 | "NetworkPermissionConfig", |
Andrei Onea | 52eac02 | 2021-12-03 15:11:27 +0000 | [diff] [blame] | 184 | "privapp_allowlist_com.android.tethering", |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 185 | ], |
| 186 | apex_available: ["com.android.tethering"], |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 187 | lint: { strict_updatability_linting: true }, |
markchien | 5a8c806 | 2021-10-27 13:22:27 +0800 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | android_app { |
| 191 | name: "TetheringNext", |
markchien | 598a75b | 2021-11-22 10:36:32 +0800 | [diff] [blame] | 192 | defaults: [ |
| 193 | "TetheringAppDefaults", |
| 194 | "TetheringApiLevel", |
| 195 | "ConnectivityNextEnableDefaults", |
| 196 | ], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 197 | static_libs: ["TetheringApiCurrentLib"], |
| 198 | certificate: "networkstack", |
| 199 | manifest: "AndroidManifest.xml", |
| 200 | use_embedded_native_libs: true, |
| 201 | // The permission configuration *must* be included to ensure security of the device |
Aaron Huang | 3f69f1c | 2021-04-27 20:24:24 +0800 | [diff] [blame] | 202 | required: [ |
| 203 | "NetworkPermissionConfig", |
Andrei Onea | 52eac02 | 2021-12-03 15:11:27 +0000 | [diff] [blame] | 204 | "privapp_allowlist_com.android.tethering", |
Aaron Huang | 3f69f1c | 2021-04-27 20:24:24 +0800 | [diff] [blame] | 205 | ], |
Jiyong Park | 1eb8933 | 2020-01-06 13:30:59 +0900 | [diff] [blame] | 206 | apex_available: ["com.android.tethering"], |
Chiachang Wang | 3bc5276 | 2021-11-25 14:17:57 +0800 | [diff] [blame] | 207 | lint: { strict_updatability_linting: true }, |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 208 | } |
Hai Zhang | 6d71f10 | 2021-02-14 06:38:22 +0000 | [diff] [blame] | 209 | |
| 210 | sdk { |
| 211 | name: "tethering-module-sdk", |
Anton Hansson | a12ffac | 2021-06-07 15:46:33 +0100 | [diff] [blame] | 212 | bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"], |
Jiakai Zhang | 86c139a | 2021-12-20 16:54:13 +0000 | [diff] [blame] | 213 | systemserverclasspath_fragments: ["com.android.tethering-systemserverclasspath-fragment"], |
Hai Zhang | 6d71f10 | 2021-02-14 06:38:22 +0000 | [diff] [blame] | 214 | } |
Wayne Ma | 71d6639 | 2022-03-03 10:15:09 +0800 | [diff] [blame] | 215 | |
| 216 | java_library_static { |
| 217 | name: "tetheringstatsprotos", |
| 218 | proto: {type: "lite"}, |
| 219 | srcs: [ |
| 220 | "src/com/android/networkstack/tethering/metrics/stats.proto", |
| 221 | ], |
| 222 | static_libs: ["tetheringprotos"], |
| 223 | apex_available: ["com.android.tethering"], |
| 224 | min_sdk_version: "30", |
| 225 | } |