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

Commit e968801c authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Allow 15 byte headtracker SDU for early implementations

Early drafts of DSA 2.0 specification had 15 byte allocation for
headtracker data over LE-ISO. This was later changed to 13 bytes.
However some early adopters of DSA 2.0 may expect an allocation of 15
bytes for headtracker data.
Early drafts of DSA 2.0 specification also didn't have metadata for
Android Headtracker Codec. This can be used to distinguish between
earbuds which support early and those which support approved DSA 2.0
specification.

Test: mmm packages/modules/Bluetooth
Test: Manual | Test DSA 2.0 with all supporting earbuds
Flag: com.android.bluetooth.flags.headtracker_sdu_size
Bug: 349901879
Bug: 350090733
Change-Id: If70046cd801a95d3b628450ba223ffe5010ffc3e
parent 28e439c4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -387,6 +387,16 @@ public:
    return dsa_modes_list;
  }

  bool DsaReducedSduSizeSupported() {
    bool reduced_sdu = false;
    for (auto leAudioDevice : leAudioDevices_) {
      if (!leAudioDevice.expired()) {
        reduced_sdu |= leAudioDevice.lock()->DsaReducedSduSizeSupported();
      }
    }
    return reduced_sdu;
  }

  types::BidirectionalPair<types::AudioContexts> GetLatestAvailableContexts(void) const;

  bool IsInTransition(void) const;
+5 −0
Original line number Diff line number Diff line
@@ -486,6 +486,9 @@ void LeAudioDevice::ParseHeadtrackingCodec(const struct types::acs_ac_record& pa
      return;
    }

    // Valid headtracker codec metadata available, so it must support reduced sdu size
    dsa_.reduced_sdu = true;

    uint8_t supported_transports = ltv[6];
    DsaModes dsa_modes = {DsaMode::DISABLED};

@@ -1205,6 +1208,8 @@ void LeAudioDevice::UpdateDeviceAllowlistFlag(void) {

DsaModes LeAudioDevice::GetDsaModes(void) { return dsa_.modes; }

bool LeAudioDevice::DsaReducedSduSizeSupported() { return dsa_.reduced_sdu; }

types::DataPathState LeAudioDevice::GetDsaDataPathState(void) { return dsa_.state; }

void LeAudioDevice::SetDsaDataPathState(types::DataPathState state) { dsa_.state = state; }
+3 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public:
        acl_asymmetric_(false),
        acl_phy_update_done_(false),
        link_quality_timer(nullptr),
        dsa_({{DsaMode::DISABLED}, types::DataPathState::IDLE, GATT_INVALID_CONN_ID}) {}
        dsa_({{DsaMode::DISABLED}, types::DataPathState::IDLE, GATT_INVALID_CONN_ID, false}) {}
  ~LeAudioDevice(void);

  void SetConnectionState(DeviceConnectState state);
@@ -227,6 +227,7 @@ public:
  void GetDeviceModelName(void);
  void UpdateDeviceAllowlistFlag(void);
  DsaModes GetDsaModes(void);
  bool DsaReducedSduSizeSupported();
  types::DataPathState GetDsaDataPathState(void);
  void SetDsaDataPathState(types::DataPathState state);
  uint16_t GetDsaCisHandle(void);
@@ -239,6 +240,7 @@ private:
    DsaModes modes;
    types::DataPathState state;
    uint16_t cis_handle;
    bool reduced_sdu;  // TODO: Remove when earbud implementations move to approved DSA 2.0 standard
  } dsa_;

  static constexpr char kLeAudioDeviceAllowListProp[] = "persist.bluetooth.leaudio.allow_list";
+6 −0
Original line number Diff line number Diff line
@@ -1398,9 +1398,15 @@ private:
                param.max_trans_lat_stom =
                        bluetooth::le_audio::types::kLeAudioHeadtrackerMaxTransLat;
                it->max_sdu_size_stom = bluetooth::le_audio::types::kLeAudioHeadtrackerMaxSduSize;

                // Early draft of DSA 2.0 spec mentioned allocating 15 bytes for headtracker data
                if (!com::android::bluetooth::flags::headtracker_sdu_size()) {
                  it->max_sdu_size_stom = 15;
                } else if (!group->DsaReducedSduSizeSupported()) {
                  log::verbose("Device does not support reduced headtracker SDU");
                  it->max_sdu_size_stom = 15;
                }

                it->rtn_stom = bluetooth::le_audio::types::kLeAudioHeadtrackerRtn;

                it++;