Merge from gingerbread
Change-Id: I6b895012db6b96666dc3257b1f2e430925981188
This commit is contained in:
22
telephony/java/com/android/internal/telephony/SMSDispatcher.java
Normal file → Executable file
22
telephony/java/com/android/internal/telephony/SMSDispatcher.java
Normal file → Executable file
@@ -65,6 +65,7 @@ import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE;
|
|||||||
|
|
||||||
public abstract class SMSDispatcher extends Handler {
|
public abstract class SMSDispatcher extends Handler {
|
||||||
private static final String TAG = "SMS";
|
private static final String TAG = "SMS";
|
||||||
|
private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg";
|
||||||
|
|
||||||
/** Default checking period for SMS sent without user permit */
|
/** Default checking period for SMS sent without user permit */
|
||||||
private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000;
|
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 mStorageAvailable = true;
|
||||||
protected boolean mReportMemoryStatusPending = false;
|
protected boolean mReportMemoryStatusPending = false;
|
||||||
|
|
||||||
|
protected static int mRemainingMessages = -1;
|
||||||
|
|
||||||
protected static int getNextConcatenatedRef() {
|
protected static int getNextConcatenatedRef() {
|
||||||
sConcatenatedRef += 1;
|
sConcatenatedRef += 1;
|
||||||
return sConcatenatedRef;
|
return sConcatenatedRef;
|
||||||
@@ -469,7 +472,17 @@ public abstract class SMSDispatcher extends Handler {
|
|||||||
|
|
||||||
if (sentIntent != null) {
|
if (sentIntent != null) {
|
||||||
try {
|
try {
|
||||||
|
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);
|
sentIntent.send(Activity.RESULT_OK);
|
||||||
|
}
|
||||||
} catch (CanceledException ex) {}
|
} catch (CanceledException ex) {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -508,8 +521,15 @@ public abstract class SMSDispatcher extends Handler {
|
|||||||
if (ar.result != null) {
|
if (ar.result != null) {
|
||||||
fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode);
|
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) {}
|
} catch (CanceledException ex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,8 @@ final class GsmSMSDispatcher extends SMSDispatcher {
|
|||||||
int msgCount = parts.size();
|
int msgCount = parts.size();
|
||||||
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
|
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
|
||||||
|
|
||||||
|
mRemainingMessages = msgCount;
|
||||||
|
|
||||||
for (int i = 0; i < msgCount; i++) {
|
for (int i = 0; i < msgCount; i++) {
|
||||||
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
|
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
|
||||||
if (encoding != details.codeUnitSize
|
if (encoding != details.codeUnitSize
|
||||||
@@ -277,6 +279,8 @@ final class GsmSMSDispatcher extends SMSDispatcher {
|
|||||||
int msgCount = parts.size();
|
int msgCount = parts.size();
|
||||||
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
|
int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN;
|
||||||
|
|
||||||
|
mRemainingMessages = msgCount;
|
||||||
|
|
||||||
for (int i = 0; i < msgCount; i++) {
|
for (int i = 0; i < msgCount; i++) {
|
||||||
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
|
TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false);
|
||||||
if (encoding != details.codeUnitSize
|
if (encoding != details.codeUnitSize
|
||||||
|
|||||||
Reference in New Issue
Block a user