Loading android/app/src/com/android/bluetooth/BluetoothObexTransport.java +16 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,24 @@ import javax.obex.ObexTransport; public class BluetoothObexTransport implements ObexTransport { private BluetoothSocket mSocket = null; /** * Will default at the maximum packet length. */ public static final int PACKET_SIZE_UNSPECIFIED = -1; private int mMaxTransmitPacketSize = PACKET_SIZE_UNSPECIFIED; private int mMaxReceivePacketSize = PACKET_SIZE_UNSPECIFIED; public BluetoothObexTransport(BluetoothSocket socket) { this.mSocket = socket; } public BluetoothObexTransport(BluetoothSocket socket, int transmitSize, int receiveSize) { this.mSocket = socket; this.mMaxTransmitPacketSize = transmitSize; this.mMaxReceivePacketSize = receiveSize; } @Override public void close() throws IOException { mSocket.close(); Loading Loading @@ -84,7 +98,7 @@ public class BluetoothObexTransport implements ObexTransport { @Override public int getMaxTransmitPacketSize() { if (mSocket.getConnectionType() != BluetoothSocket.TYPE_L2CAP) { return -1; return mMaxTransmitPacketSize; } return mSocket.getMaxTransmitPacketSize(); } Loading @@ -92,7 +106,7 @@ public class BluetoothObexTransport implements ObexTransport { @Override public int getMaxReceivePacketSize() { if (mSocket.getConnectionType() != BluetoothSocket.TYPE_L2CAP) { return -1; return mMaxReceivePacketSize; } return mSocket.getMaxReceivePacketSize(); } Loading android/app/src/com/android/bluetooth/pbap/PbapStateMachine.java +10 −2 Original line number Diff line number Diff line Loading @@ -75,6 +75,12 @@ class PbapStateMachine extends StateMachine { static final int AUTH_KEY_INPUT = 7; static final int AUTH_CANCELLED = 8; /** * Used to limit PBAP OBEX maximum packet size in order to reduce * transaction time. */ private static final int PBAP_OBEX_MAXIMUM_PACKET_SIZE = 8192; private BluetoothPbapService mService; private IObexConnectionHandler mIObexConnectionHandler; Loading Loading @@ -241,7 +247,8 @@ class PbapStateMachine extends StateMachine { private void rejectConnection() { mPbapServer = new BluetoothPbapObexServer(mServiceHandler, mService, PbapStateMachine.this); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket, PBAP_OBEX_MAXIMUM_PACKET_SIZE, BluetoothObexTransport.PACKET_SIZE_UNSPECIFIED); ObexRejectServer server = new ObexRejectServer(ResponseCodes.OBEX_HTTP_UNAVAILABLE, mConnSocket); try { Loading Loading @@ -342,7 +349,8 @@ class PbapStateMachine extends StateMachine { mObexAuth.setChallenged(false); mObexAuth.setCancelled(false); } BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket, PBAP_OBEX_MAXIMUM_PACKET_SIZE, BluetoothObexTransport.PACKET_SIZE_UNSPECIFIED); mServerSession = new ServerSession(transport, mPbapServer, mObexAuth); // It's ok to just use one wake lock // Message MSG_ACQUIRE_WAKE_LOCK is always surrounded by RELEASE. safe. Loading Loading
android/app/src/com/android/bluetooth/BluetoothObexTransport.java +16 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,24 @@ import javax.obex.ObexTransport; public class BluetoothObexTransport implements ObexTransport { private BluetoothSocket mSocket = null; /** * Will default at the maximum packet length. */ public static final int PACKET_SIZE_UNSPECIFIED = -1; private int mMaxTransmitPacketSize = PACKET_SIZE_UNSPECIFIED; private int mMaxReceivePacketSize = PACKET_SIZE_UNSPECIFIED; public BluetoothObexTransport(BluetoothSocket socket) { this.mSocket = socket; } public BluetoothObexTransport(BluetoothSocket socket, int transmitSize, int receiveSize) { this.mSocket = socket; this.mMaxTransmitPacketSize = transmitSize; this.mMaxReceivePacketSize = receiveSize; } @Override public void close() throws IOException { mSocket.close(); Loading Loading @@ -84,7 +98,7 @@ public class BluetoothObexTransport implements ObexTransport { @Override public int getMaxTransmitPacketSize() { if (mSocket.getConnectionType() != BluetoothSocket.TYPE_L2CAP) { return -1; return mMaxTransmitPacketSize; } return mSocket.getMaxTransmitPacketSize(); } Loading @@ -92,7 +106,7 @@ public class BluetoothObexTransport implements ObexTransport { @Override public int getMaxReceivePacketSize() { if (mSocket.getConnectionType() != BluetoothSocket.TYPE_L2CAP) { return -1; return mMaxReceivePacketSize; } return mSocket.getMaxReceivePacketSize(); } Loading
android/app/src/com/android/bluetooth/pbap/PbapStateMachine.java +10 −2 Original line number Diff line number Diff line Loading @@ -75,6 +75,12 @@ class PbapStateMachine extends StateMachine { static final int AUTH_KEY_INPUT = 7; static final int AUTH_CANCELLED = 8; /** * Used to limit PBAP OBEX maximum packet size in order to reduce * transaction time. */ private static final int PBAP_OBEX_MAXIMUM_PACKET_SIZE = 8192; private BluetoothPbapService mService; private IObexConnectionHandler mIObexConnectionHandler; Loading Loading @@ -241,7 +247,8 @@ class PbapStateMachine extends StateMachine { private void rejectConnection() { mPbapServer = new BluetoothPbapObexServer(mServiceHandler, mService, PbapStateMachine.this); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket, PBAP_OBEX_MAXIMUM_PACKET_SIZE, BluetoothObexTransport.PACKET_SIZE_UNSPECIFIED); ObexRejectServer server = new ObexRejectServer(ResponseCodes.OBEX_HTTP_UNAVAILABLE, mConnSocket); try { Loading Loading @@ -342,7 +349,8 @@ class PbapStateMachine extends StateMachine { mObexAuth.setChallenged(false); mObexAuth.setCancelled(false); } BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket, PBAP_OBEX_MAXIMUM_PACKET_SIZE, BluetoothObexTransport.PACKET_SIZE_UNSPECIFIED); mServerSession = new ServerSession(transport, mPbapServer, mObexAuth); // It's ok to just use one wake lock // Message MSG_ACQUIRE_WAKE_LOCK is always surrounded by RELEASE. safe. Loading