diff options
author | Ashwini Munigala <AshwiniM@codeaurora.org> | 2014-10-30 20:16:50 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:26:33 -0700 |
commit | 6209d01db54a49618f5159cb241fbfd614c9130a (patch) | |
tree | 094a72b36b59481ead0f9373b4ca168be25b3ca7 | |
parent | c91559f3b8e2084ed6eda8d44da88cb4fdc594e5 (diff) | |
download | android_packages_apps_Bluetooth-6209d01db54a49618f5159cb241fbfd614c9130a.tar.gz android_packages_apps_Bluetooth-6209d01db54a49618f5159cb241fbfd614c9130a.tar.bz2 android_packages_apps_Bluetooth-6209d01db54a49618f5159cb241fbfd614c9130a.zip |
MAP: Fix email parseBody and SMS MNS event issue
Handle Email pushMessage complete body parsing issue
for possible multiple occurencs of END:MSG in body.
Get index for last occurence of END:MSG in BMessage
pushed through MCE .
Allow SMS/MMS MNS sendingSucess event as always local
initiated.
Change-Id: I7d56279cd42683da4d7325030df3a74cbb4c59d2
CRs-fixed: 748338
-rw-r--r-- | src/com/android/bluetooth/map/BluetoothMapContentObserver.java | 30 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/bluetooth/map/BluetoothMapbMessageMmsEmail.java | 4 |
2 files changed, 13 insertions, 21 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapContentObserver.java b/src/com/android/bluetooth/map/BluetoothMapContentObserver.java index 3186f27ee..8160809c5 100644 --- a/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +++ b/src/com/android/bluetooth/map/BluetoothMapContentObserver.java @@ -343,24 +343,16 @@ public class BluetoothMapContentObserver { Log.d(TAG, "msgHandle is "+msgHandle); location = findLocationMceInitiatedOperation(Long.toString(evt.handle)); Log.d(TAG, "location is "+location); - if(evt.eventType.equalsIgnoreCase("SendingSuccess")) { - if(location != -1) { - try { - mMnsClient.sendEvent(evt.encode(), mMasId); - } catch (UnsupportedEncodingException ex) { - Log.w(TAG, ex); - } - } else { - Log.d(TAG, "not sending success event"); - return; - } - } else if (location == -1) { - try { - Log.d(TAG, "sending mns event"); - mMnsClient.sendEvent(evt.encode(), mMasId); - } catch (UnsupportedEncodingException ex) { - Log.w(TAG, ex); - } + // 'SendingSuccess' is triggered only for MCE initiated case + if(location == -1 || evt.eventType.equalsIgnoreCase("SendingSuccess")) { + try { + mMnsClient.sendEvent(evt.encode(), mMasId); + } catch (UnsupportedEncodingException ex) { + Log.w(TAG, ex); + } + } else { + Log.d(TAG, "Not MCE initiated operation" +location); + return; } } @@ -499,7 +491,7 @@ public class BluetoothMapContentObserver { sendEvent(evt); msg.type = type; - // SendingSuccess for MMS ONLY when local initiated + // Trigger 'SendingSuccess' for MMS ONLY when local initiated int loc = findLocationMceInitiatedOperation(Long.toString(id)); if (folderMms[type].equals("sent")&& loc != -1) { evt = new Event("SendingSuccess", id, diff --git a/src/com/android/bluetooth/map/BluetoothMapbMessageMmsEmail.java b/src/com/android/bluetooth/map/BluetoothMapbMessageMmsEmail.java index 394c45991..bab40d9f8 100644..100755 --- a/src/com/android/bluetooth/map/BluetoothMapbMessageMmsEmail.java +++ b/src/com/android/bluetooth/map/BluetoothMapbMessageMmsEmail.java @@ -749,7 +749,7 @@ public class BluetoothMapbMessageMmsEmail extends BluetoothMapbMessage { if (beginMsg == -1) { throw new IllegalArgumentException("Ill-formatted bMessage, no BEGIN:MSG"); } - int endMsg = body.indexOf("END:MSG", beginMsg); + int endMsg = body.lastIndexOf("END:MSG", beginMsg); if (endMsg == -1) { throw new IllegalArgumentException("Ill-formatted bMessage, no END:MSG"); } @@ -764,7 +764,7 @@ public class BluetoothMapbMessageMmsEmail extends BluetoothMapbMessage { int endVersionPos; if(rfc822Flag == 0){ if(mimeFlag == 0) { - endVersionPos = body.indexOf("END:MSG", beginVersionPos) ; + endVersionPos = body.lastIndexOf("END:MSG", beginVersionPos) ; if (endVersionPos != -1) { setEmailBody(body.substring(beginVersionPos, (endVersionPos - CRLF.length()))); } else { |