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

Commit 70f97ad5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "leaudio: Notify connected when subscribed for CCC" into tm-qpr-dev

parents e5823b63 7f1713c2
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -1566,6 +1566,14 @@ class LeAudioClientImpl : public LeAudioClient {
  void RegisterKnownNotifications(LeAudioDevice* leAudioDevice) {
    LOG(INFO) << __func__ << " device: " << leAudioDevice->address_;

    if (leAudioDevice->ctp_hdls_.val_hdl == 0) {
      LOG_ERROR(
          "Control point characteristic is mandatory - disconnecting device %s",
          leAudioDevice->address_.ToString().c_str());
      DisconnectDevice(leAudioDevice);
      return;
    }

    /* GATTC will ommit not registered previously handles */
    for (auto pac_tuple : leAudioDevice->snk_pacs_) {
      subscribe_for_notification(leAudioDevice->conn_id_,
@@ -1597,14 +1605,12 @@ class LeAudioClientImpl : public LeAudioClient {
                                 leAudioDevice->address_,
                                 leAudioDevice->audio_supp_cont_hdls_);

    if (leAudioDevice->ctp_hdls_.val_hdl != 0)
      subscribe_for_notification(leAudioDevice->conn_id_,
                                 leAudioDevice->address_,
                                 leAudioDevice->ctp_hdls_);

    for (struct ase& ase : leAudioDevice->ases_)
      subscribe_for_notification(leAudioDevice->conn_id_,
                                 leAudioDevice->address_, ase.hdls);

    subscribe_for_notification(leAudioDevice->conn_id_, leAudioDevice->address_,
                               leAudioDevice->ctp_hdls_);
  }

  void changeMtuIfPossible(LeAudioDevice* leAudioDevice) {
@@ -1653,7 +1659,7 @@ class LeAudioClientImpl : public LeAudioClient {
     * just notify connected  */
    if (leAudioDevice->known_service_handles_ &&
        !leAudioDevice->notify_connected_after_read_) {
      connectionReady(leAudioDevice);
      LOG_INFO("Wait for CCC registration and MTU change request");
      return;
    }

@@ -2155,6 +2161,15 @@ class LeAudioClientImpl : public LeAudioClient {
    if (status == GATT_SUCCESS) {
      LOG(INFO) << __func__
                << ", successfully registered on ccc: " << loghex(hdl);

      if (leAudioDevice->ctp_hdls_.ccc_hdl == hdl &&
          leAudioDevice->known_service_handles_ &&
          !leAudioDevice->notify_connected_after_read_) {
        /* Reconnection case. Control point is the last CCC LeAudio is
         * registering for on reconnection */
        connectionReady(leAudioDevice);
      }

      return;
    }