summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorChristian Gustafsson <christian.gustafsson@motorola.com>2009-09-13 20:59:47 -0500
committerWink Saville <wink@google.com>2009-09-15 10:57:15 -0700
commit70f74b79c3e4c88e0e7b747796f76187e4ea8259 (patch)
tree71c11afb2a675efe8f5a11be8539f7ada3957037 /telephony
parent04b2868c74a54cf711552262f0ad20d234b627b4 (diff)
downloadframeworks_base-70f74b79c3e4c88e0e7b747796f76187e4ea8259.zip
frameworks_base-70f74b79c3e4c88e0e7b747796f76187e4ea8259.tar.gz
frameworks_base-70f74b79c3e4c88e0e7b747796f76187e4ea8259.tar.bz2
Assemble WAP datagram correctly when segments arrive out of order
The WAP assembly code will always attach the last received segment at the end of the WAP datagram. Change the code to add the current segment at the correct location during the WAP datagram assembly. Change-Id: I4cc18bf33bc68ab9a328a0107f21e3670b5026ac
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index 623d985..386dc3d46 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -299,14 +299,16 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
// Build up the data stream
ByteArrayOutputStream output = new ByteArrayOutputStream();
- for (int i = 0; i < totalSegments-1; i++) {
+ for (int i = 0; i < totalSegments; i++) {
// reassemble the (WSP-)pdu
- output.write(pdus[i], 0, pdus[i].length);
+ if (i == segment) {
+ // This one isn't in the DB, so add it
+ output.write(pdu, index, pdu.length - index);
+ } else {
+ output.write(pdus[i], 0, pdus[i].length);
+ }
}
- // This one isn't in the DB, so add it
- output.write(pdu, index, pdu.length - index);
-
byte[] datagram = output.toByteArray();
// Dispatch the PDU to applications
switch (destinationPort) {