• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19java_defaults {
20    name: "service-bluetooth-buildflags",
21    defaults: ["bluetooth_framework_errorprone_rules"],
22
23    lint: {
24        error_checks: [
25            "ExtraText",
26            "NewApi",
27            "ObsoleteSdkInt",
28            "Recycle",
29            "RtlHardcoded",
30            "UseSparseArrays",
31            "UseValueOf",
32        ],
33        strict_updatability_linting: true,
34    },
35
36    kotlincflags: [
37        "-Werror",
38    ],
39
40    defaults_visibility: [":__subpackages__"],
41}
42
43// pre-jarjar version of service-bluetooth that builds against pre-jarjar version of framework-bluetooth
44java_library {
45    name: "service-bluetooth-pre-jarjar",
46    defaults: ["service-bluetooth-buildflags"],
47    installable: false,
48    srcs: [
49        ":statslog-bluetooth-java-gen",
50        "src/**/*.java",
51        "src/ActiveLog.kt",
52        "src/AdapterBinder.kt",
53        "src/AdapterState.kt",
54        "src/AutoOnFeature.kt",
55        "src/BleScanSettingListener.kt",
56        "src/BluetoothService.kt",
57        "src/Log.kt",
58        "src/RadioModeListener.kt",
59        "src/airplane/ModeListener.kt",
60        "src/satellite/ModeListener.kt",
61    ],
62
63    libs: [
64        "framework-annotations-lib",
65        "framework-bluetooth-pre-jarjar",
66        "framework-configinfrastructure.stubs.module_lib",
67        "framework-statsd.stubs.module_lib",
68        "service-bluetooth-binder-aidl",
69        "service-bluetooth.change-ids",
70    ],
71
72    static_libs: [
73        "androidx.annotation_annotation",
74        "androidx.appcompat_appcompat",
75        "bluetooth-nano-protos",
76        "bluetooth-proto-enums-java-gen",
77        "bluetooth_flags_java_lib",
78        "modules-utils-build_system",
79        "modules-utils-shell-command-handler",
80    ],
81
82    optimize: {
83        enabled: true,
84        shrink: true,
85        proguard_compatibility: true,
86        ignore_warnings: false,
87        proguard_flags_files: ["proguard.flags"],
88    },
89
90    sdk_version: "system_server_current",
91    min_sdk_version: "Tiramisu",
92    apex_available: ["com.android.bt"],
93    visibility: [":__subpackages__"],
94}
95
96// Apply jarjaring before using library in the apex
97java_library {
98    name: "service-bluetooth",
99    static_libs: ["service-bluetooth-pre-jarjar"],
100    installable: true,
101
102    jarjar_rules: ":bluetooth-jarjar-rules",
103
104    optimize: {
105        enabled: true,
106        shrink: true,
107        proguard_compatibility: true,
108        ignore_warnings: false,
109        proguard_flags_files: ["proguard.flags"],
110    },
111
112    libs: [
113        "framework-bluetooth.impl",
114    ],
115
116    sdk_version: "system_server_current",
117    min_sdk_version: "Tiramisu",
118    apex_available: ["com.android.bt"],
119    visibility: ["//packages/modules/Bluetooth/apex"],
120}
121
122java_library {
123    name: "bluetooth-nano-protos",
124    srcs: [":system-messages-proto-src"],
125    installable: false,
126
127    proto: {
128        type: "nano",
129    },
130
131    libs: ["libprotobuf-java-nano"],
132    lint: {
133        strict_updatability_linting: true,
134    },
135
136    sdk_version: "system_current",
137    min_sdk_version: "Tiramisu",
138    apex_available: ["com.android.bt"],
139}
140
141android_robolectric_test {
142    name: "ServiceBluetoothRoboTests",
143    instrumentation_for: "ServiceBluetoothFakeTestApp",
144
145    srcs: [
146        ":statslog-bluetooth-java-gen",
147        "src/ActiveLog.kt",
148        "src/ActiveLogTest.kt",
149        "src/AdapterState.kt",
150        "src/AdapterStateTest.kt",
151        "src/AutoOnFeature.kt",
152        "src/AutoOnFeatureTest.kt",
153        "src/BleScanSettingListener.kt",
154        "src/BleScanSettingListenerTest.kt",
155        "src/Log.kt",
156        "src/LogTest.kt",
157        "src/RadioModeListener.kt",
158        "src/RadioModeListenerTest.kt",
159        "src/airplane/ModeListener.kt",
160        "src/airplane/ModeListenerTest.kt",
161        "src/satellite/ModeListener.kt",
162        "src/satellite/ModeListenerTest.kt",
163    ],
164
165    jarjar_rules: ":bluetooth-jarjar-rules",
166
167    static_libs: [
168        "androidx.test.core",
169        "androidx.test.ext.truth",
170        "bluetooth-nano-protos",
171        "bluetooth-proto-enums-java-gen",
172        "bluetooth_flags_java_lib",
173        "flag-junit",
174        "kotlin-test",
175        "kotlinx_coroutines",
176        "kotlinx_coroutines_test",
177        "mockito-robolectric-prebuilt",
178        "modules-utils-expresslog",
179        "platform-test-annotations",
180        "service-bluetooth-binder-aidl",
181        "testng",
182        "truth",
183    ],
184
185    libs: [
186        "framework-bluetooth.stubs.module_lib",
187        "framework-statsd.stubs.module_lib",
188    ],
189
190    sdk_version: "test_current",
191    test_suites: ["general-tests"],
192    strict_mode: false,
193}
194