// Copyright (C) 2021 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["Android-Apache-2.0"], } java_defaults { name: "service-bluetooth-buildflags", defaults: ["bluetooth_framework_errorprone_rules"], lint: { error_checks: [ "ExtraText", "NewApi", "ObsoleteSdkInt", "Recycle", "RtlHardcoded", "UseSparseArrays", "UseValueOf", ], strict_updatability_linting: true, }, kotlincflags: [ "-Werror", ], defaults_visibility: [":__subpackages__"], } // pre-jarjar version of service-bluetooth that builds against pre-jarjar version of framework-bluetooth java_library { name: "service-bluetooth-pre-jarjar", defaults: ["service-bluetooth-buildflags"], installable: false, srcs: [ ":statslog-bluetooth-java-gen", "src/**/*.java", "src/ActiveLog.kt", "src/AdapterBinder.kt", "src/AdapterState.kt", "src/AutoOnFeature.kt", "src/BleScanSettingListener.kt", "src/BluetoothService.kt", "src/Log.kt", "src/RadioModeListener.kt", "src/airplane/ModeListener.kt", "src/satellite/ModeListener.kt", ], libs: [ "framework-annotations-lib", "framework-bluetooth-pre-jarjar", "framework-configinfrastructure.stubs.module_lib", "framework-statsd.stubs.module_lib", "service-bluetooth-binder-aidl", "service-bluetooth.change-ids", ], static_libs: [ "androidx.annotation_annotation", "androidx.appcompat_appcompat", "bluetooth-manager-service-proto-java-gen", "bluetooth-nano-protos", "bluetooth-proto-enums-java-gen", "bluetooth_flags_java_lib", "modules-utils-build_system", "modules-utils-shell-command-handler", ], optimize: { enabled: true, shrink: true, proguard_flags_files: ["proguard.flags"], }, sdk_version: "system_server_current", min_sdk_version: "Tiramisu", apex_available: ["com.android.btservices"], visibility: [":__subpackages__"], } // Apply jarjaring before using library in the apex java_library { name: "service-bluetooth", static_libs: ["service-bluetooth-pre-jarjar"], installable: true, jarjar_rules: ":bluetooth-jarjar-rules", optimize: { enabled: true, shrink: true, proguard_flags_files: ["proguard.flags"], }, libs: [ "framework-bluetooth.impl", ], sdk_version: "system_server_current", min_sdk_version: "Tiramisu", apex_available: ["com.android.btservices"], visibility: ["//packages/modules/Bluetooth/apex"], } java_library { name: "bluetooth-manager-service-proto-java-gen", srcs: [":srcs_bluetooth_manager_service_proto"], installable: false, proto: { type: "stream", include_dirs: ["external/protobuf/src"], }, sdk_version: "system_server_current", min_sdk_version: "Tiramisu", apex_available: ["com.android.btservices"], } java_library { name: "bluetooth-nano-protos", srcs: [":system-messages-proto-src"], installable: false, proto: { type: "nano", }, libs: ["libprotobuf-java-nano"], lint: { strict_updatability_linting: true, }, sdk_version: "system_current", min_sdk_version: "Tiramisu", apex_available: ["com.android.btservices"], } android_robolectric_test { name: "ServiceBluetoothRoboTests", instrumentation_for: "ServiceBluetoothFakeTestApp", srcs: [ ":statslog-bluetooth-java-gen", "src/ActiveLog.kt", "src/ActiveLogTest.kt", "src/AdapterState.kt", "src/AdapterStateTest.kt", "src/AutoOnFeature.kt", "src/AutoOnFeatureTest.kt", "src/BleScanSettingListener.kt", "src/BleScanSettingListenerTest.kt", "src/Log.kt", "src/LogTest.kt", "src/RadioModeListener.kt", "src/RadioModeListenerTest.kt", "src/airplane/ModeListener.kt", "src/airplane/ModeListenerTest.kt", "src/satellite/ModeListener.kt", "src/satellite/ModeListenerTest.kt", ], jarjar_rules: ":bluetooth-jarjar-rules", static_libs: [ "androidx.test.core", "androidx.test.ext.truth", "bluetooth-manager-service-proto-java-gen", "bluetooth-nano-protos", "bluetooth-proto-enums-java-gen", "bluetooth_flags_java_lib", "flag-junit", "kotlin-test", "kotlinx_coroutines", "kotlinx_coroutines_test", "mockito-robolectric-prebuilt", "modules-utils-expresslog", "platform-test-annotations", "service-bluetooth-binder-aidl", "testng", "truth", ], libs: [ "framework-bluetooth.stubs.module_lib", "framework-statsd.stubs.module_lib", ], sdk_version: "test_current", upstream: true, test_suites: ["general-tests"], strict_mode: false, }