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