1//
2// Copyright (C) 2020 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
17package {
18    // See: http://go/android-license-faq
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22filegroup {
23    name: "framework-connectivity-internal-sources",
24    srcs: [
25        "src/**/*.java",
26        "src/**/*.aidl",
27    ],
28    path: "src",
29    visibility: [
30        "//visibility:private",
31    ],
32}
33
34filegroup {
35    name: "framework-connectivity-aidl-export-sources",
36    srcs: [
37        "aidl-export/**/*.aidl",
38    ],
39    path: "aidl-export",
40    visibility: [
41        "//visibility:private",
42    ],
43}
44
45// TODO: use a java_library in the bootclasspath instead
46filegroup {
47    name: "framework-connectivity-sources",
48    srcs: [
49        ":framework-connectivity-internal-sources",
50        ":framework-connectivity-aidl-export-sources",
51    ],
52    visibility: [
53        "//frameworks/base",
54        "//packages/modules/Connectivity:__subpackages__",
55    ],
56}
57
58java_sdk_library {
59    name: "framework-connectivity",
60    sdk_version: "module_current",
61    min_sdk_version: "30",
62    defaults: ["framework-module-defaults"],
63    installable: true,
64    srcs: [
65        ":framework-connectivity-sources",
66        ":net-utils-framework-common-srcs",
67    ],
68    aidl: {
69        include_dirs: [
70            // Include directories for parcelables that are part of the stable API, and need a
71            // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
72            // TODO(b/180293679): remove these dependencies as they should not be necessary once
73            // the module builds against API (the parcelable declarations exist in framework.aidl)
74            "frameworks/base/core/java", // For framework parcelables
75            "frameworks/native/aidl/binder", // For PersistableBundle.aidl
76        ],
77    },
78    impl_only_libs: [
79        "framework-tethering.stubs.module_lib",
80        "framework-wifi.stubs.module_lib",
81        "net-utils-device-common",
82    ],
83    libs: [
84        "unsupportedappusage",
85    ],
86    jarjar_rules: "jarjar-rules.txt",
87    permitted_packages: ["android.net"],
88    impl_library_visibility: [
89        "//packages/modules/Connectivity/Tethering/apex",
90        // In preparation for future move
91        "//packages/modules/Connectivity/apex",
92        "//packages/modules/Connectivity/service",
93        "//frameworks/base/packages/Connectivity/service",
94        "//frameworks/base",
95
96        // Tests using hidden APIs
97        "//cts/tests/netlegacy22.api",
98        "//external/sl4a:__subpackages__",
99        "//frameworks/base/packages/Connectivity/tests:__subpackages__",
100        "//frameworks/libs/net/common/testutils",
101        "//frameworks/libs/net/common/tests:__subpackages__",
102        "//frameworks/opt/telephony/tests/telephonytests",
103        "//packages/modules/CaptivePortalLogin/tests",
104        "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
105        "//packages/modules/Connectivity/tests:__subpackages__",
106        "//packages/modules/NetworkStack/tests:__subpackages__",
107        "//packages/modules/Wifi/service/tests/wifitests",
108    ],
109    apex_available: [
110        "com.android.tethering",
111    ],
112}
113
114cc_library_shared {
115    name: "libframework-connectivity-jni",
116    min_sdk_version: "30",
117    cflags: [
118        "-Wall",
119        "-Werror",
120        "-Wno-unused-parameter",
121        // Don't warn about S API usage even with
122        // min_sdk 30: the library is only loaded
123        // on S+ devices
124        "-Wno-unguarded-availability",
125        "-Wthread-safety",
126    ],
127    srcs: [
128        "jni/android_net_NetworkUtils.cpp",
129        "jni/onload.cpp",
130    ],
131    shared_libs: [
132        "libandroid",
133        "liblog",
134        "libnativehelper",
135    ],
136    header_libs: [
137        "dnsproxyd_protocol_headers",
138    ],
139    stl: "none",
140    apex_available: [
141        "com.android.tethering",
142    ],
143}
144