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

Commit 8e99937a authored by Yi Kong's avatar Yi Kong
Browse files

Modernise code to use override specifier

Generated by clang-tidy.

Test: m checkbuild
Change-Id: Icba58009f6db2a0e9e1360326b0b66fc10d04a5a
parent 2c28073e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ using ::android::bluetooth::audio::utils::ParseAudioParams;

class UtilsTest : public testing::Test {
 protected:
  virtual void SetUp() {}
  virtual void TearDown() { map_.clear(); }
  void SetUp() override {}
  void TearDown() override { map_.clear(); }

  std::unordered_map<std::string, std::string> map_;
};
+8 −6
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort {
                         const android::sp<IBluetoothAudioProvider>& provider)
      : sink_(sink), provider_(provider){};

  Return<void> startStream() {
  Return<void> startStream() override {
    BluetoothAudioCtrlAck ack = sink_->StartRequest();
    if (ack != BluetoothAudioCtrlAck::PENDING) {
      auto hidl_retval =
@@ -85,7 +85,7 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort {
    return Void();
  }

  Return<void> suspendStream() {
  Return<void> suspendStream() override {
    BluetoothAudioCtrlAck ack = sink_->SuspendRequest();
    if (ack != BluetoothAudioCtrlAck::PENDING) {
      auto hidl_retval =
@@ -97,12 +97,13 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort {
    return Void();
  }

  Return<void> stopStream() {
  Return<void> stopStream() override {
    sink_->StopRequest();
    return Void();
  }

  Return<void> getPresentationPosition(getPresentationPosition_cb _hidl_cb) {
  Return<void> getPresentationPosition(
      getPresentationPosition_cb _hidl_cb) override {
    uint64_t remote_delay_report_ns;
    uint64_t total_bytes_read;
    timespec data_position;
@@ -128,7 +129,7 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort {
    return Void();
  }

  Return<void> updateMetadata(const SourceMetadata& sourceMetadata) {
  Return<void> updateMetadata(const SourceMetadata& sourceMetadata) override {
    LOG(INFO) << __func__ << ": " << sourceMetadata.tracks.size()
              << " track(s)";
    // refer to StreamOut.impl.h within Audio HAL (AUDIO_HAL_VERSION_5_0)
@@ -166,7 +167,8 @@ class BluetoothAudioDeathRecipient
      : bluetooth_audio_clientif_(clientif), message_loop_(message_loop) {}
  void serviceDied(
      uint64_t /*cookie*/,
      const ::android::wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
      const ::android::wp<::android::hidl::base::V1_0::IBase>& /*who*/)
      override {
    LOG(WARNING) << __func__ << ": restarting connection with new Audio Hal";
    if (bluetooth_audio_clientif_ != nullptr && message_loop_ != nullptr) {
      // restart the session on the correct thread
+10 −9
Original line number Diff line number Diff line
@@ -65,16 +65,16 @@ class TestTransport : public bluetooth::audio::IBluetoothTransportInstance {
 public:
  TestTransport(SessionType session_type)
      : bluetooth::audio::IBluetoothTransportInstance(session_type, {}){};
  bluetooth::audio::BluetoothAudioCtrlAck StartRequest() {
  bluetooth::audio::BluetoothAudioCtrlAck StartRequest() override {
    return bluetooth::audio::BluetoothAudioCtrlAck::SUCCESS_FINISHED;
  }
  bluetooth::audio::BluetoothAudioCtrlAck SuspendRequest() {
  bluetooth::audio::BluetoothAudioCtrlAck SuspendRequest() override {
    return bluetooth::audio::BluetoothAudioCtrlAck::SUCCESS_FINISHED;
  }
  void StopRequest() {}
  void StopRequest() override {}
  bool GetPresentationPosition(uint64_t* remote_delay_report_ns,
                               uint64_t* total_bytes_readed,
                               timespec* data_position) {
                               timespec* data_position) override {
    if (remote_delay_report_ns) {
      *remote_delay_report_ns = kRemoteDelayReportMs * 1000000;
    }
@@ -86,9 +86,10 @@ class TestTransport : public bluetooth::audio::IBluetoothTransportInstance {
    }
    return true;
  }
  void MetadataChanged(const source_metadata_t& source_metadata __unused) {}
  void ResetPresentationPosition(){};
  void LogBytesRead(size_t bytes_readed __unused){};
  void MetadataChanged(
      const source_metadata_t& source_metadata __unused) override {}
  void ResetPresentationPosition() override{};
  void LogBytesRead(size_t bytes_readed __unused) override{};
};

class BluetoothAudioClientInterfaceTest : public Test {
@@ -98,9 +99,9 @@ class BluetoothAudioClientInterfaceTest : public Test {

  static constexpr int kClientIfReturnSuccess = 0;

  virtual void SetUp() override {}
  void SetUp() override {}

  virtual void TearDown() override {
  void TearDown() override {
    clientif_ = nullptr;
    test_transport_ = nullptr;
  }
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ class HearingAidImpl : public HearingAid {
  bool audio_running;

 public:
  virtual ~HearingAidImpl() = default;
  ~HearingAidImpl() override = default;

  HearingAidImpl(bluetooth::hearing_aid::HearingAidCallbacks* callbacks,
                 Closure initCb)
+5 −5
Original line number Diff line number Diff line
@@ -137,15 +137,15 @@ static A2dpOffloadAudioStats a2dp_offload_audio_stats;

class BluetoothAudioHost : public IBluetoothAudioHost {
 public:
  Return<void> startStream() {
  Return<void> startStream() override {
    btif_a2dp_audio_send_start_req();
    return Void();
  }
  Return<void> suspendStream() {
  Return<void> suspendStream() override {
    btif_a2dp_audio_send_suspend_req();
    return Void();
  }
  Return<void> stopStream() {
  Return<void> stopStream() override {
    btif_a2dp_audio_send_stop_req();
    return Void();
  }
@@ -160,9 +160,9 @@ class BluetoothAudioHost : public IBluetoothAudioHost {

class BluetoothAudioDeathRecipient : public hidl_death_recipient {
 public:
  virtual void serviceDied(
  void serviceDied(
      uint64_t /*cookie*/,
      const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
      const wp<::android::hidl::base::V1_0::IBase>& /*who*/) override {
    LOG_ERROR(LOG_TAG, "%s", __func__);
    // Restart the session on the correct thread
    do_in_main_thread(FROM_HERE,
Loading