From 745b33b8ff55e9a9c4871f07f9d97db893f784b2 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Fri, 1 Jul 2011 12:42:41 -0700 Subject: [PATCH] Fix all NoSuchMethodErrors Change-Id: I05adf2b99c819d6aa2d3b52c52a8c655d9307337 --- .../src/com/android/emailcommon/mail/Folder.java | 14 ++++++++------ .../android/emailcommon/provider/EmailContent.java | 2 ++ .../com/android/emailcommon/provider/Policy.java | 2 ++ .../com/android/emailcommon/utility/SSLUtils.java | 3 +++ .../android/emailcommon/utility/TextUtilities.java | 3 +++ .../email/activity/AccountSelectorAdapter.java | 2 ++ src/com/android/email/mail/store/ImapFolder.java | 4 ++++ src/com/android/email/mail/store/Pop3Store.java | 2 ++ 8 files changed, 26 insertions(+), 6 deletions(-) diff --git a/emailcommon/src/com/android/emailcommon/mail/Folder.java b/emailcommon/src/com/android/emailcommon/mail/Folder.java index 41d43d11e..c58988d96 100644 --- a/emailcommon/src/com/android/emailcommon/mail/Folder.java +++ b/emailcommon/src/com/android/emailcommon/mail/Folder.java @@ -17,6 +17,7 @@ package com.android.emailcommon.mail; import com.android.emailcommon.service.SearchParams; +import com.google.common.annotations.VisibleForTesting; public abstract class Folder { @@ -27,7 +28,7 @@ public abstract class Folder { public enum FolderType { HOLDS_FOLDERS, HOLDS_MESSAGES, } - + /** * Identifiers of "special" folders. */ @@ -36,7 +37,7 @@ public abstract class Folder { TRASH, SENT, DRAFTS, - + OUTBOX, // Local folders only - not used in remote Stores OTHER, // this folder has no specific role UNKNOWN // the role of this folder is unknown @@ -76,6 +77,7 @@ public abstract class Folder { * @return True if further commands are not expected to have to open the * connection. */ + @VisibleForTesting public abstract boolean isOpen(); /** @@ -127,14 +129,14 @@ public abstract class Folder { /** * Return a set of messages based on the state of the flags. * Note: Not typically implemented in remote stores, so not abstract. - * + * * @param setFlags The flags that should be set for a message to be selected (can be null) * @param clearFlags The flags that should be clear for a message to be selected (can be null) * @param listener * @return A list of messages matching the desired flag states. * @throws MessagingException */ - public Message[] getMessages(Flag[] setFlags, Flag[] clearFlags, + public Message[] getMessages(Flag[] setFlags, Flag[] clearFlags, MessageRetrievalListener listener) throws MessagingException { throw new MessagingException("Not implemented"); } @@ -166,10 +168,10 @@ public abstract class Folder { * (such as inbox, draft, sent, or trash). Stores that do not implement this * feature can be used - the account UI will provide default strings. To * let the server identify specific folder roles, simply override this method. - * + * * @return The server- or protocol- specific role for this folder. If some roles are known * but this is not one of them, return FolderRole.OTHER. If roles are unsupported here, - * return FolderRole.UNKNOWN. + * return FolderRole.UNKNOWN. */ public FolderRole getRole() { return FolderRole.UNKNOWN; diff --git a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java index b408e4ef9..a2ea8d1ef 100644 --- a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java +++ b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java @@ -32,6 +32,7 @@ import android.os.RemoteException; import com.android.emailcommon.utility.TextUtilities; import com.android.emailcommon.utility.Utility; +import com.google.common.annotations.VisibleForTesting; import java.io.File; import java.util.ArrayList; @@ -376,6 +377,7 @@ public abstract class EmailContent { } } + @VisibleForTesting public static long restoreBodySourceKey(Context context, long messageId) { return Utility.getFirstRowLong(context, Body.CONTENT_URI, Body.PROJECTION_SOURCE_KEY, diff --git a/emailcommon/src/com/android/emailcommon/provider/Policy.java b/emailcommon/src/com/android/emailcommon/provider/Policy.java index 89933462b..ef9a78b2b 100644 --- a/emailcommon/src/com/android/emailcommon/provider/Policy.java +++ b/emailcommon/src/com/android/emailcommon/provider/Policy.java @@ -30,6 +30,7 @@ import android.os.RemoteException; import android.util.Log; import com.android.emailcommon.utility.Utility; +import com.google.common.annotations.VisibleForTesting; import java.util.ArrayList; @@ -153,6 +154,7 @@ public final class Policy extends EmailContent implements EmailContent.PolicyCol /** * Convenience method for {@link #setAccountPolicy(Context, Account, Policy, String)}. */ + @VisibleForTesting public static void setAccountPolicy(Context context, long accountId, Policy policy, String securitySyncKey) { setAccountPolicy(context, Account.restoreAccountWithId(context, accountId), diff --git a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java index 4bcd836bd..620a8d050 100644 --- a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java +++ b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java @@ -16,6 +16,8 @@ package com.android.emailcommon.utility; +import com.google.common.annotations.VisibleForTesting; + import android.content.Context; import android.net.SSLCertificateSocketFactory; import android.security.KeyChain; @@ -80,6 +82,7 @@ public class SSLUtils { * * This does not ensure that the first character is a letter (which is required by the RFC). */ + @VisibleForTesting public static String escapeForSchemeName(String s) { // According to the RFC, scheme names are case-insensitive. s = s.toLowerCase(); diff --git a/emailcommon/src/com/android/emailcommon/utility/TextUtilities.java b/emailcommon/src/com/android/emailcommon/utility/TextUtilities.java index 36bc830bf..59f6fd2c0 100644 --- a/emailcommon/src/com/android/emailcommon/utility/TextUtilities.java +++ b/emailcommon/src/com/android/emailcommon/utility/TextUtilities.java @@ -16,6 +16,8 @@ package com.android.emailcommon.utility; +import com.google.common.annotations.VisibleForTesting; + import android.graphics.Color; import android.text.Spannable; import android.text.SpannableString; @@ -509,6 +511,7 @@ public class TextUtilities { * @param query the search terms * @return HTML text with the search terms highlighted */ + @VisibleForTesting public static String highlightTermsInHtml(String text, String query) { try { return highlightTerms(text, query, true).toString(); diff --git a/src/com/android/email/activity/AccountSelectorAdapter.java b/src/com/android/email/activity/AccountSelectorAdapter.java index 8d7f1faa1..260956a05 100644 --- a/src/com/android/email/activity/AccountSelectorAdapter.java +++ b/src/com/android/email/activity/AccountSelectorAdapter.java @@ -577,6 +577,7 @@ public class AccountSelectorAdapter extends CursorAdapter { return mAccountCount; } + @VisibleForTesting public int getRecentMailboxCount() { return mRecentCount; } @@ -597,6 +598,7 @@ public class AccountSelectorAdapter extends CursorAdapter { return mAccountDisplayName; } + @VisibleForTesting public long getMailboxId() { return mMailboxId; } diff --git a/src/com/android/email/mail/store/ImapFolder.java b/src/com/android/email/mail/store/ImapFolder.java index 3fec8c779..32678ec25 100644 --- a/src/com/android/email/mail/store/ImapFolder.java +++ b/src/com/android/email/mail/store/ImapFolder.java @@ -395,6 +395,7 @@ class ImapFolder extends Folder { } @Override + @VisibleForTesting public Message getMessage(String uid) throws MessagingException { checkOpen(); @@ -413,6 +414,7 @@ class ImapFolder extends Folder { * TODO: Properly quote the filter */ @Override + @VisibleForTesting public Message[] getMessages(SearchParams params, MessageRetrievalListener listener) throws MessagingException { String filter = params.mFilter; @@ -432,6 +434,7 @@ class ImapFolder extends Folder { } @Override + @VisibleForTesting public Message[] getMessages(int start, int end, MessageRetrievalListener listener) throws MessagingException { if (start < 1 || end < 1 || end < start) { @@ -442,6 +445,7 @@ class ImapFolder extends Folder { } @Override + @VisibleForTesting public Message[] getMessages(String[] uids, MessageRetrievalListener listener) throws MessagingException { if (uids == null) { diff --git a/src/com/android/email/mail/store/Pop3Store.java b/src/com/android/email/mail/store/Pop3Store.java index 4a57d6a31..15e60a693 100644 --- a/src/com/android/email/mail/store/Pop3Store.java +++ b/src/com/android/email/mail/store/Pop3Store.java @@ -40,6 +40,7 @@ import com.android.emailcommon.service.EmailServiceProxy; import com.android.emailcommon.service.SearchParams; import com.android.emailcommon.utility.LoggingInputStream; import com.android.emailcommon.utility.Utility; +import com.google.common.annotations.VisibleForTesting; import java.io.IOException; import java.io.InputStream; @@ -932,6 +933,7 @@ public class Pop3Store extends Store { } @Override + @VisibleForTesting public boolean isOpen() { return mTransport.isOpen(); }