• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// MAP API module
2
3package {
4    default_applicable_licenses: ["packages_apps_Bluetooth_license"],
5}
6
7// Added automatically by a large-scale-change that took the approach of
8// 'apply every license found to every target'. While this makes sure we respect
9// every license restriction, it may not be entirely correct.
10//
11// e.g. GPL in an MIT project might only apply to the contrib/ directory.
12//
13// Please consider splitting the single license below into multiple licenses,
14// taking care not to lose any license_kind information, and overriding the
15// default license using the 'licenses: [...]' property on targets as needed.
16//
17// For unused files, consider creating a 'fileGroup' with "//visibility:private"
18// to attach the license to, and including a comment whether the files may be
19// used in the current project.
20// See: http://go/android-license-faq
21license {
22    name: "packages_apps_Bluetooth_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26        "SPDX-license-identifier-BSD",
27    ],
28    // large-scale-change unable to identify any license_text files
29}
30
31java_library {
32    name: "bluetooth.mapsapi",
33
34    srcs: ["lib/mapapi/**/*.java"],
35    apex_available: ["com.android.bt"],
36    min_sdk_version: "Tiramisu",
37    sdk_version: "module_current",
38    lint: {
39        baseline_filename: "lint-baseline.xml",
40    },
41}
42
43java_library {
44    name: "mmslib",
45
46    srcs: [":framework-mms-shared-srcs"],
47    libs: ["unsupportedappusage"],
48    apex_available: ["com.android.bt"],
49    min_sdk_version: "Tiramisu",
50    sdk_version: "module_current",
51    lint: {
52        baseline_filename: "lint-baseline.xml",
53    },
54}
55
56// Bluetooth JNI
57
58cc_library_shared {
59    name: "libbluetooth_jni",
60    defaults: [
61        "fluoride_defaults",
62        "latest_android_hardware_audio_common_ndk_static",
63        "latest_android_hardware_bluetooth_audio_ndk_static",
64        "latest_android_media_audio_common_types_ndk_static",
65    ],
66    srcs: ["jni/**/*.cpp"],
67    version_script: "libbluetooth_jni.map",
68    header_libs: [
69        "jni_headers",
70        "libbluetooth_headers",
71    ],
72    aidl: {
73        libs: ["bluetooth_constants"],
74    },
75    include_dirs: [
76        "packages/modules/Bluetooth/system",
77        "packages/modules/Bluetooth/system/gd",
78    ],
79    // libbluetooth_jni is the jni lib included in the com.android.bt apex.
80    // As this library is inside an APEX the shared_libs that does not
81    // expose stubs are copied inside it. As a result using those as
82    // shared libraries is less interesting as they are not shared, so we link
83    // them statically to allow the linker to perform more optimisation.
84    //
85    // The only exception to this is libcrypto because the shared version
86    // is required to maintain FIPS compliance.
87    stl: "libc++_static",
88    static_libs: [
89        "aics",
90        "android.hardware.audio.common@5.0",
91        "android.hardware.bluetooth.audio@2.0",
92        "android.hardware.bluetooth.audio@2.1",
93        "android.hardware.bluetooth@1.0",
94        "android.hardware.bluetooth@1.1",
95        "android.hardware.common-V2-ndk",
96        "android.hardware.common.fmq-V1-ndk",
97        "android.system.suspend-V1-ndk",
98        "android.system.suspend.control-V1-ndk",
99        "avrcp-target-service",
100        "bluetooth_flags_c_lib",
101        "lib-bt-packets-avrcp",
102        "lib-bt-packets-base",
103        "libFraunhoferAAC",
104        "libaconfig_storage_read_api_cc",
105        "libbase",
106        "libbluetooth-types",
107        "libbluetooth_core_rs",
108        "libbluetooth_core_rs_bridge",
109        "libbluetooth_crypto_toolbox",
110        "libbluetooth_gd",
111        "libbluetooth_log",
112        "libbt-audio-asrc",
113        "libbt-audio-hal-interface",
114        "libbt-bta",
115        "libbt-btu-main-thread",
116        "libbt-common",
117        "libbt-hci",
118        "libbt-jni-thread",
119        "libbt-sbc-decoder",
120        "libbt-sbc-encoder",
121        "libbt-stack",
122        "libbtcore",
123        "libbtdevice",
124        "libbte",
125        "libbtif",
126        "libchrome",
127        "libcutils",
128        "libevent",
129        "libexpresslog",
130        "libflags_rust_cpp_bridge",
131        "libflatbuffers-cpp",
132        "libfmq",
133        "libg722codec",
134        "libhidlbase",
135        "liblc3",
136        "libmodpb64",
137        "libopus",
138        "libosi",
139        "libperfetto_client_experimental",
140        "libprotobuf-cpp-lite",
141        "libstatslog_bt",
142        "libstatslog_express",
143        "libtextclassifier_hash_static",
144        "libudrv-uipc",
145        "libutils",
146        "server_configurable_flags",
147    ],
148    shared_libs: [
149        "libaaudio",
150        "libbinder_ndk",
151        "libcrypto",
152        "liblog",
153        "libnativehelper",
154        "libstatssocket",
155        "libvndksupport",
156    ],
157    sanitize: {
158        scs: true,
159    },
160    apex_available: ["com.android.bt"],
161    min_sdk_version: "Tiramisu",
162}
163
164android_library {
165    name: "BluetoothLib",
166    defaults: ["bluetooth_framework_errorprone_rules"],
167    manifest: "LibAndroidManifest.xml",
168
169    srcs: [
170        ":statslog-bluetooth-java-gen",
171        ":statslog-bt-restricted-java-gen",
172        ":system-messages-proto-src",
173        "proto/keystore.proto",
174        "src/**/*.java",
175        "src/**/*.kt",
176    ],
177    proto: {
178        type: "lite",
179    },
180
181    libs: [
182        "PlatformProperties",
183        "bluetooth_constants_java",
184        "bluetooth_flags_java_lib",
185        "error_prone_annotations",
186        "framework-annotations-lib",
187        "framework-bluetooth.impl",
188        "framework-configinfrastructure.stubs.module_lib",
189        "framework-connectivity-t.stubs.module_lib",
190        "framework-connectivity.stubs.module_lib",
191        "framework-location.stubs.module_lib",
192        "framework-media.stubs.module_lib",
193        "framework-mediaprovider.stubs.module_lib",
194        "framework-statsd.stubs.module_lib",
195        "framework-tethering.stubs.module_lib",
196        "framework-wifi.stubs.module_lib",
197        "modules-utils-build",
198        "modules-utils-expresslog",
199    ],
200    static_libs: [
201        "BluetoothApiShims",
202        "android.hardware.radio-V1.0-java",
203        "android.hardware.radio.sap-V1-java",
204        "android.media.audio-aconfig-exported-java",
205        "android.os.flags-aconfig-java-export",
206        "androidx.annotation_annotation",
207        "androidx.core_core",
208        "androidx.lifecycle_lifecycle-livedata",
209        "androidx.media_media",
210        "androidx.room_room-runtime",
211        "bluetooth-proto-enums-java-gen",
212        "bluetooth-protos-lite",
213        "bluetooth.change-ids",
214        "bluetooth.mapsapi",
215        "com.android.obex",
216        "com.android.vcard",
217        "guava",
218        "libprotobuf-java-lite",
219        "mmslib",
220        "modules-utils-backgroundthread",
221        "modules-utils-bytesmatcher",
222        "modules-utils-statemachine",
223        "net-utils-services-common",
224        "networkstack-client",
225        "sap-api-java-static",
226    ],
227
228    plugins: [
229        "androidx.room_room-compiler-plugin",
230    ],
231
232    // Export schemas to the test directory so that we have an history
233    // to be able to test migrations
234    // The following path is absolute because a relative path doesn't work
235    // TODO(b/147596836): Refactor this
236    javacflags: ["-Aroom.schemaLocation=packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/schemas"],
237
238    lint: {
239        error_checks: [
240            "Autofill",
241            "DefaultLocale",
242            "DuplicateDefinition",
243            // "ExportedContentProvider", // TODO: b/289445022 - enable this check
244            // "ExportedReceiver", // TODO: b/289445022 - enable this check
245            // "ExportedService", // TODO: b/289445022 - enable this check
246            "ExtraText",
247            "ExtraTranslation",
248            "GestureBackNavigation",
249            "GuardedLogInvocation",
250            "HandlerLeak",
251            "InflateParams",
252            // "InvalidPermission", // TODO: b/289445022 - enable this check
253            "LabelFor",
254            "MissingClass",
255            // "MissingVersion", // TODO: b/289445022 - enable this check
256            "MonochromeLauncherIcon",
257            "NewApi",
258            "ObsoleteSdkInt",
259            // "QueryAllPackagesPermission", // TODO: b/289445022 - enable this check
260            "Recycle",
261            "RtlHardcoded",
262            "RtlSymmetry",
263            "ScrollViewSize",
264            "SetTextI18n",
265            "SimpleDateFormat",
266            "StaticFieldLeak",
267            "StringFormatCount",
268            "StringFormatInvalid",
269            "TextFields",
270            "TypographyEllipsis",
271            "UseSparseArrays",
272            "UseValueOf",
273            "VectorPath",
274            "VisibleForTests",
275            "Wakelock",
276            "WakelockTimeout",
277        ],
278        extra_check_modules: ["BluetoothLintChecker"],
279        baseline_filename: "lib-lint-baseline.xml",
280    },
281
282    installable: false,
283    apex_available: ["com.android.bt"],
284    min_sdk_version: "Tiramisu",
285    sdk_version: "module_current",
286}
287
288// Bluetooth APK
289android_app {
290    name: "Bluetooth",
291    certificate: ":com.android.bluetooth.certificate",
292    static_libs: ["BluetoothLib"],
293
294    apex_available: ["com.android.bt"],
295    min_sdk_version: "Tiramisu",
296    sdk_version: "module_current",
297    updatable: true,
298    jarjar_rules: ":bluetooth-jarjar-rules",
299    privapp_allowlist: ":privapp_allowlist_com.android.bluetooth.xml",
300
301    jni_uses_platform_apis: true,
302    optimize: {
303        enabled: true,
304        shrink: true,
305        optimize: false,
306        ignore_warnings: false,
307        proguard_flags_files: ["proguard.flags"],
308    },
309
310    lint: {
311        error_checks: [
312            "Autofill",
313            "DefaultLocale",
314            "DuplicateDefinition",
315            // "ExportedContentProvider", // TODO: b/289445022 - enable this check
316            // "ExportedReceiver", // TODO: b/289445022 - enable this check
317            // "ExportedService", // TODO: b/289445022 - enable this check
318            "ExtraText",
319            "ExtraTranslation",
320            "GestureBackNavigation",
321            "GuardedLogInvocation",
322            "HandlerLeak",
323            "InflateParams",
324            // "InvalidPermission", // TODO: b/289445022 - enable this check
325            "LabelFor",
326            "MissingClass",
327            // "MissingVersion", // TODO: b/289445022 - enable this check
328            "MonochromeLauncherIcon",
329            "NewApi",
330            "ObsoleteSdkInt",
331            // "QueryAllPackagesPermission", // TODO: b/289445022 - enable this check
332            "Recycle",
333            "RtlHardcoded",
334            "RtlSymmetry",
335            "ScrollViewSize",
336            "SetTextI18n",
337            "SimpleDateFormat",
338            "StaticFieldLeak",
339            "StringFormatCount",
340            "StringFormatInvalid",
341            "TextFields",
342            "TypographyEllipsis",
343            "UseSparseArrays",
344            "UseValueOf",
345            "VectorPath",
346            "VisibleForTests",
347            "Wakelock",
348            "WakelockTimeout",
349        ],
350        extra_check_modules: ["BluetoothLintChecker"],
351        baseline_filename: "lint-baseline.xml",
352    },
353}
354
355java_library {
356    name: "bluetooth-proto-enums-java-gen",
357    installable: false,
358    proto: {
359        type: "stream",
360    },
361    srcs: [
362        ":srcs_bluetooth_protos",
363    ],
364    apex_available: ["com.android.bt"],
365    min_sdk_version: "Tiramisu",
366    sdk_version: "module_current",
367}
368
369genrule {
370    name: "statslog-bluetooth-java-gen",
371    tools: ["stats-log-api-gen"],
372    cmd: "$(location stats-log-api-gen) --java $(out) --module bluetooth" +
373        " --javaPackage com.android.bluetooth --javaClass BluetoothStatsLog" +
374        " --minApiLevel 33",
375    out: ["com/android/bluetooth/BluetoothStatsLog.java"],
376}
377
378genrule {
379    name: "statslog-bt-restricted-java-gen",
380    tools: ["stats-log-api-gen"],
381    cmd: "$(location stats-log-api-gen) --java $(out) --module bt_restricted" +
382        " --javaPackage com.android.bluetooth --javaClass BtRestrictedStatsLog" +
383        " --minApiLevel 34",
384    out: ["com/android/bluetooth/BtRestrictedStatsLog.java"],
385}
386
387android_app_certificate {
388    name: "com.android.bluetooth.certificate",
389    certificate: "certs/com.android.bluetooth",
390}
391