• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2024 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//
16package {
17    default_team: "trendy_team_fwk_uwb",
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21java_defaults {
22    name: "service-ranging-common-defaults",
23    defaults: ["ranging-module-sdk-version-defaults"],
24    errorprone: {
25        javacflags: ["-Xep:CheckReturnValue:ERROR"],
26    },
27    java_version: "21",
28}
29
30filegroup {
31    name: "service-ranging-srcs",
32    srcs: [
33        "java/**/*.java",
34        ":service-uwb-shared-with-ranging-srcs",
35        ":statslog-ranging-java-gen",
36    ],
37}
38
39// pre-jarjar version of service-ranging that builds against pre-jarjar version of framework-uwb
40java_library {
41    name: "service-ranging-pre-jarjar",
42    min_sdk_version: "33",
43    installable: false,
44    defaults: ["service-ranging-common-defaults"],
45    srcs: [":service-ranging-srcs"],
46    sdk_version: "system_server_current",
47
48    plugins: [
49        "auto_value_plugin",
50    ],
51    libs: [
52        "androidx.annotation_annotation",
53        "error_prone_annotations",
54        "framework-annotations-lib",
55        "framework-configinfrastructure.stubs.module_lib",
56        "framework-statsd.stubs.module_lib",
57        "framework-wifi.stubs.module_lib",
58        "framework-bluetooth.stubs.module_lib",
59        "framework-location.stubs.module_lib",
60        "ServiceUwbResources",
61    ],
62
63    static_libs: [
64        "guava",
65        "modules-utils-shell-command-handler",
66        "modules-utils-handlerexecutor",
67        // TODO: migrate away from auto value if possible.
68        "auto_value_annotations",
69        "framework-ranging-pre-jarjar",
70        "com.uwb.fusion",
71        "ranging_rtt_backend",
72        "ranging_uwb_backend",
73        "ranging_flags_lib",
74    ],
75
76    apex_available: [
77        "com.android.uwb",
78    ],
79}
80
81// service-ranging static library
82// ============================================================
83java_library {
84    name: "service-ranging",
85    min_sdk_version: "33",
86    defaults: [
87        "service-ranging-common-defaults",
88        "standalone-system-server-module-optimize-defaults",
89    ],
90    installable: true,
91    static_libs: [
92        "service-ranging-pre-jarjar",
93        "ranging_uwb_backend",
94    ],
95
96    // Need to include `libs` so that Soong doesn't complain about missing classes after jarjaring
97    // The below libraries are not actually needed to build since no source is compiled
98    // but they are necessary so that R8 has the right references to optimize the code.
99    // Without these, there will be missing class warnings and code may be wrongly optimized.
100    // TODO(b/242088131): remove libraries that aren't used directly
101    libs: [
102        "framework-ranging.impl",
103        "framework-statsd.stubs.module_lib",
104        "framework-wifi.stubs.module_lib",
105        "framework-bluetooth.stubs.module_lib",
106        "framework-connectivity.stubs.module_lib",
107    ],
108
109    sdk_version: "system_server_current",
110
111    jarjar_rules: ":ranging-jarjar-rules",
112    //optimize: {
113    //proguard_flags_files: ["proguard.flags"],
114    //},
115    visibility: [
116        "//packages/modules/Uwb/apex",
117    ],
118    apex_available: [
119        "com.android.uwb",
120    ],
121}
122
123// Metrics logging
124// ============================================================
125genrule {
126    name: "statslog-ranging-java-gen",
127    tools: ["stats-log-api-gen"],
128    cmd: "$(location stats-log-api-gen) " +
129        "--java $(out) " +
130        "--module ranging " +
131        "--javaPackage com.android.server.ranging.metrics " +
132        "--javaClass RangingStatsLog",
133    out: ["com/android/server/ranging/metrics/RangingStatsLog.java"],
134}
135