1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5filegroup {
6    name: "framework-bluetooth-sources",
7    defaults: ["framework-sources-module-defaults"],
8    srcs: [
9        "java/**/*.aidl",
10        "java/**/*.java",
11    ],
12    path: "java",
13}
14
15// defaults shared between `framework-bluetooth` & `framework-bluetooth-pre-jarjar`
16// java_sdk_library `framework-bluetooth` needs sources to generate stubs, so it cannot reuse
17// `framework-bluetooth-pre-jarjar`
18java_defaults {
19    name: "framework-bluetooth-defaults",
20    static_libs: [
21        "PlatformProperties",
22        "bluetooth_flags_java_lib",
23        "modules-utils-expresslog",
24        "service-bluetooth-binder-aidl",
25    ],
26    libs: [
27        "app-compat-annotations",
28        "framework-tethering.stubs.module_lib",
29        "unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage
30    ],
31    stub_only_libs: [
32        // TODO: b/332362688 --- Metalava should already ignore our library
33        "bluetooth_flags_java_lib",
34        "framework-tethering.stubs.module_lib",
35    ],
36    srcs: [
37        ":Bluetooth-binder-aidl",
38        ":framework-bluetooth-sources",
39    ],
40    min_sdk_version: "Tiramisu",
41}
42
43// bluetooth-service needs pre-jarjared version of framework-bluetooth so it can reference copied utility
44// classes before they are renamed.
45java_library {
46    name: "framework-bluetooth-pre-jarjar",
47    defaults: ["framework-bluetooth-defaults"],
48    sdk_version: "module_current",
49    libs: ["framework-annotations-lib"],
50    installable: false,
51}
52
53// post-jarjar version of framework-bluetooth
54java_sdk_library {
55    name: "framework-bluetooth",
56    defaults: [
57        "framework-bluetooth-defaults",
58        "framework-module-defaults",
59    ],
60
61    jarjar_rules: ":bluetooth-jarjar-rules",
62    installable: true,
63    optimize: {
64        enabled: false,
65    },
66    hostdex: true, // for hiddenapi check
67
68    impl_library_visibility: [
69        "//external/sl4a/Common",
70        "//packages/modules/Bluetooth/android/app/tests/unit",
71        "//packages/modules/Bluetooth/android/pandora/server",
72        "//packages/modules/Bluetooth/framework/tests/bumble",
73        "//packages/modules/Bluetooth/service",
74        "//packages/services/Car/car-builtin-lib",
75        // TODO(240720385)
76        "//packages/services/Car/tests/carservice_unit_test",
77        ":__subpackages__",
78    ],
79
80    apex_available: [
81        "com.android.btservices",
82    ],
83
84    permitted_packages: [
85        "android.bluetooth",
86        "com.android.bluetooth.flags",
87        "com.android.bluetooth.jarjar",
88    ],
89    errorprone: {
90        javacflags: [
91            "-Xep:InlineMeSuggester:OFF", // The @InlineMe annotation is not available
92
93            "-Xep:BadImport:ERROR",
94            "-Xep:CatchFail:ERROR",
95            "-Xep:ClassCanBeStatic:ERROR",
96            "-Xep:EmptyBlockTag:ERROR",
97            "-Xep:EmptyCatch:ERROR",
98            "-Xep:FutureReturnValueIgnored:ERROR",
99            "-Xep:InlineMeInliner:ERROR",
100            "-Xep:InvalidBlockTag:ERROR",
101            "-Xep:InvalidInlineTag:ERROR",
102            "-Xep:InvalidParam:ERROR",
103            "-Xep:MockNotUsedInProduction:ERROR",
104            "-Xep:NonApiType:ERROR",
105            "-Xep:NonCanonicalType:ERROR",
106            "-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
107            "-Xep:StringCharset:ERROR",
108            "-Xep:UnnecessaryAssignment:ERROR",
109            "-Xep:UnnecessaryAsync:ERROR",
110
111            "-XepExcludedPaths:.*/srcjars/.*", // Exclude generated files
112        ],
113        enabled: true,
114    },
115    lint: {
116        strict_updatability_linting: true,
117    },
118}
119
120// defaults for tests that need to build against framework-bluetooths's @hide APIs
121java_defaults {
122    name: "framework-bluetooth-tests-defaults",
123    sdk_version: "core_platform",
124    libs: [
125        // order matters: classes in framework-bluetooth are resolved before framework, meaning
126        // @hide APIs in framework-bluetooth are resolved before @SystemApi stubs in framework
127        "framework-bluetooth.impl",
128
129        "framework",
130        // if sdk_version="" this gets automatically included, but here we need to add manually.
131        "framework-res",
132    ],
133    defaults_visibility: ["//visibility:public"],
134}
135
136filegroup {
137    name: "bluetooth-jarjar-rules",
138    srcs: ["jarjar-rules.txt"],
139}
140
141platform_compat_config {
142    name: "framework-bluetooth-compat-config",
143    src: ":framework-bluetooth",
144}
145