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

Commit 6ab30e50 authored by Zach Johnson's avatar Zach Johnson
Browse files

No need to bounce through BTA_dm_on_hw_error

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I1fd446a1c0833cbef76764703cd7d33e40186514
parent 1a0ee193
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -305,12 +305,6 @@ void bta_dm_deinit_cb(void) {
  memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
}

void BTA_dm_on_hw_error() {
  if (bta_dm_cb.p_sec_cback != NULL) {
    bta_dm_cb.p_sec_cback(BTA_DM_HW_ERROR_EVT, NULL);
  }
}

void BTA_dm_on_hw_off() {
  if (bta_dm_cb.p_sec_cback != NULL)
    bta_dm_cb.p_sec_cback(BTA_DM_DISABLE_EVT, NULL);
+0 −1
Original line number Diff line number Diff line
@@ -364,7 +364,6 @@ typedef uint8_t tBTA_SIG_STRENGTH_MASK;
  23 /* Simple Pairing Remote OOB Extended Data request. */
#define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */
#define BTA_DM_DEV_UNPAIRED_EVT 25
#define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */
#define BTA_DM_LE_FEATURES_READ                                             \
  27                             /* Cotroller specific LE features are read \
                                    */
+2 −3
Original line number Diff line number Diff line
@@ -40,8 +40,7 @@
#include "osi/include/osi.h"
#include "utl.h"


void BTA_dm_on_hw_error();
void BTIF_dm_on_hw_error();

/* system manager control block definition */
tBTA_SYS_CB bta_sys_cb;
@@ -90,7 +89,7 @@ void BTA_sys_signal_hw_error() {
void bta_sys_hw_error() {
  APPL_TRACE_DEBUG("%s", __func__);
  if (bta_sys_cb.forward_hw_failures) {
    BTA_dm_on_hw_error();
    BTIF_dm_on_hw_error();
  }
}

+10 −9
Original line number Diff line number Diff line
@@ -1657,6 +1657,16 @@ void BTIF_dm_report_inquiry_status_change(uint8_t status) {
  do_in_jni_thread(base::Bind(report_inquiry_status_change, status));
}

static void on_hw_error() {
  BTIF_TRACE_ERROR("Received H/W Error. ");
  /* Flush storage data */
  btif_config_flush();
  usleep(100000); /* 100milliseconds */
  /* Killing the process to force a restart as part of fault tolerance */
  kill(getpid(), SIGKILL);
}

void BTIF_dm_on_hw_error() { do_in_jni_thread(base::Bind(on_hw_error)); }
/*******************************************************************************
 *
 * Function         btif_dm_upstreams_cback
@@ -1792,15 +1802,6 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
                &bd_addr, BT_ACL_STATE_DISCONNECTED);
      break;

    case BTA_DM_HW_ERROR_EVT:
      BTIF_TRACE_ERROR("Received H/W Error. ");
      /* Flush storage data */
      btif_config_flush();
      usleep(100000); /* 100milliseconds */
      /* Killing the process to force a restart as part of fault tolerance */
      kill(getpid(), SIGKILL);
      break;

    case BTA_DM_BLE_KEY_EVT:
      BTIF_TRACE_DEBUG("BTA_DM_BLE_KEY_EVT key_type=0x%02x ",
                       p_data->ble_key.key_type);
+0 −1
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@ const char* dump_dm_event(uint16_t event) {
    CASE_RETURN_STR(BTA_DM_BLE_LOCAL_ER_EVT)
    CASE_RETURN_STR(BTA_DM_BLE_AUTH_CMPL_EVT)
    CASE_RETURN_STR(BTA_DM_DEV_UNPAIRED_EVT)
    CASE_RETURN_STR(BTA_DM_HW_ERROR_EVT)
    CASE_RETURN_STR(BTA_DM_ENER_INFO_READ)

    default: