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

Commit bf238d41 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Alice Kuo
Browse files

csip: Force CSIP implementation to behave incorrectly

Android implementation does not start Lock procedure if there is Lock
device in the set.
Also in the middle of procedure, Android checks if following devices
were not locked by other device before sending Lock request.

This prevents us to pass the test case, which is about handling Lock
Denial error while lock procedure.

With setting
CSIP_UPPER_TESTER_FORCE_TO_SEND_LOCK TRUE

Android will try to Lock even locked devices.

Bug: 230426955
Test: atest BluetoothInstrumentationTests
Test: CSIP/CL/SPE/BI-01-C
Tag: #stability
Change-Id: I99627263a92cef0d78630c01c074eae7552a511c
Merged-In: I99627263a92cef0d78630c01c074eae7552a511c
(cherry picked from commit 78b38488)
parent 44dcd178
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -371,6 +371,7 @@ class CsisClientImpl : public CsisClient {
      if (next_dev) {
        auto next_csis_inst = next_dev->GetCsisInstanceByGroupId(group_id);
        LOG_ASSERT(csis_instance) << " csis_instance does not exist!";
#if CSIP_UPPER_TESTER_FORCE_TO_SEND_LOCK == FALSE
        if (next_csis_inst->GetLockState() ==
            CsisLockState::CSIS_STATE_LOCKED) {
          /* Somebody else managed to lock it.
@@ -379,6 +380,7 @@ class CsisClientImpl : public CsisClient {
          HandleCsisLockProcedureError(csis_group, device);
          return;
        }
#endif
        SetLock(next_dev, next_csis_inst, CsisLockState::CSIS_STATE_LOCKED);
      }
    }
@@ -474,6 +476,7 @@ class CsisClientImpl : public CsisClient {
      return;
    }

#if CSIP_UPPER_TESTER_FORCE_TO_SEND_LOCK == FALSE
    if (lock && !csis_group->IsAvailableForCsisLockOperation()) {
      DLOG(INFO) << __func__ << " Group " << group_id << " locked by other";
      NotifyGroupStatus(group_id, false,
@@ -481,6 +484,7 @@ class CsisClientImpl : public CsisClient {
                        std::move(cb));
      return;
    }
#endif

    csis_group->SetTargetLockState(new_lock_state, std::move(cb));

+12 −0
Original line number Diff line number Diff line
@@ -560,6 +560,18 @@
#ifndef GATT_UPPER_TESTER_MULT_VARIABLE_LENGTH_READ
#define GATT_UPPER_TESTER_MULT_VARIABLE_LENGTH_READ FALSE
#endif

/******************************************************************************
 *
 * CSIP
 *
 *****************************************************************************/

/* Used to trigger invalid behaviour of CSIP test case PTS */
#ifndef CSIP_UPPER_TESTER_FORCE_TO_SEND_LOCK
#define CSIP_UPPER_TESTER_FORCE_TO_SEND_LOCK FALSE
#endif

/******************************************************************************
 *
 * SMP