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

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

SAP: Fix issue of socket listener not getting re-started

Add logic to properly handle ACL_DISCONNECTED to restart socketListener
to handle scenarios where socket listener was not getting started due to
abnormal ACL disconnect.

Change-Id: Iac5ec52f485e692b14bb0065e30a68cae007a49d
parent e0abb30a
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -745,13 +745,15 @@ public class SapService extends ProfileService {

                if (DEBUG) Log.d(TAG,"ACL disconnected for " + device);

                if (mRemoteDevice.equals(device) && mRemoveTimeoutMsg) {
                if (mRemoteDevice.equals(device)) {
                    if (mRemoveTimeoutMsg) {
                        // Send any pending timeout now, as ACL got disconnected.
                        cancelUserTimeoutAlarm();
                        mSessionStatusHandler.removeMessages(USER_TIMEOUT);
                        sendCancelUserConfirmationIntent(mRemoteDevice);
                    }
                    mIsWaitingAuthorization = false;
                    mRemoveTimeoutMsg = false;
                    setState(BluetoothSap.STATE_DISCONNECTED);
                    // Ensure proper cleanup, and prepare for new connect.
                    mSessionStatusHandler.sendEmptyMessage(MSG_SERVERSESSION_CLOSE);
                }