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

Commit 867df5df authored by Yun-hao Chung's avatar Yun-hao Chung Committed by Automerger Merge Worker
Browse files

Merge "Floss: Don't emit metric event when remove a bond" am: fd455e92

parents 3a3dfd6c fd455e92
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -102,6 +102,9 @@ void LogMetricsBondStateChanged(
  // Ignore the start of pairing event as its logged separated above.
  // Ignore the start of pairing event as its logged separated above.
  if (pairing_state == PairingState::PAIR_STARTING) return;
  if (pairing_state == PairingState::PAIR_STARTING) return;


  // Ignore absurd state.
  if (pairing_state == PairingState::PAIR_FAIL_END) return;

  LOG_DEBUG(
  LOG_DEBUG(
      "PairingStateChanged: %s, %d, %s, %d, %d",
      "PairingStateChanged: %s, %d, %s, %d, %d",
      boot_id.c_str(),
      boot_id.c_str(),
+7 −2
Original line number Original line Diff line number Diff line
@@ -265,11 +265,16 @@ PairingState ToPairingState(uint32_t status, uint32_t bond_state, int32_t fail_r
  if ((BtStatus)status == BtStatus::BT_STATUS_SUCCESS && (hci::ErrorCode)fail_reason == hci::ErrorCode::SUCCESS) {
  if ((BtStatus)status == BtStatus::BT_STATUS_SUCCESS && (hci::ErrorCode)fail_reason == hci::ErrorCode::SUCCESS) {
    if ((BtBondState)bond_state == BtBondState::BT_BOND_STATE_BONDED) {
    if ((BtBondState)bond_state == BtBondState::BT_BOND_STATE_BONDED) {
      return PairingState::PAIR_SUCCEED;
      return PairingState::PAIR_SUCCEED;
    } else {
    } else {  // must be BtBondState::BT_BOND_STATE_NONE as BT_BOND_STATE_BONDING case has been
      return PairingState::PAIR_FAIL_CANCELLED;
              // checked early
      // This implies the event is from forgetting a device. Return an absurd value to let caller
      // know.
      return PairingState::PAIR_FAIL_END;
    }
    }
  }
  }


  // TODO(b/287392029): Translate cases of bond cancelled into PairingState:PAIR_FAIL_CANCELLED

  // When both status and fail reason are provided and disagree with each other, overwrite status with the fail reason
  // When both status and fail reason are provided and disagree with each other, overwrite status with the fail reason
  // as fail reason is generated closer to the HCI and provides a more accurate description.
  // as fail reason is generated closer to the HCI and provides a more accurate description.
  if (status) pairing_state = StatusToPairingState(status);
  if (status) pairing_state = StatusToPairingState(status);