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-manager-service-proto-java-gen", 76 "bluetooth-nano-protos", 77 "bluetooth-proto-enums-java-gen", 78 "bluetooth_flags_java_lib", 79 "modules-utils-build_system", 80 "modules-utils-shell-command-handler", 81 ], 82 83 optimize: { 84 enabled: true, 85 shrink: true, 86 proguard_flags_files: ["proguard.flags"], 87 }, 88 89 sdk_version: "system_server_current", 90 min_sdk_version: "Tiramisu", 91 apex_available: ["com.android.btservices"], 92 visibility: [":__subpackages__"], 93} 94 95// Apply jarjaring before using library in the apex 96java_library { 97 name: "service-bluetooth", 98 static_libs: ["service-bluetooth-pre-jarjar"], 99 installable: true, 100 101 jarjar_rules: ":bluetooth-jarjar-rules", 102 103 optimize: { 104 enabled: true, 105 shrink: true, 106 proguard_flags_files: ["proguard.flags"], 107 }, 108 109 libs: [ 110 "framework-bluetooth.impl", 111 ], 112 113 sdk_version: "system_server_current", 114 min_sdk_version: "Tiramisu", 115 apex_available: ["com.android.btservices"], 116 visibility: ["//packages/modules/Bluetooth/apex"], 117} 118 119java_library { 120 name: "bluetooth-manager-service-proto-java-gen", 121 srcs: [":srcs_bluetooth_manager_service_proto"], 122 installable: false, 123 124 proto: { 125 type: "stream", 126 include_dirs: ["external/protobuf/src"], 127 }, 128 129 sdk_version: "system_server_current", 130 min_sdk_version: "Tiramisu", 131 apex_available: ["com.android.btservices"], 132} 133 134java_library { 135 name: "bluetooth-nano-protos", 136 srcs: [":system-messages-proto-src"], 137 installable: false, 138 139 proto: { 140 type: "nano", 141 }, 142 143 libs: ["libprotobuf-java-nano"], 144 lint: { 145 strict_updatability_linting: true, 146 }, 147 148 sdk_version: "system_current", 149 min_sdk_version: "Tiramisu", 150 apex_available: ["com.android.btservices"], 151} 152 153android_robolectric_test { 154 name: "ServiceBluetoothRoboTests", 155 instrumentation_for: "ServiceBluetoothFakeTestApp", 156 157 srcs: [ 158 ":statslog-bluetooth-java-gen", 159 "src/ActiveLog.kt", 160 "src/ActiveLogTest.kt", 161 "src/AdapterState.kt", 162 "src/AdapterStateTest.kt", 163 "src/AutoOnFeature.kt", 164 "src/AutoOnFeatureTest.kt", 165 "src/BleScanSettingListener.kt", 166 "src/BleScanSettingListenerTest.kt", 167 "src/Log.kt", 168 "src/LogTest.kt", 169 "src/RadioModeListener.kt", 170 "src/RadioModeListenerTest.kt", 171 "src/airplane/ModeListener.kt", 172 "src/airplane/ModeListenerTest.kt", 173 "src/satellite/ModeListener.kt", 174 "src/satellite/ModeListenerTest.kt", 175 ], 176 177 jarjar_rules: ":bluetooth-jarjar-rules", 178 179 static_libs: [ 180 "androidx.test.core", 181 "androidx.test.ext.truth", 182 "bluetooth-manager-service-proto-java-gen", 183 "bluetooth-nano-protos", 184 "bluetooth-proto-enums-java-gen", 185 "bluetooth_flags_java_lib", 186 "flag-junit", 187 "kotlin-test", 188 "kotlinx_coroutines", 189 "kotlinx_coroutines_test", 190 "mockito-robolectric-prebuilt", 191 "modules-utils-expresslog", 192 "platform-test-annotations", 193 "service-bluetooth-binder-aidl", 194 "testng", 195 "truth", 196 ], 197 198 libs: [ 199 "framework-bluetooth.stubs.module_lib", 200 "framework-statsd.stubs.module_lib", 201 ], 202 203 sdk_version: "test_current", 204 upstream: true, 205 test_suites: ["general-tests"], 206 strict_mode: false, 207} 208