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