From d715e17b2876a7420a88ae6c90526aecea7f233f Mon Sep 17 00:00:00 2001 From: Yu Ping Hu Date: Wed, 29 Jan 2014 15:24:06 -0800 Subject: [PATCH] Delete unused functions from IEmailService.aidl. Change-Id: I131d2d3436a50c94d664fc57c6514481d9afbc97 Conflicts: src/com/android/email/service/ImapService.java --- .../service/EmailServiceProxy.java | 136 ------------------ .../emailcommon/service/IEmailService.aidl | 45 ++---- .../email/service/EmailServiceStub.java | 100 +------------ .../email/service/EmailServiceUtils.java | 47 ------ .../android/email/service/ImapService.java | 20 --- .../android/email/service/Pop3Service.java | 14 +- 6 files changed, 17 insertions(+), 345 deletions(-) diff --git a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java index f2173c327..706e459d1 100644 --- a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java +++ b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java @@ -22,11 +22,9 @@ import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; -import com.android.emailcommon.Api; import com.android.emailcommon.Device; import com.android.emailcommon.TempDirectory; import com.android.emailcommon.mail.MessagingException; -import com.android.emailcommon.provider.Account; import com.android.emailcommon.provider.HostAuth; import com.android.emailcommon.provider.Policy; import com.android.mail.utils.LogUtils; @@ -103,11 +101,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { return isRemote; } - @Override - public int getApiLevel() { - return Api.LEVEL; - } - /** * Request an attachment to be loaded; the service MUST give higher priority to * non-background loading. The service MUST use the loadAttachmentStatus callback when @@ -142,45 +135,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { }, "loadAttachment"); } - /** - * Request the sync of a mailbox; the service MUST send the syncMailboxStatus callback - * indicating "starting" and "finished" (or error), regardless of whether the mailbox is - * actually syncable. - * TODO: Remove this from IEmailService in favor of ContentResolver.requestSync. - * - * @param mailboxId the id of the mailbox record - * @param userRequest whether or not the user specifically asked for the sync - * @param deltaMessageCount amount by which to change the number of messages synced. - */ - @Deprecated - @Override - public void startSync(final long mailboxId, final boolean userRequest, - final int deltaMessageCount) throws RemoteException { - setTask(new ProxyTask() { - @Override - public void run() throws RemoteException { - mService.startSync(mailboxId, userRequest, deltaMessageCount); - } - }, "startSync"); - } - - /** - * Request the immediate termination of a mailbox sync. Although the service is not required to - * acknowledge this request, it MUST send a "finished" (or error) syncMailboxStatus callback if - * the sync was started via the startSync service call. - * - * @param mailboxId the id of the mailbox record - */ - @Override - public void stopSync(final long mailboxId) throws RemoteException { - setTask(new ProxyTask() { - @Override - public void run() throws RemoteException { - mService.stopSync(mailboxId); - } - }, "stopSync"); - } - /** * Validate a user account, given a protocol, host address, port, ssl status, and credentials. * The result of this call is returned in a Bundle which MUST include a result code and MAY @@ -275,23 +229,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { }, "setLogging"); } - /** - * Alert the sync adapter that the account's host information has (or may have) changed; the - * service MUST stop all in-process or pending syncs, clear error states related to the - * account and its mailboxes, and restart necessary sync adapters (e.g. pushed mailboxes) - * - * @param accountId the id of the account whose host information has changed - */ - @Override - public void hostChanged(final long accountId) throws RemoteException { - setTask(new ProxyTask() { - @Override - public void run() throws RemoteException { - mService.hostChanged(accountId); - } - }, "hostChanged"); - } - /** * Send a meeting response for the specified message * @@ -309,56 +246,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { }, "sendMeetingResponse"); } - /** - * Request the sync adapter to load a complete message - * - * @param messageId the id of the message to be loaded - */ - @Override - public void loadMore(final long messageId) throws RemoteException { - setTask(new ProxyTask() { - @Override - public void run() throws RemoteException { - mService.loadMore(messageId); - } - }, "startSync"); - } - - /** - * Not yet used - * - * @param accountId the account in which the folder is to be created - * @param name the name of the folder to be created - */ - @Override - public boolean createFolder(long accountId, String name) throws RemoteException { - return false; - } - - /** - * Not yet used - * - * @param accountId the account in which the folder resides - * @param name the name of the folder to be deleted - */ - @Override - public boolean deleteFolder(long accountId, String name) throws RemoteException { - return false; - } - - /** - * Not yet used - * - * @param accountId the account in which the folder resides - * @param oldName the name of the existing folder - * @param newName the new name for the folder - */ - @Override - public boolean renameFolder(long accountId, String oldName, String newName) - throws RemoteException { - return false; - } - /** * Request the service to delete the account's PIM (personal information management) data. This * data includes any data that is 1) associated with the account and 2) created/stored by the @@ -423,29 +310,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { }, "sendMail"); } - @Deprecated - @Override - public int getCapabilities(final Account acct) throws RemoteException { - //This function should not be used; see {@link EmailProvider#getCapabilities} instead. - return 0; - } - /** - * Request that the account be updated for this service; this call is synchronous - * - * @param emailAddress the email address of the account to be updated - */ - @Override - public void serviceUpdated(final String emailAddress) throws RemoteException { - setTask(new ProxyTask() { - @Override - public void run() throws RemoteException{ - mService.serviceUpdated(emailAddress); - } - }, "settingsUpdate"); - waitForCompletion(); - } - - @Override public IBinder asBinder() { return null; diff --git a/emailcommon/src/com/android/emailcommon/service/IEmailService.aidl b/emailcommon/src/com/android/emailcommon/service/IEmailService.aidl index 74a55e58e..d8f550bd3 100644 --- a/emailcommon/src/com/android/emailcommon/service/IEmailService.aidl +++ b/emailcommon/src/com/android/emailcommon/service/IEmailService.aidl @@ -24,42 +24,25 @@ import com.android.emailcommon.service.SearchParams; import android.os.Bundle; interface IEmailService { - Bundle validate(in HostAuth hostauth); - - oneway void startSync(long mailboxId, boolean userRequest, int deltaMessageCount); - oneway void stopSync(long mailboxId); - - // TODO: loadMore appears to be unused; if so, delete it. - oneway void loadMore(long messageId); + // 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 updateFolderList(long accountId); - boolean createFolder(long accountId, String name); - boolean deleteFolder(long accountId, String name); - boolean renameFolder(long accountId, String oldName, String newName); - - oneway void setLogging(int on); - - oneway void hostChanged(long accountId); - - Bundle autoDiscover(String userName, String password); - - oneway void sendMeetingResponse(long messageId, int response); - - // Must not be oneway; unless an exception is thrown, the caller is guaranteed that the action - // has been completed - void deleteAccountPIMData(String emailAddress); - - int getApiLevel(); - - // API level 2 + // Other email operations. + Bundle validate(in HostAuth hostauth); int searchMessages(long accountId, in SearchParams params, long destMailboxId); - void sendMail(long accountId); + // PIM functionality (not strictly EAS specific). + oneway void sendMeetingResponse(long messageId, int response); - // API level 3 - int getCapabilities(in Account acct); + // Specific to EAS protocol. + Bundle autoDiscover(String userName, String password); - void serviceUpdated(String emailAddress); + // Service control operations (i.e. does not generate a client-server message). + oneway void setLogging(int on); + + // Needs to get moved into Email since this is NOT a client-server command. + void deleteAccountPIMData(String emailAddress); } diff --git a/src/com/android/email/service/EmailServiceStub.java b/src/com/android/email/service/EmailServiceStub.java index 3943cf948..215d553a0 100644 --- a/src/com/android/email/service/EmailServiceStub.java +++ b/src/com/android/email/service/EmailServiceStub.java @@ -24,16 +24,13 @@ import android.net.TrafficStats; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; -import android.text.TextUtils; import com.android.email.NotificationController; import com.android.email.mail.Sender; import com.android.email.mail.Store; import com.android.email.provider.AccountReconciler; -import com.android.email.provider.Utilities; import com.android.email.service.EmailServiceUtils.EmailServiceInfo; import com.android.email2.ui.MailActivityEmail; -import com.android.emailcommon.Api; import com.android.emailcommon.Logging; import com.android.emailcommon.TrafficFlags; import com.android.emailcommon.internet.MimeBodyPart; @@ -63,7 +60,6 @@ import com.android.emailcommon.service.SearchParams; import com.android.emailcommon.utility.AttachmentUtilities; import com.android.emailcommon.utility.Utility; import com.android.mail.providers.UIProvider; -import com.android.mail.providers.UIProvider.DraftType; import com.android.mail.utils.LogUtils; import java.util.HashSet; @@ -99,10 +95,7 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm return null; } - @Deprecated - @Override - public void startSync(long mailboxId, boolean userRequest, int deltaMessageCount) - throws RemoteException { + protected void requestSync(long mailboxId, boolean userRequest, int deltaMessageCount) { final Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, mailboxId); if (mailbox == null) return; final Account account = Account.restoreAccountWithId(mContext, mailbox.mAccountKey); @@ -125,66 +118,6 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm account.toString(), extras.toString()); } - @Override - public void stopSync(long mailboxId) throws RemoteException { - // Not required - } - - @Override - public void loadMore(long messageId) throws RemoteException { - // Load a message for view... - try { - // 1. Resample the message, in case it disappeared or synced while - // this command was in queue - final EmailContent.Message message = - EmailContent.Message.restoreMessageWithId(mContext, messageId); - if (message == null) { - return; - } - if (message.mFlagLoaded == EmailContent.Message.FLAG_LOADED_COMPLETE) { - // We should NEVER get here - return; - } - - // 2. Open the remote folder. - // TODO combine with common code in loadAttachment - final Account account = Account.restoreAccountWithId(mContext, message.mAccountKey); - final Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, message.mMailboxKey); - if (account == null || mailbox == null) { - //mListeners.loadMessageForViewFailed(messageId, "null account or mailbox"); - return; - } - TrafficStats.setThreadStatsTag(TrafficFlags.getSyncFlags(mContext, account)); - - final Store remoteStore = Store.getInstance(account, mContext); - final String remoteServerId; - // If this is a search result, use the protocolSearchInfo field to get the - // correct remote location - if (!TextUtils.isEmpty(message.mProtocolSearchInfo)) { - remoteServerId = message.mProtocolSearchInfo; - } else { - remoteServerId = mailbox.mServerId; - } - final Folder remoteFolder = remoteStore.getFolder(remoteServerId); - remoteFolder.open(OpenMode.READ_WRITE); - - // 3. Set up to download the entire message - final Message remoteMessage = remoteFolder.getMessage(message.mServerId); - final FetchProfile fp = new FetchProfile(); - fp.add(FetchProfile.Item.BODY); - remoteFolder.fetch(new Message[] { remoteMessage }, fp, null); - - // 4. Write to provider - Utilities.copyOneMessageToProvider(mContext, remoteMessage, account, mailbox, - EmailContent.Message.FLAG_LOADED_COMPLETE); - } catch (MessagingException me) { - if (Logging.LOGD) LogUtils.v(Logging.LOG_TAG, "", me); - - } catch (RuntimeException rte) { - LogUtils.d(Logging.LOG_TAG, "RTE During loadMore"); - } - } - @Override public void loadAttachment(final IEmailServiceCallback cb, final long attachmentId, final boolean background) throws RemoteException { @@ -419,40 +352,16 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm } // If we just created the inbox, sync it if (inboxId != -1) { - startSync(inboxId, true, 0); + requestSync(inboxId, true, 0); } } } - @Override - public boolean createFolder(long accountId, String name) throws RemoteException { - // Not required - return false; - } - - @Override - public boolean deleteFolder(long accountId, String name) throws RemoteException { - // Not required - return false; - } - - @Override - public boolean renameFolder(long accountId, String oldName, String newName) - throws RemoteException { - // Not required - return false; - } - @Override public void setLogging(int on) throws RemoteException { // Not required } - @Override - public void hostChanged(long accountId) throws RemoteException { - // Not required - } - @Override public Bundle autoDiscover(String userName, String password) throws RemoteException { // Not required @@ -469,11 +378,6 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm AccountReconciler.reconcileAccounts(mContext); } - @Override - public int getApiLevel() throws RemoteException { - return Api.LEVEL; - } - @Override public int searchMessages(long accountId, SearchParams params, long destMailboxId) throws RemoteException { diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java index c9b083bdb..03c83e06f 100644 --- a/src/com/android/email/service/EmailServiceUtils.java +++ b/src/com/android/email/service/EmailServiceUtils.java @@ -633,19 +633,6 @@ public class EmailServiceUtils { return null; } - @Override - public void startSync(long mailboxId, boolean userRequest, int deltaMessageCount) - throws RemoteException { - } - - @Override - public void stopSync(long mailboxId) throws RemoteException { - } - - @Override - public void loadMore(long messageId) throws RemoteException { - } - @Override public void loadAttachment(final IEmailServiceCallback cb, final long attachmentId, final boolean background) throws RemoteException { @@ -655,30 +642,10 @@ public class EmailServiceUtils { public void updateFolderList(long accountId) throws RemoteException { } - @Override - public boolean createFolder(long accountId, String name) throws RemoteException { - return false; - } - - @Override - public boolean deleteFolder(long accountId, String name) throws RemoteException { - return false; - } - - @Override - public boolean renameFolder(long accountId, String oldName, String newName) - throws RemoteException { - return false; - } - @Override public void setLogging(int on) throws RemoteException { } - @Override - public void hostChanged(long accountId) throws RemoteException { - } - @Override public Bundle autoDiscover(String userName, String password) throws RemoteException { return null; @@ -692,11 +659,6 @@ public class EmailServiceUtils { public void deleteAccountPIMData(final String emailAddress) throws RemoteException { } - @Override - public int getApiLevel() throws RemoteException { - return Api.LEVEL; - } - @Override public int searchMessages(long accountId, SearchParams params, long destMailboxId) throws RemoteException { @@ -706,14 +668,5 @@ public class EmailServiceUtils { @Override public void sendMail(long accountId) throws RemoteException { } - - @Override - public void serviceUpdated(String emailAddress) throws RemoteException { - } - - @Override - public int getCapabilities(Account acct) throws RemoteException { - return 0; - } } } diff --git a/src/com/android/email/service/ImapService.java b/src/com/android/email/service/ImapService.java index 1cdd326d6..106a51817 100644 --- a/src/com/android/email/service/ImapService.java +++ b/src/com/android/email/service/ImapService.java @@ -26,7 +26,6 @@ import android.database.Cursor; import android.net.TrafficStats; import android.net.Uri; import android.os.IBinder; -import android.os.RemoteException; import android.os.SystemClock; import android.text.TextUtils; import android.text.format.DateUtils; @@ -60,7 +59,6 @@ import com.android.emailcommon.service.EmailServiceStatus; import com.android.emailcommon.service.SearchParams; import com.android.emailcommon.utility.AttachmentUtilities; import com.android.mail.providers.UIProvider; -import com.android.mail.providers.UIProvider.AccountCapabilities; import com.android.mail.utils.LogUtils; import java.util.ArrayList; @@ -114,11 +112,6 @@ public class ImapService extends Service { * Create our EmailService implementation here. */ private final EmailServiceStub mBinder = new EmailServiceStub() { - @Override - public void loadMore(long messageId) throws RemoteException { - // We don't do "loadMore" for IMAP messages; the sync should handle this - } - @Override public int searchMessages(long accountId, SearchParams searchParams, long destMailboxId) { try { @@ -129,19 +122,6 @@ public class ImapService extends Service { } return 0; } - - @Override - public int getCapabilities(Account acct) throws RemoteException { - return AccountCapabilities.SYNCABLE_FOLDERS | - AccountCapabilities.FOLDER_SERVER_SEARCH | - AccountCapabilities.UNDO | - AccountCapabilities.DISCARD_CONVERSATION_DRAFTS; - } - - @Override - public void serviceUpdated(String emailAddress) throws RemoteException { - // Not needed - } }; @Override diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index 07f4a2459..7bff8001b 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -52,7 +52,6 @@ import com.android.emailcommon.service.EmailServiceStatus; import com.android.emailcommon.service.IEmailServiceCallback; import com.android.emailcommon.utility.AttachmentUtilities; import com.android.mail.providers.UIProvider; -import com.android.mail.providers.UIProvider.AccountCapabilities; import com.android.mail.providers.UIProvider.AttachmentState; import com.android.mail.utils.LogUtils; @@ -76,12 +75,6 @@ public class Pop3Service extends Service { * Create our EmailService implementation here. */ private final EmailServiceStub mBinder = new EmailServiceStub() { - @Override - public int getCapabilities(Account acct) throws RemoteException { - return AccountCapabilities.UNDO | - AccountCapabilities.DISCARD_CONVERSATION_DRAFTS; - } - @Override public void loadAttachment(final IEmailServiceCallback callback, final long attachmentId, final boolean background) throws RemoteException { @@ -90,12 +83,7 @@ public class Pop3Service extends Service { long inboxId = Mailbox.findMailboxOfType(mContext, att.mAccountKey, Mailbox.TYPE_INBOX); if (inboxId == Mailbox.NO_MAILBOX) return; // We load attachments during a sync - startSync(inboxId, true, 0); - } - - @Override - public void serviceUpdated(String emailAddress) throws RemoteException { - // Not required for POP3 + requestSync(inboxId, true, 0); } };