summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Gupta <hemantg@codeaurora.org>2015-05-13 13:19:18 +0530
committerAndre Eisenbach <eisenbach@google.com>2015-05-14 17:21:15 -0700
commit4231be1e03b7c5e563fea1fa7c56abfe2a1e61dd (patch)
treeac23149457b50acbfb0448e844ec80577f5480fb
parent501fc972ed07c56eceb1309dbee6bc84dbf4c1c1 (diff)
downloadbluetooth-4231be1e03b7c5e563fea1fa7c56abfe2a1e61dd.tar.gz
MAPC: Fix following issues in map client codeandroid-cts-6.0_r9android-cts-6.0_r8android-cts-6.0_r7android-cts-6.0_r6android-cts-6.0_r5android-cts-6.0_r4android-cts-6.0_r32android-cts-6.0_r31android-cts-6.0_r30android-cts-6.0_r3android-cts-6.0_r29android-cts-6.0_r28android-cts-6.0_r27android-cts-6.0_r26android-cts-6.0_r25android-cts-6.0_r24android-cts-6.0_r23android-cts-6.0_r22android-cts-6.0_r21android-cts-6.0_r20android-cts-6.0_r2android-cts-6.0_r19android-cts-6.0_r18android-cts-6.0_r17android-cts-6.0_r16android-cts-6.0_r15android-cts-6.0_r14android-cts-6.0_r13android-cts-6.0_r12android-cts-6.0_r1android-6.0.1_r9android-6.0.1_r81android-6.0.1_r80android-6.0.1_r8android-6.0.1_r79android-6.0.1_r78android-6.0.1_r77android-6.0.1_r74android-6.0.1_r73android-6.0.1_r72android-6.0.1_r70android-6.0.1_r7android-6.0.1_r69android-6.0.1_r68android-6.0.1_r67android-6.0.1_r66android-6.0.1_r65android-6.0.1_r63android-6.0.1_r62android-6.0.1_r61android-6.0.1_r60android-6.0.1_r59android-6.0.1_r58android-6.0.1_r57android-6.0.1_r56android-6.0.1_r55android-6.0.1_r54android-6.0.1_r53android-6.0.1_r52android-6.0.1_r51android-6.0.1_r50android-6.0.1_r5android-6.0.1_r49android-6.0.1_r48android-6.0.1_r47android-6.0.1_r46android-6.0.1_r45android-6.0.1_r43android-6.0.1_r42android-6.0.1_r41android-6.0.1_r40android-6.0.1_r4android-6.0.1_r33android-6.0.1_r32android-6.0.1_r31android-6.0.1_r30android-6.0.1_r3android-6.0.1_r28android-6.0.1_r27android-6.0.1_r26android-6.0.1_r25android-6.0.1_r24android-6.0.1_r22android-6.0.1_r21android-6.0.1_r20android-6.0.1_r18android-6.0.1_r17android-6.0.1_r16android-6.0.1_r13android-6.0.1_r12android-6.0.1_r11android-6.0.1_r10android-6.0.1_r1android-6.0.0_r7android-6.0.0_r6android-6.0.0_r5android-6.0.0_r41android-6.0.0_r4android-6.0.0_r3android-6.0.0_r26android-6.0.0_r25android-6.0.0_r24android-6.0.0_r23android-6.0.0_r2android-6.0.0_r13android-6.0.0_r12android-6.0.0_r11android-6.0.0_r1marshmallow-releasemarshmallow-mr3-releasemarshmallow-mr2-releasemarshmallow-mr1-releasemarshmallow-mr1-devmarshmallow-dr1.6-releasemarshmallow-dr1.5-releasemarshmallow-dr1.5-devmarshmallow-dr-releasemarshmallow-dr-dragon-releasemarshmallow-dr-devmarshmallow-devmarshmallow-cts-release
- Fix NPE for ObexTime and dateTimeformat. Handle possible NullPointerException while accessing map client ObexTime constructor utility. Send all parameters event, status and notification state to Test Client for setNotifcationRegistration event both success and failure case. - Fix GetMessagelisting Request for maxlistcount value 0. Include maxlistcount for value 0 in application parameters header while composing obex GetMessageListing Request to MAP Server. - Add maxListCount param in getfolderlisting. A special case, where MCE APP send the folderlisting with maxlistcount=0, startoffset=5, As DUT(MCE role) does not include maxListcount param in folderlsiting, when it's value set to 0 by MCE APP. So as per the spec, MSE assume maxListCount = 1024 for folderlsiting & MSE response as the bad request, when startoffset is Out of range. Adding MaxListCount in folderListing to solve this issue, when it's value set to 0. - Handle exception for incorrect length value from MSE Handle possible exception while parsing GET Message response with incorrect LENGTH value fetched from MSE. - Include ParameterMask Header in GET only when specified. Include ParmaterMask in GET MessageLising Request only when specific values are selected from TestClient. ParameterMask is not a mandatory feild as per MAP1.1 Spec. excluding ParameterMask for default or value '0' fix MSE IOT issues that doesnot support ParameterMask Header. Change-Id: I1bee3f512f877974bb8fd63f3b27dc3ce3ff8a13
-rw-r--r--src/android/bluetooth/client/map/BluetoothMapBmessageParser.java17
-rw-r--r--src/android/bluetooth/client/map/BluetoothMapMessage.java8
-rw-r--r--src/android/bluetooth/client/map/BluetoothMasClient.java17
-rw-r--r--src/android/bluetooth/client/map/BluetoothMasRequest.java1
-rw-r--r--src/android/bluetooth/client/map/BluetoothMasRequestGetFolderListing.java4
-rw-r--r--src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java15
6 files changed, 43 insertions, 19 deletions
diff --git a/src/android/bluetooth/client/map/BluetoothMapBmessageParser.java b/src/android/bluetooth/client/map/BluetoothMapBmessageParser.java
index fa3d817..ef75e7b 100644
--- a/src/android/bluetooth/client/map/BluetoothMapBmessageParser.java
+++ b/src/android/bluetooth/client/map/BluetoothMapBmessageParser.java
@@ -312,8 +312,16 @@ class BluetoothMapBmessageParser {
prop = mParser.next(true);
- if (prop != null && prop.equals(END_MSG)) {
- mBmsg.mMessage = new String(data, 0, messageLen);
+ if (prop != null) {
+ if (prop.equals(END_MSG)) {
+ mBmsg.mMessage = new String(data, 0, messageLen);
+ } else {
+ /* Handle possible exception for incorrect LENGTH value
+ * from MSE while parsing GET Message response */
+ Log.e(TAG, "Prop Invalid: "+ prop.toString());
+ Log.e(TAG, "Possible Invalid LENGTH value");
+ throw expected(END_MSG);
+ }
} else {
data = null;
@@ -322,6 +330,11 @@ class BluetoothMapBmessageParser {
* now we check if bMessage can be parsed if LENGTH is handled as
* number of characters instead of number of bytes
*/
+ if (offset < 0 || offset > remng.length()) {
+ /* Handle possible exception for incorrect LENGTH value
+ * from MSE while parsing GET Message response */
+ throw new ParseException("Invalid LENGTH value", mParser.pos());
+ }
Log.w(TAG, "byte LENGTH seems to be invalid, trying with char length");
diff --git a/src/android/bluetooth/client/map/BluetoothMapMessage.java b/src/android/bluetooth/client/map/BluetoothMapMessage.java
index 6c76bbe..5ce6c4b 100644
--- a/src/android/bluetooth/client/map/BluetoothMapMessage.java
+++ b/src/android/bluetooth/client/map/BluetoothMapMessage.java
@@ -91,8 +91,14 @@ public class BluetoothMapMessage {
}
mSubject = attrs.get("subject");
+ String dateTime = attrs.get("datetime");
+ //Handle possible NPE when not able to retreive datetime attribute
+ if(dateTime != null){
+ mDateTime = (new ObexTime(dateTime)).getTime();
+ } else {
+ mDateTime = null;
+ }
- mDateTime = (new ObexTime(attrs.get("datetime"))).getTime();
mSenderName = attrs.get("sender_name");
diff --git a/src/android/bluetooth/client/map/BluetoothMasClient.java b/src/android/bluetooth/client/map/BluetoothMasClient.java
index d6d2a1c..7f71693 100644
--- a/src/android/bluetooth/client/map/BluetoothMasClient.java
+++ b/src/android/bluetooth/client/map/BluetoothMasClient.java
@@ -453,13 +453,9 @@ public class BluetoothMasClient {
}
private void sendToClient(int event, boolean success, Object param) {
- if (success) {
- mCallback.obtainMessage(event, STATUS_OK, mMas.getMasInstanceId(), param)
- .sendToTarget();
- } else {
- mCallback.obtainMessage(event, STATUS_FAILED, mMas.getMasInstanceId(), null)
- .sendToTarget();
- }
+ // Send event, status and notification state for both sucess and failure case.
+ mCallback.obtainMessage(event, success ? STATUS_OK : STATUS_FAILED, mMas.getMasInstanceId(),
+ param).sendToTarget();
}
private class SocketConnectThread extends Thread {
@@ -547,8 +543,11 @@ public class BluetoothMasClient {
}
public void setPeriod(Date filterBegin, Date filterEnd) {
- periodBegin = (new ObexTime(filterBegin)).toString();
- periodEnd = (new ObexTime(filterEnd)).toString();
+ //Handle possible NPE for obexTime constructor utility
+ if(filterBegin != null )
+ periodBegin = (new ObexTime(filterBegin)).toString();
+ if(filterEnd != null)
+ periodEnd = (new ObexTime(filterEnd)).toString();
}
public void setReadStatus(byte readfilter) {
diff --git a/src/android/bluetooth/client/map/BluetoothMasRequest.java b/src/android/bluetooth/client/map/BluetoothMasRequest.java
index 658a344..0c9c29c 100644
--- a/src/android/bluetooth/client/map/BluetoothMasRequest.java
+++ b/src/android/bluetooth/client/map/BluetoothMasRequest.java
@@ -43,6 +43,7 @@ abstract class BluetoothMasRequest {
protected static final byte OAP_TAGID_NEW_MESSAGE = 0x0d;
protected static final byte OAP_TAGID_NOTIFICATION_STATUS = 0x0e;
protected static final byte OAP_TAGID_MAS_INSTANCE_ID = 0x0f;
+ protected static final byte OAP_TAGID_PARAMETER_MASK = 0x10;
protected static final byte OAP_TAGID_FOLDER_LISTING_SIZE = 0x11;
protected static final byte OAP_TAGID_MESSAGES_LISTING_SIZE = 0x12;
protected static final byte OAP_TAGID_SUBJECT_LENGTH = 0x13;
diff --git a/src/android/bluetooth/client/map/BluetoothMasRequestGetFolderListing.java b/src/android/bluetooth/client/map/BluetoothMasRequestGetFolderListing.java
index bd5a2dd..db22ada 100644
--- a/src/android/bluetooth/client/map/BluetoothMasRequestGetFolderListing.java
+++ b/src/android/bluetooth/client/map/BluetoothMasRequestGetFolderListing.java
@@ -43,8 +43,8 @@ final class BluetoothMasRequestGetFolderListing extends BluetoothMasRequest {
mHeaderSet.setHeader(HeaderSet.TYPE, TYPE);
ObexAppParameters oap = new ObexAppParameters();
-
- if (maxListCount > 0) {
+ // Allow GetFolderListing for maxListCount value 0 also.
+ if (maxListCount >= 0) {
oap.add(OAP_TAGID_MAX_LIST_COUNT, (short) maxListCount);
}
diff --git a/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java b/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java
index d5460f9..2ad167d 100644
--- a/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java
+++ b/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java
@@ -41,7 +41,6 @@ final class BluetoothMasRequestGetMessagesListing extends BluetoothMasRequest {
public BluetoothMasRequestGetMessagesListing(String folderName, int parameters,
BluetoothMasClient.MessagesFilter filter, int subjectLength, int maxListCount,
int listStartOffset) {
-
if (subjectLength < 0 || subjectLength > 255) {
throw new IllegalArgumentException("subjectLength should be [0..255]");
}
@@ -97,8 +96,14 @@ final class BluetoothMasRequestGetMessagesListing extends BluetoothMasRequest {
if (subjectLength != 0) {
oap.add(OAP_TAGID_SUBJECT_LENGTH, (byte) subjectLength);
}
-
- if (maxListCount != 0) {
+ /* Include parameterMask only when specific values are selected,
+ * to avoid IOT specific issue with no paramterMask header support.
+ */
+ if (parameters > 0 ) {
+ oap.add(OAP_TAGID_PARAMETER_MASK, parameters);
+ }
+ // Allow GetMessageListing for maxlistcount value 0 also.
+ if (maxListCount >= 0) {
oap.add(OAP_TAGID_MAX_LIST_COUNT, (short) maxListCount);
}
@@ -122,8 +127,8 @@ final class BluetoothMasRequestGetMessagesListing extends BluetoothMasRequest {
if (oap.exists(OAP_TAGID_MSE_TIME)) {
String mseTime = oap.getString(OAP_TAGID_MSE_TIME);
-
- mServerTime = (new ObexTime(mseTime)).getTime();
+ if(mseTime != null )
+ mServerTime = (new ObexTime(mseTime)).getTime();
}
}