markchien | 017fef2 | 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", |
Anton Hansson | 383321e | 2020-03-18 14:15:42 +0000 | [diff] [blame] | 19 | sdk_version: "module_current", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 20 | srcs: [ |
| 21 | "src/**/*.java", |
markchien | a6ba54d | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 22 | ":framework-tethering-shared-srcs", |
markchien | 92b8e7f | 2020-01-07 14:43:17 +0800 | [diff] [blame] | 23 | ":tethering-module-utils-srcs", |
markchien | a6ba54d | 2019-09-03 15:58:06 +0800 | [diff] [blame] | 24 | ":services-tethering-shared-srcs", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 25 | ], |
| 26 | static_libs: [ |
| 27 | "androidx.annotation_annotation", |
Lorenzo Colitti | 9bf6b41 | 2020-06-10 00:59:37 +0900 | [diff] [blame] | 28 | "netd_aidl_interface-java", |
Remi NGUYEN VAN | 882d8b3 | 2019-08-09 15:52:06 +0900 | [diff] [blame] | 29 | "netlink-client", |
Jeongik Cha | f17753a | 2020-05-07 11:26:19 +0000 | [diff] [blame] | 30 | "networkstack-aidl-interfaces-java", |
markchien | 0d5a36b | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 31 | "android.hardware.tetheroffload.config-V1.0-java", |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 32 | "android.hardware.tetheroffload.control-V1.0-java", |
markchien | 21372af | 2020-01-14 17:28:47 +0800 | [diff] [blame] | 33 | "net-utils-framework-common", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 34 | ], |
markchien | 6d06f6d | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 35 | libs: [ |
Paul Duffin | a66161e | 2020-05-13 12:28:49 +0100 | [diff] [blame] | 36 | "framework-tethering.impl", |
Paul Duffin | abebc6a | 2020-05-31 11:35:50 +0100 | [diff] [blame] | 37 | "framework-wifi", |
Artur Satayev | 2d330f6 | 2019-12-10 17:47:53 +0000 | [diff] [blame] | 38 | "unsupportedappusage", |
markchien | 6d06f6d | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 39 | ], |
markchien | 8fad208 | 2020-01-16 11:21:53 +0800 | [diff] [blame] | 40 | plugins: ["java_api_finder"], |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 41 | manifest: "AndroidManifestBase.xml", |
| 42 | } |
| 43 | |
| 44 | // Build tethering static library, used to compile both variants of the tethering. |
| 45 | android_library { |
| 46 | name: "TetheringApiCurrentLib", |
| 47 | defaults: ["TetheringAndroidLibraryDefaults"], |
| 48 | } |
| 49 | |
markchien | d8676d9 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 50 | // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). |
| 51 | cc_library { |
markchien | 771c3e9 | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 52 | name: "libtetherutilsjni", |
markchien | 0d5a36b | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 53 | sdk_version: "current", |
Jooyung Han | fc02525 | 2020-04-29 02:43:30 +0900 | [diff] [blame] | 54 | apex_available: [ |
| 55 | "//apex_available:platform", // Used by InProcessTethering |
| 56 | "com.android.tethering", |
| 57 | ], |
| 58 | min_sdk_version: "current", |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 59 | srcs: [ |
markchien | 771c3e9 | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 60 | "jni/android_net_util_TetheringUtils.cpp", |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 61 | ], |
| 62 | shared_libs: [ |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 63 | "liblog", |
markchien | 0d5a36b | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 64 | "libnativehelper_compat_libc++", |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 65 | ], |
| 66 | |
markchien | 0d5a36b | 2020-02-05 12:42:25 +0800 | [diff] [blame] | 67 | // We cannot use plain "libc++" here to link libc++ dynamically because it results in: |
| 68 | // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found |
| 69 | // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't |
| 70 | // build because soong complains of: |
| 71 | // module Tethering missing dependencies: libc++_shared |
| 72 | // |
| 73 | // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries |
| 74 | // we depend on do not dynamically link libc++. This is currently the case, because liblog is |
| 75 | // C-only and libnativehelper_compat_libc also uses stl: "c++_static". |
| 76 | stl: "c++_static", |
| 77 | |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 78 | cflags: [ |
| 79 | "-Wall", |
| 80 | "-Werror", |
| 81 | "-Wno-unused-parameter", |
| 82 | "-Wthread-safety", |
| 83 | ], |
markchien | d8676d9 | 2019-10-23 16:27:52 +0800 | [diff] [blame] | 84 | |
| 85 | ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"], |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 86 | } |
| 87 | |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 88 | // Common defaults for compiling the actual APK. |
| 89 | java_defaults { |
| 90 | name: "TetheringAppDefaults", |
Anton Hansson | 383321e | 2020-03-18 14:15:42 +0000 | [diff] [blame] | 91 | sdk_version: "module_current", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 92 | privileged: true, |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 93 | jni_libs: [ |
markchien | 771c3e9 | 2019-12-07 22:02:28 +0800 | [diff] [blame] | 94 | "libtetherutilsjni", |
markchien | 77c17be6 | 2019-09-25 14:33:39 +0800 | [diff] [blame] | 95 | ], |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 96 | resource_dirs: [ |
| 97 | "res", |
| 98 | ], |
markchien | 6d06f6d | 2019-12-16 20:15:20 +0800 | [diff] [blame] | 99 | libs: [ |
| 100 | "framework-tethering", |
| 101 | ], |
| 102 | jarjar_rules: "jarjar-rules.txt", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 103 | optimize: { |
| 104 | proguard_flags_files: ["proguard.flags"], |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | // Non-updatable tethering running in the system server process for devices not using the module |
markchien | 0df2ebc4 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 109 | android_app { |
| 110 | name: "InProcessTethering", |
| 111 | defaults: ["TetheringAppDefaults"], |
| 112 | static_libs: ["TetheringApiCurrentLib"], |
| 113 | certificate: "platform", |
| 114 | manifest: "AndroidManifest_InProcess.xml", |
| 115 | // InProcessTethering is a replacement for Tethering |
| 116 | overrides: ["Tethering"], |
markchien | 523616a | 2020-05-05 17:42:44 +0800 | [diff] [blame] | 117 | apex_available: ["com.android.tethering"], |
Jooyung Han | 292dff5 | 2020-05-11 13:18:29 +0900 | [diff] [blame] | 118 | min_sdk_version: "current", |
markchien | 0df2ebc4 | 2019-09-30 14:40:57 +0800 | [diff] [blame] | 119 | } |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 120 | |
| 121 | // Updatable tethering packaged as an application |
| 122 | android_app { |
| 123 | name: "Tethering", |
| 124 | defaults: ["TetheringAppDefaults"], |
| 125 | static_libs: ["TetheringApiCurrentLib"], |
| 126 | certificate: "networkstack", |
| 127 | manifest: "AndroidManifest.xml", |
| 128 | use_embedded_native_libs: true, |
| 129 | // The permission configuration *must* be included to ensure security of the device |
| 130 | required: ["NetworkPermissionConfig"], |
Jiyong Park | 90247c8 | 2020-01-06 13:30:59 +0900 | [diff] [blame] | 131 | apex_available: ["com.android.tethering"], |
Jooyung Han | fc02525 | 2020-04-29 02:43:30 +0900 | [diff] [blame] | 132 | min_sdk_version: "current", |
markchien | 017fef2 | 2019-08-27 10:19:38 +0800 | [diff] [blame] | 133 | } |