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

Commit fcfc0e72 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix yet another alarm cancel missing.

Fixes the race which could lead to link drop on timeout which should be
canceled.
This patch also adds unit test update which verifies alarm canceling
behaviour.

Bug: 255291874
Test: atest bluetooth_le_audio_test
Test: atest BluetoothInstrumentationTests
Test: Manual testing
Tag: #feature

Merged-In: I213b3e39e1f9e30187cd7313069d0fbf06bc34bc
Change-Id: I213b3e39e1f9e30187cd7313069d0fbf06bc34bc
(cherry picked from commit 57c09df7)
parent 00406c3f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -892,6 +892,10 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
         * In such an event, there is need to notify upper layer about state
         * from here.
         */
        if (alarm_is_scheduled(watchdog_)) {
          alarm_cancel(watchdog_);
        }

        if (current_group_state == AseState::BTA_LE_AUDIO_ASE_STATE_IDLE) {
          LOG_INFO(
              "Cises disconnected for group %d, we are good in Idle state.",
@@ -906,12 +910,11 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
              "Cises disconnected for group: %d, we are good in Configured "
              "state, reconfig=%d.",
              group->group_id_, reconfig);

          if (reconfig) {
            group->ClearPendingConfiguration();
            state_machine_callbacks_->StatusReportCb(
                group->group_id_, GroupStreamStatus::CONFIGURED_BY_USER);
            /* No more transition for group */
            alarm_cancel(watchdog_);
          } else {
            /* This is Autonomous change if both, target and current state
             * is CODEC_CONFIGURED
+126 −1
Original line number Diff line number Diff line
@@ -449,6 +449,11 @@ class StateMachineTest : public Test {
  }

  void TearDown() override {
    /* Clear the alarm on tear down in case test case ends when the
     * alarm is scheduled
     */
    alarm_cancel(nullptr);

    iso_manager_->Stop();
    mock_iso_manager_ = nullptr;
    codec_manager_->Stop();
@@ -1238,6 +1243,9 @@ TEST_F(StateMachineTest, testConfigureCodecSingle) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED);

  /* Cancel is called when group goes to streaming. */
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testConfigureCodecMulti) {
@@ -1280,6 +1288,9 @@ TEST_F(StateMachineTest, testConfigureCodecMulti) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED);

  /* Cancel is called when group goes to streaming. */
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testConfigureQosSingle) {
@@ -1322,6 +1333,8 @@ TEST_F(StateMachineTest, testConfigureQosSingle) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);

  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testConfigureQosSingleRecoverCig) {
@@ -1368,6 +1381,7 @@ TEST_F(StateMachineTest, testConfigureQosSingleRecoverCig) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testConfigureQosMultiple) {
@@ -1413,6 +1427,7 @@ TEST_F(StateMachineTest, testConfigureQosMultiple) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testStreamSingle) {
@@ -1463,6 +1478,7 @@ TEST_F(StateMachineTest, testStreamSingle) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testStreamSkipEnablingSink) {
@@ -1511,6 +1527,8 @@ TEST_F(StateMachineTest, testStreamSkipEnablingSink) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testStreamSkipEnablingSinkSource) {
@@ -1562,6 +1580,7 @@ TEST_F(StateMachineTest, testStreamSkipEnablingSinkSource) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testStreamMultipleConversational) {
@@ -1615,6 +1634,7 @@ TEST_F(StateMachineTest, testStreamMultipleConversational) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testStreamMultiple) {
@@ -1667,6 +1687,7 @@ TEST_F(StateMachineTest, testStreamMultiple) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testUpdateMetadataMultiple) {
@@ -1722,6 +1743,9 @@ TEST_F(StateMachineTest, testUpdateMetadataMultiple) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Make sure all devices get the metadata update
  leAudioDevice = group->GetFirstDevice();
  expected_devices_written = 0;
@@ -1741,6 +1765,9 @@ TEST_F(StateMachineTest, testUpdateMetadataMultiple) {
  ASSERT_TRUE(LeAudioGroupStateMachine::Get()->StartStream(
      group, static_cast<LeAudioContextType>(context_type),
      metadata_context_type));

  /* This is just update metadata - watchdog is not used */
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testDisableSingle) {
@@ -1781,6 +1808,11 @@ TEST_F(StateMachineTest, testDisableSingle) {

  InjectInitialIdleNotification(group);

  EXPECT_CALL(
      mock_callbacks_,
      StatusReportCb(leaudio_group_id,
                     bluetooth::le_audio::GroupStreamStatus::STREAMING));

  // Start the configuration and stream Media content
  LeAudioGroupStateMachine::Get()->StartStream(
      group, static_cast<LeAudioContextType>(context_type),
@@ -1790,6 +1822,10 @@ TEST_F(StateMachineTest, testDisableSingle) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
@@ -1806,6 +1842,9 @@ TEST_F(StateMachineTest, testDisableSingle) {
  // Check if group has transition to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testDisableMultiple) {
@@ -1857,6 +1896,8 @@ TEST_F(StateMachineTest, testDisableMultiple) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
@@ -1874,6 +1915,8 @@ TEST_F(StateMachineTest, testDisableMultiple) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);
  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testDisableBidirectional) {
@@ -1958,6 +2001,19 @@ TEST_F(StateMachineTest, testDisableBidirectional) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
      StatusReportCb(leaudio_group_id,
                     bluetooth::le_audio::GroupStreamStatus::SUSPENDING));
  EXPECT_CALL(
      mock_callbacks_,
      StatusReportCb(leaudio_group_id,
                     bluetooth::le_audio::GroupStreamStatus::SUSPENDED));

  // Suspend the stream
  LeAudioGroupStateMachine::Get()->SuspendStream(group);

@@ -1966,6 +2022,9 @@ TEST_F(StateMachineTest, testDisableBidirectional) {
            types::AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);
  ASSERT_EQ(removed_bidirectional, true);
  ASSERT_EQ(removed_unidirectional, true);

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testReleaseSingle) {
@@ -2012,7 +2071,8 @@ TEST_F(StateMachineTest, testReleaseSingle) {
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;
  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
@@ -2027,6 +2087,7 @@ TEST_F(StateMachineTest, testReleaseSingle) {

  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(), types::AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testReleaseCachingSingle) {
@@ -2090,12 +2151,17 @@ TEST_F(StateMachineTest, testReleaseCachingSingle) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Stop the stream
  LeAudioGroupStateMachine::Get()->StopStream(group);

  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest,
@@ -2167,6 +2233,9 @@ TEST_F(StateMachineTest,
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Stop the stream
  LeAudioGroupStateMachine::Get()->StopStream(group);

@@ -2174,6 +2243,9 @@ TEST_F(StateMachineTest,
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Start the configuration and stream Media content
  LeAudioGroupStateMachine::Get()->StartStream(
      group, static_cast<LeAudioContextType>(context_type),
@@ -2182,6 +2254,9 @@ TEST_F(StateMachineTest,
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;
}

TEST_F(StateMachineTest,
@@ -2267,6 +2342,9 @@ TEST_F(StateMachineTest,
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Stop the stream
  LeAudioGroupStateMachine::Get()->StopStream(group);

@@ -2274,6 +2352,9 @@ TEST_F(StateMachineTest,
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Start the configuration and stream Media content
  context_type = kContextTypeMedia;
  LeAudioGroupStateMachine::Get()->StartStream(
@@ -2283,6 +2364,7 @@ TEST_F(StateMachineTest,
  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testReleaseMultiple) {
@@ -2332,6 +2414,9 @@ TEST_F(StateMachineTest, testReleaseMultiple) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
@@ -2346,6 +2431,7 @@ TEST_F(StateMachineTest, testReleaseMultiple) {

  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(), types::AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testReleaseBidirectional) {
@@ -2393,11 +2479,16 @@ TEST_F(StateMachineTest, testReleaseBidirectional) {
  ASSERT_EQ(group->GetState(),
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Stop the stream
  LeAudioGroupStateMachine::Get()->StopStream(group);

  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(), types::AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;
}

TEST_F(StateMachineTest, testDisableAndReleaseBidirectional) {
@@ -2558,6 +2649,9 @@ TEST_F(StateMachineTest, testAseAutonomousRelease) {
  /* Single disconnect as it is bidirectional Cis*/
  EXPECT_CALL(*mock_iso_manager_, DisconnectCis(_, _)).Times(2);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  for (auto* device = group->GetFirstDevice(); device != nullptr;
       device = group->GetNextDevice(device)) {
    for (auto& ase : device->ases_) {
@@ -2581,6 +2675,8 @@ TEST_F(StateMachineTest, testAseAutonomousRelease) {
      ASSERT_EQ(ase.state, types::AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);
    }
  }

  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, testAseAutonomousRelease2Devices) {
@@ -3120,6 +3216,9 @@ TEST_F(StateMachineTest, StartStreamCachedConfig) {

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
@@ -3136,6 +3235,9 @@ TEST_F(StateMachineTest, StartStreamCachedConfig) {

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Restart stream
  EXPECT_CALL(
      mock_callbacks_,
@@ -3147,6 +3249,7 @@ TEST_F(StateMachineTest, StartStreamCachedConfig) {
      group, context_type, types::AudioContexts(context_type));

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, BoundedHeadphonesConversationalToMediaChannelCount_2) {
@@ -3304,6 +3407,9 @@ TEST_F(StateMachineTest, BoundedHeadphonesConversationalToMediaChannelCount_1) {

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Validate GroupStreamStatus
  EXPECT_CALL(
      mock_callbacks_,
@@ -3319,6 +3425,8 @@ TEST_F(StateMachineTest, BoundedHeadphonesConversationalToMediaChannelCount_1) {
  LeAudioGroupStateMachine::Get()->StopStream(group);

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  // Restart stream
  EXPECT_CALL(
@@ -3331,6 +3439,7 @@ TEST_F(StateMachineTest, BoundedHeadphonesConversationalToMediaChannelCount_1) {
      group, new_context_type, types::AudioContexts(new_context_type));

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, lateCisDisconnectedEvent_ConfiguredByUser) {
@@ -3383,6 +3492,9 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_ConfiguredByUser) {
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  testing::Mock::VerifyAndClearExpectations(&mock_iso_manager_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  /* Prepare DisconnectCis mock to not symulate CisDisconnection */
  ON_CALL(*mock_iso_manager_, DisconnectCis).WillByDefault(Return());

@@ -3404,6 +3516,8 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_ConfiguredByUser) {

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);

  EXPECT_CALL(mock_callbacks_,
              StatusReportCb(
                  leaudio_group_id,
@@ -3412,6 +3526,7 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_ConfiguredByUser) {
  // Inject CIS and ACL disconnection of first device
  InjectCisDisconnected(group, leAudioDevice, HCI_ERR_CONN_CAUSE_LOCAL_HOST);
  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, lateCisDisconnectedEvent_AutonomousConfigured) {
@@ -3464,6 +3579,9 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_AutonomousConfigured) {
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  testing::Mock::VerifyAndClearExpectations(&mock_iso_manager_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;

  /* Prepare DisconnectCis mock to not symulate CisDisconnection */
  ON_CALL(*mock_iso_manager_, DisconnectCis).WillByDefault(Return());

@@ -3489,6 +3607,8 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_AutonomousConfigured) {

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);

  EXPECT_CALL(
      mock_callbacks_,
      StatusReportCb(
@@ -3498,6 +3618,7 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_AutonomousConfigured) {
  // Inject CIS and ACL disconnection of first device
  InjectCisDisconnected(group, leAudioDevice, HCI_ERR_CONN_CAUSE_LOCAL_HOST);
  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}

TEST_F(StateMachineTest, lateCisDisconnectedEvent_Idle) {
@@ -3550,6 +3671,8 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_Idle) {
            types::AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
  testing::Mock::VerifyAndClearExpectations(&mock_iso_manager_);

  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
  mock_function_count_map["alarm_cancel"] = 0;
  /* Prepare DisconnectCis mock to not symulate CisDisconnection */
  ON_CALL(*mock_iso_manager_, DisconnectCis).WillByDefault(Return());

@@ -3569,6 +3692,7 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_Idle) {

  // Check if group has transitioned to a proper state
  ASSERT_EQ(group->GetState(), types::AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);
  ASSERT_EQ(0, mock_function_count_map["alarm_cancel"]);

  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);

@@ -3579,6 +3703,7 @@ TEST_F(StateMachineTest, lateCisDisconnectedEvent_Idle) {
  // Inject CIS and ACL disconnection of first device
  InjectCisDisconnected(group, leAudioDevice, HCI_ERR_CONN_CAUSE_LOCAL_HOST);
  testing::Mock::VerifyAndClearExpectations(&mock_callbacks_);
  ASSERT_EQ(1, mock_function_count_map["alarm_cancel"]);
}
}  // namespace internal
}  // namespace le_audio