Rescheduling pending messages after outside window failure am: 0ff700cea4
Change-Id: I84881b6b958ea11fc42c2e8c6b21d0b29b8fef64
This commit is contained in:
@@ -83,7 +83,7 @@ public class ProcessDownloadedMmsAction extends Action {
|
|||||||
// Set when message downloaded by us (legacy)
|
// Set when message downloaded by us (legacy)
|
||||||
private static final String KEY_STATUS = "status";
|
private static final String KEY_STATUS = "status";
|
||||||
private static final String KEY_RAW_STATUS = "raw_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
|
// 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";
|
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) {
|
if (response == null) {
|
||||||
// No message download to process; doBackgroundWork sent a notify deferred response
|
// No message download to process; doBackgroundWork sent a notify deferred response
|
||||||
Assert.isTrue(actionParameters.getBoolean(KEY_SEND_DEFERRED_RESP_STATUS));
|
Assert.isTrue(actionParameters.getBoolean(KEY_SEND_DEFERRED_RESP_STATUS));
|
||||||
|
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(
|
||||||
|
true /* failed */, this);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +345,9 @@ public class ProcessDownloadedMmsAction extends Action {
|
|||||||
|
|
||||||
final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID);
|
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 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 transactionId = actionParameters.getString(KEY_TRANSACTION_ID);
|
||||||
final String contentLocation = actionParameters.getString(KEY_CONTENT_LOCATION);
|
final String contentLocation = actionParameters.getString(KEY_CONTENT_LOCATION);
|
||||||
sendDeferredRespStatus(messageId, transactionId, contentLocation, subId);
|
sendDeferredRespStatus(messageId, transactionId, contentLocation, subId);
|
||||||
@@ -373,7 +377,11 @@ public class ProcessDownloadedMmsAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean failed = (messageUri == null);
|
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) {
|
if (failed) {
|
||||||
BugleNotifications.update(false, BugleNotifications.UPDATE_ERRORS);
|
BugleNotifications.update(false, BugleNotifications.UPDATE_ERRORS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,12 +301,16 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
|
|||||||
unregister(subId);
|
unregister(subId);
|
||||||
|
|
||||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
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 {
|
} else {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: Not default SMS app; rescheduling");
|
LogUtil.v(TAG, "ProcessPendingMessagesAction: Not default SMS app; rescheduling");
|
||||||
}
|
}
|
||||||
scheduleProcessPendingMessagesAction(true, this);
|
scheduleProcessPendingMessagesAction(true /* failed */, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -207,6 +207,8 @@ public class ProcessSentMessageAction extends Action {
|
|||||||
if (message == null) {
|
if (message == null) {
|
||||||
LogUtil.w(TAG, "ProcessSentMessageAction: Sent message " + messageId
|
LogUtil.w(TAG, "ProcessSentMessageAction: Sent message " + messageId
|
||||||
+ " missing from local database");
|
+ " missing from local database");
|
||||||
|
ProcessPendingMessagesAction.scheduleProcessPendingMessagesAction(
|
||||||
|
true /* failed */, processingAction);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String conversationId = message.getConversationId();
|
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
|
* 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
|
* ({@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.
|
* 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>
|
* <p>
|
||||||
* This class is public (not package-private) because the SMS/MMS (e.g. MmsUtils) classes need to
|
* 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.
|
* 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,
|
MmsUtils.MMS_REQUEST_MANUAL_RETRY, MessageData.RAW_TELEPHONY_STATUS_UNDEFINED,
|
||||||
isSms, this, subId, resultCode, httpStatusCode);
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ public class MessageData implements Parcelable {
|
|||||||
// primary user.
|
// primary user.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Should show option for manual download iff status is manual download or failed
|
// Should show option for manual download if status is manual download or failed
|
||||||
return (status == BUGLE_STATUS_INCOMING_DOWNLOAD_FAILED ||
|
return (status == BUGLE_STATUS_INCOMING_DOWNLOAD_FAILED ||
|
||||||
status == BUGLE_STATUS_INCOMING_YET_TO_MANUAL_DOWNLOAD ||
|
status == BUGLE_STATUS_INCOMING_YET_TO_MANUAL_DOWNLOAD ||
|
||||||
// If debug is enabled, allow to download an expired or unavailable message.
|
// If debug is enabled, allow to download an expired or unavailable message.
|
||||||
@@ -596,7 +596,7 @@ public class MessageData implements Parcelable {
|
|||||||
// primary user.
|
// primary user.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Can download iff status is retrying auto/manual downloading
|
// Can download if status is retrying auto/manual downloading
|
||||||
return (mStatus == BUGLE_STATUS_INCOMING_RETRYING_MANUAL_DOWNLOAD ||
|
return (mStatus == BUGLE_STATUS_INCOMING_RETRYING_MANUAL_DOWNLOAD ||
|
||||||
mStatus == BUGLE_STATUS_INCOMING_RETRYING_AUTO_DOWNLOAD);
|
mStatus == BUGLE_STATUS_INCOMING_RETRYING_AUTO_DOWNLOAD);
|
||||||
}
|
}
|
||||||
@@ -607,7 +607,7 @@ public class MessageData implements Parcelable {
|
|||||||
// primary user.
|
// primary user.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Can redownload iff status is manual download not started or download failed
|
// Can redownload if status is manual download not started or download failed
|
||||||
return (mStatus == BUGLE_STATUS_INCOMING_DOWNLOAD_FAILED ||
|
return (mStatus == BUGLE_STATUS_INCOMING_DOWNLOAD_FAILED ||
|
||||||
mStatus == BUGLE_STATUS_INCOMING_YET_TO_MANUAL_DOWNLOAD ||
|
mStatus == BUGLE_STATUS_INCOMING_YET_TO_MANUAL_DOWNLOAD ||
|
||||||
// If debug is enabled, allow to download an expired or unavailable message.
|
// If debug is enabled, allow to download an expired or unavailable message.
|
||||||
@@ -616,12 +616,12 @@ public class MessageData implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean getShowResendMessage(final int status) {
|
static boolean getShowResendMessage(final int status) {
|
||||||
// Should show option to resend iff status is failed
|
// Should show option to resend if status is failed
|
||||||
return (status == BUGLE_STATUS_OUTGOING_FAILED);
|
return (status == BUGLE_STATUS_OUTGOING_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean getOneClickResendMessage(final int status, final int rawStatus) {
|
static boolean getOneClickResendMessage(final int status, final int rawStatus) {
|
||||||
// Should show option to resend iff status is failed
|
// Should show option to resend if status is failed
|
||||||
return (status == BUGLE_STATUS_OUTGOING_FAILED
|
return (status == BUGLE_STATUS_OUTGOING_FAILED
|
||||||
&& rawStatus == RAW_TELEPHONY_STATUS_UNDEFINED);
|
&& rawStatus == RAW_TELEPHONY_STATUS_UNDEFINED);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user