1//
2// Copyright (C) 2021 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    default_team: "trendy_team_fwk_core_networking",
19    // See: http://go/android-license-faq
20    default_applicable_licenses: ["Android-Apache-2.0"],
21}
22
23service_remoteauth_pre_jarjar_lib = "service-remoteauth-pre-jarjar"
24
25// Include build rules from Sources.bp
26build = ["Sources.bp"]
27
28filegroup {
29    name: "service-connectivity-tiramisu-sources",
30    srcs: [
31        "src/**/*.java",
32    ],
33    visibility: ["//visibility:private"],
34}
35
36// The above filegroup can be used to specify different sources depending
37// on the branch, while minimizing merge conflicts in the rest of the
38// build rules.
39
40// This builds T+ services depending on framework-connectivity-t
41// hidden symbols separately from the S+ services, to ensure that S+
42// services cannot accidentally depend on T+ hidden symbols from
43// framework-connectivity-t.
44java_library {
45    name: "service-connectivity-tiramisu-pre-jarjar",
46    sdk_version: "system_server_current",
47    // TODO(b/210962470): Bump this to at least S, and then T.
48    min_sdk_version: "30",
49    srcs: [
50        ":service-connectivity-tiramisu-sources",
51    ],
52    libs: [
53        "framework-annotations-lib",
54        "framework-configinfrastructure",
55        "framework-connectivity-pre-jarjar",
56        "framework-connectivity-t-pre-jarjar",
57        // TODO: use framework-tethering-pre-jarjar when it is separated from framework-tethering
58        "framework-tethering.impl",
59        "framework-wifi",
60        "service-connectivity-pre-jarjar",
61        "service-nearby-pre-jarjar",
62        "service-thread-pre-jarjar",
63        service_remoteauth_pre_jarjar_lib,
64        "ServiceConnectivityResources",
65        "unsupportedappusage",
66    ],
67    static_libs: [
68        // Do not add static_libs here if they are already included in framework-connectivity
69        // or in service-connectivity. They are not necessary (included via
70        // service-connectivity-pre-jarjar), and in the case of code that is already in
71        // framework-connectivity, the classes would be included in the apex twice.
72        "modules-utils-statemachine",
73    ],
74    apex_available: [
75        "com.android.tethering",
76    ],
77    visibility: [
78        "//frameworks/base/services/tests/VpnTests",
79        "//frameworks/base/tests/vcn",
80        "//packages/modules/Connectivity/service",
81        "//packages/modules/Connectivity/tests:__subpackages__",
82        "//packages/modules/IPsec/tests/iketests",
83    ],
84    lint: {
85        baseline_filename: "lint-baseline.xml",
86    },
87}
88
89// Test building mDNS as a standalone, so that it can be imported into other repositories as-is.
90// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that
91// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build
92// rule verifies that the mDNS code can be built into apps, if code transformations are applied to
93// the annotations.
94// When using "system_current", framework annotations are not available; they would appear as
95// package-private as they are marked as such in the system_current stubs. So build against
96// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7.
97java_library {
98    name: "service-connectivity-mdns-standalone-build-test",
99    sdk_version: "core_platform",
100    min_sdk_version: "21",
101    lint: {
102        error_checks: ["NewApi"],
103
104    },
105    srcs: [
106        "src/com/android/server/connectivity/mdns/**/*.java",
107        ":framework-connectivity-t-mdns-standalone-build-sources",
108        ":service-mdns-droidstubs",
109    ],
110    exclude_srcs: [
111        "src/com/android/server/connectivity/mdns/internal/SocketNetlinkMonitor.java",
112        "src/com/android/server/connectivity/mdns/SocketNetLinkMonitorFactory.java",
113        "src/com/android/server/connectivity/mdns/MdnsAdvertiser.java",
114        "src/com/android/server/connectivity/mdns/MdnsAnnouncer.java",
115        "src/com/android/server/connectivity/mdns/MdnsInterfaceAdvertiser.java",
116        "src/com/android/server/connectivity/mdns/MdnsProber.java",
117        "src/com/android/server/connectivity/mdns/MdnsRecordRepository.java",
118    ],
119    static_libs: [
120        "net-utils-device-common-mdns-standalone-build-test",
121    ],
122    libs: [
123        "framework-annotations-lib",
124        "android_system_stubs_current",
125        "androidx.annotation_annotation",
126    ],
127    visibility: [
128        "//visibility:private",
129    ],
130}
131
132droidstubs {
133    name: "service-mdns-droidstubs",
134    srcs: ["src/com/android/server/connectivity/mdns/SocketNetLinkMonitorFactory.java"],
135    libs: [
136        "net-utils-device-common-mdns-standalone-build-test",
137        "service-connectivity-tiramisu-pre-jarjar",
138    ],
139    visibility: [
140        "//visibility:private",
141    ],
142}
143