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 { |
| 22 | name: "TetheringAndroidLibraryDefaults", |
Anton Hansson | bbe4af1 | 2020-03-18 14:15:42 +0000 | [diff] [blame] | 23 | sdk_version: "module_current", |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 24 | min_sdk_version: "30", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 25 | srcs: [ |
Hungming Chen | dd55b91 | 2020-12-26 17:13:22 +0800 | [diff] [blame] | 26 | "apishim/**/*.java", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 27 | "src/**/*.java", |
Aaron Huang | e831688 | 2021-01-22 18:35:00 +0800 | [diff] [blame] | 28 | ":framework-connectivity-shared-srcs", |
markchien | 12c5bb8 | 2020-01-07 14:43:17 +0800 | [diff] [blame] | 29 | ":tethering-module-utils-srcs", |
markchien | 43e97e0 | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 30 | ":services-tethering-shared-srcs", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 31 | ], |
| 32 | static_libs: [ |
junyulai | b95083e | 2021-05-06 15:42:17 +0800 | [diff] [blame] | 33 | "NetworkStackApiStableShims", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 34 | "androidx.annotation_annotation", |
Hungming Chen | dd55b91 | 2020-12-26 17:13:22 +0800 | [diff] [blame] | 35 | "modules-utils-build", |
Remi NGUYEN VAN | 88998f4 | 2019-08-09 15:52:06 +0900 | [diff] [blame] | 36 | "netlink-client", |
Jeongik Cha | d05f990 | 2021-01-26 22:35:02 +0900 | [diff] [blame] | 37 | "networkstack-client", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 38 | "android.hardware.tetheroffload.config-V1.0-java", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 39 | "android.hardware.tetheroffload.control-V1.0-java", |
junyulai | 184d458 | 2021-03-10 15:26:50 +0800 | [diff] [blame] | 40 | "android.hardware.tetheroffload.control-V1.1-java", |
markchien | 75fc6ab | 2020-01-14 17:28:47 +0800 | [diff] [blame] | 41 | "net-utils-framework-common", |
Chalard Jean | bdcca92 | 2020-06-26 00:19:33 +0900 | [diff] [blame] | 42 | "net-utils-device-common", |
lucaslin | ee661df | 2020-12-28 16:44:49 +0800 | [diff] [blame] | 43 | "netd-client", |
markchien | dfa5697 | 2021-05-10 00:34:47 +0800 | [diff] [blame] | 44 | "NetworkStackApiCurrentShims", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 45 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 46 | libs: [ |
Remi NGUYEN VAN | cfe6763 | 2021-01-15 20:26:28 +0900 | [diff] [blame] | 47 | "framework-connectivity", |
waynema | b7048af | 2020-06-19 19:48:56 +0800 | [diff] [blame] | 48 | "framework-statsd.stubs.module_lib", |
Paul Duffin | 2dae272 | 2020-05-13 12:28:49 +0100 | [diff] [blame] | 49 | "framework-tethering.impl", |
Paul Duffin | 6812c1b | 2020-05-31 11:35:50 +0100 | [diff] [blame] | 50 | "framework-wifi", |
Artur Satayev | 4784fb0 | 2019-12-10 17:47:53 +0000 | [diff] [blame] | 51 | "unsupportedappusage", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 52 | ], |
markchien | 84a9282 | 2020-01-16 11:21:53 +0800 | [diff] [blame] | 53 | plugins: ["java_api_finder"], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 54 | manifest: "AndroidManifestBase.xml", |
| 55 | } |
| 56 | |
| 57 | // Build tethering static library, used to compile both variants of the tethering. |
| 58 | android_library { |
| 59 | name: "TetheringApiCurrentLib", |
| 60 | defaults: ["TetheringAndroidLibraryDefaults"], |
| 61 | } |
| 62 | |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 63 | // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). |
| 64 | cc_library { |
markchien | f87ebdc | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 65 | name: "libtetherutilsjni", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 66 | sdk_version: "current", |
Jooyung Han | 8182d8b | 2020-04-29 02:43:30 +0900 | [diff] [blame] | 67 | apex_available: [ |
| 68 | "//apex_available:platform", // Used by InProcessTethering |
| 69 | "com.android.tethering", |
| 70 | ], |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 71 | min_sdk_version: "30", |
Lorenzo Colitti | 734b14e | 2021-02-05 23:56:09 +0900 | [diff] [blame] | 72 | header_libs: [ |
| 73 | "bpf_syscall_wrappers", |
| 74 | "bpf_tethering_headers", |
| 75 | ], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 76 | srcs: [ |
markchien | 7052688 | 2020-11-12 00:17:15 +0800 | [diff] [blame] | 77 | "jni/*.cpp", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 78 | ], |
| 79 | shared_libs: [ |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 80 | "liblog", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 81 | "libnativehelper_compat_libc++", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 82 | ], |
Orion Hodson | e5bd0db | 2020-12-08 09:57:42 +0000 | [diff] [blame] | 83 | static_libs: [ |
| 84 | "libnetjniutils", |
| 85 | ], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 86 | |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 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 | |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 98 | cflags: [ |
| 99 | "-Wall", |
| 100 | "-Werror", |
| 101 | "-Wno-unused-parameter", |
| 102 | "-Wthread-safety", |
| 103 | ], |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 104 | |
| 105 | ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 106 | } |
| 107 | |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 108 | // Common defaults for compiling the actual APK. |
| 109 | java_defaults { |
| 110 | name: "TetheringAppDefaults", |
Anton Hansson | bbe4af1 | 2020-03-18 14:15:42 +0000 | [diff] [blame] | 111 | sdk_version: "module_current", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 112 | privileged: true, |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 113 | jni_libs: [ |
markchien | f87ebdc | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 114 | "libtetherutilsjni", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 115 | ], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 116 | resource_dirs: [ |
| 117 | "res", |
| 118 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 119 | libs: [ |
| 120 | "framework-tethering", |
Anton Hansson | b8a342e | 2020-10-02 16:38:21 +0100 | [diff] [blame] | 121 | "framework-wifi", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 122 | ], |
| 123 | jarjar_rules: "jarjar-rules.txt", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 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 |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 130 | android_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"], |
markchien | dbaff66 | 2020-05-05 17:42:44 +0800 | [diff] [blame] | 138 | apex_available: ["com.android.tethering"], |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 139 | min_sdk_version: "30", |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 140 | } |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 141 | |
| 142 | // Updatable tethering packaged as an application |
| 143 | android_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 |
Aaron Huang | a546d85 | 2021-04-27 20:24:24 +0800 | [diff] [blame] | 151 | required: [ |
| 152 | "NetworkPermissionConfig", |
| 153 | "privapp_whitelist_com.android.networkstack.tethering", |
| 154 | ], |
Jiyong Park | 1eb8933 | 2020-01-06 13:30:59 +0900 | [diff] [blame] | 155 | apex_available: ["com.android.tethering"], |
Nikita Ioffe | 583e35a | 2020-10-31 22:41:41 +0000 | [diff] [blame] | 156 | min_sdk_version: "30", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 157 | } |
Hai Zhang | 6d71f10 | 2021-02-14 06:38:22 +0000 | [diff] [blame] | 158 | |
| 159 | sdk { |
| 160 | name: "tethering-module-sdk", |
Anton Hansson | 3669599 | 2021-06-07 15:46:33 +0100 | [diff] [blame] | 161 | bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"], |
Hai Zhang | 6d71f10 | 2021-02-14 06:38:22 +0000 | [diff] [blame] | 162 | } |