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

Commit 729f731b authored by Zach Johnson's avatar Zach Johnson
Browse files

BTA_SYS_EVT_DISABLED_EVT only ever comes in the HW_STOPPING state

it's only initated from bta_sys_hw_api_disable
bta_sys_hw_api_disable sets the state to HW_STOPPING

so remove this state and go there directly

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I53c429bf05307a22256cd61885cfc5b263484128
parent 0d3bb65d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -172,7 +172,6 @@ enum {
  BTA_SYS_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SYS),
  BTA_SYS_EVT_STACK_ENABLED_EVT,
  BTA_SYS_API_DISABLE_EVT,
  BTA_SYS_EVT_DISABLED_EVT,
  BTA_SYS_ERROR_EVT,

  BTA_SYS_MAX_EVT
+2 −14
Original line number Diff line number Diff line
@@ -120,11 +120,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
        case BTA_SYS_API_DISABLE_EVT:
          bta_sys_set_state(BTA_SYS_HW_STOPPING);
          break;
        case BTA_SYS_EVT_DISABLED_EVT:
          bta_sys_set_state(BTA_SYS_HW_STARTING);
          BTA_dm_on_hw_off();
          bta_sys_hw_api_enable();
          break;
        case BTA_SYS_ERROR_EVT:
          bta_sys_set_state(BTA_SYS_HW_ON);
          bta_sys_hw_error();
@@ -142,7 +137,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
          bta_sys_hw_api_disable();
          break;
        case BTA_SYS_ERROR_EVT:
        case BTA_SYS_EVT_DISABLED_EVT:
          bta_sys_hw_error();
          break;
        default:
@@ -158,10 +152,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
          BTA_dm_on_hw_on();
          bta_sys_hw_api_disable();
          break;
        case BTA_SYS_EVT_DISABLED_EVT:
          bta_sys_set_state(BTA_SYS_HW_OFF);
          BTA_dm_on_hw_off();
          break;
        case BTA_SYS_ERROR_EVT:
          bta_sys_hw_api_disable();
          break;
@@ -238,10 +228,8 @@ void bta_sys_hw_api_disable() {
  /* register which module we turn off */
  bta_sys_cb.bluetooth_active = false;

  /* manually update the state of our system */
  bta_sys_cb.state = BTA_SYS_HW_STOPPING;

  send_bta_sys_hw_event(BTA_SYS_EVT_DISABLED_EVT);
  bta_sys_set_state(BTA_SYS_HW_OFF);
  BTA_dm_on_hw_off();
}

/*******************************************************************************