Loading android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java +29 −18 Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch private static final String SOCKET_LINK_KEY_ERROR = "Invalid exchange"; private static final Object INSTANCE_LOCK = new Object(); private Context mContext; private BluetoothAdapter mAdapter; Loading Loading @@ -162,8 +164,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch markConnectionFailed(null); return; } synchronized (INSTANCE_LOCK) { mConnectThread = new SocketConnectThread(mDevice, false, true, record.getL2capPsm()); } mConnectThread.start(); mDevice = null; } Loading Loading @@ -206,9 +210,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch switch (msg.what) { case SOCKET_ERROR_RETRY: BluetoothDevice device = (BluetoothDevice) msg.obj; synchronized (INSTANCE_LOCK) { mConnectThread = new SocketConnectThread(device, true); mConnectThread.start(); } break; case TRANSPORT_ERROR: /* Loading @@ -218,7 +223,9 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch if (V) { Log.v(TAG, "receive TRANSPORT_ERROR msg"); } synchronized (INSTANCE_LOCK) { mConnectThread = null; } markBatchFailed(BluetoothShare.STATUS_CONNECTION_ERROR); mBatch.mStatus = Constants.BATCH_STATUS_FAILED; Loading @@ -231,7 +238,9 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch if (V) { Log.v(TAG, "Transfer receive TRANSPORT_CONNECTED msg"); } synchronized (INSTANCE_LOCK) { mConnectThread = null; } mTransport = (ObexTransport) msg.obj; startObexSession(); Loading Loading @@ -514,6 +523,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch } cleanUp(); synchronized (INSTANCE_LOCK) { if (mConnectThread != null) { try { mConnectThread.interrupt(); Loading @@ -528,6 +538,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch } mConnectThread = null; } } // Prevent concurrent access synchronized (this) { if (mHandlerThread != null) { Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java +29 −18 Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch private static final String SOCKET_LINK_KEY_ERROR = "Invalid exchange"; private static final Object INSTANCE_LOCK = new Object(); private Context mContext; private BluetoothAdapter mAdapter; Loading Loading @@ -162,8 +164,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch markConnectionFailed(null); return; } synchronized (INSTANCE_LOCK) { mConnectThread = new SocketConnectThread(mDevice, false, true, record.getL2capPsm()); } mConnectThread.start(); mDevice = null; } Loading Loading @@ -206,9 +210,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch switch (msg.what) { case SOCKET_ERROR_RETRY: BluetoothDevice device = (BluetoothDevice) msg.obj; synchronized (INSTANCE_LOCK) { mConnectThread = new SocketConnectThread(device, true); mConnectThread.start(); } break; case TRANSPORT_ERROR: /* Loading @@ -218,7 +223,9 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch if (V) { Log.v(TAG, "receive TRANSPORT_ERROR msg"); } synchronized (INSTANCE_LOCK) { mConnectThread = null; } markBatchFailed(BluetoothShare.STATUS_CONNECTION_ERROR); mBatch.mStatus = Constants.BATCH_STATUS_FAILED; Loading @@ -231,7 +238,9 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch if (V) { Log.v(TAG, "Transfer receive TRANSPORT_CONNECTED msg"); } synchronized (INSTANCE_LOCK) { mConnectThread = null; } mTransport = (ObexTransport) msg.obj; startObexSession(); Loading Loading @@ -514,6 +523,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch } cleanUp(); synchronized (INSTANCE_LOCK) { if (mConnectThread != null) { try { mConnectThread.interrupt(); Loading @@ -528,6 +538,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch } mConnectThread = null; } } // Prevent concurrent access synchronized (this) { if (mHandlerThread != null) { Loading