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

Commit 42467161 authored by weichinweng's avatar weichinweng Committed by Weichin Weng
Browse files

ASHA: Don't retry if the phy update fail with not success status.

Tag: #feature
Bug: 235181841
Test: manual
Change-Id: Ida889ac2600d6c769767cf8342ce4dc6b17446f7
parent dee84567
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -584,6 +584,7 @@ class HearingAidImpl : public HearingAid {
    }
  }

  // Just take care phy update successful case to avoid loop excuting.
  void OnPhyUpdateEvent(uint16_t conn_id, uint8_t tx_phys, uint8_t rx_phys,
                        tGATT_STATUS status) {
    HearingDevice* hearingDevice = hearingDevices.FindByConnId(conn_id);
@@ -591,14 +592,19 @@ class HearingAidImpl : public HearingAid {
      DVLOG(2) << "Skipping unknown device, conn_id=" << loghex(conn_id);
      return;
    }
    if (status == GATT_SUCCESS && tx_phys == PHY_LE_2M &&
        rx_phys == PHY_LE_2M) {
    if (status != GATT_SUCCESS) {
      LOG(WARNING) << hearingDevice->address
                   << " phy update fail with status: " << status;
      return;
    }
    if (tx_phys == PHY_LE_2M && rx_phys == PHY_LE_2M) {
      LOG(INFO) << hearingDevice->address << " phy update to 2M successful";
      return;
    }
    LOG(INFO) << hearingDevice->address
              << " phy update to 2M fail, try again. status: " << status
              << ", tx_phys: " << tx_phys << ", rx_phys: " << rx_phys;
    LOG(INFO)
        << hearingDevice->address
        << " phy update successful but not target phy, try again. tx_phys: "
        << tx_phys << ", rx_phys: " << rx_phys;
    BTM_BleSetPhy(hearingDevice->address, PHY_LE_2M, PHY_LE_2M, 0);
  }