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

Commit 25b01eb2 authored by Hongguang Chen's avatar Hongguang Chen Committed by Automerger Merge Worker
Browse files

Merge "Fix bluetooth aidl crash" into main am: 5e80be91

parents a1bbe741 5e80be91
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ ndk::ScopedAStatus BluetoothHci::close() {
  {
    std::lock_guard<std::mutex> guard(mStateMutex);
    mState = HalState::READY;
    mH4 = nullptr;
  }
  return ndk::ScopedAStatus::ok();
}
@@ -346,13 +347,16 @@ ndk::ScopedAStatus BluetoothHci::sendIsoData(

ndk::ScopedAStatus BluetoothHci::send(PacketType type,
    const std::vector<uint8_t>& v) {
  if (mH4 == nullptr) {
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
  }
  if (v.empty()) {
    ALOGE("Packet is empty, no data was found to be sent");
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
  }

  std::lock_guard<std::mutex> guard(mStateMutex);
  if (mH4 == nullptr) {
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
  }

  mH4->Send(type, v);
  return ndk::ScopedAStatus::ok();
}