am 8444023f: Merge from open-source gingerbread

* commit '8444023f351b22816f6827d3314ff81b3533e3d9':
  Fix the Multi-page SMS sending error to several receipents
This commit is contained in:
Jean-Baptiste Queru
2011-02-03 14:09:34 -08:00
committed by Android Git Automerger
2 changed files with 26 additions and 2 deletions

View File

@@ -65,6 +65,7 @@ import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE;
public abstract class SMSDispatcher extends Handler {
private static final String TAG = "SMS";
private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg";
/** Default checking period for SMS sent without user permit */
private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000;
@@ -156,6 +157,8 @@ public abstract class SMSDispatcher extends Handler {
protected boolean mStorageAvailable = true;
protected boolean mReportMemoryStatusPending = false;
protected static int mRemainingMessages = -1;
protected static int getNextConcatenatedRef() {
sConcatenatedRef += 1;
return sConcatenatedRef;
@@ -469,7 +472,17 @@ public abstract class SMSDispatcher extends Handler {
if (sentIntent != null) {
try {
sentIntent.send(Activity.RESULT_OK);
if (mRemainingMessages > -1) {
mRemainingMessages--;
}
if (mRemainingMessages == 0) {
Intent sendNext = new Intent();
sendNext.putExtra(SEND_NEXT_MSG_EXTRA, true);
sentIntent.send(mContext, Activity.RESULT_OK, sendNext);
} else {
sentIntent.send(Activity.RESULT_OK);
}
} catch (CanceledException ex) {}
}
} else {
@@ -508,8 +521,15 @@ public abstract class SMSDispatcher extends Handler {
if (ar.result != null) {
fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode);
}
tracker.mSentIntent.send(mContext, error, fillIn);
if (mRemainingMessages > -1) {
mRemainingMessages--;
}
if (mRemainingMessages == 0) {
fillIn.putExtra(SEND_NEXT_MSG_EXTRA, true);
}
tracker.mSentIntent.send(mContext, error, fillIn);
} catch (CanceledException ex) {}
}
}

View File

@@ -188,6 +188,8 @@ final class GsmSMSDispatcher extends SMSDispatcher {
int msgCount = parts.size();
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
mRemainingMessages = msgCount;
for (int i = 0; i < msgCount; i++) {
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
if (encoding != details.codeUnitSize
@@ -277,6 +279,8 @@ final class GsmSMSDispatcher extends SMSDispatcher {
int msgCount = parts.size();
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
mRemainingMessages = msgCount;
for (int i = 0; i < msgCount; i++) {
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
if (encoding != details.codeUnitSize