Changed the IEmailService interface to accept and accountId in
the loadAttachment() call. This work was necessary to support the new EasService & EasOperation infrastructure. Change-Id: Idd507aec999596ccd4afa5f03ff2b3c2e38a9029 (cherry picked from commit efac8255ed75d22e60036e19e7a95f8407d18ad3)
This commit is contained in:
parent
701134953e
commit
70cb2878d7
@ -108,19 +108,20 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService {
|
||||
* possible.
|
||||
*
|
||||
* @param cb The {@link IEmailServiceCallback} to use for this operation.
|
||||
* @param accountId the id of the account in question
|
||||
* @param attachmentId the id of the attachment record
|
||||
* @param background whether or not this request corresponds to a background action (i.e.
|
||||
* prefetch) vs a foreground action (user request)
|
||||
*/
|
||||
@Override
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long attachmentId,
|
||||
final boolean background)
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long accountId,
|
||||
final long attachmentId, final boolean background)
|
||||
throws RemoteException {
|
||||
setTask(new ProxyTask() {
|
||||
@Override
|
||||
public void run() throws RemoteException {
|
||||
try {
|
||||
mService.loadAttachment(cb, attachmentId, background);
|
||||
mService.loadAttachment(cb, accountId, attachmentId, background);
|
||||
} catch (RemoteException e) {
|
||||
try {
|
||||
// Try to send a callback (if set)
|
||||
|
@ -27,7 +27,8 @@ interface IEmailService {
|
||||
// Core email operations.
|
||||
// TODO: is sendMail really necessary, or should we standardize on sync(outbox)?
|
||||
void sendMail(long accountId);
|
||||
oneway void loadAttachment(IEmailServiceCallback cb, long attachmentId, boolean background);
|
||||
oneway void loadAttachment(IEmailServiceCallback cb, long accountId, long attachmentId,
|
||||
boolean background);
|
||||
oneway void updateFolderList(long accountId);
|
||||
|
||||
// Push-related functionality.
|
||||
|
@ -539,7 +539,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
|
||||
req.startTime = System.currentTimeMillis();
|
||||
req.inProgress = true;
|
||||
mDownloadsInProgress.put(req.attachmentId, req);
|
||||
service.loadAttachment(mServiceCallback, req.attachmentId,
|
||||
service.loadAttachment(mServiceCallback, req.accountId, req.attachmentId,
|
||||
req.priority != PRIORITY_FOREGROUND);
|
||||
setWatchdogAlarm();
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long attachmentId,
|
||||
final boolean background) throws RemoteException {
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long accountId,
|
||||
final long attachmentId, final boolean background) throws RemoteException {
|
||||
Folder remoteFolder = null;
|
||||
try {
|
||||
//1. Check if the attachment is already here and return early in that case
|
||||
|
@ -660,8 +660,8 @@ public class EmailServiceUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long attachmentId,
|
||||
final boolean background) throws RemoteException {
|
||||
public void loadAttachment(final IEmailServiceCallback cb, final long accountId,
|
||||
final long attachmentId, final boolean background) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,8 +76,8 @@ public class Pop3Service extends Service {
|
||||
*/
|
||||
private final EmailServiceStub mBinder = new EmailServiceStub() {
|
||||
@Override
|
||||
public void loadAttachment(final IEmailServiceCallback callback, final long attachmentId,
|
||||
final boolean background) throws RemoteException {
|
||||
public void loadAttachment(final IEmailServiceCallback callback, final long accountId,
|
||||
final long attachmentId, final boolean background) throws RemoteException {
|
||||
Attachment att = Attachment.restoreAttachmentWithId(mContext, attachmentId);
|
||||
if (att == null || att.mUiState != AttachmentState.DOWNLOADING) return;
|
||||
long inboxId = Mailbox.findMailboxOfType(mContext, att.mAccountKey, Mailbox.TYPE_INBOX);
|
||||
|
Loading…
Reference in New Issue
Block a user