summaryrefslogtreecommitdiff
path: root/common/Android.bp
blob: d8d0accb19f3d77459691927221ca200901052af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// 1. The "net-utils-framework-common" library is also compiled into the framework and placed on the
//    boot classpath. It uses jarjar rules so that anything outside the framework can use this
//    library directly.
// 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services.
//    It does not need to be jarjared because it is not placed on the bootclasspath.
// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which
//    places many of its classes, even non-API service classes, on the boot classpath. Any file that
//    is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar
//    rules file. Otherwise, it will end up on the boot classpath and other modules will not be able
//    to provide their own copy.

// Note: all filegroups here must have the right path attribute because otherwise, if they are
// included in the bootclasspath, they could incorrectly be included in the SDK documentation even
// though they are not in the current.txt files.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

java_library {
  name: "net-utils-device-common",
  srcs: [
      "device/com/android/net/module/util/arp/ArpPacket.java",
      "device/com/android/net/module/util/DeviceConfigUtils.java",
      "device/com/android/net/module/util/DomainUtils.java",
      "device/com/android/net/module/util/FdEventsReader.java",
      "device/com/android/net/module/util/NetworkMonitorUtils.java",
      "device/com/android/net/module/util/PacketReader.java",
      "device/com/android/net/module/util/SharedLog.java",
      "device/com/android/net/module/util/SocketUtils.java",
      "device/com/android/net/module/util/FeatureVersions.java",
      // This library is used by system modules, for which the system health impact of Kotlin
      // has not yet been evaluated. Annotations may need jarjar'ing.
      // "src_devicecommon/**/*.kt",
  ],
  sdk_version: "module_current",
  min_sdk_version: "29",
  target_sdk_version: "30",
  apex_available: [
      "//apex_available:anyapex",
      "//apex_available:platform",
  ],
  visibility: [
        "//frameworks/base/packages/Tethering",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/Connectivity/framework:__subpackages__",
        "//frameworks/opt/net/ike",
        "//frameworks/opt/net/wifi/service",
        "//packages/modules/Wifi/service",
        "//frameworks/opt/net/telephony",
        "//packages/modules/NetworkStack:__subpackages__",
        "//packages/modules/CaptivePortalLogin",
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/testutils:__subpackages__",
  ],
  static_libs: [
      "net-utils-framework-common",
  ],
  libs: [
      "androidx.annotation_annotation",
      "framework-annotations-lib",
      "framework-configinfrastructure",
      "framework-connectivity.stubs.module_lib",
  ],
  lint: { strict_updatability_linting: true },
}

java_defaults {
    name: "lib_mockito_extended",
    static_libs: [
        "mockito-target-extended-minus-junit4"
    ],
    jni_libs: [
        "libdexmakerjvmtiagent",
        "libstaticjvmtiagent",
    ],
}

java_library {
    name: "net-utils-dnspacket-common",
    srcs: [
    "framework/**/DnsPacket.java",
    "framework/**/DnsPacketUtils.java",
    ],
    sdk_version: "module_current",
    visibility: [
        "//packages/services/Iwlan:__subpackages__",
    ],
    libs: [
        "framework-annotations-lib",
        "framework-connectivity.stubs.module_lib",
    ],
}

filegroup {
    name: "net-utils-framework-common-srcs",
    srcs: ["framework/**/*.java"],
    path: "framework",
    visibility: [
        "//frameworks/base",
        "//packages/modules/Connectivity:__subpackages__",
    ],
}

