Fix wrong sync message issue for pending outgoing messages am: bccecb6393 am: 6af3221619
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Messaging/+/1547734
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I21fb2baa06e6f91804ab9b8610334d87f747a67e
diff --git a/src/com/android/messaging/datamodel/action/ResendMessageAction.java b/src/com/android/messaging/datamodel/action/ResendMessageAction.java
index 0943f72..b442ae6 100644
--- a/src/com/android/messaging/datamodel/action/ResendMessageAction.java
+++ b/src/com/android/messaging/datamodel/action/ResendMessageAction.java
@@ -80,8 +80,6 @@
final ContentValues values = new ContentValues();
values.put(MessageColumns.STATUS, MessageData.BUGLE_STATUS_OUTGOING_YET_TO_SEND);
- values.put(MessageColumns.RECEIVED_TIMESTAMP, timestamp);
- values.put(MessageColumns.SENT_TIMESTAMP, timestamp);
values.put(MessageColumns.RETRY_START_TIMESTAMP, timestamp);
// Row must exist as was just loaded above (on ActionService thread)
diff --git a/src/com/android/messaging/datamodel/action/SendMessageAction.java b/src/com/android/messaging/datamodel/action/SendMessageAction.java
index 35e6280..44c661d 100644
--- a/src/com/android/messaging/datamodel/action/SendMessageAction.java
+++ b/src/com/android/messaging/datamodel/action/SendMessageAction.java
@@ -95,13 +95,17 @@
private boolean queueAction(final String messageId, final Action processingAction) {
actionParameters.putString(KEY_MESSAGE_ID, messageId);
- final long timestamp = System.currentTimeMillis();
final DatabaseWrapper db = DataModel.get().getDatabase();
final MessageData message = BugleDatabaseOperations.readMessage(db, messageId);
// Check message can be resent
if (message != null && message.canSendMessage()) {
- final boolean isSms = (message.getProtocol() == MessageData.PROTOCOL_SMS);
+ final boolean isSms = message.getIsSms();
+ long timestamp = System.currentTimeMillis();
+ if (!isSms) {
+ // MMS expects timestamp rounded to nearest second
+ timestamp = 1000 * ((timestamp + 500) / 1000);
+ }
final ParticipantData self = BugleDatabaseOperations.getExistingParticipant(
db, message.getSelfId());
@@ -110,8 +114,13 @@
// Update message status
if (message.getYetToSend()) {
- // Initial sending of message
- message.markMessageSending(timestamp);
+ if (message.getReceivedTimeStamp() == message.getRetryStartTimestamp()) {
+ // Initial sending of message
+ message.markMessageSending(timestamp);
+ } else {
+ // Manual resend of message
+ message.markMessageManualResend(timestamp);
+ }
} else {
// Automatic resend of message
message.markMessageResending(timestamp);