Set max transmit packet size for OBEX packets to the max if they exceed the
max allowed packet size Tag: #feature Bug: 187174891 Test: Manual Merged-In: I80422e03d14958f2ea95327f95d010c747948e2c Change-Id: I80422e03d14958f2ea95327f95d010c747948e2c
This commit is contained in:
parent
4db95cceb9
commit
6338fb0d7f
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
package javax.obex;
|
package javax.obex;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@ -43,7 +45,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class defines a set of helper methods for the implementation of Obex.
|
* This class defines a set of helper methods for the implementation of Obex.
|
||||||
@ -1083,11 +1084,12 @@ public final class ObexHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int validateMaxPacketSize(int size) {
|
private static int validateMaxPacketSize(int size) {
|
||||||
if(VDBG && (size > MAX_PACKET_SIZE_INT)) Log.w(TAG,
|
if (VDBG && (size > MAX_PACKET_SIZE_INT)) {
|
||||||
"The packet size supported for the connection (" + size + ") is larger"
|
Log.w(TAG, "The packet size supported for the connection (" + size + ") is larger"
|
||||||
+ " than the configured OBEX packet size: " + MAX_PACKET_SIZE_INT);
|
+ " than the configured OBEX packet size: " + MAX_PACKET_SIZE_INT);
|
||||||
if(size != -1) {
|
}
|
||||||
if(size < LOWER_LIMIT_MAX_PACKET_SIZE) {
|
if (size != -1 && size < MAX_PACKET_SIZE_INT) {
|
||||||
|
if (size < LOWER_LIMIT_MAX_PACKET_SIZE) {
|
||||||
throw new IllegalArgumentException(size + " is less that the lower limit: "
|
throw new IllegalArgumentException(size + " is less that the lower limit: "
|
||||||
+ LOWER_LIMIT_MAX_PACKET_SIZE);
|
+ LOWER_LIMIT_MAX_PACKET_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,8 @@ public interface ObexTransport {
|
|||||||
* size. Therefore this value shall not change.
|
* size. Therefore this value shall not change.
|
||||||
* For RFCOMM or other transport types where the OBEX packets size
|
* For RFCOMM or other transport types where the OBEX packets size
|
||||||
* is unrelated to the transport packet size, return -1;
|
* is unrelated to the transport packet size, return -1;
|
||||||
|
* Exception can be made (like PBAP transport) with a smaller value
|
||||||
|
* to avoid bad effect on other profiles using the RFCOMM;
|
||||||
* @return the maximum allowed OBEX packet that can be send over
|
* @return the maximum allowed OBEX packet that can be send over
|
||||||
* the transport. Or -1 in case of don't care.
|
* the transport. Or -1 in case of don't care.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user