From 1b8e0fa23f6e9957f0b8753dd3f5b95d3f5d98ea Mon Sep 17 00:00:00 2001 From: Scott Kennedy Date: Tue, 25 Jun 2013 15:15:02 -0700 Subject: [PATCH] Clean up a bunch of warnings Bug: 9565838 Change-Id: I5e95562bbf463f057cbcc4a9884427a774473b45 --- .../emailcommon/internet/Rfc822Output.java | 4 +-- .../android/emailcommon/provider/Account.java | 2 +- .../android/emailcommon/provider/Policy.java | 2 +- .../service/AccountServiceProxy.java | 1 - .../android/email/NotificationController.java | 15 +++------ src/com/android/email/Preferences.java | 8 ++--- .../email/RequireManualSyncDialog.java | 3 +- .../activity/InsertQuickResponseDialog.java | 10 ++---- .../android/email/activity/UiUtilities.java | 12 ------- .../setup/AccountCheckSettingsFragment.java | 1 - .../email/activity/setup/AccountSecurity.java | 4 +-- .../email/activity/setup/AccountSettings.java | 12 ++----- .../activity/setup/AccountSetupNames.java | 4 +-- .../email/activity/setup/MailboxSettings.java | 2 -- src/com/android/email/mail/Sender.java | 3 +- src/com/android/email/mail/Store.java | 2 +- .../android/email/mail/store/ImapFolder.java | 3 +- .../email/mail/transport/MailTransport.java | 2 +- .../android/email/provider/ContentCache.java | 31 +------------------ .../android/email/provider/EmailProvider.java | 6 +--- .../email/provider/WidgetProvider.java | 4 +-- .../android/email/service/AccountService.java | 1 - .../android/email/service/ImapService.java | 11 +++---- .../service/PopImapSyncAdapterService.java | 9 ++---- 24 files changed, 38 insertions(+), 114 deletions(-) diff --git a/emailcommon/src/com/android/emailcommon/internet/Rfc822Output.java b/emailcommon/src/com/android/emailcommon/internet/Rfc822Output.java index 81beaef51..17dff5cbd 100644 --- a/emailcommon/src/com/android/emailcommon/internet/Rfc822Output.java +++ b/emailcommon/src/com/android/emailcommon/internet/Rfc822Output.java @@ -89,7 +89,7 @@ public class Rfc822Output { /** * Gets both the plain text and HTML versions of the message body. */ - /*package*/ static String[] buildBodyText(Body body, int flags, boolean useSmartReply) { + /*package*/ static String[] buildBodyText(Body body, boolean useSmartReply) { if (body == null) { return new String[2]; } @@ -149,7 +149,7 @@ public class Rfc822Output { // Analyze message and determine if we have multiparts Body body = Body.restoreBodyWithMessageId(context, message.mId); - String[] bodyText = buildBodyText(body, message.mFlags, useSmartReply); + String[] bodyText = buildBodyText(body, useSmartReply); // If a list of attachments hasn't been passed in, build one from the message if (attachments == null) { diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java index 98382565f..c7cfe3d8b 100755 --- a/emailcommon/src/com/android/emailcommon/provider/Account.java +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java @@ -262,7 +262,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY); } - private long getId(Uri u) { + private static long getId(Uri u) { return Long.parseLong(u.getPathSegments().get(1)); } diff --git a/emailcommon/src/com/android/emailcommon/provider/Policy.java b/emailcommon/src/com/android/emailcommon/provider/Policy.java index 0c2410d34..3df6d2b2c 100755 --- a/emailcommon/src/com/android/emailcommon/provider/Policy.java +++ b/emailcommon/src/com/android/emailcommon/provider/Policy.java @@ -385,7 +385,7 @@ public final class Policy extends EmailContent implements EmailContent.PolicyCol return result; } - private void appendPolicy(StringBuilder sb, String code, int value) { + private static void appendPolicy(StringBuilder sb, String code, int value) { sb.append(code); sb.append(":"); sb.append(value); diff --git a/emailcommon/src/com/android/emailcommon/service/AccountServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/AccountServiceProxy.java index 1667295cb..8f41ff080 100644 --- a/emailcommon/src/com/android/emailcommon/service/AccountServiceProxy.java +++ b/emailcommon/src/com/android/emailcommon/service/AccountServiceProxy.java @@ -17,7 +17,6 @@ package com.android.emailcommon.service; import android.content.Context; -import android.content.Intent; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; diff --git a/src/com/android/email/NotificationController.java b/src/com/android/email/NotificationController.java index 331697c86..b7c721a25 100644 --- a/src/com/android/email/NotificationController.java +++ b/src/com/android/email/NotificationController.java @@ -386,9 +386,8 @@ public class NotificationController { mContext.getString(R.string.login_failed_ticker, account.mDisplayName), mContext.getString(R.string.login_failed_title), account.getDisplayName(), - AccountSettings.createAccountSettingsIntent(mContext, accountId, - account.mDisplayName, reason), - getLoginFailedNotificationId(accountId)); + AccountSettings.createAccountSettingsIntent(accountId, + account.mDisplayName, reason), getLoginFailedNotificationId(accountId)); } /** @@ -464,8 +463,7 @@ public class NotificationController { * account settings screen where he can view the list of enforced policies */ public void showSecurityChangedNotification(Account account) { - Intent intent = - AccountSettings.createAccountSettingsIntent(mContext, account.mId, null, null); + Intent intent = AccountSettings.createAccountSettingsIntent(account.mId, null, null); String accountName = account.getDisplayName(); String ticker = mContext.getString(R.string.security_changed_ticker_fmt, accountName); @@ -479,8 +477,7 @@ public class NotificationController { * account settings screen where he can view the list of unsupported policies */ public void showSecurityUnsupportedNotification(Account account) { - Intent intent = - AccountSettings.createAccountSettingsIntent(mContext, account.mId, null, null); + Intent intent = AccountSettings.createAccountSettingsIntent(account.mId, null, null); String accountName = account.getDisplayName(); String ticker = mContext.getString(R.string.security_unsupported_ticker_fmt, accountName); @@ -640,9 +637,7 @@ public class NotificationController { newAccountList.add(accountId); } } finally { - if (c != null) { - c.close(); - } + c.close(); } // NOTE: Looping over three lists is not necessarily the most efficient. However, the // account lists are going to be very small, so, this will not be necessarily bad. diff --git a/src/com/android/email/Preferences.java b/src/com/android/email/Preferences.java index a8b40e214..99d43b4cd 100644 --- a/src/com/android/email/Preferences.java +++ b/src/com/android/email/Preferences.java @@ -265,7 +265,7 @@ public class Preferences { try { return parseEmailSet(mSharedPreferences.getString(TRUSTED_SENDERS, "")); } catch (JSONException e) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } } @@ -311,7 +311,7 @@ public class Preferences { * Gets whether the require manual sync dialog has been shown for the specified account. * It should only be shown once per account. */ - public boolean getHasShownRequireManualSync(Context context, Account account) { + public boolean getHasShownRequireManualSync(Account account) { return getBoolean(account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN, false); } @@ -319,7 +319,7 @@ public class Preferences { * Sets whether the require manual sync dialog has been shown for the specified account. * It should only be shown once per account. */ - public void setHasShownRequireManualSync(Context context, Account account, boolean value) { + public void setHasShownRequireManualSync(Account account, boolean value) { setBoolean(account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN, value); } @@ -331,7 +331,7 @@ public class Preferences { */ public boolean shouldShowRequireManualSync(Context context, Account account) { return Account.isAutomaticSyncDisabledByRoaming(context, account.mId) - && !getHasShownRequireManualSync(context, account); + && !getHasShownRequireManualSync(account); } public void clear() { diff --git a/src/com/android/email/RequireManualSyncDialog.java b/src/com/android/email/RequireManualSyncDialog.java index d1c60b9a2..10d94162c 100644 --- a/src/com/android/email/RequireManualSyncDialog.java +++ b/src/com/android/email/RequireManualSyncDialog.java @@ -22,7 +22,6 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; -import android.content.res.Resources; public class RequireManualSyncDialog extends AlertDialog implements OnClickListener { @@ -30,7 +29,7 @@ public class RequireManualSyncDialog extends AlertDialog implements OnClickListe super(context); setMessage(context.getResources().getString(R.string.require_manual_sync_message)); setButton(DialogInterface.BUTTON_POSITIVE, context.getString(android.R.string.ok), this); - Preferences.getPreferences(context).setHasShownRequireManualSync(context, account, true); + Preferences.getPreferences(context).setHasShownRequireManualSync(account, true); } /** {@inheritDoc} */ diff --git a/src/com/android/email/activity/InsertQuickResponseDialog.java b/src/com/android/email/activity/InsertQuickResponseDialog.java index 5a5689a9d..0e0b04d40 100644 --- a/src/com/android/email/activity/InsertQuickResponseDialog.java +++ b/src/com/android/email/activity/InsertQuickResponseDialog.java @@ -67,11 +67,8 @@ public class InsertQuickResponseDialog extends DialogFragment final InsertQuickResponseDialog dialog = new InsertQuickResponseDialog(); // If a target is set, it MUST implement Callback. Fail-fast if not. - final Callback callback; if (callbackFragment != null) { - try { - callback = (Callback) callbackFragment; - } catch (ClassCastException e) { + if (!(callbackFragment instanceof Callback)) { throw new ClassCastException(callbackFragment.toString() + " must implement Callback"); } @@ -89,10 +86,7 @@ public class InsertQuickResponseDialog extends DialogFragment // If target not set, the parent activity MUST implement Callback. Fail-fast if not. final Fragment targetFragment = getTargetFragment(); if (targetFragment != null) { - final Callback callback; - try { - callback = (Callback) getActivity(); - } catch (ClassCastException e) { + if (!(getActivity() instanceof Callback)) { throw new ClassCastException(getActivity().toString() + " must implement Callback"); } } diff --git a/src/com/android/email/activity/UiUtilities.java b/src/com/android/email/activity/UiUtilities.java index de853d31a..2452d365c 100644 --- a/src/com/android/email/activity/UiUtilities.java +++ b/src/com/android/email/activity/UiUtilities.java @@ -123,16 +123,4 @@ public class UiUtilities { public static void setVisibilitySafe(View parent, int viewId, int visibility) { setVisibilitySafe(parent.findViewById(viewId), visibility); } - - private static int sDebugForcedPaneMode = 0; - - /** - * Force 1-pane UI or 2-pane UI. - * - * @param paneMode Set 1 if 1-pane UI should be used. Set 2 if 2-pane UI should be used. - * Set 0 to use the default UI. - */ - static void setDebugPaneMode(int paneMode) { - sDebugForcedPaneMode = paneMode; - } } diff --git a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java index 45546ca37..eb5454ede 100644 --- a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java +++ b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java @@ -331,7 +331,6 @@ public class AccountCheckSettingsFragment extends Fragment { } private void onEditCertificateOk() { - Callbacks callbackTarget = getCallbackTarget(); getCallbackTarget().onCheckSettingsComplete(CHECK_SETTINGS_CLIENT_CERTIFICATE_NEEDED); finish(); } diff --git a/src/com/android/email/activity/setup/AccountSecurity.java b/src/com/android/email/activity/setup/AccountSecurity.java index 5e6ebfdf7..008bdfe31 100644 --- a/src/com/android/email/activity/setup/AccountSecurity.java +++ b/src/com/android/email/activity/setup/AccountSecurity.java @@ -292,7 +292,7 @@ public class AccountSecurity extends Activity { * Mark an account as not-ready-for-sync and post a notification to bring the user back here * eventually. */ - private void repostNotification(final Account account, final SecurityPolicy security) { + private static void repostNotification(final Account account, final SecurityPolicy security) { if (account == null) return; Utility.runAsync(new Runnable() { @Override @@ -360,7 +360,7 @@ public class AccountSecurity extends Activity { if (MailActivityEmail.DEBUG || DEBUG) { LogUtils.d(TAG, "User declines; repost notification"); } - activity.repostNotification( + AccountSecurity.repostNotification( activity.mAccount, SecurityPolicy.getInstance(activity)); activity.finish(); break; diff --git a/src/com/android/email/activity/setup/AccountSettings.java b/src/com/android/email/activity/setup/AccountSettings.java index f54d277e6..0d8a1f87c 100644 --- a/src/com/android/email/activity/setup/AccountSettings.java +++ b/src/com/android/email/activity/setup/AccountSettings.java @@ -33,7 +33,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceActivity; import android.text.SpannableString; -import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.text.util.Linkify; import android.view.KeyEvent; @@ -52,7 +51,6 @@ import com.android.emailcommon.service.ServiceProxy; import com.android.emailcommon.utility.IntentUtilities; import com.android.emailcommon.utility.Utility; import com.android.mail.providers.Folder; -import com.android.mail.providers.UIProvider; import com.android.mail.providers.UIProvider.EditSettingsExtras; import com.android.mail.ui.FeedbackEnabledActivity; import com.android.mail.utils.LogUtils; @@ -114,7 +112,6 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl private int mNumGeneralHeaderClicked = 0; private long mRequestedAccountId; - private Header mRequestedAccountHeader; private Header[] mAccountListHeaders; private Header mAppPreferencesHeader; /* package */ Fragment mCurrentFragment; @@ -137,8 +134,7 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl * Display (and edit) settings for a specific account, or -1 for any/all accounts */ public static void actionSettings(Activity fromActivity, long accountId) { - fromActivity.startActivity( - createAccountSettingsIntent(fromActivity, accountId, null, null)); + fromActivity.startActivity(createAccountSettingsIntent(accountId, null, null)); } /** @@ -146,7 +142,7 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl * for any/all accounts. If an account name string is provided, a warning dialog will be * displayed as well. */ - public static Intent createAccountSettingsIntent(Context context, long accountId, + public static Intent createAccountSettingsIntent(long accountId, String loginWarningAccountName, String loginWarningReason) { final Uri.Builder b = IntentUtilities.createActivityIntentUrlBuilder("settings"); IntentUtilities.setAccountId(b, accountId); @@ -380,9 +376,6 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl */ @Override public void onBuildHeaders(List
target) { - // Assume the account is unspecified - mRequestedAccountHeader = null; - // Always add app preferences as first header target.clear(); target.add(getAppPreferencesHeader()); @@ -396,7 +389,6 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl if (header.id != mDeletingAccountId) { target.add(header); if (header.id == mRequestedAccountId) { - mRequestedAccountHeader = header; mRequestedAccountId = -1; } } diff --git a/src/com/android/email/activity/setup/AccountSetupNames.java b/src/com/android/email/activity/setup/AccountSetupNames.java index 29f45a9b1..d3e305b9e 100644 --- a/src/com/android/email/activity/setup/AccountSetupNames.java +++ b/src/com/android/email/activity/setup/AccountSetupNames.java @@ -90,7 +90,7 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi mName.addTextChangedListener(validationTextWatcher); mName.setKeyListener(TextKeyListener.getInstance(false, Capitalize.WORDS)); - Account account = SetupData.getAccount(); + final Account account = SetupData.getAccount(); if (account == null) { throw new IllegalStateException("unexpected null account"); } @@ -116,7 +116,7 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi mName.setVisibility(View.GONE); accountNameLabel.setVisibility(View.GONE); } else { - if (account != null && account.getSenderName() != null) { + if (account.getSenderName() != null) { mName.setText(account.getSenderName()); } else if (flowMode != SetupData.FLOW_MODE_FORCE_CREATE && flowMode != SetupData.FLOW_MODE_EDIT) { diff --git a/src/com/android/email/activity/setup/MailboxSettings.java b/src/com/android/email/activity/setup/MailboxSettings.java index d8c30fc20..5ffa5762e 100644 --- a/src/com/android/email/activity/setup/MailboxSettings.java +++ b/src/com/android/email/activity/setup/MailboxSettings.java @@ -18,7 +18,6 @@ package com.android.email.activity.setup; import android.app.ActionBar; import android.app.Activity; -import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; @@ -171,7 +170,6 @@ public class MailboxSettings extends PreferenceActivity { mMailbox = Mailbox.restoreMailboxWithId(c, mMailboxId); mMaxLookback = 0; if (mMailbox != null) { - final ContentResolver cr = c.getContentResolver(); // Get the max lookback from our policy, if we have one. final Long policyKey = Utility.getFirstRowLong(c, ContentUris.withAppendedId( Account.CONTENT_URI, mMailbox.mAccountKey), POLICY_KEY_PROJECTION, diff --git a/src/com/android/email/mail/Sender.java b/src/com/android/email/mail/Sender.java index 238de2c29..49f861e89 100644 --- a/src/com/android/email/mail/Sender.java +++ b/src/com/android/email/mail/Sender.java @@ -37,8 +37,7 @@ public abstract class Sender { * Static named constructor. It should be overrode by extending class. * Because this method will be called through reflection, it can not be protected. */ - public static Sender newInstance(Context context, Account account) - throws MessagingException { + public static Sender newInstance(Account account) throws MessagingException { throw new MessagingException("Sender.newInstance: Unknown scheme in " + account.mDisplayName); } diff --git a/src/com/android/email/mail/Store.java b/src/com/android/email/mail/Store.java index e2b0e868e..977282cfb 100644 --- a/src/com/android/email/mail/Store.java +++ b/src/com/android/email/mail/Store.java @@ -62,7 +62,7 @@ public abstract class Store { * Static named constructor. It should be overrode by extending class. * Because this method will be called through reflection, it can not be protected. */ - static Store newInstance(Account account, Context context) throws MessagingException { + static Store newInstance(Account account) throws MessagingException { throw new MessagingException("Store#newInstance: Unknown scheme in " + account.mDisplayName); } diff --git a/src/com/android/email/mail/store/ImapFolder.java b/src/com/android/email/mail/store/ImapFolder.java index 8209d4ecb..504d26e14 100644 --- a/src/com/android/email/mail/store/ImapFolder.java +++ b/src/com/android/email/mail/store/ImapFolder.java @@ -582,7 +582,6 @@ class ImapFolder extends Folder { Utility.combine(fetchFields.toArray(new String[fetchFields.size()]), ' ') ), false); ImapResponse response; - int messageNumber = 0; do { response = null; try { @@ -680,7 +679,7 @@ class ImapFolder extends Folder { * Removes any content transfer encoding from the stream and returns a Body. * This code is taken/condensed from MimeUtility.decodeBody */ - private Body decodeBody(InputStream in, String contentTransferEncoding, int size, + private static Body decodeBody(InputStream in, String contentTransferEncoding, int size, MessageRetrievalListener listener) throws IOException { // Get a properly wrapped input stream in = MimeUtility.getInputStreamForContentTransferEncoding(in, contentTransferEncoding); diff --git a/src/com/android/email/mail/transport/MailTransport.java b/src/com/android/email/mail/transport/MailTransport.java index c54899cb9..0e2ffede4 100644 --- a/src/com/android/email/mail/transport/MailTransport.java +++ b/src/com/android/email/mail/transport/MailTransport.java @@ -189,7 +189,7 @@ public class MailTransport { * @throws IOException if something goes wrong handshaking with the server * @throws SSLPeerUnverifiedException if the server cannot prove its identity */ - private void verifyHostname(Socket socket, String hostname) throws IOException { + private static void verifyHostname(Socket socket, String hostname) throws IOException { // The code at the start of OpenSSLSocketImpl.startHandshake() // ensures that the call is idempotent, so we can safely call it. SSLSocket ssl = (SSLSocket) socket; diff --git a/src/com/android/email/provider/ContentCache.java b/src/com/android/email/provider/ContentCache.java index 61afe6b94..3a7f99210 100644 --- a/src/com/android/email/provider/ContentCache.java +++ b/src/com/android/email/provider/ContentCache.java @@ -715,35 +715,6 @@ public final class ContentCache { } } - private static class CacheCounter implements Comparable { - String uri; - Integer count; - - CacheCounter(String _uri, Integer _count) { - uri = _uri; - count = _count; - } - - @Override - public int compareTo(CacheCounter another) { - return another.count > count ? 1 : another.count == count ? 0 : -1; - } - } - - private static void dumpNotCacheableQueries() { - int size = sNotCacheableMap.size(); - CacheCounter[] array = new CacheCounter[size]; - - int i = 0; - for (Map.Entry entry: sNotCacheableMap.entrySet()) { - array[i++] = new CacheCounter(entry.getKey(), entry.getValue()); - } - Arrays.sort(array); - for (CacheCounter cc: array) { - LogUtils.d("NotCacheable", cc.count + ": " + cc.uri); - } - } - // For use with unit tests public static void invalidateAllCaches() { for (ContentCache cache: sContentCaches) { @@ -812,7 +783,7 @@ public final class ContentCache { } } - private void append(StringBuilder sb, String name, Object value) { + private static void append(StringBuilder sb, String name, Object value) { sb.append(", "); sb.append(name); sb.append(": "); diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 2eb8b08dd..f0ee810af 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2733,10 +2733,6 @@ public class EmailProvider extends ContentProvider { return Long.toString(Account.ACCOUNT_ID_COMBINED_VIEW + type); } - private static String getVirtualMailboxIdString(long accountId, int type) { - return Long.toString(getVirtualMailboxId(accountId, type)); - } - public static long getVirtualMailboxId(long accountId, int type) { return (accountId << 32) + type; } @@ -4022,7 +4018,7 @@ public class EmailProvider extends ContentProvider { undoValues.put(MessageColumns.FLAG_FAVORITE, msg.mFlagFavorite); } } - if (undoValues == null || undoValues.size() == 0) { + if (undoValues.size() == 0) { return -1; } final Boolean suppressUndo = diff --git a/src/com/android/email/provider/WidgetProvider.java b/src/com/android/email/provider/WidgetProvider.java index 1b30b1da8..89e066e34 100644 --- a/src/com/android/email/provider/WidgetProvider.java +++ b/src/com/android/email/provider/WidgetProvider.java @@ -119,7 +119,7 @@ public class WidgetProvider extends BaseWidgetProvider { editor.apply(); } - private long migrateLegacyWidgetAccountId(long accountId) { + private static long migrateLegacyWidgetAccountId(long accountId) { if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) { return EmailProvider.COMBINED_ACCOUNT_ID; } @@ -130,7 +130,7 @@ public class WidgetProvider extends BaseWidgetProvider { * @param accountId The migrated accountId * @return */ - private long migrateLegacyWidgetMailboxId(long mailboxId, long accountId) { + private static long migrateLegacyWidgetMailboxId(long mailboxId, long accountId) { if (mailboxId == Mailbox.QUERY_ALL_INBOXES) { return EmailProvider.getVirtualMailboxId(accountId, Mailbox.TYPE_INBOX); } else if (mailboxId == Mailbox.QUERY_ALL_UNREAD) { diff --git a/src/com/android/email/service/AccountService.java b/src/com/android/email/service/AccountService.java index b79842fa1..f89645874 100644 --- a/src/com/android/email/service/AccountService.java +++ b/src/com/android/email/service/AccountService.java @@ -32,7 +32,6 @@ import com.android.emailcommon.Configuration; import com.android.emailcommon.Device; import com.android.emailcommon.VendorPolicyLoader; import com.android.emailcommon.provider.Account; -import com.android.emailcommon.provider.HostAuth; import com.android.emailcommon.service.IAccountService; import com.android.emailcommon.utility.EmailAsyncTask; diff --git a/src/com/android/email/service/ImapService.java b/src/com/android/email/service/ImapService.java index 1ed3627e1..fce7d97de 100644 --- a/src/com/android/email/service/ImapService.java +++ b/src/com/android/email/service/ImapService.java @@ -667,8 +667,7 @@ public class ImapService extends Service { // Dispatch here for specific change types if (deleteFromTrash) { // Move message to trash - processPendingDeleteFromTrash(context, remoteStore, account, mailbox, - oldMessage); + processPendingDeleteFromTrash(remoteStore, account, mailbox, oldMessage); } } @@ -922,7 +921,7 @@ public class ImapService extends Service { } else if (mailbox.mType == Mailbox.TYPE_TRASH) { deleteUpdate = false; LogUtils.d(Logging.LOG_TAG, "Upsync skipped for mailbox=trash, id=" + messageId); - } else if (newMessage != null && newMessage.mMailboxKey != mailbox.mId) { + } else if (newMessage.mMailboxKey != mailbox.mId) { deleteUpdate = false; LogUtils.d(Logging.LOG_TAG, "Upsync skipped; mailbox changed, id=" + messageId); } else { @@ -1145,7 +1144,7 @@ public class ImapService extends Service { * @param oldMailbox The local trash mailbox * @param oldMessage The message that was deleted from the trash */ - private static void processPendingDeleteFromTrash(Context context, Store remoteStore, + private static void processPendingDeleteFromTrash(Store remoteStore, Account account, Mailbox oldMailbox, EmailContent.Message oldMessage) throws MessagingException { @@ -1311,8 +1310,8 @@ public class ImapService extends Service { } } - private int searchMailboxImpl(final Context context, long accountId, SearchParams searchParams, - final long destMailboxId) throws MessagingException { + private static int searchMailboxImpl(final Context context, final long accountId, + final SearchParams searchParams, final long destMailboxId) throws MessagingException { final Account account = Account.restoreAccountWithId(context, accountId); final Mailbox mailbox = Mailbox.restoreMailboxWithId(context, searchParams.mMailboxId); final Mailbox destMailbox = Mailbox.restoreMailboxWithId(context, destMailboxId); diff --git a/src/com/android/email/service/PopImapSyncAdapterService.java b/src/com/android/email/service/PopImapSyncAdapterService.java index b9cab8acf..62c900e72 100644 --- a/src/com/android/email/service/PopImapSyncAdapterService.java +++ b/src/com/android/email/service/PopImapSyncAdapterService.java @@ -59,8 +59,8 @@ public class PopImapSyncAdapterService extends Service { @Override public void onPerformSync(android.accounts.Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { - PopImapSyncAdapterService.performSync(getContext(), account, extras, authority, - provider, syncResult); + PopImapSyncAdapterService.performSync(getContext(), account, extras, provider, + syncResult); } } @@ -156,8 +156,7 @@ public class PopImapSyncAdapterService extends Service { * Partial integration with system SyncManager; we initiate manual syncs upon request */ private static void performSync(Context context, android.accounts.Account account, - Bundle extras, String authority, ContentProviderClient provider, - SyncResult syncResult) { + Bundle extras, ContentProviderClient provider, SyncResult syncResult) { // Find an EmailProvider account with the Account's email address Cursor c = null; try { @@ -198,7 +197,6 @@ public class PopImapSyncAdapterService extends Service { LogUtils.d(TAG, extras.toString()); long mailboxId = extras.getLong(Mailbox.SYNC_EXTRA_MAILBOX_ID, Mailbox.NO_MAILBOX); - boolean isInbox = false; if (mailboxId == Mailbox.NO_MAILBOX) { // Update folders. EmailServiceProxy service = @@ -206,7 +204,6 @@ public class PopImapSyncAdapterService extends Service { service.updateFolderList(acct.mId); mailboxId = Mailbox.findMailboxOfType(context, acct.mId, Mailbox.TYPE_INBOX); - isInbox = true; } if (mailboxId == Mailbox.NO_MAILBOX) return; boolean uiRefresh =