Loading system/bta/ag/bta_ag_sdp.cc +4 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,10 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) { } /* Remote supports 1.7, store it in HFP 1.7 BL file */ if (bluetooth::common::init_flags::hfp_dynamic_version_is_enabled()) { if (p_scb->peer_version == HFP_VERSION_1_7) { if (p_scb->peer_version >= HFP_VERSION_1_9) { interop_database_add_addr(INTEROP_HFP_1_9_ALLOWLIST, &p_scb->peer_addr, 3); } else if (p_scb->peer_version >= HFP_VERSION_1_7) { interop_database_add_addr(INTEROP_HFP_1_7_ALLOWLIST, &p_scb->peer_addr, 3); } Loading system/device/include/interop.h +2 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,8 @@ typedef enum { INTEROP_HFP_1_7_ALLOWLIST, INTEROP_HFP_1_9_ALLOWLIST, // Some device may have problem in reconnect flow, // need we initiate connection after signalling timeout INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT, Loading system/device/src/interop.cc +1 −0 Original line number Diff line number Diff line Loading @@ -391,6 +391,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_AVRCP_1_3_ONLY) CASE_RETURN_STR(INTEROP_DISABLE_ROBUST_CACHING); CASE_RETURN_STR(INTEROP_HFP_1_7_ALLOWLIST); CASE_RETURN_STR(INTEROP_HFP_1_9_ALLOWLIST); CASE_RETURN_STR(INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT); } return UNKNOWN_INTEROP_FEATURE; Loading system/stack/sdp/sdp_server.cc +11 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "osi/include/allocator.h" #include "osi/include/properties.h" #include "stack/btm/btm_dev.h" #include "stack/btm/btm_sco_hfp_hal.h" #include "stack/include/avrc_api.h" #include "stack/include/avrc_defs.h" #include "stack/include/bt_hdr.h" Loading @@ -60,6 +61,7 @@ #define SDP_PROFILE_DESC_LENGTH 8 #define HFP_PROFILE_MINOR_VERSION_6 0x06 #define HFP_PROFILE_MINOR_VERSION_7 0x07 #define HFP_PROFILE_MINOR_VERSION_9 0x09 #define PBAP_GOEP_L2CAP_PSM_LEN 0x06 #define PBAP_SUPP_FEA_LEN 0x08 Loading Loading @@ -171,12 +173,19 @@ bool sdp_dynamic_change_hfp_version(const tSDP_ATTRIBUTE* p_attr, bool is_allowlisted_1_7 = interop_match_addr_or_name(INTEROP_HFP_1_7_ALLOWLIST, &remote_address, &btif_storage_get_remote_device_property); bool is_allowlisted_1_9 = interop_match_addr_or_name(INTEROP_HFP_1_9_ALLOWLIST, &remote_address, &btif_storage_get_remote_device_property); /* For PTS we should update AG's HFP version as 1.7 */ if (!(is_allowlisted_1_7) && if (!(is_allowlisted_1_7) && !(is_allowlisted_1_9) && !(osi_property_get_bool("vendor.bt.pts.certification", false))) { return false; } if (hfp_hal_interface::get_swb_supported() && is_allowlisted_1_9) { p_attr->value_ptr[PROFILE_VERSION_POSITION] = HFP_PROFILE_MINOR_VERSION_9; } else { p_attr->value_ptr[PROFILE_VERSION_POSITION] = HFP_PROFILE_MINOR_VERSION_7; } SDP_TRACE_INFO("%s SDP Change HFP Version = %d for %s", __func__, p_attr->value_ptr[PROFILE_VERSION_POSITION], ADDRESS_TO_LOGGABLE_CSTR(remote_address)); Loading system/stack/test/sdp/stack_sdp_utils_test.cc +12 −0 Original line number Diff line number Diff line Loading @@ -589,6 +589,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_fail) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(false)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(false)); ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), false); } Loading @@ -601,6 +605,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_success) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), true); } Loading @@ -613,6 +621,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_fallback_success) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); bool is_hfp_fallback = sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr); ASSERT_EQ(hfp_attr.value_ptr[PROFILE_VERSION_POSITION], HFP_PROFILE_MINOR_VERSION_7); Loading Loading
system/bta/ag/bta_ag_sdp.cc +4 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,10 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) { } /* Remote supports 1.7, store it in HFP 1.7 BL file */ if (bluetooth::common::init_flags::hfp_dynamic_version_is_enabled()) { if (p_scb->peer_version == HFP_VERSION_1_7) { if (p_scb->peer_version >= HFP_VERSION_1_9) { interop_database_add_addr(INTEROP_HFP_1_9_ALLOWLIST, &p_scb->peer_addr, 3); } else if (p_scb->peer_version >= HFP_VERSION_1_7) { interop_database_add_addr(INTEROP_HFP_1_7_ALLOWLIST, &p_scb->peer_addr, 3); } Loading
system/device/include/interop.h +2 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,8 @@ typedef enum { INTEROP_HFP_1_7_ALLOWLIST, INTEROP_HFP_1_9_ALLOWLIST, // Some device may have problem in reconnect flow, // need we initiate connection after signalling timeout INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT, Loading
system/device/src/interop.cc +1 −0 Original line number Diff line number Diff line Loading @@ -391,6 +391,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_AVRCP_1_3_ONLY) CASE_RETURN_STR(INTEROP_DISABLE_ROBUST_CACHING); CASE_RETURN_STR(INTEROP_HFP_1_7_ALLOWLIST); CASE_RETURN_STR(INTEROP_HFP_1_9_ALLOWLIST); CASE_RETURN_STR(INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT); } return UNKNOWN_INTEROP_FEATURE; Loading
system/stack/sdp/sdp_server.cc +11 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "osi/include/allocator.h" #include "osi/include/properties.h" #include "stack/btm/btm_dev.h" #include "stack/btm/btm_sco_hfp_hal.h" #include "stack/include/avrc_api.h" #include "stack/include/avrc_defs.h" #include "stack/include/bt_hdr.h" Loading @@ -60,6 +61,7 @@ #define SDP_PROFILE_DESC_LENGTH 8 #define HFP_PROFILE_MINOR_VERSION_6 0x06 #define HFP_PROFILE_MINOR_VERSION_7 0x07 #define HFP_PROFILE_MINOR_VERSION_9 0x09 #define PBAP_GOEP_L2CAP_PSM_LEN 0x06 #define PBAP_SUPP_FEA_LEN 0x08 Loading Loading @@ -171,12 +173,19 @@ bool sdp_dynamic_change_hfp_version(const tSDP_ATTRIBUTE* p_attr, bool is_allowlisted_1_7 = interop_match_addr_or_name(INTEROP_HFP_1_7_ALLOWLIST, &remote_address, &btif_storage_get_remote_device_property); bool is_allowlisted_1_9 = interop_match_addr_or_name(INTEROP_HFP_1_9_ALLOWLIST, &remote_address, &btif_storage_get_remote_device_property); /* For PTS we should update AG's HFP version as 1.7 */ if (!(is_allowlisted_1_7) && if (!(is_allowlisted_1_7) && !(is_allowlisted_1_9) && !(osi_property_get_bool("vendor.bt.pts.certification", false))) { return false; } if (hfp_hal_interface::get_swb_supported() && is_allowlisted_1_9) { p_attr->value_ptr[PROFILE_VERSION_POSITION] = HFP_PROFILE_MINOR_VERSION_9; } else { p_attr->value_ptr[PROFILE_VERSION_POSITION] = HFP_PROFILE_MINOR_VERSION_7; } SDP_TRACE_INFO("%s SDP Change HFP Version = %d for %s", __func__, p_attr->value_ptr[PROFILE_VERSION_POSITION], ADDRESS_TO_LOGGABLE_CSTR(remote_address)); Loading
system/stack/test/sdp/stack_sdp_utils_test.cc +12 −0 Original line number Diff line number Diff line Loading @@ -589,6 +589,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_fail) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(false)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(false)); ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), false); } Loading @@ -601,6 +605,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_success) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), true); } Loading @@ -613,6 +621,10 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_fallback_success) { InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_9_ALLOWLIST, &bdaddr, &btif_storage_get_remote_device_property)) .WillOnce(Return(true)); bool is_hfp_fallback = sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr); ASSERT_EQ(hfp_attr.value_ptr[PROFILE_VERSION_POSITION], HFP_PROFILE_MINOR_VERSION_7); Loading