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_uwb",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20java_defaults {
21    name: "uwb-module-sdk-version-defaults",
22    min_sdk_version: "Tiramisu",
23}
24
25filegroup {
26    name: "framework-uwb-updatable-exported-aidl-sources",
27    srcs: ["aidl-export/**/*.aidl"],
28    path: "aidl-export",
29    visibility: ["//visibility:private"],
30}
31
32filegroup {
33    name: "framework-uwb-updatable-java-sources",
34    srcs: [
35        "java/**/*.java",
36        "java/**/*.aidl",
37    ],
38    path: "java",
39    visibility: ["//visibility:private"],
40}
41
42filegroup {
43    name: "framework-uwb-updatable-sources",
44    defaults: ["framework-sources-module-defaults"],
45    srcs: [
46        ":framework-uwb-updatable-java-sources",
47        ":framework-uwb-updatable-exported-aidl-sources",
48    ],
49}
50
51// defaults shared between `framework-uwb` & `framework-uwb-pre-jarjar`
52// java_sdk_library `framework-uwb` needs sources to generate stubs, so it cannot reuse
53// `framework-uwb-pre-jarjar`
54java_defaults {
55    name: "framework-uwb-defaults",
56    defaults: ["uwb-module-sdk-version-defaults"],
57    static_libs: [
58        "modules-utils-preconditions",
59        "modules-utils-build",
60        "uwb_aconfig_flags_lib",
61    ],
62    libs: [
63        "androidx.annotation_annotation",
64        "unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage
65    ],
66    srcs: [
67        ":framework-uwb-updatable-sources",
68    ],
69}
70
71// uwb-service needs pre-jarjared version of framework-uwb so it can reference copied utility
72// classes before they are renamed.
73java_library {
74    name: "framework-uwb-pre-jarjar",
75    defaults: ["framework-uwb-defaults"],
76    sdk_version: "module_current",
77    libs: ["framework-annotations-lib"],
78    installable: false,
79    lint: {
80        baseline_filename: "lint-baseline.xml",
81    },
82}
83
84// post-jarjar version of framework-uwb
85java_sdk_library {
86    name: "framework-uwb",
87    defaults: [
88        "framework-module-defaults",
89        "framework-uwb-defaults",
90    ],
91    jarjar_rules: ":uwb-jarjar-rules",
92
93    installable: true,
94    optimize: {
95        enabled: false,
96    },
97    hostdex: true, // for hiddenapi check
98
99    impl_library_visibility: [
100        "//external/sl4a/Common:__subpackages__",
101        "//packages/modules/Uwb:__subpackages__",
102    ],
103
104    aconfig_declarations: [
105        "uwb_aconfig_flags",
106    ],
107
108    apex_available: [
109        "com.android.uwb",
110    ],
111    permitted_packages: [
112        "android.uwb",
113        "android.uwb.util",
114        // Created by jarjar rules.
115        "com.android.x.uwb",
116    ],
117    lint: {
118        strict_updatability_linting: true,
119        baseline_filename: "lint-baseline.xml",
120    },
121}
122
123// defaults for tests that need to build against framework-uwb's @hide APIs
124java_defaults {
125    name: "framework-uwb-test-defaults",
126    sdk_version: "module_current",
127    libs: [
128        "framework-uwb.impl",
129    ],
130    defaults_visibility: [
131        "//packages/modules/Uwb/framework/tests:__subpackages__",
132        "//packages/modules/Uwb/service/tests:__subpackages__",
133    ],
134}
135
136filegroup {
137    name: "uwb-jarjar-rules",
138    srcs: ["jarjar-rules.txt"],
139}
140