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

Commit 6ebe2513 authored by yanggang.yang's avatar yanggang.yang Committed by 陈璨
Browse files

Fix bluetooth AIDL restart fail when open HCI Fail

[Description]
If aidl open HCI fail at the first time, the aidl state
can not change to enable for the next time to initialize.

[Root Cause]
Bluetooth AIDL State is always equal to INITIALIZING after
open hci fail at the first time.

[Solution]
When open HCI fail at the first time, initialize the mstate to ready

Bug: 285517442
Test: pass

Change-Id: I19756d6602ba931242d0f95942db55c505a210bb
parent 7e9eece7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ ndk::ScopedAStatus BluetoothHci::initialize(
    ALOGI("Unable to open Linux interface, trying default path.");
    mFd = getFdFromDevPath();
    if (mFd < 0) {
      mState = HalState::READY;
      cb->initializationComplete(Status::UNABLE_TO_OPEN_INTERFACE);
      return ndk::ScopedAStatus::ok();
    }
@@ -281,6 +282,7 @@ ndk::ScopedAStatus BluetoothHci::close() {
  {
    std::lock_guard<std::mutex> guard(mStateMutex);
    if (mState != HalState::ONE_CLIENT) {
      ASSERT(mState != HalState::INITIALIZING);
      ALOGI("Already closed");
      return ndk::ScopedAStatus::ok();
    }