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

Commit b8984f61 authored by Hemant Gupta's avatar Hemant Gupta Committed by Andre Eisenbach
Browse files

SAP: Handle disconnect request during call ongoing state

Handle disconnect request during call ongoing state properly.
Previously if disconnect was received from SAP client while in
call ongoing state, it was not handled properly, leading to
Server not sending the DISCONNECT response thereby violating
Bluetooth SAP Specification.

Change-Id: I666fab4b4513abfa00df4be5b3a7aab95d5f0331
parent f4de2e06
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -350,16 +350,20 @@ public class SapServer extends Thread implements Callback {
                             *       close socket-streams and initiate cleanup */
                            if(VERBOSE) Log.d(TAG, "DISCONNECT_REQ");

                            if (mState ==  SAP_STATE.CONNECTING_CALL_ONGOING) {
                                Log.d(TAG, "disconnect received when call was ongoing, " +
                                     "send disconnect response");
                                changeState(SAP_STATE.DISCONNECTING);
                                SapMessage reply = new SapMessage(SapMessage.ID_DISCONNECT_RESP);
                                sendClientMessage(reply);
                            } else {
                                clearPendingRilResponses(msg);

                                changeState(SAP_STATE.DISCONNECTING);

                                sendRilThreadMessage(msg);
                            /* We simply need to forward to RIL, but not change state to busy
                             * - hence send and set message to null. */
                            msg = null; // don't send twice
                                /*cancel the timer for the hard-disconnect intent*/
                                stopDisconnectTimer();
                            }
                            msg = null; // No message needs to be sent to RIL
                            break;
                        case SapMessage.ID_POWER_SIM_OFF_REQ: // Fall through
                        case SapMessage.ID_RESET_SIM_REQ: