Apply new duplication detection logic for M-Notification.ind am: 77a839f1ef

am: cf5dcfef5a

Change-Id: I66f05f83a35c54e35488d86f44e2286a52abca68
This commit is contained in:
Taesu Lee
2019-06-21 12:22:24 -07:00
committed by android-build-merger
4 changed files with 43 additions and 59 deletions
@@ -82,6 +82,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
private static final String KEY_SUB_PHONE_NUMBER = "sub_phone_number";
private static final String KEY_AUTO_DOWNLOAD = "auto_download";
private static final String KEY_FAILURE_STATUS = "failure_status";
private static final String KEY_EXPIRY = "expiry";
// Values we attach to the pending intent that's fired when the message is downloaded.
// Only applicable when downloading via the platform APIs on L+.
@@ -97,6 +98,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
public static final String EXTRA_CONVERSATION_ID = "conversation_id";
public static final String EXTRA_PARTICIPANT_ID = "participant_id";
public static final String EXTRA_STATUS_IF_FAILED = "status_if_failed";
public static final String EXTRA_EXPIRY = "expiry";
private DownloadMmsAction() {
super();
@@ -130,6 +132,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
actionParameters.putString(KEY_TRANSACTION_ID, message.getMmsTransactionId());
actionParameters.putParcelable(KEY_NOTIFICATION_URI, notificationUri);
actionParameters.putBoolean(KEY_AUTO_DOWNLOAD, isAutoDownload(status));
actionParameters.putLong(KEY_EXPIRY, message.getMmsExpiry());
final long now = System.currentTimeMillis();
if (message.getInDownloadWindow(now)) {
@@ -239,6 +242,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID);
final String participantId = actionParameters.getString(KEY_PARTICIPANT_ID);
final int statusIfFailed = actionParameters.getInt(KEY_FAILURE_STATUS);
final long expiry = actionParameters.getLong(KEY_EXPIRY);
final long receivedTimestampRoundedToSecond =
1000 * ((System.currentTimeMillis() + 500) / 1000);
@@ -256,7 +260,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
// Start the download
final MmsUtils.StatusPlusUri status = MmsUtils.downloadMmsMessage(context,
notificationUri, subId, subPhoneNumber, transactionId, contentLocation,
autoDownload, receivedTimestampRoundedToSecond / 1000L, extras);
autoDownload, receivedTimestampRoundedToSecond / 1000L, expiry / 1000L, extras);
if (status == MmsUtils.STATUS_PENDING) {
// Async download; no status yet
if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
@@ -78,6 +78,7 @@ public class ProcessDownloadedMmsAction extends Action {
private static final String KEY_CONTENT_LOCATION = "content_location";
private static final String KEY_AUTO_DOWNLOAD = "auto_download";
private static final String KEY_RECEIVED_TIMESTAMP = "received_timestamp";
private static final String KEY_EXPIRY = "expiry";
// Set when message downloaded by us (legacy)
private static final String KEY_STATUS = "status";
@@ -130,6 +131,7 @@ public class ProcessDownloadedMmsAction extends Action {
params.putString(KEY_PARTICIPANT_ID, participantId);
params.putInt(KEY_STATUS_IF_FAILED,
extras.getInt(DownloadMmsAction.EXTRA_STATUS_IF_FAILED));
params.putLong(KEY_EXPIRY, extras.getLong(DownloadMmsAction.EXTRA_EXPIRY));
action.start();
}
@@ -279,6 +281,7 @@ public class ProcessDownloadedMmsAction extends Action {
KEY_AUTO_DOWNLOAD);
final long receivedTimestampInSeconds =
actionParameters.getLong(KEY_RECEIVED_TIMESTAMP);
final long expiry = actionParameters.getLong(KEY_EXPIRY);
// Inform sync we're adding a message to telephony
final SyncManager syncManager = DataModel.get().getSyncManager();
@@ -288,7 +291,7 @@ public class ProcessDownloadedMmsAction extends Action {
MmsUtils.insertDownloadedMessageAndSendResponse(context,
notificationUri, subId, subPhoneNumber, transactionId,
contentLocation, autoDownload, receivedTimestampInSeconds,
retrieveConf);
expiry, retrieveConf);
status = result.status;
rawStatus = result.rawStatus;
mmsUri = result.uri;
@@ -540,6 +540,10 @@ public class MessageData implements Parcelable {
return mSeen;
}
public final long getMmsExpiry() {
return mMmsExpiry;
}
/**
* For incoming MMS messages this returns the retrieve-status value
* For sent MMS messages this returns the response-status value