Rescheduling pending messages after outside window failure
No more rescheduling for pending messages after DownloadMmsAction is failed caused by outside window. Any pending download messages will be remained as the DOWNLOADING state without actual downloading operations and sending a DEFERRED M-NotifyResp.ind even. It will reschedule pending messages whenever sending or downloading is failed including outside window failure case. And it also removes dup scheduling and fix some typo. Test: Manual Change-Id: Ie37088347c69f25d838875830fc65ce7727fefe6 Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
@@ -83,7 +83,7 @@ public class ProcessDownloadedMmsAction extends Action {
|
||||
// Set when message downloaded by us (legacy)
|
||||
private static final String KEY_STATUS = "status";
|
||||
private static final String KEY_RAW_STATUS = "raw_status";
|
||||
private static final String KEY_MMS_URI = "mms_uri";
|
||||
private static final String KEY_MMS_URI = "mms_uri";
|
||||
|
||||
// Used to send a deferred response in response to auto-download failure
|
||||
private static final String KEY_SEND_DEFERRED_RESP_STATUS = "send_deferred_resp_status";
|
||||
@@ -329,6 +329,8 @@ public class ProcessDownloadedMmsAction extends Action {
|
||||
if (response == null) {
|
||||
// No message download to process; doBackgroundWork sent a notify deferred response
|
||||
Assert.isTrue(actionParameters.getBoolean(KEY_SEND_DEFERRED_RESP_STATUS));
|
||||
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(
|
||||
true /* failed */, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -343,7 +345,9 @@ public class ProcessDownloadedMmsAction extends Action {
|
||||
|
||||
final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
// If we were trying to auto-download but have failed need to send the deferred response
|
||||
if (autoDownload && message == null && status == MmsUtils.MMS_REQUEST_MANUAL_RETRY) {
|
||||
final boolean needToSendDeferredResp =
|
||||
autoDownload && (status == MmsUtils.MMS_REQUEST_MANUAL_RETRY);
|
||||
if (needToSendDeferredResp) {
|
||||
final String transactionId = actionParameters.getString(KEY_TRANSACTION_ID);
|
||||
final String contentLocation = actionParameters.getString(KEY_CONTENT_LOCATION);
|
||||
sendDeferredRespStatus(messageId, transactionId, contentLocation, subId);
|
||||
@@ -373,7 +377,11 @@ public class ProcessDownloadedMmsAction extends Action {
|
||||
}
|
||||
|
||||
final boolean failed = (messageUri == null);
|
||||
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(failed, this);
|
||||
// Scheduling pending messages. If auto downloading is failed and it needs to send the
|
||||
// deferred response, Skip it here and it will be scheduled after sending the response.
|
||||
if (!needToSendDeferredResp) {
|
||||
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(failed, this);
|
||||
}
|
||||
if (failed) {
|
||||
BugleNotifications.update(false, BugleNotifications.UPDATE_ERRORS);
|
||||
}
|
||||
|
||||
@@ -301,12 +301,16 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
|
||||
unregister(subId);
|
||||
|
||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
||||
queueActions(this);
|
||||
if (!queueActions(this)) {
|
||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: rescheduling");
|
||||
// TODO: Need to clear retry count here?
|
||||
scheduleProcessPendingMessagesAction(true /* failed */, this);
|
||||
}
|
||||
} else {
|
||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: Not default SMS app; rescheduling");
|
||||
}
|
||||
scheduleProcessPendingMessagesAction(true, this);
|
||||
scheduleProcessPendingMessagesAction(true /* failed */, this);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -207,6 +207,8 @@ public class ProcessSentMessageAction extends Action {
|
||||
if (message == null) {
|
||||
LogUtil.w(TAG, "ProcessSentMessageAction: Sent message " + messageId
|
||||
+ " missing from local database");
|
||||
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(
|
||||
true /* failed */, processingAction);
|
||||
return;
|
||||
}
|
||||
final String conversationId = message.getConversationId();
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.ArrayList;
|
||||
* Action used to send an outgoing message. It writes MMS messages to the telephony db
|
||||
* ({@link InsertNewMessageAction}) writes SMS messages to the telephony db). It also
|
||||
* initiates the actual sending. It will all be used for re-sending a failed message.
|
||||
* NOTE: This action must queue a ProcessPendingMessagesAction when it is done (success or failure).
|
||||
* <p>
|
||||
* This class is public (not package-private) because the SMS/MMS (e.g. MmsUtils) classes need to
|
||||
* access the EXTRA_* fields for setting up the 'sent' pending intent.
|
||||
@@ -294,9 +293,6 @@ public class SendMessageAction extends Action implements Parcelable {
|
||||
MmsUtils.MMS_REQUEST_MANUAL_RETRY, MessageData.RAW_TELEPHONY_STATUS_UNDEFINED,
|
||||
isSms, this, subId, resultCode, httpStatusCode);
|
||||
|
||||
// Whether we succeeded or failed we will check and maybe schedule some more work
|
||||
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(true, this);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user