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

Commit 1a855f5b authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Merge "Close leftover Audio-to-Bluetooth HAL connections before reopening" am:...

Merge "Close leftover Audio-to-Bluetooth HAL connections before reopening" am: db132e65 am: 672546da
am: a6472293

Change-Id: Ib2c3b705de66904e302994f562449f77d1c8d027
parents ab5b2964 a6472293
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -272,11 +272,19 @@ static int uipc_check_fd_locked(tUIPC_CH_ID ch_id) {
  if (SAFE_FD_ISSET(uipc_main.ch[ch_id].srvfd, &uipc_main.read_set)) {
    BTIF_TRACE_EVENT("INCOMING CONNECTION ON CH %d", ch_id);

    // Close the previous connection
    if (uipc_main.ch[ch_id].fd != UIPC_DISCONNECTED) {
      BTIF_TRACE_EVENT("CLOSE CONNECTION (FD %d)", uipc_main.ch[ch_id].fd);
      close(uipc_main.ch[ch_id].fd);
      FD_CLR(uipc_main.ch[ch_id].fd, &uipc_main.active_set);
      uipc_main.ch[ch_id].fd = UIPC_DISCONNECTED;
    }

    uipc_main.ch[ch_id].fd = accept_server_socket(uipc_main.ch[ch_id].srvfd);

    BTIF_TRACE_EVENT("NEW FD %d", uipc_main.ch[ch_id].fd);

    if ((uipc_main.ch[ch_id].fd > 0) && uipc_main.ch[ch_id].cback) {
    if ((uipc_main.ch[ch_id].fd >= 0) && uipc_main.ch[ch_id].cback) {
      /*  if we have a callback we should add this fd to the active set
          and notify user with callback event */
      BTIF_TRACE_EVENT("ADD FD %d TO ACTIVE SET", uipc_main.ch[ch_id].fd);