diff options
author | 2025-01-21 19:49:49 +0000 | |
---|---|---|
committer | 2025-02-19 18:20:58 +0000 | |
commit | d2c61295cb4c02a9b805bdf52b0052eaaec76fa4 (patch) | |
tree | e2ee4e99d9477336fbc81f5061b1b4771a5fb824 | |
parent | 57238606fb4ff38304e62578ae8e7f76f49611dc (diff) |
HAL: Add a sysprop to read MSFT vendor specific opcode
Using MGMT to read the MSFT vendor specific opcode from the
kernel is too BlueZ specific. Replace with a sysprop instead.
Bug: 390425327
Bug: 365787977
Flag: com.android.bluetooth.flags.le_scan_msft_support
Test: mmm packages/modules/Bluetooth
Change-Id: I88bd30f1c1b81ab1299af0459aef4e7596183db0
-rw-r--r-- | sysprop/Android.bp | 1 | ||||
-rw-r--r-- | sysprop/BUILD.gn | 1 | ||||
-rw-r--r-- | sysprop/exported_include/android_bluetooth_sysprop.h | 1 | ||||
-rw-r--r-- | sysprop/hci.sysprop | 10 | ||||
-rw-r--r-- | system/gd/Android.bp | 34 | ||||
-rw-r--r-- | system/gd/hal/hci_hal_android.cc | 8 | ||||
-rw-r--r-- | system/gd/os/Android.bp | 22 | ||||
-rw-r--r-- | system/gd/os/mgmt_stub.cc | 36 |
8 files changed, 19 insertions, 94 deletions
diff --git a/sysprop/Android.bp b/sysprop/Android.bp index 241e8711f7..ef0ebad98d 100644 --- a/sysprop/Android.bp +++ b/sysprop/Android.bp @@ -13,6 +13,7 @@ sysprop_library { "device_id.sysprop", "gap.sysprop", "hardware.sysprop", + "hci.sysprop", "hfp.sysprop", ], property_owner: "Platform", diff --git a/sysprop/BUILD.gn b/sysprop/BUILD.gn index 9cdbf48530..84b21f0737 100644 --- a/sysprop/BUILD.gn +++ b/sysprop/BUILD.gn @@ -9,6 +9,7 @@ sysprop("libcom.android.sysprop.bluetooth") { "device_id.sysprop", "gap.sysprop", "hardware.sysprop", + "hci.sysprop", "hfp.sysprop", ] deps = [ "//bt/floss/android-base:android-base" ] diff --git a/sysprop/exported_include/android_bluetooth_sysprop.h b/sysprop/exported_include/android_bluetooth_sysprop.h index 24053123ac..4d3949a75f 100644 --- a/sysprop/exported_include/android_bluetooth_sysprop.h +++ b/sysprop/exported_include/android_bluetooth_sysprop.h @@ -23,4 +23,5 @@ #include <device_id.sysprop.h> #include <gap.sysprop.h> #include <hardware.sysprop.h> +#include <hci.sysprop.h> #include <hfp.sysprop.h> diff --git a/sysprop/hci.sysprop b/sysprop/hci.sysprop new file mode 100644 index 0000000000..04e7b6ccf8 --- /dev/null +++ b/sysprop/hci.sysprop @@ -0,0 +1,10 @@ +module: "android.sysprop.bluetooth.Hci" +owner: Platform + +prop { + api_name: "msft_vendor_opcode" + type: Integer + scope: Internal + access: Readonly + prop_name: "bluetooth.hci.msft_vendor_opcode" +}
\ No newline at end of file diff --git a/system/gd/Android.bp b/system/gd/Android.bp index 1ed068af68..981f6bd43c 100644 --- a/system/gd/Android.bp +++ b/system/gd/Android.bp @@ -37,44 +37,10 @@ cc_defaults { header_libs: ["jni_headers"], } -soong_config_module_type { - name: "mgmt_cc_defaults", - module_type: "cc_defaults", - config_namespace: "mgmt", - variables: ["vertical"], - properties: ["srcs"], -} - -soong_config_string_variable { - name: "vertical", - values: [ - "android_default", - "android_desktop", - ], -} - -mgmt_cc_defaults { - name: "mgmt_defaults", - soong_config_variables: { - vertical: { - android_desktop: { - srcs: [":BluetoothOsSources_mgmt_linux"], - }, - android_default: { - srcs: [":BluetoothOsSources_mgmt"], - }, - conditions_default: { - srcs: [":BluetoothOsSources_mgmt"], - }, - }, - }, -} - cc_defaults { name: "libbluetooth_gd_defaults", defaults: [ "gd_defaults", - "mgmt_defaults", ], host_supported: true, target: { diff --git a/system/gd/hal/hci_hal_android.cc b/system/gd/hal/hci_hal_android.cc index 51bc789cc8..20d9e29e3d 100644 --- a/system/gd/hal/hci_hal_android.cc +++ b/system/gd/hal/hci_hal_android.cc @@ -14,7 +14,9 @@ * limitations under the License. */ +#include <android_bluetooth_sysprop.h> #include <bluetooth/log.h> +#include <com_android_bluetooth_flags.h> #include <future> #include <mutex> @@ -25,7 +27,6 @@ #include "hal/hci_hal.h" #include "hal/link_clocker.h" #include "hal/snoop_logger.h" -#include "os/mgmt.h" namespace bluetooth::hal { @@ -159,7 +160,10 @@ public: } uint16_t getMsftOpcode() override { - return os::Management::getInstance().getVendorSpecificCode(MGMT_VS_OPCODE_MSFT); + if (com::android::bluetooth::flags::le_scan_msft_support()) { + return android::sysprop::bluetooth::Hci::msft_vendor_opcode().value_or(0); + } + return 0; } protected: diff --git a/system/gd/os/Android.bp b/system/gd/os/Android.bp deleted file mode 100644 index 92e8533a00..0000000000 --- a/system/gd/os/Android.bp +++ /dev/null @@ -1,22 +0,0 @@ -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "system_bt_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["system_bt_license"], -} - -filegroup { - name: "BluetoothOsSources_mgmt", - srcs: [ - "mgmt_stub.cc", - ], -} - -filegroup { - name: "BluetoothOsSources_mgmt_linux", - srcs: [ - "linux_generic/mgmt.cc", - ], -} diff --git a/system/gd/os/mgmt_stub.cc b/system/gd/os/mgmt_stub.cc deleted file mode 100644 index 308838818b..0000000000 --- a/system/gd/os/mgmt_stub.cc +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** - * - * Copyright 2024 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. - * - ******************************************************************************/ - -/* - * MGMT stub - */ - -#include <bluetooth/log.h> - -#include "os/mgmt.h" - -namespace bluetooth { -namespace os { - -uint16_t Management::getVendorSpecificCode(uint16_t vendor_specification) { - log::debug("Using stub for vendor opcode 0x{:04x}", vendor_specification); - return 0; -} - -} // namespace os -} // namespace bluetooth |