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 | |
| 17 | java_defaults { |
| 18 | name: "TetheringAndroidLibraryDefaults", |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 19 | // TODO (b/146757305): change to module API once available |
Remi NGUYEN VAN | b9379a5 | 2020-02-13 09:16:19 +0900 | [diff] [blame] | 20 | // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready. |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 21 | sdk_version: "core_platform", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 22 | srcs: [ |
| 23 | "src/**/*.java", |
markchien | 43e97e0 | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 24 | ":framework-tethering-shared-srcs", |
markchien | 12c5bb8 | 2020-01-07 14:43:17 +0800 | [diff] [blame] | 25 | ":tethering-module-utils-srcs", |
markchien | 43e97e0 | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 26 | ":services-tethering-shared-srcs", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 27 | ], |
| 28 | static_libs: [ |
| 29 | "androidx.annotation_annotation", |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 30 | "netd_aidl_interface-unstable-java", |
Remi NGUYEN VAN | 88998f4 | 2019-08-09 15:52:06 +0900 | [diff] [blame] | 31 | "netlink-client", |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 32 | "networkstack-aidl-interfaces-unstable-java", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 33 | "android.hardware.tetheroffload.config-V1.0-java", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 34 | "android.hardware.tetheroffload.control-V1.0-java", |
markchien | 75fc6ab | 2020-01-14 17:28:47 +0800 | [diff] [blame] | 35 | "net-utils-framework-common", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 36 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 37 | libs: [ |
Remi NGUYEN VAN | b9379a5 | 2020-02-13 09:16:19 +0900 | [diff] [blame] | 38 | // Order matters: framework-tethering needs to be before the system stubs, otherwise |
| 39 | // hidden fields in the framework-tethering classes (which are also used to generate stubs) |
| 40 | // will not be found. |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 41 | "framework-tethering", |
Remi NGUYEN VAN | b9379a5 | 2020-02-13 09:16:19 +0900 | [diff] [blame] | 42 | "android_system_stubs_current", |
| 43 | "framework-res", |
Artur Satayev | 4784fb0 | 2019-12-10 17:47:53 +0000 | [diff] [blame] | 44 | "unsupportedappusage", |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 45 | "android_system_stubs_current", |
| 46 | "framework-res", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 47 | ], |
markchien | 84a9282 | 2020-01-16 11:21:53 +0800 | [diff] [blame] | 48 | plugins: ["java_api_finder"], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 49 | manifest: "AndroidManifestBase.xml", |
| 50 | } |
| 51 | |
| 52 | // Build tethering static library, used to compile both variants of the tethering. |
| 53 | android_library { |
| 54 | name: "TetheringApiCurrentLib", |
| 55 | defaults: ["TetheringAndroidLibraryDefaults"], |
| 56 | } |
| 57 | |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 58 | // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). |
| 59 | cc_library { |
markchien | f87ebdc | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 60 | name: "libtetherutilsjni", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 61 | sdk_version: "current", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 62 | srcs: [ |
markchien | f87ebdc | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 63 | "jni/android_net_util_TetheringUtils.cpp", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 64 | ], |
| 65 | shared_libs: [ |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 66 | "liblog", |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 67 | "libnativehelper_compat_libc++", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 68 | ], |
| 69 | |
markchien | 547e168 | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 70 | // We cannot use plain "libc++" here to link libc++ dynamically because it results in: |
| 71 | // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found |
| 72 | // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't |
| 73 | // build because soong complains of: |
| 74 | // module Tethering missing dependencies: libc++_shared |
| 75 | // |
| 76 | // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries |
| 77 | // we depend on do not dynamically link libc++. This is currently the case, because liblog is |
| 78 | // C-only and libnativehelper_compat_libc also uses stl: "c++_static". |
| 79 | stl: "c++_static", |
| 80 | |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 81 | cflags: [ |
| 82 | "-Wall", |
| 83 | "-Werror", |
| 84 | "-Wno-unused-parameter", |
| 85 | "-Wthread-safety", |
| 86 | ], |
markchien | 810aa68 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 87 | |
| 88 | ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"], |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 89 | } |
| 90 | |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 91 | // Common defaults for compiling the actual APK. |
| 92 | java_defaults { |
| 93 | name: "TetheringAppDefaults", |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 94 | // TODO (b/146757305): change to module API once available |
Remi NGUYEN VAN | b9379a5 | 2020-02-13 09:16:19 +0900 | [diff] [blame] | 95 | // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready. |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 96 | sdk_version: "core_platform", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 97 | privileged: true, |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 98 | jni_libs: [ |
markchien | f87ebdc | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 99 | "libtetherutilsjni", |
markchien | 6aa3889 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 100 | ], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 101 | resource_dirs: [ |
| 102 | "res", |
| 103 | ], |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 104 | libs: [ |
Remi NGUYEN VAN | b9379a5 | 2020-02-13 09:16:19 +0900 | [diff] [blame] | 105 | // Order matters: framework-tethering needs to be before the system stubs, otherwise |
| 106 | // hidden fields in the framework-tethering classes (which are also used to generate stubs) |
| 107 | // will not be found. |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 108 | "framework-tethering", |
Remi NGUYEN VAN | 293d351 | 2020-01-31 15:05:22 +0900 | [diff] [blame] | 109 | "android_system_stubs_current", |
| 110 | "framework-res", |
markchien | 9d35382 | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 111 | ], |
| 112 | jarjar_rules: "jarjar-rules.txt", |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 113 | optimize: { |
| 114 | proguard_flags_files: ["proguard.flags"], |
| 115 | }, |
| 116 | } |
| 117 | |
| 118 | // 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] | 119 | android_app { |
| 120 | name: "InProcessTethering", |
| 121 | defaults: ["TetheringAppDefaults"], |
| 122 | static_libs: ["TetheringApiCurrentLib"], |
| 123 | certificate: "platform", |
| 124 | manifest: "AndroidManifest_InProcess.xml", |
| 125 | // InProcessTethering is a replacement for Tethering |
| 126 | overrides: ["Tethering"], |
markchien | ee6ad37 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 127 | } |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 128 | |
| 129 | // Updatable tethering packaged as an application |
| 130 | android_app { |
| 131 | name: "Tethering", |
| 132 | defaults: ["TetheringAppDefaults"], |
| 133 | static_libs: ["TetheringApiCurrentLib"], |
| 134 | certificate: "networkstack", |
| 135 | manifest: "AndroidManifest.xml", |
| 136 | use_embedded_native_libs: true, |
| 137 | // The permission configuration *must* be included to ensure security of the device |
| 138 | required: ["NetworkPermissionConfig"], |
Jiyong Park | 1eb8933 | 2020-01-06 13:30:59 +0900 | [diff] [blame] | 139 | apex_available: ["com.android.tethering"], |
markchien | 932da86 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 140 | } |