Merge "Clean up dead/weird code." into ub-mail-master
This commit is contained in:
commit
1644749d1b
|
@ -18,7 +18,6 @@ package com.android.email.mail.store;
|
|||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Base64DataException;
|
||||
|
||||
import com.android.email.mail.store.ImapStore.ImapException;
|
||||
|
@ -29,6 +28,7 @@ import com.android.email.mail.store.imap.ImapList;
|
|||
import com.android.email.mail.store.imap.ImapResponse;
|
||||
import com.android.email.mail.store.imap.ImapString;
|
||||
import com.android.email.mail.store.imap.ImapUtility;
|
||||
import com.android.email.service.ImapService;
|
||||
import com.android.email2.ui.MailActivityEmail;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.internet.BinaryTempFileBody;
|
||||
|
@ -813,7 +813,7 @@ class ImapFolder extends Folder {
|
|||
}
|
||||
}
|
||||
} catch (Base64DataException bde) {
|
||||
String warning = "\n\n" + MailActivityEmail.getMessageDecodeErrorString();
|
||||
String warning = "\n\n" + ImapService.getMessageDecodeErrorString();
|
||||
out.write(warning.getBytes());
|
||||
} finally {
|
||||
out.close();
|
||||
|
|
|
@ -33,6 +33,7 @@ import android.text.format.DateUtils;
|
|||
|
||||
import com.android.email.LegacyConversions;
|
||||
import com.android.email.NotificationController;
|
||||
import com.android.email.R;
|
||||
import com.android.email.mail.Store;
|
||||
import com.android.email.provider.Utilities;
|
||||
import com.android.email2.ui.MailActivityEmail;
|
||||
|
@ -105,6 +106,24 @@ public class ImapService extends Service {
|
|||
*/
|
||||
private static final String LOCAL_SERVERID_PREFIX = "Local-";
|
||||
|
||||
private static String sMessageDecodeErrorString;
|
||||
|
||||
/**
|
||||
* Used in ImapFolder for base64 errors. Cached here because ImapFolder does not have access
|
||||
* to a Context object.
|
||||
* @return Error string or empty string
|
||||
*/
|
||||
public static String getMessageDecodeErrorString() {
|
||||
return sMessageDecodeErrorString == null ? "" : sMessageDecodeErrorString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
sMessageDecodeErrorString = getString(R.string.message_decode_error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return Service.START_STICKY;
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.os.Bundle;
|
|||
|
||||
import com.android.email.NotificationController;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
import com.android.email.provider.EmailProvider;
|
||||
import com.android.email.service.AttachmentDownloadService;
|
||||
import com.android.email.service.EmailServiceUtils;
|
||||
|
@ -74,16 +73,6 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
*/
|
||||
public static boolean sDebugInhibitGraphicsAcceleration = false;
|
||||
|
||||
/**
|
||||
* This is used to force stacked UI to return to the "welcome" screen any time we change
|
||||
* the accounts list (e.g. deleting accounts in the Account Manager preferences.)
|
||||
*/
|
||||
private static boolean sAccountsChangedNotification = false;
|
||||
|
||||
private static String sMessageDecodeErrorString;
|
||||
|
||||
private static Thread sUiThread;
|
||||
|
||||
private static final int MATCH_LEGACY_SHORTCUT_INTENT = 1;
|
||||
/**
|
||||
* A matcher for data URI's that specify conversation list info.
|
||||
|
@ -98,8 +87,6 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
/**
|
||||
* Asynchronous version of {@link #setServicesEnabledSync(Context)}. Use when calling from
|
||||
* UI thread (or lifecycle entry points.)
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void setServicesEnabledAsync(final Context context) {
|
||||
EmailAsyncTask.runAsyncParallel(new Runnable() {
|
||||
|
@ -117,7 +104,6 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
*
|
||||
* Blocking call - do not call from UI/lifecycle threads.
|
||||
*
|
||||
* @param context
|
||||
* @return true if there are any accounts configured.
|
||||
*/
|
||||
public static boolean setServicesEnabledSync(Context context) {
|
||||
|
@ -191,8 +177,7 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
}
|
||||
|
||||
super.onCreate(bundle);
|
||||
sUiThread = Thread.currentThread();
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
final Preferences prefs = Preferences.getPreferences(this);
|
||||
DEBUG = prefs.getEnableDebugLogging();
|
||||
sDebugInhibitGraphicsAcceleration = prefs.getInhibitGraphicsAcceleration();
|
||||
enableStrictMode(prefs.getEnableStrictMode());
|
||||
|
@ -201,9 +186,6 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
// Enable logging in the EAS service, so it starts up as early as possible.
|
||||
updateLoggingFlags(this);
|
||||
|
||||
// Get a helper string used deep inside message decoders (which don't have context)
|
||||
sMessageDecodeErrorString = getString(R.string.message_decode_error);
|
||||
|
||||
// Make sure all required services are running when the app is started (can prevent
|
||||
// issues after an adb sync/install)
|
||||
setServicesEnabledAsync(this);
|
||||
|
@ -233,38 +215,6 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
|||
LogUtils.d(Logging.LOG_TAG, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the accounts reconciler to notify that accounts have changed, or by "Welcome"
|
||||
* to clear the flag.
|
||||
* @param setFlag true to set the notification flag, false to clear it
|
||||
*/
|
||||
public static synchronized void setNotifyUiAccountsChanged(boolean setFlag) {
|
||||
sAccountsChangedNotification = setFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from activity onResume() functions to check for an accounts-changed condition, at
|
||||
* which point they should finish() and jump to the Welcome activity.
|
||||
*/
|
||||
public static synchronized boolean getNotifyUiAccountsChanged() {
|
||||
return sAccountsChangedNotification;
|
||||
}
|
||||
|
||||
public static void warnIfUiThread() {
|
||||
if (Thread.currentThread().equals(sUiThread)) {
|
||||
LogUtils.w(Logging.LOG_TAG, "Method called on the UI thread",
|
||||
new Exception("STACK TRACE"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a simple string that can be used when message decoders encounter bad data.
|
||||
* This is provided here because the protocol decoders typically don't have mContext.
|
||||
*/
|
||||
public static String getMessageDecodeErrorString() {
|
||||
return sMessageDecodeErrorString != null ? sMessageDecodeErrorString : "";
|
||||
}
|
||||
|
||||
public static void enableStrictMode(boolean enabled) {
|
||||
Utility.enableStrictMode(enabled);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue