summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TEST_MAPPING219
-rw-r--r--android/app/src/com/android/bluetooth/vc/VolumeControlService.java26
-rw-r--r--android/pandora/mmi2grpc/mmi2grpc/__init__.py8
-rw-r--r--android/pandora/mmi2grpc/mmi2grpc/sdp.py2
-rw-r--r--android/pandora/mmi2grpc/mmi2grpc/vcp.py121
-rw-r--r--android/pandora/server/configs/PtsBotTest.xml1
-rw-r--r--android/pandora/server/configs/pts_bot_tests_config.json62
-rw-r--r--android/pandora/server/src/LeAudio.kt102
-rw-r--r--android/pandora/server/src/Server.kt1
-rw-r--r--pandora/interfaces/pandora_experimental/le_audio.proto17
-rw-r--r--pandora/interfaces/python/Android.bp5
-rw-r--r--sysprop/Android.bp11
-rw-r--r--sysprop/exported_include/android_bluetooth_sysprop.h35
-rw-r--r--system/BUILD.gn1
-rw-r--r--system/bta/Android.bp163
-rw-r--r--system/bta/csis/csis_client.cc22
-rw-r--r--system/bta/dm/bta_dm_disc.cc12
-rw-r--r--system/bta/dm/bta_dm_sec.cc2
-rw-r--r--system/bta/include/bta_api.h4
-rw-r--r--system/bta/le_audio/codec_manager_test.cc2
-rw-r--r--system/bta/le_audio/state_machine.cc7
-rw-r--r--system/bta/test/bta_dm_test.cc1
-rw-r--r--system/bta/test/common/btm_api_mock.cc11
-rw-r--r--system/bta/test/common/btm_api_mock.h10
-rw-r--r--system/btif/Android.bp6
-rw-r--r--system/gd/hci/acl_manager.h2
-rw-r--r--system/gd/l2cap/le/l2cap_le_module.h5
-rw-r--r--system/main/shim/l2c_api.cc24
-rw-r--r--system/main/shim/l2c_api.h3
-rw-r--r--system/profile/avrcp/Android.bp2
-rw-r--r--system/stack/Android.bp8
-rw-r--r--system/stack/btm/btm_ble_sec.cc15
-rw-r--r--system/stack/btm/btm_devctl.cc3
-rw-r--r--system/stack/btm/btm_sco_hci.cc14
-rw-r--r--system/stack/btm/btm_sec.cc22
-rw-r--r--system/stack/btm/btm_sec.h8
-rw-r--r--system/stack/btm/hfp_lc3_decoder.cc5
-rw-r--r--system/stack/btm/hfp_lc3_decoder_linux.cc4
-rw-r--r--system/stack/btm/security_device_record.h3
-rw-r--r--system/stack/include/btm_ble_sec_api.h31
-rw-r--r--system/stack/include/sdp_device_id.h1
-rw-r--r--system/stack/include/security_client_callbacks.h3
-rw-r--r--system/test/mock/mock_main_shim_l2cap_api.cc5
-rw-r--r--system/test/mock/mock_main_shim_l2cap_api.h8
-rw-r--r--system/test/mock/mock_stack_btm_interface.cc6
-rw-r--r--system/test/mock/mock_stack_btm_sec.cc10
-rw-r--r--system/test/mock/mock_stack_btm_sec.h23
-rw-r--r--system/test/suite/Android.bp2
48 files changed, 606 insertions, 452 deletions
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 77d77cc3d4..2dca394ca8 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -5,266 +5,205 @@
"name": "CtsBluetoothTestCases"
},
{
- "name": "BluetoothInstrumentationTests",
- "keywords": ["internal"]
+ "name": "BluetoothInstrumentationTests"
+ },
+ {
+ "name": "GoogleBluetoothInstrumentationTests"
+ },
+ {
+ "name": "FrameworkBluetoothTests"
+ },
+ {
+ "name": "ServiceBluetoothTests"
},
- //{
- // "name": "GoogleBluetoothInstrumentationTests"
- //},
- //{
- // "name": "FrameworkBluetoothTests"
- //},
- //{
- // "name": "ServiceBluetoothTests"
- //},
// device only tests
// Broken
//{
// "name": "bluetooth-test-audio-hal-interface"
//},
{
- "name": "net_test_audio_a2dp_hw",
- "keywords": ["internal"]
+ "name": "net_test_audio_a2dp_hw"
},
{
- "name": "net_test_audio_hearing_aid_hw",
- "keywords": ["internal"]
+ "name": "net_test_audio_hearing_aid_hw"
},
{
- "name": "net_test_bluetooth",
- "keywords": ["internal"]
+ "name": "net_test_bluetooth"
},
{
- "name": "net_test_bta",
- "keywords": ["internal"]
+ "name": "net_test_bta"
},
{
- "name": "net_test_bta_security",
- "keywords": ["internal"]
+ "name": "net_test_bta_security"
},
{
- "name": "net_test_btif",
- "keywords": ["internal"]
+ "name": "net_test_btif"
},
{
- "name": "net_test_btif_hf_client_service",
- "keywords": ["internal"]
+ "name": "net_test_btif_hf_client_service"
},
{
- "name": "net_test_btif_profile_queue",
- "keywords": ["internal"]
+ "name": "net_test_btif_profile_queue"
},
{
- "name": "net_test_btif_avrcp_audio_track",
- "keywords": ["internal"]
+ "name": "net_test_btif_avrcp_audio_track"
},
{
- "name": "net_test_device",
- "keywords": ["internal"]
+ "name": "net_test_device"
},
{
- "name": "net_test_device_iot_config",
- "keywords": ["internal"]
+ "name": "net_test_device_iot_config"
},
{
- "name": "net_test_gatt_conn_multiplexing",
- "keywords": ["internal"]
+ "name": "net_test_gatt_conn_multiplexing"
},
{
- "name": "net_test_hci",
- "keywords": ["internal"]
+ "name": "net_test_hci"
},
{
- "name": "net_test_stack",
- "keywords": ["internal"]
+ "name": "net_test_stack"
},
{
- "name": "net_test_stack_a2dp_codecs_native",
- "keywords": ["internal"]
+ "name": "net_test_stack_a2dp_codecs_native"
},
{
- "name": "net_test_stack_ad_parser",
- "keywords": ["internal"]
+ "name": "net_test_stack_ad_parser"
},
// go/a-unit-tests tests (unit_test: true)
// Thoses test run on the host in the CI automatically.
// Run the one that are available on the device on the
// device as well
{
- "name": "bluetooth_csis_test",
- "keywords": ["internal"]
+ "name": "bluetooth_csis_test"
},
{
- "name": "bluetooth_flatbuffer_tests",
- "keywords": ["internal"]
+ "name": "bluetooth_flatbuffer_tests"
},
{
- "name": "bluetooth_groups_test",
- "keywords": ["internal"]
+ "name": "bluetooth_groups_test"
},
{
- "name": "bluetooth_has_test",
- "keywords": ["internal"]
+ "name": "bluetooth_has_test"
},
{
- "name": "bluetooth_hh_test",
- "keywords": ["internal"]
+ "name": "bluetooth_hh_test"
},
{
- "name": "bluetooth_le_audio_client_test",
- "keywords": ["internal"]
+ "name": "bluetooth_le_audio_client_test"
},
{
- "name": "bluetooth_le_audio_test",
- "keywords": ["internal"]
+ "name": "bluetooth_le_audio_test"
},
{
- "name": "bluetooth_packet_parser_test",
- "keywords": ["internal"]
+ "name": "bluetooth_packet_parser_test"
},
{
- "name": "bluetooth_test_broadcaster",
- "keywords": ["internal"]
+ "name": "bluetooth_test_broadcaster"
},
{
- "name": "bluetooth_test_broadcaster_state_machine",
- "keywords": ["internal"]
+ "name": "bluetooth_test_broadcaster_state_machine"
},
{
- "name": "bluetooth_test_common",
- "keywords": ["internal"]
+ "name": "bluetooth_test_common"
},
{
- "name": "bluetooth_test_gd_unit",
- "keywords": ["internal"]
+ "name": "bluetooth_test_gd_unit"
},
{
- "name": "bluetooth_test_sdp",
- "keywords": ["internal"]
+ "name": "bluetooth_test_sdp"
},
{
- "name": "bluetooth_vc_test",
- "keywords": ["internal"]
+ "name": "bluetooth_vc_test"
},
{
- "name": "bt_host_test_bta",
- "keywords": ["internal"]
+ "name": "bt_host_test_bta"
},
{
- "name": "libaptx_enc_tests",
- "keywords": ["internal"]
+ "name": "libaptx_enc_tests"
},
{
- "name": "libaptxhd_enc_tests",
- "keywords": ["internal"]
+ "name": "libaptxhd_enc_tests"
},
{
- "name": "net_test_avrcp",
- "keywords": ["internal"]
+ "name": "net_test_avrcp"
},
{
- "name": "net_test_btcore",
- "keywords": ["internal"]
+ "name": "net_test_btcore"
},
{
- "name": "net_test_btif_config_cache",
- "keywords": ["internal"]
+ "name": "net_test_btif_config_cache"
},
{
- "name": "net_test_btif_hh",
- "keywords": ["internal"]
+ "name": "net_test_btif_hh"
},
{
- "name": "net_test_btif_rc",
- "keywords": ["internal"]
+ "name": "net_test_btif_rc"
},
{
- "name": "net_test_btif_stack",
- "keywords": ["internal"]
+ "name": "net_test_btif_stack"
},
{
- "name": "net_test_btm_iso",
- "keywords": ["internal"]
+ "name": "net_test_btm_iso"
},
{
- "name": "net_test_btpackets",
- "keywords": ["internal"]
+ "name": "net_test_btpackets"
},
{
- "name": "net_test_eatt",
- "keywords": ["internal"]
+ "name": "net_test_eatt"
},
{
- "name": "net_test_main_shim",
- "keywords": ["internal"]
+ "name": "net_test_main_shim"
},
{
- "name": "net_test_osi",
- "keywords": ["internal"]
+ "name": "net_test_osi"
},
{
- "name": "net_test_performance",
- "keywords": ["internal"]
+ "name": "net_test_performance"
},
{
- "name": "net_test_stack_a2dp_native",
- "keywords": ["internal"]
+ "name": "net_test_stack_a2dp_native"
},
{
- "name": "net_test_stack_acl",
- "keywords": ["internal"]
+ "name": "net_test_stack_acl"
},
{
- "name": "net_test_stack_avdtp",
- "keywords": ["internal"]
+ "name": "net_test_stack_avdtp"
},
{
- "name": "net_test_stack_btm",
- "keywords": ["internal"]
+ "name": "net_test_stack_btm"
},
{
- "name": "net_test_stack_btu",
- "keywords": ["internal"]
+ "name": "net_test_stack_btu"
},
{
- "name": "net_test_stack_gatt",
- "keywords": ["internal"]
+ "name": "net_test_stack_gatt"
},
{
- "name": "net_test_stack_gatt_native",
- "keywords": ["internal"]
+ "name": "net_test_stack_gatt_native"
},
{
- "name": "net_test_stack_gatt_sr_hash_native",
- "keywords": ["internal"]
+ "name": "net_test_stack_gatt_sr_hash_native"
},
{
- "name": "net_test_stack_hci",
- "keywords": ["internal"]
+ "name": "net_test_stack_hci"
},
{
- "name": "net_test_stack_hid",
- "keywords": ["internal"]
+ "name": "net_test_stack_hid"
},
{
- "name": "net_test_stack_l2cap",
- "keywords": ["internal"]
+ "name": "net_test_stack_l2cap"
},
{
- "name": "net_test_stack_rfcomm",
- "keywords": ["internal"]
+ "name": "net_test_stack_rfcomm"
},
{
- "name": "net_test_stack_sdp",
- "keywords": ["internal"]
+ "name": "net_test_stack_sdp"
},
{
- "name": "net_test_stack_smp",
- "keywords": ["internal"]
+ "name": "net_test_stack_smp"
},
{
- "name": "net_test_types",
- "keywords": ["internal"]
+ "name": "net_test_types"
}
],
"hwasan-presubmit": [
@@ -275,15 +214,15 @@
{
"name": "BluetoothInstrumentationTests"
},
- //{
- // "name": "GoogleBluetoothInstrumentationTests"
- //},
- //{
- // "name": "FrameworkBluetoothTests"
- //},
- //{
- // "name": "ServiceBluetoothTests"
- //},
+ {
+ "name": "GoogleBluetoothInstrumentationTests"
+ },
+ {
+ "name": "FrameworkBluetoothTests"
+ },
+ {
+ "name": "ServiceBluetoothTests"
+ },
// device only tests
// Broken
//{
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
index fe85daefe5..591ab496d4 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
@@ -85,8 +85,7 @@ public class VolumeControlService extends ProfileService {
private Handler mHandler = null;
private FeatureFlags mFeatureFlags;
- @VisibleForTesting
- RemoteCallbackList<IBluetoothVolumeControlCallback> mCallbacks;
+ @VisibleForTesting RemoteCallbackList<IBluetoothVolumeControlCallback> mCallbacks;
@VisibleForTesting
static class VolumeControlOffsetDescriptor {
@@ -1775,8 +1774,15 @@ public class VolumeControlService extends ProfileService {
}
enforceBluetoothPrivilegedPermission(service);
- service.registerCallback(callback);
- receiver.send(null);
+ service.mHandler.post(
+ () -> {
+ try {
+ service.registerCallback(callback);
+ receiver.send(null);
+ } catch (RuntimeException e) {
+ receiver.propagateException(e);
+ }
+ });
} catch (RuntimeException e) {
receiver.propagateException(e);
}
@@ -1796,9 +1802,15 @@ public class VolumeControlService extends ProfileService {
}
enforceBluetoothPrivilegedPermission(service);
-
- service.mCallbacks.unregister(callback);
- receiver.send(null);
+ service.mHandler.post(
+ () -> {
+ try {
+ service.mCallbacks.unregister(callback);
+ receiver.send(null);
+ } catch (RuntimeException e) {
+ receiver.propagateException(e);
+ }
+ });
} catch (RuntimeException e) {
receiver.propagateException(e);
}
diff --git a/android/pandora/mmi2grpc/mmi2grpc/__init__.py b/android/pandora/mmi2grpc/mmi2grpc/__init__.py
index ecf84b196a..a0adfe1494 100644
--- a/android/pandora/mmi2grpc/mmi2grpc/__init__.py
+++ b/android/pandora/mmi2grpc/mmi2grpc/__init__.py
@@ -37,6 +37,7 @@ from mmi2grpc.pbap import PBAPProxy
from mmi2grpc.rfcomm import RFCOMMProxy
from mmi2grpc.sdp import SDPProxy
from mmi2grpc.sm import SMProxy
+from mmi2grpc.vcp import VCPProxy
from mmi2grpc._helpers import format_proxy
from mmi2grpc._rootcanal import RootCanal
from mmi2grpc._modem import Modem
@@ -89,6 +90,7 @@ class IUT:
self._rfcomm = None
self._sdp = None
self._sm = None
+ self._vcp = None
def __enter__(self):
"""Resets the IUT when starting a PTS test."""
@@ -125,6 +127,7 @@ class IUT:
self._rfcomm = None
self._sdp = None
self._sm = None
+ self._vcp = None
def _retry(self, func):
@@ -273,6 +276,11 @@ class IUT:
if not self._sm:
self._sm = SMProxy(grpc.insecure_channel(f"localhost:{self.pandora_server_port}"), self.rootcanal)
return self._sm.interact(test, interaction, description, pts_address)
+ # HandlesVCP MMIs.
+ if profile in ("VCP"):
+ if not self._vcp:
+ self._vcp = VCPProxy(grpc.insecure_channel(f"localhost:{self.pandora_server_port}"), self.rootcanal)
+ return self._vcp.interact(test, interaction, description, pts_address)
# Handles unsupported profiles.
code = format_proxy(profile, interaction, description)
diff --git a/android/pandora/mmi2grpc/mmi2grpc/sdp.py b/android/pandora/mmi2grpc/mmi2grpc/sdp.py
index f06a388226..b22d06b8ee 100644
--- a/android/pandora/mmi2grpc/mmi2grpc/sdp.py
+++ b/android/pandora/mmi2grpc/mmi2grpc/sdp.py
@@ -145,6 +145,7 @@ class SDPProxy(ProfileProxy):
"HandsfreeAudioGateway",
"GenericAudio",
"Message Access Server",
+ "TMAS",
"NAP",
"PANU",
"Phonebook Access - PSE",
@@ -155,6 +156,7 @@ class SDPProxy(ProfileProxy):
"Generic Attribute service",
"A/V_RemoteControlController",
"Android Auto Compatibility",
+ "TMAS",
]
movable_services = [
"Message Access Server",
diff --git a/android/pandora/mmi2grpc/mmi2grpc/vcp.py b/android/pandora/mmi2grpc/mmi2grpc/vcp.py
new file mode 100644
index 0000000000..423feae758
--- /dev/null
+++ b/android/pandora/mmi2grpc/mmi2grpc/vcp.py
@@ -0,0 +1,121 @@
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+"""VCP proxy module."""
+import threading
+
+from mmi2grpc._helpers import assert_description, match_description
+from mmi2grpc._proxy import ProfileProxy
+from mmi2grpc._rootcanal import Dongle
+
+from pandora.security_grpc import Security
+from pandora.security_pb2 import LE_LEVEL3, PairingEventAnswer
+from pandora.host_grpc import Host
+from pandora.host_pb2 import PUBLIC, RANDOM
+from pandora_experimental.le_audio_grpc import LeAudio
+
+
+class VCPProxy(ProfileProxy):
+
+ def __init__(self, channel, rootcanal):
+ super().__init__(channel)
+ self.host = Host(channel)
+ self.security = Security(channel)
+ self.le_audio = LeAudio(channel)
+ self.rootcanal = rootcanal
+ self.connection = None
+ self.pairing_stream = None
+
+ def test_started(self, test: str, description: str, pts_addr: bytes):
+ self.rootcanal.select_pts_dongle(Dongle.LAIRD_BL654)
+
+ return "OK"
+
+ @assert_description
+ def IUT_INITIATE_CONNECTION(self, pts_addr: bytes, **kwargs):
+ """
+ Please initiate a GATT connection to the PTS.
+
+ Description: Verify that
+ the Implementation Under Test (IUT) can initiate a GATT connect request
+ to the PTS.
+ """
+ self.connection = self.host.ConnectLE(own_address_type=RANDOM, public=pts_addr).connection
+ self.pairing_stream = self.security.OnPairing()
+
+ def secure():
+ self.security.Secure(connection=self.connection, le=LE_LEVEL3)
+
+ threading.Thread(target=secure).start()
+ return "OK"
+
+ @match_description
+ def _mmi_2004(self, pts_addr: bytes, passkey: str, **kwargs):
+ """
+ Please confirm that 6 digit number is matched with (?P<passkey>[0-9]*).
+ """
+ received = []
+ for event in self.pairing_stream:
+ if event.address == pts_addr and event.numeric_comparison == int(passkey):
+ self.pairing_stream.send(PairingEventAnswer(
+ event=event,
+ confirm=True,
+ ))
+ return "OK"
+ received.append(event.numeric_comparison)
+
+ assert False, f"mismatched passcode: expected {passkey}, received {received}"
+
+ @match_description
+ def IUT_INITIATE_DISCOVER_CHARACTERISTIC(self, **kwargs):
+ """
+ Please take action to discover the
+ (Volume Control Point|Volume State|Volume Flags|Offset State|Volume Offset Control Point)
+ characteristic from the Volume (Offset)? Control. Discover the primary service if needed.
+ Description: Verify that the Implementation Under Test \(IUT\) can send
+ Discover All Characteristics command.
+ """
+ return "OK"
+
+ @match_description
+ def IUT_READ_CHARACTERISTIC(self, name: str, handle: str, **kwargs):
+ """
+ Please send Read Request to read (?P<name>(Volume State|Volume Flags|Offset State)) characteristic with handle
+ = (?P<handle>(0x[0-9A-Fa-f]{4})).
+ """
+ return "OK"
+
+ @assert_description
+ def USER_CONFIRM_SUPPORTED_CHARACTERISTIC(self, characteristics: str, **kwargs):
+ """
+ Please verify that for each supported characteristic, attribute
+ handle/UUID pair(s) is returned to the upper tester.(?P<characteristics>(.|\n)*)
+ """
+
+ return "OK"
+
+ @match_description
+ def IUT_CONFIG_NOTIFICATION(self, name: str, **kwargs):
+ """
+ Please write to Client Characteristic Configuration Descriptor of
+ (?P<name>(Volume State|Offset State)) characteristic to enable notification.
+ """
+ return "OK"
+
+ @assert_description
+ def _mmi_20501(self, **kwargs):
+ """
+ Please start general inquiry. Click 'Yes' If IUT does discovers PTS
+ otherwise click 'No'.
+ """
+ return "OK"
diff --git a/android/pandora/server/configs/PtsBotTest.xml b/android/pandora/server/configs/PtsBotTest.xml
index ceac057f58..8068835d0e 100644
--- a/android/pandora/server/configs/PtsBotTest.xml
+++ b/android/pandora/server/configs/PtsBotTest.xml
@@ -56,5 +56,6 @@
<option name="profile" value="RFCOMM" />
<option name="profile" value="SDP" />
<option name="profile" value="SM" />
+ <option name="profile" value="VCP" />
</test>
</configuration>
diff --git a/android/pandora/server/configs/pts_bot_tests_config.json b/android/pandora/server/configs/pts_bot_tests_config.json
index 294e5dec92..a8b41e9251 100644
--- a/android/pandora/server/configs/pts_bot_tests_config.json
+++ b/android/pandora/server/configs/pts_bot_tests_config.json
@@ -1012,7 +1012,21 @@
"SM/PER/SCPK/BI-04-C",
"SM/PER/SCPK/BV-03-C",
"SM/PER/SIE/BV-01-C",
- "SM/PER/SIP/BV-01-C"
+ "SM/PER/SIP/BV-01-C",
+ "VCP/VC/CGGIT/CHA/BV-01-C",
+ "VCP/VC/CGGIT/CHA/BV-02-C",
+ "VCP/VC/CGGIT/CHA/BV-03-C",
+ "VCP/VC/CGGIT/CHA/BV-04-C",
+ "VCP/VC/CGGIT/SER/BV-01-C",
+ "VCP/VC/CGGIT/SER/BV-02-C",
+ "VCP/VC/SPE/BI-05-C",
+ "VCP/VC/SPE/BI-06-C",
+ "VCP/VC/SPE/BI-13-C",
+ "VCP/VC/SPE/BI-15-C",
+ "VCP/VC/SPE/BI-16-C",
+ "VCP/VC/VCCP/BV-05-C",
+ "VCP/VC/VCCP/BV-06-C",
+ "VCP/VC/VOCP/BV-01-C"
],
"ics": {
"TSPC_4.0HCI_1a_2": true,
@@ -2113,7 +2127,48 @@
"TSPC_SPP_4_5": true,
"TSPC_SPP_4_6": true,
"TSPC_SUM ICS_31_22": true,
- "TSPC_SUM ICS_52_1": true
+ "TSPC_SUM ICS_52_1": true,
+ "TSPC_VCP_1_2": true,
+ "TSPC_VCP_2_2": true,
+ "TSPC_VCP_8_1": true,
+ "TSPC_VCP_10_1": true,
+ "TSPC_VCP_10_2": true,
+ "TSPC_VCP_11_1": true,
+ "TSPC_VCP_11_2": true,
+ "TSPC_VCP_11_3": true,
+ "TSPC_VCP_12_1": true,
+ "TSPC_VCP_12_11": true,
+ "TSPC_VCP_12_12": true,
+ "TSPC_VCP_12_2": true,
+ "TSPC_VCP_12_3": true,
+ "TSPC_VCP_12_4": true,
+ "TSPC_VCP_12_6": true,
+ "TSPC_VCP_13_1": true,
+ "TSPC_VCP_13_3": true,
+ "TSPC_VCP_14_1": true,
+ "TSPC_VCP_14_2": true,
+ "TSPC_VCP_14_3": true,
+ "TSPC_VCP_14_4": true,
+ "TSPC_VCP_14_6": true,
+ "TSPC_VCP_17_1": true,
+ "TSPC_VCP_17_10": true,
+ "TSPC_VCP_17_11": true,
+ "TSPC_VCP_17_2": true,
+ "TSPC_VCP_17_3": true,
+ "TSPC_VCP_17_4": true,
+ "TSPC_VCP_17_5": true,
+ "TSPC_VCP_17_6": true,
+ "TSPC_VCP_17_7": true,
+ "TSPC_VCP_17_8": true,
+ "TSPC_VCP_17_9": true,
+ "TSPC_VCP_18_1": true,
+ "TSPC_VCP_18_12": true,
+ "TSPC_VCP_18_2": true,
+ "TSPC_VCP_18_3": true,
+ "TSPC_VCP_18_6": true,
+ "TSPC_VCP_18_8": true,
+ "TSPC_VCP_19_1": true,
+ "TSPC_VCP_19_2": true
},
"ixit": {
"default": {},
@@ -2161,6 +2216,7 @@
"SDP": {},
"SM": {},
"SPP": {},
- "SUM ICS": {}
+ "SUM ICS": {},
+ "VCP": {}
}
}
diff --git a/android/pandora/server/src/LeAudio.kt b/android/pandora/server/src/LeAudio.kt
new file mode 100644
index 0000000000..4abbb993fb
--- /dev/null
+++ b/android/pandora/server/src/LeAudio.kt
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2022 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 com.android.pandora
+
+import android.bluetooth.BluetoothAdapter
+import android.bluetooth.BluetoothLeAudio
+import android.bluetooth.BluetoothManager
+import android.bluetooth.BluetoothProfile
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
+import android.media.*
+import android.util.Log
+import com.google.protobuf.Empty
+import io.grpc.stub.StreamObserver
+import java.io.Closeable
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.cancel
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.filter
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.flow.shareIn
+import pandora.LeAudioGrpc.LeAudioImplBase
+import pandora.LeAudioProto.*
+
+@kotlinx.coroutines.ExperimentalCoroutinesApi
+class LeAudio(val context: Context) : LeAudioImplBase(), Closeable {
+
+ private val TAG = "PandoraLeAudio"
+
+ private val scope: CoroutineScope
+ private val flow: Flow<Intent>
+
+ private val audioManager = context.getSystemService(AudioManager::class.java)!!
+
+ private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!!
+ private val bluetoothAdapter = bluetoothManager.adapter
+ private val bluetoothLeAudio =
+ getProfileProxy<BluetoothLeAudio>(context, BluetoothProfile.LE_AUDIO)
+
+ init {
+ scope = CoroutineScope(Dispatchers.Default)
+ val intentFilter = IntentFilter()
+ intentFilter.addAction(BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED)
+
+ flow = intentFlow(context, intentFilter, scope).shareIn(scope, SharingStarted.Eagerly)
+ }
+
+ override fun close() {
+ bluetoothAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO, bluetoothLeAudio)
+ scope.cancel()
+ }
+
+ override fun open(request: OpenRequest, responseObserver: StreamObserver<Empty>) {
+ grpcUnary<Empty>(scope, responseObserver) {
+ val device = request.connection.toBluetoothDevice(bluetoothAdapter)
+ Log.i(TAG, "open: device=$device")
+
+ if (bluetoothLeAudio.getConnectionState(device) != BluetoothProfile.STATE_CONNECTED) {
+ bluetoothLeAudio.connect(device)
+ val state =
+ flow
+ .filter {
+ it.getAction() ==
+ BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED
+ }
+ .filter { it.getBluetoothDeviceExtra() == device }
+ .map {
+ it.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothAdapter.ERROR)
+ }
+ .filter {
+ it == BluetoothProfile.STATE_CONNECTED ||
+ it == BluetoothProfile.STATE_DISCONNECTED
+ }
+ .first()
+
+ if (state == BluetoothProfile.STATE_DISCONNECTED) {
+ throw RuntimeException("open failed, LE_AUDIO has been disconnected")
+ }
+ }
+
+ Empty.getDefaultInstance()
+ }
+ }
+}
diff --git a/android/pandora/server/src/Server.kt b/android/pandora/server/src/Server.kt
index 73784067cb..6e7fab667e 100644
--- a/android/pandora/server/src/Server.kt
+++ b/android/pandora/server/src/Server.kt
@@ -66,6 +66,7 @@ class Server(context: Context) {
BluetoothProfile.PBAP to ::Pbap,
BluetoothProfile.OPP to ::Opp,
BluetoothProfile.MAP to ::Map,
+ BluetoothProfile.LE_AUDIO to ::LeAudio,
)
.filter { bluetoothAdapter.isEnabled }
.filter { bluetoothAdapter.getSupportedProfiles().contains(it.key) == true }
diff --git a/pandora/interfaces/pandora_experimental/le_audio.proto b/pandora/interfaces/pandora_experimental/le_audio.proto
new file mode 100644
index 0000000000..4500564991
--- /dev/null
+++ b/pandora/interfaces/pandora_experimental/le_audio.proto
@@ -0,0 +1,17 @@
+syntax = "proto3";
+
+import "pandora/host.proto";
+import "google/protobuf/empty.proto";
+
+option java_outer_classname = "LeAudioProto";
+
+package pandora;
+
+// Service to trigger LE Audio procedures.
+service LeAudio {
+ rpc Open(OpenRequest) returns (google.protobuf.Empty);
+}
+
+message OpenRequest {
+ Connection connection = 1;
+}
diff --git a/pandora/interfaces/python/Android.bp b/pandora/interfaces/python/Android.bp
index a670b06ec5..4893f597c2 100644
--- a/pandora/interfaces/python/Android.bp
+++ b/pandora/interfaces/python/Android.bp
@@ -54,6 +54,10 @@ genrule {
"pandora_experimental/l2cap_grpc_aio.py",
"pandora_experimental/l2cap_pb2.py",
"pandora_experimental/l2cap_pb2.pyi",
+ "pandora_experimental/le_audio_grpc.py",
+ "pandora_experimental/le_audio_grpc_aio.py",
+ "pandora_experimental/le_audio_pb2.py",
+ "pandora_experimental/le_audio_pb2.pyi",
"pandora_experimental/map_grpc.py",
"pandora_experimental/map_grpc_aio.py",
"pandora_experimental/map_pb2.py",
@@ -106,6 +110,7 @@ filegroup {
":pandora_experimental-python-gen-src{pandora_experimental/hfp_pb2.pyi}",
":pandora_experimental-python-gen-src{pandora_experimental/hid_pb2.pyi}",
":pandora_experimental-python-gen-src{pandora_experimental/l2cap_pb2.pyi}",
+ ":pandora_experimental-python-gen-src{pandora_experimental/le_audio_pb2.pyi}",
":pandora_experimental-python-gen-src{pandora_experimental/map_pb2.pyi}",
":pandora_experimental-python-gen-src{pandora_experimental/mediaplayer_pb2.pyi}",
":pandora_experimental-python-gen-src{pandora_experimental/opp_pb2.pyi}",
diff --git a/sysprop/Android.bp b/sysprop/Android.bp
index 4f848817f2..76750c9220 100644
--- a/sysprop/Android.bp
+++ b/sysprop/Android.bp
@@ -20,3 +20,14 @@ sysprop_library {
},
apex_available: ["com.android.btservices"],
}
+
+cc_library_static {
+ name: "libcom.android.sysprop.bluetooth.wrapped",
+ host_supported: true,
+ whole_static_libs: ["libcom.android.sysprop.bluetooth"],
+ export_include_dirs: ["exported_include"],
+ export_static_lib_headers: ["libcom.android.sysprop.bluetooth"],
+ visibility: ["//packages/modules/Bluetooth/system:__subpackages__"],
+ apex_available: ["com.android.btservices"],
+ min_sdk_version: "Tiramisu",
+}
diff --git a/sysprop/exported_include/android_bluetooth_sysprop.h b/sysprop/exported_include/android_bluetooth_sysprop.h
new file mode 100644
index 0000000000..3a3ccda8fe
--- /dev/null
+++ b/sysprop/exported_include/android_bluetooth_sysprop.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2023 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.
+ */
+
+#pragma once
+
+#ifndef TARGET_FLOSS
+
+#include <a2dp.sysprop.h>
+#include <avrcp.sysprop.h>
+#include <ble.sysprop.h>
+#include <bta.sysprop.h>
+#include <hfp.sysprop.h>
+#include <pan.sysprop.h>
+
+#define GET_SYSPROP(namespace, prop, default) \
+ android::sysprop::bluetooth::namespace ::prop().value_or(default)
+
+#else
+
+#define GET_SYSPROP(namespace, prop, default) default
+
+#endif
diff --git a/system/BUILD.gn b/system/BUILD.gn
index a28ca64bd3..02b92d245b 100644
--- a/system/BUILD.gn
+++ b/system/BUILD.gn
@@ -76,6 +76,7 @@ config("target_defaults") {
include_dirs = [
"//bt/system",
"//bt/flags/exported_include",
+ "//bt/sysprop/exported_include",
"//bt/system/linux_include",
"//bt/system/types",
"//bt/system/include",
diff --git a/system/bta/Android.bp b/system/bta/Android.bp
index f9e7e78f11..3439372f87 100644
--- a/system/bta/Android.bp
+++ b/system/bta/Android.bp
@@ -139,7 +139,7 @@ cc_library_static {
"libbt-bta-core",
"libbt-platform-protos-lite",
"libbt_shim_bridge",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"liblc3",
],
shared_libs: [
@@ -202,7 +202,7 @@ cc_library_static {
"lib-bt-packets",
"libbt-platform-protos-lite",
"libbt_shim_bridge",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
],
apex_available: [
"com.android.btservices",
@@ -211,7 +211,6 @@ cc_library_static {
min_sdk_version: "Tiramisu",
}
-// bta unit tests for target
cc_test {
name: "net_test_bta",
defaults: [
@@ -227,19 +226,33 @@ cc_test {
":TestCommonSyncMainHandler",
":TestFakeOsi",
":TestMockBtif",
+ ":TestMockDevice",
":TestMockMainShim",
+ ":TestMockStackA2dp",
":TestMockStackAcl",
+ ":TestMockStackAvct",
+ ":TestMockStackAvdt",
+ ":TestMockStackAvrc",
":TestMockStackBtm",
":TestMockStackGap",
":TestMockStackGatt",
":TestMockStackL2cap",
":TestMockStackMetrics",
+ ":TestMockStackPan",
":TestMockStackRfcomm",
+ "test/bta_ag_sco_test.cc",
+ "test/bta_api_test.cc",
+ "test/bta_av_test.cc",
"test/bta_dip_test.cc",
"test/bta_disc_test.cc",
"test/bta_dm_cust_uuid_test.cc",
+ "test/bta_dm_test.cc",
+ "test/bta_gatt_test.cc",
"test/bta_hf_client_add_record_test.cc",
"test/bta_hf_client_test.cc",
+ "test/bta_pan_test.cc",
+ "test/bta_sdp_test.cc",
+ "test/bta_sec_test.cc",
],
generated_headers: [
"BluetoothGeneratedDumpsysDataSchema_h",
@@ -248,6 +261,7 @@ cc_test {
"android.hardware.bluetooth.audio@2.0",
"android.hardware.bluetooth.audio@2.1",
"libcrypto",
+ "libcutils",
"liblog",
],
static_libs: [
@@ -266,7 +280,7 @@ cc_test {
"libbtcore",
"libbtdevice",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
],
@@ -322,7 +336,7 @@ cc_test {
"libbt_shim_ffi",
"libbtcore",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libgmock",
],
cflags: ["-Wno-unused-parameter"],
@@ -372,141 +386,6 @@ cc_test {
}
cc_test {
- name: "bt_host_test_bta",
- defaults: [
- "fluoride_bta_defaults",
- "mts_defaults",
- ],
- test_suites: ["general-tests"],
- host_supported: true,
- include_dirs: [
- "packages/modules/Bluetooth/system",
- "packages/modules/Bluetooth/system/gd",
- ],
- generated_headers: [
- "BluetoothGeneratedDumpsysDataSchema_h",
- ],
- srcs: [
- ":BtaDmSources",
- ":LegacyStackSdp",
- ":OsiCompatSources",
- ":TestCommonMainHandler",
- ":TestCommonMockFunctions",
- ":TestFakeOsi",
- ":TestMockBtaScn",
- ":TestMockBtaSdp",
- ":TestMockBtif",
- ":TestMockDevice",
- ":TestMockMainShim",
- ":TestMockSrvcDis",
- ":TestMockStackA2dp",
- ":TestMockStackAcl",
- ":TestMockStackAvct",
- ":TestMockStackAvdt",
- ":TestMockStackAvrc",
- ":TestMockStackBtm",
- ":TestMockStackCryptotoolbox",
- ":TestMockStackGap",
- ":TestMockStackGatt",
- ":TestMockStackHid",
- ":TestMockStackL2cap",
- ":TestMockStackMetrics",
- ":TestMockStackPan",
- ":TestMockStackRfcomm",
- "ag/bta_ag_act.cc",
- "ag/bta_ag_api.cc",
- "ag/bta_ag_at.cc",
- "ag/bta_ag_cfg.cc",
- "ag/bta_ag_cmd.cc",
- "ag/bta_ag_main.cc",
- "ag/bta_ag_rfc.cc",
- "ag/bta_ag_sco.cc",
- "ag/bta_ag_sdp.cc",
- "ar/bta_ar.cc",
- "av/bta_av_aact.cc",
- "av/bta_av_act.cc",
- "av/bta_av_cfg.cc",
- "av/bta_av_main.cc",
- "av/bta_av_ssm.cc",
- "gatt/bta_gattc_act.cc",
- "gatt/bta_gattc_api.cc",
- "gatt/bta_gattc_cache.cc",
- "gatt/bta_gattc_db_storage.cc",
- "gatt/bta_gattc_main.cc",
- "gatt/bta_gattc_queue.cc",
- "gatt/bta_gattc_utils.cc",
- "gatt/database.cc",
- "gatt/database_builder.cc",
- "hf_client/bta_hf_client_act.cc",
- "hf_client/bta_hf_client_api.cc",
- "hf_client/bta_hf_client_at.cc",
- "hf_client/bta_hf_client_main.cc",
- "hf_client/bta_hf_client_rfc.cc",
- "hf_client/bta_hf_client_sco.cc",
- "hf_client/bta_hf_client_sdp.cc",
- "hfp/bta_hfp_api.cc",
- "hh/bta_hh_act.cc",
- "hh/bta_hh_api.cc",
- "hh/bta_hh_cfg.cc",
- "hh/bta_hh_le.cc",
- "hh/bta_hh_main.cc",
- "hh/bta_hh_utils.cc",
- "pan/bta_pan_act.cc",
- "pan/bta_pan_api.cc",
- "pan/bta_pan_main.cc",
- "sdp/bta_sdp_cfg.cc",
- "sys/bta_sys_conn.cc",
- "sys/bta_sys_main.cc",
- "sys/utl.cc",
- "test/bta_ag_sco_test.cc",
- "test/bta_api_test.cc",
- "test/bta_av_test.cc",
- "test/bta_disc_test.cc",
- "test/bta_dm_cust_uuid_test.cc",
- "test/bta_dm_test.cc",
- "test/bta_gatt_test.cc",
- "test/bta_hf_client_add_record_test.cc",
- "test/bta_pan_test.cc",
- "test/bta_sdp_test.cc",
- "test/bta_sec_test.cc",
- ],
- shared_libs: [
- "libbase",
- "libcrypto",
- "libcutils",
- "liblog",
- ],
- static_libs: [
- "libbluetooth-types",
- "libbluetooth_gd",
- "libbluetooth_hci_pdl",
- "libbt-common",
- "libbt-platform-protos-lite",
- "libbt_shim_bridge",
- "libbt_shim_ffi",
- "libbtcore",
- "libbtdevice",
- "libchrome",
- "libcom.android.sysprop.bluetooth",
- "libevent",
- "libgmock",
- ],
- sanitize: {
- address: true,
- cfi: true,
- misc_undefined: ["bounds"],
- },
- target: {
- android: {
- whole_static_libs: [
- "libPlatformProperties",
- ],
- },
- },
- cflags: ["-Wno-unused-parameter"],
-}
-
-cc_test {
name: "bt_host_test_bta_scn",
defaults: [
"fluoride_bta_defaults",
@@ -550,7 +429,7 @@ cc_test {
"libbtcore",
"libbtdevice",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
],
@@ -1324,7 +1203,7 @@ cc_test {
"libbt_shim_bridge",
"libbt_shim_ffi",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
"libosi",
diff --git a/system/bta/csis/csis_client.cc b/system/bta/csis/csis_client.cc
index 303452b16b..b2e6e88c33 100644
--- a/system/bta/csis/csis_client.cc
+++ b/system/bta/csis/csis_client.cc
@@ -1317,12 +1317,11 @@ class CsisClientImpl : public CsisClient {
/* Make sure device is not already bonded which could
* be a case for dual mode devices where
*/
- tBTM_SEC_DEV_REC* p_dev = btm_find_dev(result->bd_addr);
- if (p_dev && p_dev->is_le_link_key_known()) {
- LOG_VERBOSE(
- "Device %s already bonded. Identity address: %s",
- ADDRESS_TO_LOGGABLE_CSTR(result->bd_addr),
- ADDRESS_TO_LOGGABLE_CSTR(p_dev->ble.identity_address_with_type));
+ if (BTM_BleIsLinkKeyKnown(result->bd_addr)) {
+ LOG_VERBOSE("Device %s already bonded. Identity address: %s",
+ ADDRESS_TO_LOGGABLE_CSTR(result->bd_addr),
+ ADDRESS_TO_LOGGABLE_CSTR(
+ *BTM_BleGetIdentityAddress(result->bd_addr)));
return;
}
@@ -1468,12 +1467,11 @@ class CsisClientImpl : public CsisClient {
/* Make sure device is not already bonded which could
* be a case for dual mode devices where
*/
- tBTM_SEC_DEV_REC* p_dev = btm_find_dev(result->bd_addr);
- if (p_dev && p_dev->is_le_link_key_known()) {
- LOG_VERBOSE(
- "Device %s already bonded. Identity address: %s",
- ADDRESS_TO_LOGGABLE_CSTR(result->bd_addr),
- ADDRESS_TO_LOGGABLE_CSTR(p_dev->ble.identity_address_with_type));
+ if (BTM_BleIsLinkKeyKnown(result->bd_addr)) {
+ LOG_VERBOSE("Device %s already bonded. Identity address: %s",
+ ADDRESS_TO_LOGGABLE_CSTR(result->bd_addr),
+ ADDRESS_TO_LOGGABLE_CSTR(
+ *BTM_BleGetIdentityAddress(result->bd_addr)));
return;
}
diff --git a/system/bta/dm/bta_dm_disc.cc b/system/bta/dm/bta_dm_disc.cc
index 929500151b..195768de63 100644
--- a/system/bta/dm/bta_dm_disc.cc
+++ b/system/bta/dm/bta_dm_disc.cc
@@ -2378,15 +2378,19 @@ bool bta_dm_search_sm_execute(const BT_HDR_RIGID* p_msg) {
return true;
}
+static void bta_dm_disc_init_search_cb(tBTA_DM_SEARCH_CB& bta_dm_search_cb) {
+ bta_dm_search_cb = {};
+ bta_dm_search_cb.state = BTA_DM_SEARCH_IDLE;
+ bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID;
+ bta_dm_search_cb.transport = BT_TRANSPORT_AUTO;
+}
+
static void bta_dm_disc_reset() {
alarm_free(bta_dm_search_cb.search_timer);
alarm_free(bta_dm_search_cb.gatt_close_timer);
osi_free_and_reset((void**)&bta_dm_search_cb.p_pending_search);
fixed_queue_free(bta_dm_search_cb.pending_discovery_queue, osi_free);
- bta_dm_search_cb = {};
- bta_dm_search_cb.state = BTA_DM_SEARCH_IDLE;
- bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID;
- bta_dm_search_cb.transport = BT_TRANSPORT_AUTO;
+ bta_dm_disc_init_search_cb(::bta_dm_search_cb);
}
void bta_dm_disc_start(bool delay_close_gatt) {
diff --git a/system/bta/dm/bta_dm_sec.cc b/system/bta/dm/bta_dm_sec.cc
index 673aa7d0da..4c2fc79361 100644
--- a/system/bta/dm/bta_dm_sec.cc
+++ b/system/bta/dm/bta_dm_sec.cc
@@ -161,7 +161,7 @@ void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
const char* p_name;
tBTM_STATUS status = get_btm_client_interface().security.BTM_SecBond(
- bd_addr, addr_type, transport, device_type, 0, NULL);
+ bd_addr, addr_type, transport, device_type);
if (bta_dm_sec_cb.p_sec_cback && (status != BTM_CMD_STARTED)) {
memset(&sec_event, 0, sizeof(tBTA_DM_SEC));
diff --git a/system/bta/include/bta_api.h b/system/bta/include/bta_api.h
index 90d5e03b71..92c93606b9 100644
--- a/system/bta/include/bta_api.h
+++ b/system/bta/include/bta_api.h
@@ -33,12 +33,12 @@
#include "bt_target.h" // Must be first to define build configuration
#include "bta_api_data_types.h"
-#include "osi/include/log.h"
+#include "os/log.h"
#include "stack/include/bt_name.h"
#include "stack/include/btm_api_types.h"
#include "stack/include/btm_ble_api_types.h"
#include "stack/include/hci_error_code.h"
-#include "stack/include/sdp_api.h"
+#include "stack/include/sdp_device_id.h"
#include "types/ble_address_with_type.h"
#include "types/bluetooth/uuid.h"
#include "types/bt_transport.h"
diff --git a/system/bta/le_audio/codec_manager_test.cc b/system/bta/le_audio/codec_manager_test.cc
index fb5c5949c2..29a2e43e31 100644
--- a/system/bta/le_audio/codec_manager_test.cc
+++ b/system/bta/le_audio/codec_manager_test.cc
@@ -88,6 +88,7 @@ class CodecManagerTestBase : public Test {
.WillByDefault(Return(true));
controller::SetMockControllerInterface(&controller_interface);
+ Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock());
codec_manager = CodecManager::GetInstance();
}
@@ -95,6 +96,7 @@ class CodecManagerTestBase : public Test {
virtual void TearDown() override {
codec_manager->Stop();
+ Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock());
controller::SetMockControllerInterface(nullptr);
}
diff --git a/system/bta/le_audio/state_machine.cc b/system/bta/le_audio/state_machine.cc
index 85306a1b8d..1665aec018 100644
--- a/system/bta/le_audio/state_machine.cc
+++ b/system/bta/le_audio/state_machine.cc
@@ -1289,13 +1289,6 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
return false;
}
- // Use 1M Phy for the ACK packet from remote device to phone for better
- // sensitivity
- if (max_sdu_size_stom == 0 &&
- (phy_stom & bluetooth::hci::kIsoCigPhy1M) != 0) {
- phy_stom = bluetooth::hci::kIsoCigPhy1M;
- }
-
uint8_t rtn_mtos = 0;
uint8_t rtn_stom = 0;
diff --git a/system/bta/test/bta_dm_test.cc b/system/bta/test/bta_dm_test.cc
index 2f696c12ef..110031c756 100644
--- a/system/bta/test/bta_dm_test.cc
+++ b/system/bta/test/bta_dm_test.cc
@@ -417,7 +417,6 @@ TEST_F(BtaDmTest, bta_dm_remname_cback__wrong_address) {
sync_main_handler();
ASSERT_EQ(0, get_func_call_count("BTM_SecDeleteRmtNameNotifyCallback"));
- ASSERT_FALSE(bta_dm_search_cb.name_discover_done);
}
TEST_F(BtaDmTest, bta_dm_remname_cback__HCI_ERR_CONNECTION_EXISTS) {
diff --git a/system/bta/test/common/btm_api_mock.cc b/system/bta/test/common/btm_api_mock.cc
index 432e487fc3..1682ff9ae4 100644
--- a/system/bta/test/common/btm_api_mock.cc
+++ b/system/bta/test/common/btm_api_mock.cc
@@ -117,3 +117,14 @@ std::optional<Octet16> BTM_BleGetPeerIRK(const RawAddress address) {
LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
return btm_interface->BTM_BleGetPeerIRK(address);
}
+
+bool BTM_BleIsLinkKeyKnown(const RawAddress address) {
+ LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
+ return btm_interface->BTM_BleIsLinkKeyKnown(address);
+}
+
+std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(
+ const RawAddress address) {
+ LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
+ return btm_interface->BTM_BleGetIdentityAddress(address);
+}
diff --git a/system/bta/test/common/btm_api_mock.h b/system/bta/test/common/btm_api_mock.h
index 1e324a527c..f134c62a3c 100644
--- a/system/bta/test/common/btm_api_mock.h
+++ b/system/bta/test/common/btm_api_mock.h
@@ -23,6 +23,7 @@
#include "bt_octets.h"
#include "btm_api.h"
#include "stack/btm/security_device_record.h"
+#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
namespace bluetooth {
@@ -62,6 +63,10 @@ class BtmInterface {
virtual std::optional<Octet16> BTM_BleGetPeerIRK(
const RawAddress address) = 0;
+ virtual bool BTM_BleIsLinkKeyKnown(const RawAddress address) = 0;
+ virtual std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(
+ const RawAddress address) = 0;
+
virtual ~BtmInterface() = default;
};
@@ -107,6 +112,11 @@ class MockBtmInterface : public BtmInterface {
(const RawAddress address), (override));
MOCK_METHOD((std::optional<Octet16>), BTM_BleGetPeerIRK,
(const RawAddress address), (override));
+
+ MOCK_METHOD((bool), BTM_BleIsLinkKeyKnown, (const RawAddress address),
+ (override));
+ MOCK_METHOD((std::optional<tBLE_BD_ADDR>), BTM_BleGetIdentityAddress,
+ (const RawAddress address), (override));
};
/**
diff --git a/system/btif/Android.bp b/system/btif/Android.bp
index 56277c4b25..41ff9822ef 100644
--- a/system/btif/Android.bp
+++ b/system/btif/Android.bp
@@ -521,7 +521,7 @@ cc_test {
"libbt_shim_bridge",
"libbt_shim_ffi",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
],
cflags: [
"-DBUILDCFG",
@@ -638,7 +638,7 @@ cc_test {
"libbtif-core",
"libc++fs",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
"libstatslog_bt",
@@ -775,7 +775,7 @@ cc_test {
"libbtif-core",
"libc++fs",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
"libstatslog_bt",
diff --git a/system/gd/hci/acl_manager.h b/system/gd/hci/acl_manager.h
index 8675b4a05b..08665324c2 100644
--- a/system/gd/hci/acl_manager.h
+++ b/system/gd/hci/acl_manager.h
@@ -43,7 +43,6 @@ class Acl;
}
class Btm;
-void L2CA_UseLegacySecurityModule();
bool L2CA_SetAclPriority(uint16_t, bool);
}
@@ -52,7 +51,6 @@ namespace hci {
class AclManager : public Module {
friend class bluetooth::shim::Btm;
friend class bluetooth::shim::legacy::Acl;
- friend void bluetooth::shim::L2CA_UseLegacySecurityModule();
friend bool bluetooth::shim::L2CA_SetAclPriority(uint16_t, bool);
friend class bluetooth::hci::LeScanningManager;
friend class bluetooth::hci::DistanceMeasurementManager;
diff --git a/system/gd/l2cap/le/l2cap_le_module.h b/system/gd/l2cap/le/l2cap_le_module.h
index 28352c0c68..999f1dfad1 100644
--- a/system/gd/l2cap/le/l2cap_le_module.h
+++ b/system/gd/l2cap/le/l2cap_le_module.h
@@ -25,10 +25,6 @@
namespace bluetooth {
-namespace shim {
-void L2CA_UseLegacySecurityModule();
-}
-
namespace security {
class SecurityModule;
}
@@ -70,7 +66,6 @@ class L2capLeModule : public bluetooth::Module {
std::unique_ptr<impl> pimpl_;
friend security::SecurityModule;
- friend void bluetooth::shim::L2CA_UseLegacySecurityModule();
/**
* Only for the LE security module to inject functionality to enforce security level for a connection. When LE
diff --git a/system/main/shim/l2c_api.cc b/system/main/shim/l2c_api.cc
index 0b12919db3..8dda84e007 100644
--- a/system/main/shim/l2c_api.cc
+++ b/system/main/shim/l2c_api.cc
@@ -690,30 +690,6 @@ uint8_t* L2CA_ReadRemoteFeatures(const RawAddress& addr) {
return entry.raw_remote_features;
}
-static void on_sco_disconnect(uint16_t handle, uint8_t reason) {
- GetGdShimHandler()->Post(base::BindOnce(base::IgnoreResult(&btm_sco_removed),
- handle,
- static_cast<tHCI_REASON>(reason)));
-}
-
-void L2CA_UseLegacySecurityModule() {
- LOG_INFO("GD L2cap is using legacy security module");
- GetL2capClassicModule()->SetLinkPropertyListener(
- GetGdShimHandler(), &link_property_listener_shim_);
-
- GetL2capClassicModule()->InjectSecurityEnforcementInterface(
- &security_enforcement_shim_);
- security_interface_ = GetL2capClassicModule()->GetSecurityInterface(
- GetGdShimHandler(), &security_listener_shim_);
-
- GetL2capLeModule()->SetLinkPropertyListener(GetGdShimHandler(),
- &le_link_property_listener_shim_);
- GetL2capLeModule()->InjectSecurityEnforcementInterface(
- &le_security_enforcement_shim_);
-
- GetAclManager()->HACK_SetNonAclDisconnectCallback(on_sco_disconnect);
-}
-
/**
* Classic Service Registration APIs
*/
diff --git a/system/main/shim/l2c_api.h b/system/main/shim/l2c_api.h
index 4b02c44a8c..9f12916ca0 100644
--- a/system/main/shim/l2c_api.h
+++ b/system/main/shim/l2c_api.h
@@ -455,9 +455,6 @@ void L2CA_ConnectForSecurity(const RawAddress& bd_addr);
// Set bonding state to acquire/release link refcount
void L2CA_SetBondingState(const RawAddress& p_bd_addr, bool is_bonding);
-// Indicated by shim stack manager that GD L2cap is enabled but Security is not
-void L2CA_UseLegacySecurityModule();
-
void L2CA_SwitchRoleToCentral(const RawAddress& addr);
bool L2CA_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
diff --git a/system/profile/avrcp/Android.bp b/system/profile/avrcp/Android.bp
index bd4380b4b8..34e3d1df48 100644
--- a/system/profile/avrcp/Android.bp
+++ b/system/profile/avrcp/Android.bp
@@ -31,7 +31,7 @@ cc_library_static {
"libosi",
],
whole_static_libs: [
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
],
shared_libs: [
"liblog",
diff --git a/system/stack/Android.bp b/system/stack/Android.bp
index 5f57faa8b7..ea6114872f 100644
--- a/system/stack/Android.bp
+++ b/system/stack/Android.bp
@@ -171,7 +171,7 @@ cc_library_static {
whole_static_libs: [
"libaptx_enc",
"libaptxhd_enc",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libldacBT_abr",
"libldacBT_enc",
],
@@ -324,7 +324,7 @@ cc_library_static {
"libbt-hci",
"libbt-platform-protos-lite",
"libbt_shim_bridge",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
],
shared_libs: [
"libPlatformProperties",
@@ -612,7 +612,7 @@ cc_fuzz {
target: {
android: {
static_libs: [
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
],
},
},
@@ -1548,7 +1548,7 @@ cc_test {
"libbt_shim_ffi",
"libbtdevice",
"libchrome",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
"liblc3",
diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc
index d2d8f1b4b1..e32285e2ee 100644
--- a/system/stack/btm/btm_ble_sec.cc
+++ b/system/stack/btm/btm_ble_sec.cc
@@ -1961,3 +1961,18 @@ std::optional<Octet16> BTM_BleGetPeerIRK(const RawAddress address) {
return p_dev_rec->ble_keys.irk;
}
+
+bool BTM_BleIsLinkKeyKnown(const RawAddress address) {
+ tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
+ return p_dev_rec != nullptr && p_dev_rec->is_le_link_key_known();
+}
+
+std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(
+ const RawAddress address) {
+ tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
+ if (p_dev_rec == nullptr) {
+ return std::nullopt;
+ }
+
+ return p_dev_rec->ble.identity_address_with_type;
+}
diff --git a/system/stack/btm/btm_devctl.cc b/system/stack/btm/btm_devctl.cc
index e393d5758f..67996b6af7 100644
--- a/system/stack/btm/btm_devctl.cc
+++ b/system/stack/btm/btm_devctl.cc
@@ -23,14 +23,13 @@
*
******************************************************************************/
-#include "acl_api_types.h"
#define LOG_TAG "devctl"
-
#include <base/logging.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include "acl_api_types.h"
#include "btif/include/btif_bqr.h"
#include "btm_ble_int.h"
#include "btm_sec_cb.h"
diff --git a/system/stack/btm/btm_sco_hci.cc b/system/stack/btm/btm_sco_hci.cc
index d470f3d38f..0505052fd5 100644
--- a/system/stack/btm/btm_sco_hci.cc
+++ b/system/stack/btm/btm_sco_hci.cc
@@ -880,7 +880,6 @@ struct tBTM_LC3_INFO {
const uint8_t* find_lc3_pkt_head() {
if (read_corrupted) {
- LOG_DEBUG("Skip corrupted LC3 packets");
read_corrupted = false;
return nullptr;
}
@@ -987,8 +986,6 @@ bool enqueue_packet(const std::vector<uint8_t>& data, bool corrupted) {
lc3_info->read_corrupted |= corrupted;
if (lc3_info->write(data) != data.size()) {
- LOG_DEBUG("Fail to write packet with size %lu to buffer",
- (unsigned long)data.size());
return false;
}
@@ -1009,16 +1006,10 @@ size_t decode(const uint8_t** out_data) {
}
if (lc3_info->decodable() < BTM_LC3_PKT_LEN) {
- LOG_DEBUG("No complete LC3 packet to decode");
return 0;
}
frame_head = lc3_info->find_lc3_pkt_head();
- if (frame_head == nullptr) {
- LOG_DEBUG("No valid LC3 packet to decode %lu, %lu",
- (unsigned long)lc3_info->decode_buf_ro,
- (unsigned long)lc3_info->decode_buf_wo);
- }
bool plc_conducted = !GetInterfaceToProfiles()->lc3Codec->decodePacket(
frame_head, lc3_info->decoded_pcm_buf, sizeof(lc3_info->decoded_pcm_buf));
@@ -1047,16 +1038,11 @@ size_t encode(int16_t* data, size_t len) {
}
if (len < BTM_LC3_CODE_SIZE) {
- LOG_DEBUG(
- "PCM frames with size %lu is insufficient to be encoded into a LC3 "
- "packet",
- (unsigned long)len);
return 0;
}
pkt_body = lc3_info->fill_lc3_pkt_template();
if (pkt_body == nullptr) {
- LOG_DEBUG("Failed to fill the template to fill the LC3 packet");
return 0;
}
diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc
index 0a422b28dd..13eee35a9c 100644
--- a/system/stack/btm/btm_sec.cc
+++ b/system/stack/btm/btm_sec.cc
@@ -754,15 +754,14 @@ void BTM_PINCodeReply(const RawAddress& bd_addr, tBTM_STATUS res,
* Description this is the bond function that will start either SSP or SMP.
*
* Parameters: bd_addr - Address of the device to bond
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
+ * addr_type - type of the address
+ * transport - transport on which to create bond
*
* Note: After 2.1 parameters are not used and preserved here not to change API
******************************************************************************/
tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin) {
+ tBT_TRANSPORT transport) {
tBTM_SEC_DEV_REC* p_dev_rec;
tBTM_STATUS status;
LOG_INFO("%s: Transport used %d, bd_addr=%s", __func__, transport,
@@ -805,13 +804,6 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
return (BTM_NO_RESOURCES);
}
- /* Save the PIN code if we got a valid one */
- if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) {
- btm_sec_cb.pin_code_len = pin_len;
- p_dev_rec->pin_code_length = pin_len;
- memcpy(btm_sec_cb.pin_code, p_pin, PIN_CODE_LEN);
- }
-
btm_sec_cb.pairing_bda = bd_addr;
btm_sec_cb.pairing_flags = BTM_PAIR_FLAGS_WE_STARTED_DD;
@@ -921,14 +913,11 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
*
* Parameters: bd_addr - Address of the device to bond
* transport - doing SSP over BR/EDR or SMP over LE
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
*
* Note: After 2.1 parameters are not used and preserved here not to change API
******************************************************************************/
tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin) {
+ tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
if (transport == BT_TRANSPORT_AUTO) {
if (addr_type == BLE_ADDR_PUBLIC) {
transport =
@@ -950,8 +939,7 @@ tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
"device on don't match");
return BTM_ILLEGAL_ACTION;
}
- return btm_sec_bond_by_transport(bd_addr, addr_type, transport, pin_len,
- p_pin);
+ return btm_sec_bond_by_transport(bd_addr, addr_type, transport);
}
/*******************************************************************************
diff --git a/system/stack/btm/btm_sec.h b/system/stack/btm/btm_sec.h
index d65a5312d8..af455ea038 100644
--- a/system/stack/btm/btm_sec.h
+++ b/system/stack/btm/btm_sec.h
@@ -208,8 +208,7 @@ void BTM_PINCodeReply(const RawAddress& bd_addr, tBTM_STATUS res,
******************************************************************************/
tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin);
+ tBT_TRANSPORT transport);
/*******************************************************************************
*
@@ -221,14 +220,11 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
*
* Parameters: bd_addr - Address of the device to bond
* transport - doing SSP over BR/EDR or SMP over LE
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
*
* Note: After 2.1 parameters are not used and preserved here not to change API
******************************************************************************/
tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin);
+ tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type);
/*******************************************************************************
*
diff --git a/system/stack/btm/hfp_lc3_decoder.cc b/system/stack/btm/hfp_lc3_decoder.cc
index 38133b51ed..dd82859694 100644
--- a/system/stack/btm/hfp_lc3_decoder.cc
+++ b/system/stack/btm/hfp_lc3_decoder.cc
@@ -74,10 +74,5 @@ bool hfp_lc3_decoder_decode_packet(const uint8_t* i_buf, int16_t* o_buf,
ASSERT(rc == 0 || rc == 1);
- if (rc == 1) {
- LOG_WARN("%s: PLC conducted", __func__);
- /* TODO(b/269970706): change this to debug log */
- }
-
return !rc;
}
diff --git a/system/stack/btm/hfp_lc3_decoder_linux.cc b/system/stack/btm/hfp_lc3_decoder_linux.cc
index 3d78492cda..52d3d4513f 100644
--- a/system/stack/btm/hfp_lc3_decoder_linux.cc
+++ b/system/stack/btm/hfp_lc3_decoder_linux.cc
@@ -98,10 +98,6 @@ bool hfp_lc3_decoder_decode_packet(const uint8_t* i_buf, int16_t* o_buf,
bool plc_conducted = o_packet[0];
- if (plc_conducted == 1) {
- LOG_DEBUG("%s: PLC conducted", __func__);
- }
-
std::copy(o_packet + 1, o_packet + 1 + out_len, (uint8_t*)o_buf);
delete[] o_packet;
diff --git a/system/stack/btm/security_device_record.h b/system/stack/btm/security_device_record.h
index e7d9d007fb..7ab0600001 100644
--- a/system/stack/btm/security_device_record.h
+++ b/system/stack/btm/security_device_record.h
@@ -252,8 +252,7 @@ struct tBTM_SEC_DEV_REC {
uint8_t key_type);
friend tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport,
- uint8_t pin_len, uint8_t* p_pin);
+ tBT_TRANSPORT transport);
uint8_t pin_code_length; /* Length of the pin_code used for paring */
public:
diff --git a/system/stack/include/btm_ble_sec_api.h b/system/stack/include/btm_ble_sec_api.h
index 3830cf2539..f3481a0d14 100644
--- a/system/stack/include/btm_ble_sec_api.h
+++ b/system/stack/include/btm_ble_sec_api.h
@@ -235,3 +235,34 @@ std::optional<Octet16> BTM_BleGetPeerLTK(const RawAddress address);
*
******************************************************************************/
std::optional<Octet16> BTM_BleGetPeerIRK(const RawAddress address);
+
+/*******************************************************************************
+ *
+ * Function BTM_BleIsLinkKeyKnown
+ *
+ * Description This function is used to check whether the link key
+ * of a peer (LE) device is known or not
+ *
+ * Parameters: address: address of the peer device
+ *
+ * Returns true if the link key is known
+ * false otherwise
+ *
+ ******************************************************************************/
+bool BTM_BleIsLinkKeyKnown(const RawAddress address);
+
+/*******************************************************************************
+ *
+ * Function BTM_BleGetIdentityAddress
+ *
+ * Description This function is called to get the identity address
+ * (with type) of a peer (LE) device.
+ *
+ * Parameters: address: address of the peer device
+ *
+ * Returns the identity address in std::optional if the remote device
+ * is present in security database
+ * std::nullopt if the device is not present
+ *
+ ******************************************************************************/
+std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(const RawAddress address);
diff --git a/system/stack/include/sdp_device_id.h b/system/stack/include/sdp_device_id.h
index cb0f3fe44f..8544e2c9f1 100644
--- a/system/stack/include/sdp_device_id.h
+++ b/system/stack/include/sdp_device_id.h
@@ -21,7 +21,6 @@
#include <cstdint>
#include "bt_target.h"
-#include "stack/include/sdp_status.h"
/* Device Identification (DI) data structure
*/
diff --git a/system/stack/include/security_client_callbacks.h b/system/stack/include/security_client_callbacks.h
index 33d934f105..efffe164bb 100644
--- a/system/stack/include/security_client_callbacks.h
+++ b/system/stack/include/security_client_callbacks.h
@@ -104,8 +104,7 @@ typedef struct {
const char* (*BTM_SecReadDevName)(const RawAddress& bd_addr);
tBTM_STATUS (*BTM_SecBond)(const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type, tBT_TRANSPORT transport,
- tBT_DEVICE_TYPE device_type, uint8_t pin_len,
- uint8_t* p_pin);
+ tBT_DEVICE_TYPE device_type);
tBTM_STATUS (*BTM_SecBondCancel)(const RawAddress& bd_addr);
void (*BTM_SecAddBleKey)(const RawAddress& bd_addr,
tBTM_LE_KEY_VALUE* p_le_key,
diff --git a/system/test/mock/mock_main_shim_l2cap_api.cc b/system/test/mock/mock_main_shim_l2cap_api.cc
index f08ce34a2e..e0cfe37ee6 100644
--- a/system/test/mock/mock_main_shim_l2cap_api.cc
+++ b/system/test/mock/mock_main_shim_l2cap_api.cc
@@ -40,7 +40,6 @@ namespace main_shim_l2cap_api {
// Function state capture and return values, if needed
struct L2CA_ReadRemoteVersion L2CA_ReadRemoteVersion;
struct L2CA_ReadRemoteFeatures L2CA_ReadRemoteFeatures;
-struct L2CA_UseLegacySecurityModule L2CA_UseLegacySecurityModule;
struct L2CA_Register L2CA_Register;
struct L2CA_Deregister L2CA_Deregister;
struct L2CA_ConnectReq L2CA_ConnectReq;
@@ -101,10 +100,6 @@ uint8_t* bluetooth::shim::L2CA_ReadRemoteFeatures(const RawAddress& addr) {
inc_func_call_count(__func__);
return test::mock::main_shim_l2cap_api::L2CA_ReadRemoteFeatures(addr);
}
-void bluetooth::shim::L2CA_UseLegacySecurityModule() {
- inc_func_call_count(__func__);
- test::mock::main_shim_l2cap_api::L2CA_UseLegacySecurityModule();
-}
uint16_t bluetooth::shim::L2CA_Register(
uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks, bool enable_snoop,
tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu,
diff --git a/system/test/mock/mock_main_shim_l2cap_api.h b/system/test/mock/mock_main_shim_l2cap_api.h
index 7da77c2258..3905742bb9 100644
--- a/system/test/mock/mock_main_shim_l2cap_api.h
+++ b/system/test/mock/mock_main_shim_l2cap_api.h
@@ -60,14 +60,6 @@ struct L2CA_ReadRemoteFeatures {
uint8_t* operator()(const RawAddress& addr) { return body(addr); };
};
extern struct L2CA_ReadRemoteFeatures L2CA_ReadRemoteFeatures;
-// Name: L2CA_UseLegacySecurityModule
-// Params:
-// Returns: void
-struct L2CA_UseLegacySecurityModule {
- std::function<void()> body{[]() {}};
- void operator()() { body(); };
-};
-extern struct L2CA_UseLegacySecurityModule L2CA_UseLegacySecurityModule;
// Name: L2CA_Register
// Params: uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks, bool
// enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t
diff --git a/system/test/mock/mock_stack_btm_interface.cc b/system/test/mock/mock_stack_btm_interface.cc
index 37fb680239..186d78ff00 100644
--- a/system/test/mock/mock_stack_btm_interface.cc
+++ b/system/test/mock/mock_stack_btm_interface.cc
@@ -119,10 +119,8 @@ struct btm_client_interface_t default_btm_client_interface = {
return nullptr;
},
.BTM_SecBond = [](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin) -> tBTM_STATUS {
- return BTM_SUCCESS;
- },
+ tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type)
+ -> tBTM_STATUS { return BTM_SUCCESS; },
.BTM_SecBondCancel = [](const RawAddress& bd_addr) -> tBTM_STATUS {
return BTM_SUCCESS;
},
diff --git a/system/test/mock/mock_stack_btm_sec.cc b/system/test/mock/mock_stack_btm_sec.cc
index 0eef335270..7968d3a6bd 100644
--- a/system/test/mock/mock_stack_btm_sec.cc
+++ b/system/test/mock/mock_stack_btm_sec.cc
@@ -230,11 +230,10 @@ bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) {
return test::mock::stack_btm_sec::BTM_SecAddRmtNameNotifyCallback(p_callback);
}
tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin) {
+ tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
inc_func_call_count(__func__);
return test::mock::stack_btm_sec::BTM_SecBond(bd_addr, addr_type, transport,
- device_type, pin_len, p_pin);
+ device_type);
}
tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
inc_func_call_count(__func__);
@@ -333,11 +332,10 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
}
tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin) {
+ tBT_TRANSPORT transport) {
inc_func_call_count(__func__);
return test::mock::stack_btm_sec::btm_sec_bond_by_transport(
- bd_addr, addr_type, transport, pin_len, p_pin);
+ bd_addr, addr_type, transport);
}
void btm_sec_check_pending_reqs(void) {
inc_func_call_count(__func__);
diff --git a/system/test/mock/mock_stack_btm_sec.h b/system/test/mock/mock_stack_btm_sec.h
index 899ba882af..0b7f451c7a 100644
--- a/system/test/mock/mock_stack_btm_sec.h
+++ b/system/test/mock/mock_stack_btm_sec.h
@@ -270,15 +270,13 @@ struct BTM_SecBond {
static tBTM_STATUS return_value;
std::function<tBTM_STATUS(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
tBT_TRANSPORT transport,
- tBT_DEVICE_TYPE device_type, uint8_t pin_len,
- uint8_t* p_pin)>
+ tBT_DEVICE_TYPE device_type)>
body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin) { return return_value; }};
+ tBT_TRANSPORT transport,
+ tBT_DEVICE_TYPE device_type) { return return_value; }};
tBTM_STATUS operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
- uint8_t pin_len, uint8_t* p_pin) {
- return body(bd_addr, addr_type, transport, device_type, pin_len, p_pin);
+ tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
+ return body(bd_addr, addr_type, transport, device_type);
};
};
extern struct BTM_SecBond BTM_SecBond;
@@ -539,15 +537,12 @@ extern struct btm_sec_auth_complete btm_sec_auth_complete;
struct btm_sec_bond_by_transport {
static tBTM_STATUS return_value;
std::function<tBTM_STATUS(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin)>
+ tBT_TRANSPORT transport)>
body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin) { return return_value; }};
+ tBT_TRANSPORT transport) { return return_value; }};
tBTM_STATUS operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin) {
- return body(bd_addr, addr_type, transport, pin_len, p_pin);
+ tBT_TRANSPORT transport) {
+ return body(bd_addr, addr_type, transport);
};
};
extern struct btm_sec_bond_by_transport btm_sec_bond_by_transport;
diff --git a/system/test/suite/Android.bp b/system/test/suite/Android.bp
index 1fd608b022..1fb71fb269 100644
--- a/system/test/suite/Android.bp
+++ b/system/test/suite/Android.bp
@@ -87,7 +87,7 @@ cc_defaults {
"libbtif",
"libbtif-core",
"libc++fs",
- "libcom.android.sysprop.bluetooth",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libflatbuffers-cpp",
"libg722codec",
"libgmock",