1// Copyright 2022, 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_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19// Libraries for the API shims
20java_defaults {
21    name: "BluetoothShimsDefaults",
22    libs: [
23        "androidx.annotation_annotation",
24    ],
25    static_libs : [
26        "modules-utils-build_system"
27    ],
28    apex_available: [
29        "com.android.btservices",
30    ],
31    min_sdk_version: "Tiramisu",
32}
33
34// Common shim code. This includes the shim interface definitions themselves.
35// Compiles against system_current because ShimUtils
36// needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK.
37java_library {
38    name: "BluetoothShimsCommon",
39    defaults: [
40        "BluetoothShimsDefaults",
41    ],
42    srcs: ["common/**/*.java"],
43    sdk_version: "system_current",
44    visibility: ["//visibility:private"],
45}
46
47// Each level of the shims (33, 34, ...) is its own java_library compiled against the corresponding
48// system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level.
49java_library {
50    name: "BluetoothApi33Shims",
51    defaults: [
52        "BluetoothShimsDefaults",
53    ],
54    srcs: [
55        "33/**/*.java",
56    ],
57    libs: [
58        "BluetoothShimsCommon",
59    ],
60    sdk_version: "module_33",
61    visibility: ["//visibility:private"],
62}
63
64java_library {
65    name: "BluetoothApi34Shims",
66    defaults: [
67        "BluetoothShimsDefaults",
68    ],
69    srcs: [
70        "34/**/*.java",
71    ],
72    libs: [
73        "BluetoothShimsCommon",
74        "BluetoothApi33Shims",
75    ],
76    sdk_version: "module_current",
77    visibility: ["//visibility:private"],
78}
79
80java_library {
81    name: "BluetoothApiShims",
82    defaults: [
83        "BluetoothShimsDefaults",
84    ],
85    static_libs: [
86        "BluetoothShimsCommon",
87        "BluetoothApi33Shims",
88        "BluetoothApi34Shims",
89    ],
90    visibility: [
91        "//packages/modules/Bluetooth/android/app",
92    ],
93    sdk_version: "module_33",
94}