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

Commit 68610fd7 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge "Prevents the OOB data generation procedure from getting stuck because...

Merge "Prevents the OOB data generation procedure from getting stuck because the SMP state machine is busy" am: f18448b9

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2455632



Change-Id: Ic3f099dfdf61bc0852535c09588cd64ec3e4cdf5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 63595ccc f18448b9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3064,7 +3064,11 @@ void btif_dm_generate_local_oob_data(tBT_TRANSPORT transport) {
        stop_oob_advertiser();
      }
      waiting_on_oob_advertiser_start = true;
      SMP_CrLocScOobData();
      if (!SMP_CrLocScOobData()) {
        waiting_on_oob_advertiser_start = false;
        GetInterfaceToProfiles()->events->invoke_oob_data_request_cb(
            transport, false, Octet16{}, Octet16{}, RawAddress{}, 0x00);
      }
    } else {
      GetInterfaceToProfiles()->events->invoke_oob_data_request_cb(
          transport, false, Octet16{}, Octet16{}, RawAddress{}, 0x00);
+4 −1
Original line number Diff line number Diff line
@@ -187,8 +187,11 @@ extern void SMP_SecureConnectionOobDataReply(uint8_t* p_data);
 * Description      This function is called to generate a public key to be
 *                  passed to a remote device via an Out of Band transport
 *
 * Returns          true if the request is successfully sent and executed by the
 *                  state machine, false otherwise
 *
 ******************************************************************************/
extern void SMP_CrLocScOobData();
extern bool SMP_CrLocScOobData();

/*******************************************************************************
 *
+5 −2
Original line number Diff line number Diff line
@@ -567,10 +567,13 @@ void SMP_SecureConnectionOobDataReply(uint8_t* p_data) {
 * Description      This function is called to generate a public key to be
 *                  passed to a remote device via Out of Band transport.
 *
 * Returns          true if the request is successfully sent and executed by the
 *                  state machine, false otherwise
 *
 ******************************************************************************/
void SMP_CrLocScOobData() {
bool SMP_CrLocScOobData() {
  tSMP_INT_DATA smp_int_data;
  smp_sm_event(&smp_cb, SMP_CR_LOC_SC_OOB_DATA_EVT, &smp_int_data);
  return smp_sm_event(&smp_cb, SMP_CR_LOC_SC_OOB_DATA_EVT, &smp_int_data);
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ extern tSMP_CB smp_cb;
extern void smp_init(void);

/* smp main */
extern void smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event,
extern bool smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event,
                         tSMP_INT_DATA* p_data);

extern tSMP_STATE smp_get_state(void);
+8 −5
Original line number Diff line number Diff line
@@ -973,17 +973,19 @@ tSMP_STATE smp_get_state(void) { return smp_cb.state; }
 *              not NULL state, adjust the new state to the returned state. If
 *              (api_evt != MAX), call callback function.
 *
 * Returns      void.
 * Returns      true if the event is executed and a state transition can be
 *              expected, false if the event is ignored, state is invalid, or
 *              the role is invalid for the control block.
 *
 ******************************************************************************/
void smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event, tSMP_INT_DATA* p_data) {
bool smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event, tSMP_INT_DATA* p_data) {
  uint8_t curr_state = p_cb->state;
  tSMP_SM_TBL state_table;
  uint8_t action, entry, i;

  if (p_cb->role >= 2) {
    SMP_TRACE_DEBUG("Invalid role: %d", p_cb->role);
    return;
    return false;
  }

  tSMP_ENTRY_TBL entry_table = smp_entry_table[p_cb->role];
@@ -991,7 +993,7 @@ void smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event, tSMP_INT_DATA* p_data) {
  SMP_TRACE_EVENT("main smp_sm_event");
  if (curr_state >= SMP_STATE_MAX) {
    SMP_TRACE_DEBUG("Invalid state: %d", curr_state);
    return;
    return false;
  }

  SMP_TRACE_DEBUG("SMP Role: %s State: [%s (%d)], Event: [%s (%d)]",
@@ -1014,7 +1016,7 @@ void smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event, tSMP_INT_DATA* p_data) {
    SMP_TRACE_DEBUG("Ignore event [%s (%d)] in state [%s (%d)]",
                    smp_get_event_name(event), event,
                    smp_get_state_name(curr_state), curr_state);
    return;
    return false;
  }

  /* Get possible next state from state table. */
@@ -1035,6 +1037,7 @@ void smp_sm_event(tSMP_CB* p_cb, tSMP_EVENT event, tSMP_INT_DATA* p_data) {
    }
  }
  SMP_TRACE_DEBUG("result state = %s", smp_get_state_name(p_cb->state));
  return true;
}

/*******************************************************************************
Loading