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

Commit 5f26afba authored by Matthew Xie's avatar Matthew Xie Committed by Android Git Automerger
Browse files

am 2f67b082: Move socket initialization code out of pbap service\'s main thread

* commit '2f67b082':
  Move socket initialization code out of pbap service's main thread
parents 1286be1c 2f67b082
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -437,7 +437,7 @@ final class RemoteDevices {
    }
    }


    private void debugLog(String msg) {
    private void debugLog(String msg) {
        if (DBG) Log.e(TAG, msg);
        if (DBG) Log.d(TAG, msg);
    }
    }


    private void infoLog(String msg) {
    private void infoLog(String msg) {
+9 −7
Original line number Original line Diff line number Diff line
@@ -316,12 +316,6 @@ public class BluetoothPbapService extends Service {
    private void startRfcommSocketListener() {
    private void startRfcommSocketListener() {
        if (VERBOSE) Log.v(TAG, "Pbap Service startRfcommSocketListener");
        if (VERBOSE) Log.v(TAG, "Pbap Service startRfcommSocketListener");


        if (mServerSocket == null) {
            if (!initSocket()) {
                closeService();
                return;
            }
        }
        if (mAcceptThread == null) {
        if (mAcceptThread == null) {
            mAcceptThread = new SocketAcceptThread();
            mAcceptThread = new SocketAcceptThread();
            mAcceptThread.setName("BluetoothPbapAcceptThread");
            mAcceptThread.setName("BluetoothPbapAcceptThread");
@@ -340,7 +334,8 @@ public class BluetoothPbapService extends Service {
            try {
            try {
                // It is mandatory for PSE to support initiation of bonding and
                // It is mandatory for PSE to support initiation of bonding and
                // encryption.
                // encryption.
                mServerSocket = mAdapter.listenUsingEncryptedRfcommWithServiceRecord("OBEX Phonebook Access Server", BluetoothUuid.PBAP_PSE.getUuid());
                mServerSocket = mAdapter.listenUsingEncryptedRfcommWithServiceRecord
                    ("OBEX Phonebook Access Server", BluetoothUuid.PBAP_PSE.getUuid());


            } catch (IOException e) {
            } catch (IOException e) {
                Log.e(TAG, "Error create RfcommServerSocket " + e.toString());
                Log.e(TAG, "Error create RfcommServerSocket " + e.toString());
@@ -521,6 +516,13 @@ public class BluetoothPbapService extends Service {


        @Override
        @Override
        public void run() {
        public void run() {
            if (mServerSocket == null) {
                if (!initSocket()) {
                    closeService();
                    return;
                }
            }

            while (!stopped) {
            while (!stopped) {
                try {
                try {
                    if (VERBOSE) Log.v(TAG, "Accepting socket connection...");
                    if (VERBOSE) Log.v(TAG, "Accepting socket connection...");