am 70f74b79: Assemble WAP datagram correctly when segments arrive out of order

Merge commit '70f74b79c3e4c88e0e7b747796f76187e4ea8259' into eclair-plus-aosp

* commit '70f74b79c3e4c88e0e7b747796f76187e4ea8259':
  Assemble WAP datagram correctly when segments arrive out of order
This commit is contained in:
Christian Gustafsson
2009-09-15 11:05:23 -07:00
committed by Android Git Automerger

View File

@@ -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) {