blob: 12daa6142d5c69300a93f11ef97e0550a7a383ae [file] [log] [blame]
markchien017fef22019-08-27 10:19:38 +08001//
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
17java_defaults {
18 name: "TetheringAndroidLibraryDefaults",
Anton Hansson383321e2020-03-18 14:15:42 +000019 sdk_version: "module_current",
markchien017fef22019-08-27 10:19:38 +080020 srcs: [
21 "src/**/*.java",
markchiena6ba54d2019-09-03 15:58:06 +080022 ":framework-tethering-shared-srcs",
markchien92b8e7f2020-01-07 14:43:17 +080023 ":tethering-module-utils-srcs",
markchiena6ba54d2019-09-03 15:58:06 +080024 ":services-tethering-shared-srcs",
markchien017fef22019-08-27 10:19:38 +080025 ],
26 static_libs: [
27 "androidx.annotation_annotation",
Lorenzo Colitti9bf6b412020-06-10 00:59:37 +090028 "netd_aidl_interface-java",
Remi NGUYEN VAN882d8b32019-08-09 15:52:06 +090029 "netlink-client",
Jeongik Chaf17753a2020-05-07 11:26:19 +000030 "networkstack-aidl-interfaces-java",
markchien0d5a36b2020-02-05 12:42:25 +080031 "android.hardware.tetheroffload.config-V1.0-java",
markchien77c17be62019-09-25 14:33:39 +080032 "android.hardware.tetheroffload.control-V1.0-java",
markchien21372af2020-01-14 17:28:47 +080033 "net-utils-framework-common",
markchien017fef22019-08-27 10:19:38 +080034 ],
markchien6d06f6d2019-12-16 20:15:20 +080035 libs: [
waynema41e5aac2020-06-19 19:48:56 +080036 "framework-statsd.stubs.module_lib",
Paul Duffina66161e2020-05-13 12:28:49 +010037 "framework-tethering.impl",
Paul Duffinabebc6a2020-05-31 11:35:50 +010038 "framework-wifi",
Artur Satayev2d330f62019-12-10 17:47:53 +000039 "unsupportedappusage",
markchien6d06f6d2019-12-16 20:15:20 +080040 ],
markchien8fad2082020-01-16 11:21:53 +080041 plugins: ["java_api_finder"],
markchien017fef22019-08-27 10:19:38 +080042 manifest: "AndroidManifestBase.xml",
43}
44
45// Build tethering static library, used to compile both variants of the tethering.
46android_library {
47 name: "TetheringApiCurrentLib",
48 defaults: ["TetheringAndroidLibraryDefaults"],
49}
50
markchiend8676d92019-10-23 16:27:52 +080051// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
52cc_library {
markchien771c3e92019-12-07 22:02:28 +080053 name: "libtetherutilsjni",
markchien0d5a36b2020-02-05 12:42:25 +080054 sdk_version: "current",
Jooyung Hanfc025252020-04-29 02:43:30 +090055 apex_available: [
56 "//apex_available:platform", // Used by InProcessTethering
57 "com.android.tethering",
58 ],
59 min_sdk_version: "current",
markchien77c17be62019-09-25 14:33:39 +080060 srcs: [
markchien771c3e92019-12-07 22:02:28 +080061 "jni/android_net_util_TetheringUtils.cpp",
markchien77c17be62019-09-25 14:33:39 +080062 ],
63 shared_libs: [
markchien77c17be62019-09-25 14:33:39 +080064 "liblog",
markchien0d5a36b2020-02-05 12:42:25 +080065 "libnativehelper_compat_libc++",
markchien77c17be62019-09-25 14:33:39 +080066 ],
67
markchien0d5a36b2020-02-05 12:42:25 +080068 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
69 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
70 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
71 // build because soong complains of:
72 // module Tethering missing dependencies: libc++_shared
73 //
74 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
75 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
76 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
77 stl: "c++_static",
78
markchien77c17be62019-09-25 14:33:39 +080079 cflags: [
80 "-Wall",
81 "-Werror",
82 "-Wno-unused-parameter",
83 "-Wthread-safety",
84 ],
markchiend8676d92019-10-23 16:27:52 +080085
86 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien77c17be62019-09-25 14:33:39 +080087}
88
markchien017fef22019-08-27 10:19:38 +080089// Common defaults for compiling the actual APK.
90java_defaults {
91 name: "TetheringAppDefaults",
Anton Hansson383321e2020-03-18 14:15:42 +000092 sdk_version: "module_current",
markchien017fef22019-08-27 10:19:38 +080093 privileged: true,
markchien77c17be62019-09-25 14:33:39 +080094 jni_libs: [
markchien771c3e92019-12-07 22:02:28 +080095 "libtetherutilsjni",
markchien77c17be62019-09-25 14:33:39 +080096 ],
markchien017fef22019-08-27 10:19:38 +080097 resource_dirs: [
98 "res",
99 ],
markchien6d06f6d2019-12-16 20:15:20 +0800100 libs: [
101 "framework-tethering",
102 ],
103 jarjar_rules: "jarjar-rules.txt",
markchien017fef22019-08-27 10:19:38 +0800104 optimize: {
105 proguard_flags_files: ["proguard.flags"],
106 },
107}
108
109// Non-updatable tethering running in the system server process for devices not using the module
markchien0df2ebc42019-09-30 14:40:57 +0800110android_app {
111 name: "InProcessTethering",
112 defaults: ["TetheringAppDefaults"],
113 static_libs: ["TetheringApiCurrentLib"],
114 certificate: "platform",
115 manifest: "AndroidManifest_InProcess.xml",
116 // InProcessTethering is a replacement for Tethering
117 overrides: ["Tethering"],
markchien523616a2020-05-05 17:42:44 +0800118 apex_available: ["com.android.tethering"],
Jooyung Han292dff52020-05-11 13:18:29 +0900119 min_sdk_version: "current",
markchien0df2ebc42019-09-30 14:40:57 +0800120}
markchien017fef22019-08-27 10:19:38 +0800121
122// Updatable tethering packaged as an application
123android_app {
124 name: "Tethering",
125 defaults: ["TetheringAppDefaults"],
126 static_libs: ["TetheringApiCurrentLib"],
127 certificate: "networkstack",
128 manifest: "AndroidManifest.xml",
129 use_embedded_native_libs: true,
130 // The permission configuration *must* be included to ensure security of the device
131 required: ["NetworkPermissionConfig"],
Jiyong Park90247c82020-01-06 13:30:59 +0900132 apex_available: ["com.android.tethering"],
Jooyung Hanfc025252020-04-29 02:43:30 +0900133 min_sdk_version: "current",
markchien017fef22019-08-27 10:19:38 +0800134}