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

Commit 67fa38c7 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

csip: Fix handling error on locking.

When one of the device locking will not succeed, we should unlocked
previously locked devices.
This patch fixes unlock state value which previously was 0x00 (unset)

Bug: 230426955
Test: atest BluetoothInstrumentationTests
Test: atest --host bluetooth_csis_test
Tag: #stability
Change-Id: I15f97d1ab79cecccfd20260de198e037db1506b1
parent 7147c575
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -292,14 +292,14 @@ class CsisClientImpl : public CsisClient {
    csis_group->SetTargetLockState(CsisLockState::CSIS_STATE_UNSET);

    int group_id = csis_group->GetGroupId();
    CsisLockState current_lock_state = csis_group->GetCurrentLockState();
    /* Send unlock to previous devices. It shall be done in reverse order. */
    auto prev_dev = csis_group->GetPrevDevice(csis_device);
    while (prev_dev) {
      if (prev_dev->IsConnected()) {
        auto prev_csis_instance = prev_dev->GetCsisInstanceByGroupId(group_id);
        LOG_ASSERT(prev_csis_instance) << " prev_csis_instance does not exist!";
        SetLock(prev_dev, prev_csis_instance, current_lock_state);
        SetLock(prev_dev, prev_csis_instance,
                CsisLockState::CSIS_STATE_UNLOCKED);
      }
      prev_dev = csis_group->GetPrevDevice(prev_dev);
    }
@@ -381,7 +381,7 @@ class CsisClientImpl : public CsisClient {
          /* Somebody else managed to lock it.
           * Unlock previous devices
           */
          HandleCsisLockProcedureError(csis_group, device);
          HandleCsisLockProcedureError(csis_group, next_dev);
          return;
        }
        SetLock(next_dev, next_csis_inst, CsisLockState::CSIS_STATE_LOCKED);