Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Set local time as timestamp when MMS has been downloaded
Browse files Browse the repository at this point in the history
Previously, the timestamp of notifications was the current local time,
but as soon as the MMS was downloaded it got the timestamp from the
PDU. This could cause problems if timezones weren't set correctly etc.
Now a downloaded MMS will always get the current local time as its
timestamp, regardless of when it was first received.
  • Loading branch information
Matthias Thomae committed Jun 1, 2011
1 parent 8ad8c48 commit 69481af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/com/android/mms/transaction/NotificationTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.google.android.mms.pdu.PduPersister;
import android.database.sqlite.SqliteWrapper;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
Expand Down Expand Up @@ -172,6 +173,13 @@ public void run() {
// Save the received PDU (must be a M-RETRIEVE.CONF).
PduPersister p = PduPersister.getPduPersister(mContext);
Uri uri = p.persist(pdu, Inbox.CONTENT_URI);

// Use local time instead of PDU time
ContentValues values = new ContentValues(1);
values.put(Mms.DATE, System.currentTimeMillis() / 1000L);
SqliteWrapper.update(mContext, mContext.getContentResolver(),
uri, values, null, null);

// We have successfully downloaded the new MM. Delete the
// M-NotifyResp.ind from Inbox.
SqliteWrapper.delete(mContext, mContext.getContentResolver(),
Expand Down
6 changes: 6 additions & 0 deletions src/com/android/mms/transaction/RetrieveTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ public void run() {
PduPersister persister = PduPersister.getPduPersister(mContext);
msgUri = persister.persist(retrieveConf, Inbox.CONTENT_URI);

// Use local time instead of PDU time
ContentValues values = new ContentValues(1);
values.put(Mms.DATE, System.currentTimeMillis() / 1000L);
SqliteWrapper.update(mContext, mContext.getContentResolver(),
msgUri, values, null, null);

// The M-Retrieve.conf has been successfully downloaded.
mTransactionState.setState(TransactionState.SUCCESS);
mTransactionState.setContentUri(msgUri);
Expand Down

0 comments on commit 69481af

Please sign in to comment.