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

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

ASHA: do service search after service discovery

From the ASHA design, will do service search for the ASHA profile
from SDP after encryption successful. On this time, the service search
will fail and no responed if the service discovery is running. Then the
ASHA profile connection is broken due to service search no response.
This patch make sure the ASHA can do service search after service
discovery.

Tag: #feature
Bug: 235913388
Test: manual
Ignore-AOSP-First: cherry-pick
Merged-In: I78e8b9c1cc78fb129d7872c98e902cc71b5a5f16
Change-Id: I78e8b9c1cc78fb129d7872c98e902cc71b5a5f16
parent db85eae2
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -570,7 +570,7 @@ class HearingAidImpl : public HearingAid {
      return;
    }

    DVLOG(2) << __func__ << " " << address;
    LOG(INFO) << __func__ << ": " << address;

    if (hearingDevice->audio_control_point_handle &&
        hearingDevice->audio_status_handle &&
@@ -579,6 +579,8 @@ class HearingAidImpl : public HearingAid {
      // Use cached data, jump to read PSM
      ReadPSM(hearingDevice);
    } else {
      LOG(INFO) << __func__ << ": " << address
                << ": do BTA_GATTC_ServiceSearchRequest";
      hearingDevice->first_connection = true;
      BTA_GATTC_ServiceSearchRequest(hearingDevice->conn_id, &HEARING_AID_UUID);
    }
@@ -630,7 +632,14 @@ class HearingAidImpl : public HearingAid {
      VLOG(2) << "Skipping unknown device" << address;
      return;
    }
    if (hearingDevice->service_changed_rcvd) {
    LOG(INFO) << __func__ << ": " << address;
    if (hearingDevice->service_changed_rcvd ||
        !(hearingDevice->audio_control_point_handle &&
          hearingDevice->audio_status_handle &&
          hearingDevice->audio_status_ccc_handle &&
          hearingDevice->volume_handle && hearingDevice->read_psm_handle)) {
      LOG(INFO) << __func__ << ": " << address
                << ": do BTA_GATTC_ServiceSearchRequest";
      BTA_GATTC_ServiceSearchRequest(hearingDevice->conn_id, &HEARING_AID_UUID);
    }
  }
@@ -897,7 +906,8 @@ class HearingAidImpl : public HearingAid {
    uint16_t psm = *((uint16_t*)value);
    VLOG(2) << "read psm:" << loghex(psm);

    if (hearingDevice->gap_handle == GAP_INVALID_HANDLE) {
    if (hearingDevice->gap_handle == GAP_INVALID_HANDLE &&
        BTM_IsEncrypted(hearingDevice->address, BT_TRANSPORT_LE)) {
      ConnectSocket(hearingDevice, psm);
    }
  }