1// Copyright (C) 2021 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_team: "trendy_team_fwk_core_networking",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20filegroup {
21    name: "nearby-service-srcs",
22    srcs: [
23        "java/**/*.java",
24        ":statslog-nearby-java-gen",
25    ],
26}
27
28// Main lib for nearby services.
29java_library {
30    name: "service-nearby-pre-jarjar",
31    srcs: [":nearby-service-srcs"],
32
33    defaults: [
34        "framework-system-server-module-defaults",
35    ],
36    libs: [
37        "androidx.annotation_annotation",
38        "framework-bluetooth",
39        "error_prone_annotations",
40        "framework-configinfrastructure",
41        "framework-connectivity-t.impl",
42        "framework-statsd",
43    ],
44    static_libs: [
45        "androidx.core_core",
46        "android.hardware.bluetooth.finder-V1-java",
47        "guava",
48        "libprotobuf-java-lite",
49        "modules-utils-build",
50        "modules-utils-handlerexecutor",
51        "modules-utils-preconditions",
52        "modules-utils-backgroundthread",
53        "presence-lite-protos",
54    ],
55    sdk_version: "system_server_current",
56    // This is included in service-connectivity which is 30+
57    // TODO (b/293613362): allow APEXes to have service jars with higher min_sdk than the APEX
58    // (service-connectivity is only used on 31+) and use 31 here
59    min_sdk_version: "30",
60
61    dex_preopt: {
62        enabled: false,
63        app_image: false,
64    },
65    visibility: [
66        "//packages/modules/Nearby/apex",
67    ],
68    apex_available: [
69        "com.android.tethering",
70    ],
71    lint: {
72        baseline_filename: "lint-baseline.xml",
73    },
74}
75
76genrule {
77    name: "statslog-nearby-java-gen",
78    tools: ["stats-log-api-gen"],
79    cmd: "$(location stats-log-api-gen) --java $(out) --module nearby " +
80        " --javaPackage com.android.server.nearby.proto --javaClass NearbyStatsLog" +
81        " --minApiLevel 33",
82    out: ["com/android/server/nearby/proto/NearbyStatsLog.java"],
83}
84