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

Commit 16159961 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

Remove contacts at shutdown.

If the bluetooth adapter gets turned off clean up PBAP contacts.

bug: 28630194
Change-Id: Ibaec25d6f1f5f5aca4dc00c0437af54d3d534be4
parent 9541d943
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -101,8 +101,9 @@ class PbapClientConnectionHandler extends Handler {
                     * connect via an OBEX session */
                    mSocket = mDevice.createRfcommSocketToServiceRecord(
                            BluetoothUuid.PBAP_PSE.getUuid());
                    if (DBG) Log.d(TAG, "Socket created.");
                    mSocket.connect();

                    if (DBG) Log.d(TAG, "Socket connected.");
                    BluetoothPbapObexTransport transport;
                    transport = new BluetoothPbapObexTransport(mSocket);

@@ -131,14 +132,17 @@ class PbapClientConnectionHandler extends Handler {
                break;

            case MSG_DISCONNECT:
                if (DBG) Log.d(TAG,"Starting Disconnect");
                try {
                    if (mObexSession != null) {
                        mObexSession.disconnect(null);
                    }
                    if (DBG) Log.d(TAG, "Closing Socket");
                    closeSocket();
                } catch (IOException e) {
                    Log.w(TAG,"DISCONNECT Failure " + e.toString());
                    Log.w(TAG, "DISCONNECT Failure ", e);
                }
                Log.d(TAG, "Completing Disconnect");
                removeAccount(mAccount);
                mContext.getContentResolver()
                        .delete(CallLog.Calls.CONTENT_URI, null, null);
+5 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ final class PbapClientStateMachine extends StateMachine {
        mConnecting = new Connecting();
        mDisconnecting = new Disconnecting();
        mConnected = new Connected();
        removeUncleanAccounts();

        addState(mDisconnected);
        addState(mConnecting);
@@ -353,6 +354,10 @@ final class PbapClientStateMachine extends StateMachine {
    }

    void doQuit() {
        removeUncleanAccounts();
        if (mHandlerThread != null) {
            mHandlerThread.quitSafely();
        }
        quitNow();
    }