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

Commit c9df5238 authored by Sanket Agarwal's avatar Sanket Agarwal
Browse files

Check A2DP source is not already shut{ting} down

In case A2DP is not enabled we are still executing the shut down path
which is leading to a race condition and posting to a thread queue which
is never created.

Bug: b/32610895
Change-Id: Id0cf95f4c7b5be26be28db5e837fbca3a0a87072
parent 9a81a263
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -244,6 +244,11 @@ static void btif_a2dp_source_startup_delayed(UNUSED_ATTR void* context) {
}

void btif_a2dp_source_shutdown(void) {
  if ((btif_a2dp_source_state == BTIF_A2DP_SOURCE_STATE_OFF) ||
      (btif_a2dp_source_state == BTIF_A2DP_SOURCE_STATE_SHUTTING_DOWN)) {
    return;
  }

  /* Make sure no channels are restarted while shutting down */
  btif_a2dp_source_state = BTIF_A2DP_SOURCE_STATE_SHUTTING_DOWN;