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 errorprone: { 22 enabled: true, 23 javacflags: [ 24 "-Xep:AlreadyChecked:ERROR", 25 "-Xep:BadImport:ERROR", 26 "-Xep:CatchFail:ERROR", 27 "-Xep:CheckReturnValue:ERROR", 28 "-Xep:ClassCanBeStatic:ERROR", 29 "-Xep:EmptyBlockTag:ERROR", 30 "-Xep:EmptyCatch:ERROR", 31 "-Xep:EqualsIncompatibleType:ERROR", 32 "-Xep:FutureReturnValueIgnored:ERROR", 33 "-Xep:InlineMeInliner:ERROR", 34 "-Xep:InvalidBlockTag:ERROR", 35 "-Xep:InvalidInlineTag:ERROR", 36 "-Xep:InvalidParam:ERROR", 37 "-Xep:MockNotUsedInProduction:ERROR", 38 "-Xep:NonApiType:ERROR", 39 "-Xep:NonCanonicalType:ERROR", 40 "-Xep:ReferenceEquality:ERROR", 41 "-Xep:ReturnAtTheEndOfVoidFunction:ERROR", 42 "-Xep:StringCharset:ERROR", 43 "-Xep:UnnecessaryAssignment:ERROR", 44 "-Xep:UnnecessaryAsync:ERROR", 45 "-Xep:UnusedMethod:ERROR", 46 "-Xep:UnusedVariable:ERROR", 47 ], 48 }, 49 50 lint: { 51 error_checks: [ 52 "ExtraText", 53 "NewApi", 54 "ObsoleteSdkInt", 55 "Recycle", 56 "RtlHardcoded", 57 "UseSparseArrays", 58 "UseValueOf", 59 ], 60 strict_updatability_linting: true, 61 }, 62 63 kotlincflags: [ 64 "-Werror", 65 ], 66 67 defaults_visibility: [":__subpackages__"], 68} 69 70// pre-jarjar version of service-bluetooth that builds against pre-jarjar version of framework-bluetooth 71java_library { 72 name: "service-bluetooth-pre-jarjar", 73 defaults: ["service-bluetooth-buildflags"], 74 installable: false, 75 srcs: [ 76 ":statslog-bluetooth-java-gen", 77 "src/**/*.java", 78 "src/AdapterBinder.kt", 79 "src/AdapterState.kt", 80 "src/AutoOnFeature.kt", 81 "src/BleScanSettingListener.kt", 82 "src/BluetoothService.kt", 83 "src/Log.kt", 84 "src/RadioModeListener.kt", 85 "src/airplane/ModeListener.kt", 86 "src/satellite/ModeListener.kt", 87 ], 88 89 libs: [ 90 "framework-annotations-lib", 91 "framework-bluetooth-pre-jarjar", 92 "framework-configinfrastructure", 93 "framework-statsd.stubs.module_lib", 94 "service-bluetooth-binder-aidl", 95 "service-bluetooth.change-ids", 96 ], 97 98 static_libs: [ 99 "androidx.annotation_annotation", 100 "androidx.appcompat_appcompat", 101 "bluetooth-manager-service-proto-java-gen", 102 "bluetooth-nano-protos", 103 "bluetooth-proto-enums-java-gen", 104 "bluetooth_flags_java_lib", 105 "modules-utils-build_system", 106 "modules-utils-shell-command-handler", 107 ], 108 109 lint: { 110 baseline_filename: "lint-baseline.xml", 111 }, 112 113 optimize: { 114 enabled: true, 115 shrink: true, 116 proguard_flags_files: ["proguard.flags"], 117 }, 118 119 sdk_version: "system_server_current", 120 min_sdk_version: "Tiramisu", 121 apex_available: ["com.android.btservices"], 122 visibility: [":__subpackages__"], 123} 124 125// Apply jarjaring before using library in the apex 126java_library { 127 name: "service-bluetooth", 128 static_libs: ["service-bluetooth-pre-jarjar"], 129 installable: true, 130 131 jarjar_rules: ":bluetooth-jarjar-rules", 132 133 optimize: { 134 enabled: true, 135 shrink: true, 136 proguard_flags_files: ["proguard.flags"], 137 }, 138 139 libs: [ 140 "framework-bluetooth", 141 ], 142 143 sdk_version: "system_server_current", 144 min_sdk_version: "Tiramisu", 145 apex_available: ["com.android.btservices"], 146 visibility: ["//packages/modules/Bluetooth/apex"], 147} 148 149java_library { 150 name: "bluetooth-manager-service-proto-java-gen", 151 srcs: [":srcs_bluetooth_manager_service_proto"], 152 installable: false, 153 154 proto: { 155 type: "stream", 156 include_dirs: ["external/protobuf/src"], 157 }, 158 159 sdk_version: "system_server_current", 160 min_sdk_version: "Tiramisu", 161 apex_available: ["com.android.btservices"], 162} 163 164java_library { 165 name: "bluetooth-nano-protos", 166 srcs: [":system-messages-proto-src"], 167 installable: false, 168 169 proto: { 170 type: "nano", 171 }, 172 173 libs: ["libprotobuf-java-nano"], 174 lint: { 175 strict_updatability_linting: true, 176 }, 177 178 sdk_version: "system_current", 179 min_sdk_version: "Tiramisu", 180 apex_available: ["com.android.btservices"], 181} 182 183android_robolectric_test { 184 name: "ServiceBluetoothRoboTests", 185 instrumentation_for: "ServiceBluetoothFakeTestApp", 186 187 srcs: [ 188 ":statslog-bluetooth-java-gen", 189 "src/AdapterState.kt", 190 "src/AdapterStateTest.kt", 191 "src/AutoOnFeature.kt", 192 "src/AutoOnFeatureTest.kt", 193 "src/BleScanSettingListener.kt", 194 "src/BleScanSettingListenerTest.kt", 195 "src/Log.kt", 196 "src/LogTest.kt", 197 "src/RadioModeListener.kt", 198 "src/RadioModeListenerTest.kt", 199 "src/airplane/ModeListener.kt", 200 "src/airplane/ModeListenerTest.kt", 201 "src/satellite/ModeListener.kt", 202 "src/satellite/ModeListenerTest.kt", 203 ], 204 205 jarjar_rules: ":bluetooth-jarjar-rules", 206 207 static_libs: [ 208 "androidx.test.core", 209 "androidx.test.ext.truth", 210 "bluetooth_flags_java_lib", 211 "flag-junit", 212 "kotlin-test", 213 "kotlinx_coroutines", 214 "kotlinx_coroutines_test", 215 "mockito-robolectric-prebuilt", 216 "modules-utils-expresslog", 217 "platform-test-annotations", 218 "testng", 219 "truth", 220 ], 221 222 libs: [ 223 "framework-bluetooth.stubs.module_lib", 224 "framework-statsd.stubs.module_lib", 225 ], 226 227 sdk_version: "module_current", 228 upstream: true, 229 test_suites: ["general-tests"], 230 strict_mode: false, 231} 232