Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27749c4f authored by Myles Watson's avatar Myles Watson
Browse files

InitFlags: Remove hfp_dynamic_version

Bug: 252902891
Fixes: 290845201
Test: mma -j32
Flag: EXEMPT, no logical change
Change-Id: I67d2f7516bbd99fdbecc192e59be0ba28528908b
parent d9c5af50
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -181,11 +181,7 @@ bool bta_ag_add_record(uint16_t service_uuid, const char* p_service_name, uint8_
  /* add profile descriptor list */
  if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) {
    profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
    if (bluetooth::common::init_flags::hfp_dynamic_version_is_enabled()) {
    version = HFP_VERSION_1_6;
    } else {
      version = get_default_hfp_version();
    }
  } else {
    profile_uuid = UUID_SERVCLASS_HEADSET;
    version = HSP_VERSION_1_2;
@@ -418,14 +414,12 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {
          p_scb->peer_features = sdp_features & HFP_SDP_BRSF_FEATURES_MASK;
        }
        /* 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_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);
        }
      }
      }
    } else {
      /* No peer version caching for HSP, use discovered one directly */
      p_scb->peer_version = peer_version;
+0 −1
Original line number Diff line number Diff line
@@ -210,7 +210,6 @@ init_flags!(
        classic_discovery_only,
        dynamic_avrcp_version_enhancement = true,
        hci_adapter: i32,
        hfp_dynamic_version = true,
        irk_rotation,
        leaudio_targeted_announcement_reconnection_mode = true,
        pbap_pse_dynamic_version_upgrade = false,
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ mod ffi {
        fn classic_discovery_only_is_enabled() -> bool;
        fn dynamic_avrcp_version_enhancement_is_enabled() -> bool;
        fn get_hci_adapter() -> i32;
        fn hfp_dynamic_version_is_enabled() -> bool;
        fn irk_rotation_is_enabled() -> bool;
        fn leaudio_targeted_announcement_reconnection_mode_is_enabled() -> bool;
        fn pbap_pse_dynamic_version_upgrade_is_enabled() -> bool;
+2 −6
Original line number Diff line number Diff line
@@ -543,9 +543,7 @@ static void process_service_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, uint16
          sdpu_set_avrc_target_features(p_attr, &(p_ccb->device_address), avrc_sdp_version);
        }
      }
      if (bluetooth::common::init_flags::hfp_dynamic_version_is_enabled()) {
      is_hfp_fallback = sdp_dynamic_change_hfp_version(p_attr, p_ccb->device_address);
      }
      /* Check if attribute fits. Assume 3-byte value type/length */
      rem_len = max_list_len - (int16_t)(p_rsp - &p_ccb->rsp_list[0]);

@@ -914,9 +912,7 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num,
            sdpu_set_avrc_target_features(p_attr, &(p_ccb->device_address), avrc_sdp_version);
          }
        }
        if (bluetooth::common::init_flags::hfp_dynamic_version_is_enabled()) {
        is_hfp_fallback = sdp_dynamic_change_hfp_version(p_attr, p_ccb->device_address);
        }
        /* Check if attribute fits. Assume 3-byte value type/length */
        rem_len = max_list_len - (int16_t)(p_rsp - &p_ccb->rsp_list[0]);

+0 −16
Original line number Diff line number Diff line
@@ -74,16 +74,6 @@ const char* test_flags_feature_enabled[] = {
        "INIT_dynamic_avrcp_version_enhancement=true",
        nullptr,
};
const char* hfp_test_flags_feature_disabled[] = {
        "INIT_hfp_dynamic_version=false",
        nullptr,
};

const char* hfp_test_flags_feature_enabled[] = {
        "INIT_hfp_dynamic_version=true",
        nullptr,
};

namespace {
// convenience mock
class IopMock {
@@ -275,7 +265,6 @@ class StackSdpUtilsTest : public StackSdpInitTest {
protected:
  void SetUp() override {
    StackSdpInitTest::SetUp();
    bluetooth::common::InitFlags::Load(hfp_test_flags_feature_disabled);
    bluetooth::common::InitFlags::Load(test_flags_feature_disabled);
    GetInterfaceToProfiles()->profileSpecific_HACK->AVRC_GetProfileVersion = AVRC_GetProfileVersion;
    test::mock::btif_config::btif_config_get_bin.body = [this](const std::string& section,
@@ -555,21 +544,18 @@ TEST_F(StackSdpUtilsTest, sdpu_set_avrc_target_feature_device_versoin_1_6) {
}

TEST_F(StackSdpUtilsTest, dynamic_hfp_version_with_invalid_length) {
  bluetooth::common::InitFlags::Load(hfp_test_flags_feature_enabled);
  RawAddress bdaddr(RawAddress::kEmpty);
  set_hfp_attr(INVALID_LENGTH, ATTR_ID_BT_PROFILE_DESC_LIST, UUID_HF_LSB);
  ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), false);
}

TEST_F(StackSdpUtilsTest, dynamic_hfp_version_with_invalid_UUID) {
  bluetooth::common::InitFlags::Load(hfp_test_flags_feature_enabled);
  RawAddress bdaddr(RawAddress::kEmpty);
  set_hfp_attr(SDP_PROFILE_DESC_LENGTH, ATTR_ID_BT_PROFILE_DESC_LIST, INVALID_UUID);
  ASSERT_EQ(sdp_dynamic_change_hfp_version(&hfp_attr, bdaddr), false);
}

TEST_F(StackSdpUtilsTest, check_HFP_version_change_fail) {
  bluetooth::common::InitFlags::Load(hfp_test_flags_feature_enabled);
  RawAddress bdaddr(RawAddress::kEmpty);
  set_hfp_attr(SDP_PROFILE_DESC_LENGTH, ATTR_ID_BT_PROFILE_DESC_LIST, UUID_HF_LSB);
  test::mock::osi_properties::osi_property_get_bool.body =
@@ -584,7 +570,6 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_fail) {
}

TEST_F(StackSdpUtilsTest, check_HFP_version_change_success) {
  bluetooth::common::InitFlags::Load(hfp_test_flags_feature_enabled);
  RawAddress bdaddr(RawAddress::kEmpty);
  set_hfp_attr(SDP_PROFILE_DESC_LENGTH, ATTR_ID_BT_PROFILE_DESC_LIST, UUID_HF_LSB);
  EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr,
@@ -597,7 +582,6 @@ TEST_F(StackSdpUtilsTest, check_HFP_version_change_success) {
}

TEST_F(StackSdpUtilsTest, check_HFP_version_fallback_success) {
  bluetooth::common::InitFlags::Load(hfp_test_flags_feature_enabled);
  RawAddress bdaddr(RawAddress::kEmpty);
  set_hfp_attr(SDP_PROFILE_DESC_LENGTH, ATTR_ID_BT_PROFILE_DESC_LIST, UUID_HF_LSB);
  EXPECT_CALL(*localIopMock, InteropMatchAddrOrName(INTEROP_HFP_1_7_ALLOWLIST, &bdaddr,