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

Commit 9099f04c authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge "Convert all uses of base::TimeDelta to std::chrono::microseconds" into...

Merge "Convert all uses of base::TimeDelta to std::chrono::microseconds" into main am: d1e37cda am: 319c4bd4

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2883067



Change-Id: I78228c2dc9784c8f6d8376bd346f510194db4509
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7bc2feb8 319c4bd4
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -159,12 +159,8 @@ static void bta_av_api_enable(tBTA_AV_DATA* p_data) {
      tBTA_AV_API_ENABLE* p_buf =
          (tBTA_AV_API_ENABLE*)osi_malloc(sizeof(tBTA_AV_API_ENABLE));
      memcpy(p_buf, &p_data->api_enable, sizeof(tBTA_AV_API_ENABLE));
#if BASE_VER < 931007
      bta_sys_sendmsg_delayed(p_buf, base::TimeDelta::FromMilliseconds(
#else
      bta_sys_sendmsg_delayed(p_buf, base::Milliseconds(
#endif
                                         kEnablingAttemptsIntervalMs));
      bta_sys_sendmsg_delayed(
          p_buf, std::chrono::milliseconds(kEnablingAttemptsIntervalMs));
      return;
    }
    if (bta_av_cb.sdp_a2dp_handle) {
@@ -465,11 +461,7 @@ static void bta_av_api_register(tBTA_AV_DATA* p_data) {
        (tBTA_AV_API_REG*)osi_malloc(sizeof(tBTA_AV_API_REG));
    memcpy(p_buf, &p_data->api_reg, sizeof(tBTA_AV_API_REG));
    bta_sys_sendmsg_delayed(
#if BASE_VER < 931007
        p_buf, base::TimeDelta::FromMilliseconds(kEnablingAttemptsIntervalMs));
#else
        p_buf, base::Milliseconds(kEnablingAttemptsIntervalMs));
#endif
        p_buf, std::chrono::milliseconds(kEnablingAttemptsIntervalMs));
    return;
  }

+3 −8
Original line number Diff line number Diff line
@@ -128,14 +128,9 @@ void start_audio_ticks() {
  }

  wakelock_acquire();
  audio_timer.SchedulePeriodic(
      get_main_thread()->GetWeakPtr(), FROM_HERE,
  audio_timer.SchedulePeriodic(get_main_thread()->GetWeakPtr(), FROM_HERE,
                               base::BindRepeating(&send_audio_data),
#if BASE_VER < 931007
      base::TimeDelta::FromMilliseconds(data_interval_ms));
#else
      base::Milliseconds(data_interval_ms));
#endif
                               std::chrono::milliseconds(data_interval_ms));
  LOG_INFO("running with data interval: %d", data_interval_ms);
}

+1 −5
Original line number Diff line number Diff line
@@ -254,11 +254,7 @@ void SourceImpl::StartAudioTicks() {
  audio_timer_.SchedulePeriodic(
      worker_thread_->GetWeakPtr(), FROM_HERE,
      base::BindRepeating(&SourceImpl::SendAudioData, base::Unretained(this)),
#if BASE_VER < 931007
      base::TimeDelta::FromMicroseconds(source_codec_config_.data_interval_us));
#else
      base::Microseconds(source_codec_config_.data_interval_us));
#endif
      std::chrono::microseconds(source_codec_config_.data_interval_us));
}

void SourceImpl::StopAudioTicks() {
+5 −30
Original line number Diff line number Diff line
@@ -2211,12 +2211,7 @@ class LeAudioClientImpl : public LeAudioClient {
        base::BindOnce(
            &LeAudioClientImpl::checkGroupConnectionStateAfterMemberDisconnect,
            weak_factory_.GetWeakPtr(), group_id),
#if BASE_VER < 931007
        base::TimeDelta::FromMilliseconds(kGroupConnectedWatchDelayMs)
#else
        base::Milliseconds(kDeviceAttachDelayMs)
#endif
    );
        std::chrono::milliseconds(kGroupConnectedWatchDelayMs));
  }

  void autoConnect(RawAddress address) {
@@ -2236,12 +2231,7 @@ class LeAudioClientImpl : public LeAudioClient {
        FROM_HERE,
        base::BindOnce(&LeAudioClientImpl::autoConnect,
                       weak_factory_.GetWeakPtr(), address),
#if BASE_VER < 931007
        base::TimeDelta::FromMilliseconds(kAutoConnectAfterOwnDisconnectDelayMs)
#else
        base::Milliseconds(kDeviceAttachDelayMs)
#endif
    );
        std::chrono::milliseconds(kAutoConnectAfterOwnDisconnectDelayMs));
  }

  void recoveryReconnect(RawAddress address) {
@@ -2275,12 +2265,7 @@ class LeAudioClientImpl : public LeAudioClient {
        FROM_HERE,
        base::BindOnce(&LeAudioClientImpl::recoveryReconnect,
                       weak_factory_.GetWeakPtr(), address),
#if BASE_VER < 931007
        base::TimeDelta::FromMilliseconds(kRecoveryReconnectDelayMs)
#else
        base::Milliseconds(kDeviceAttachDelayMs)
#endif
    );
        std::chrono::milliseconds(kRecoveryReconnectDelayMs));
  }

  void checkIfGroupMember(RawAddress address) {
@@ -2316,12 +2301,7 @@ class LeAudioClientImpl : public LeAudioClient {
        FROM_HERE,
        base::BindOnce(&LeAudioClientImpl::checkIfGroupMember,
                       weak_factory_.GetWeakPtr(), address),
#if BASE_VER < 931007
        base::TimeDelta::FromMilliseconds(kCsisGroupMemberDelayMs)
#else
        base::Milliseconds(kCsisGroupMemberDelayMs)
#endif
    );
        std::chrono::milliseconds(kCsisGroupMemberDelayMs));
  }

  void OnGattDisconnected(uint16_t conn_id, tGATT_IF client_if,
@@ -3127,12 +3107,7 @@ class LeAudioClientImpl : public LeAudioClient {
        FROM_HERE,
        base::BindOnce(&LeAudioClientImpl::restartAttachToTheStream,
                       weak_factory_.GetWeakPtr(), addr),
#if BASE_VER < 931007
        base::TimeDelta::FromMilliseconds(kDeviceAttachDelayMs)
#else
        base::Milliseconds(kDeviceAttachDelayMs)
#endif
    );
        std::chrono::milliseconds(kDeviceAttachDelayMs));
  }

  void SendAudioGroupSelectableCodecConfigChanged(LeAudioDeviceGroup* group) {
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ bt_status_t do_in_main_thread(const base::Location& from_here,

bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
                                      base::OnceClosure task,
                                      const base::TimeDelta& delay) {
                                      std::chrono::microseconds delay) {
  /* For testing purpose it is ok to just skip delay */
  return do_in_main_thread(from_here, std::move(task));
}
Loading