java_library {
    name: "net-utils-device-common-bpf",
    srcs: [
        "device/com/android/net/module/util/BpfBitmap.java",
        "device/com/android/net/module/util/BpfDump.java",
        "device/com/android/net/module/util/BpfMap.java",
        "device/com/android/net/module/util/BpfUtils.java",
        "device/com/android/net/module/util/IBpfMap.java",
        "device/com/android/net/module/util/JniUtil.java",
        "device/com/android/net/module/util/Struct.java",
        "device/com/android/net/module/util/TcUtils.java",
        "framework/com/android/net/module/util/HexDump.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/NetworkStack:__subpackages__",
    ],
    libs: [
        "androidx.annotation_annotation",
        "framework-connectivity.stubs.module_lib",
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    name: "net-utils-device-common-struct",
    srcs: [
        "device/com/android/net/module/util/Ipv6Utils.java",
        "device/com/android/net/module/util/PacketBuilder.java",
        "device/com/android/net/module/util/Struct.java",
        "device/com/android/net/module/util/structs/*.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/NetworkStack:__subpackages__",
    ],
    static_libs: [
        "net-utils-framework-common",
    ],
    libs: [
        "androidx.annotation_annotation",
        "framework-connectivity.stubs.module_lib",
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    name: "net-utils-device-common-netlink",
    srcs: [
        "device/com/android/net/module/util/netlink/*.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/NetworkStack:__subpackages__",
    ],
    static_libs: [
        "net-utils-device-common-struct",
    ],
    libs: [
        "androidx.annotation_annotation",
        "framework-connectivity.stubs.module_lib",
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    // TODO : this target should probably be folded into net-utils-device-common
    name: "net-utils-device-common-ip",
    srcs: [
        "device/com/android/net/module/util/ip/*.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/NetworkStack:__subpackages__",
    ],
    libs: [
        "framework-annotations-lib",
        "framework-connectivity",
    ],
    static_libs: [
        "net-utils-device-common",
        "net-utils-device-common-netlink",
        "net-utils-framework-common",
        "netd-client",
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    name: "net-utils-framework-common",
    srcs: [
        ":net-utils-framework-common-srcs",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    libs: [
        "androidx.annotation_annotation",
        "framework-annotations-lib",
        "framework-connectivity.stubs.module_lib",
        "framework-connectivity-t.stubs.module_lib",
        "framework-location.stubs.module_lib",
    ],
    jarjar_rules: "jarjar-rules-shared.txt",
    visibility: [
        "//cts/tests/tests/net",
        "//cts/tests/tests/wifi",
        "//packages/modules/Connectivity/tests/cts/net",
        "//frameworks/base/packages/Tethering",
        "//packages/modules/Connectivity/Tethering",
        "//frameworks/base/tests:__subpackages__",
        "//frameworks/opt/net/ike",
        "//frameworks/opt/telephony",
        "//frameworks/base/wifi:__subpackages__",
        "//frameworks/base/packages/Connectivity:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
        "//packages/modules/NetworkStack:__subpackages__",
        "//packages/modules/CaptivePortalLogin",
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/device",
        "//packages/modules/Wifi/framework/tests:__subpackages__",
        "//packages/apps/Settings",
    ],
    lint: { strict_updatability_linting: true },
    errorprone: {
        enabled: true,
        // Error-prone checking only warns of problems when building. To make the build fail with
        // these errors, list the specific error-prone problems below.
        javacflags: [
            "-Xep:NullablePrimitive:ERROR",
        ],
    },
}

java_library {
    name: "net-utils-services-common",
    srcs: [
        "device/android/net/NetworkFactory.java",
        "device/android/net/NetworkFactoryImpl.java",
        "device/android/net/NetworkFactoryLegacyImpl.java",
        "device/android/net/NetworkFactoryShim.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "30",
    static_libs: [
        "modules-utils-build_system",
    ],
    libs: [
        "framework-annotations-lib",
        "framework-connectivity",
    ],
    // TODO: remove "apex_available:platform".
    apex_available: [
        "//apex_available:platform",
        "com.android.btservices",
        "com.android.tethering",
        "com.android.wifi",
    ],
    visibility: [
        // TODO: remove after NetworkStatsService moves to the module.
        "//frameworks/base/services/net",
        "//packages/modules/Connectivity/service",
        "//packages/modules/Connectivity/tests:__subpackages__",
        "//packages/modules/Bluetooth/android/app",
        "//packages/modules/Wifi/service:__subpackages__",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    name: "net-utils-device-common-async",
    srcs: [
        "device/com/android/net/module/util/async/*.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
    ],
    libs: [
        "framework-annotations-lib",
    ],
    static_libs: [
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

java_library {
    name: "net-utils-device-common-wear",
    srcs: [
        "device/com/android/net/module/util/wear/*.java",
    ],
    sdk_version: "module_current",
    min_sdk_version: "29",
    visibility: [
        "//frameworks/libs/net/common/tests:__subpackages__",
        "//frameworks/libs/net/common/testutils:__subpackages__",
        "//packages/modules/Connectivity:__subpackages__",
    ],
    libs: [
        "framework-annotations-lib",
    ],
    static_libs: [
        "net-utils-device-common-async",
    ],
    apex_available: [
        "com.android.tethering",
        "//apex_available:platform",
    ],
    lint: { strict_updatability_linting: true },
}

// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure
// the mDNS code can build with only system APIs.
// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that
// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build
// rule verifies that the mDNS code can be built into apps, if code transformations are applied to
// the annotations.
// When using "system_current", framework annotations are not available; they would appear as
// package-private as they are marked as such in the system_current stubs. So build against
// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7.
java_library {
    name: "net-utils-device-common-mdns-standalone-build-test",
    // Build against core_platform and add the stub libraries manually in "libs", as annotations
    // are already included in android_system_stubs_current but package-private, so
    // "framework-annotations-lib" needs to be manually included before
    // "android_system_stubs_current" (b/272392042)
    sdk_version: "core_platform",
    srcs: [
        "device/com/android/net/module/util/FdEventsReader.java",
        "device/com/android/net/module/util/SharedLog.java",
        "framework/com/android/net/module/util/ByteUtils.java",
        "framework/com/android/net/module/util/CollectionUtils.java",
        "framework/com/android/net/module/util/HexDump.java",
        "framework/com/android/net/module/util/LinkPropertiesUtils.java",
    ],
    libs: [
        "framework-annotations-lib",
        "android_system_stubs_current",
        "androidx.annotation_annotation",
    ],
    visibility: ["//packages/modules/Connectivity/service-t"],
}

// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
// included either (some annotations would be duplicated on the bootclasspath).
filegroup {
    name: "net-utils-telephony-common-srcs",
    srcs: [
        // Any class here *must* have a corresponding jarjar rule in the telephony build rules.
        "device/android/net/NetworkFactory.java",
        "device/android/net/NetworkFactoryImpl.java",
        "device/android/net/NetworkFactoryLegacyImpl.java",
        "device/android/net/NetworkFactoryShim.java",
    ],
    path: "device",
    visibility: [
        "//frameworks/opt/telephony",
    ],
}

// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar
// rules on the wifi side.
// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
filegroup {
    name: "net-utils-framework-wifi-common-srcs",
    srcs: [
        "framework/com/android/net/module/util/DnsSdTxtRecord.java",
        "framework/com/android/net/module/util/Inet4AddressUtils.java",
        "framework/com/android/net/module/util/InetAddressUtils.java",
        "framework/com/android/net/module/util/MacAddressUtils.java",
        "framework/com/android/net/module/util/NetUtils.java",
    ],
    path: "framework",
    visibility: [
        "//frameworks/base",
    ],
}

// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar
// rules on the wifi side.
// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
filegroup {
    name: "net-utils-wifi-service-common-srcs",
    srcs: [
       "device/android/net/NetworkFactory.java",
       "device/android/net/NetworkFactoryImpl.java",
       "device/android/net/NetworkFactoryLegacyImpl.java",
       "device/android/net/NetworkFactoryShim.java",
    ],
    visibility: [
        "//frameworks/opt/net/wifi/service",
        "//packages/modules/Wifi/service",
    ],
}