Unify LogTag

There is now only one LogTag class. The static initializer of
GmailApplication (existing) and EmailApplication (new) will now set
the log tag to "Gmail" and "Email", respectively. Up until that code
is run, it will be "UnifiedEmail".

"setprop log.tag.Gmail VERBOSE" (or .Email) will trigger all logs to
be printed as long as they go through LogUtils, regardless of what tag
is used by that individual log. This lets us still turn on logging
everywhere in one command, but also lets us use more descriptive tags
(like the class name).

And since we no longer have three com.android.mail.utils.LogTag
classes, builds will be much easier.

Also, we now use LogUtils everywhere.

Change-Id: I55f1c7a66ce50ead54877a13e40256422a56dc39
This commit is contained in:
Scott Kennedy 2013-05-25 21:32:32 -07:00
parent f20ed13765
commit 560bfadc31
77 changed files with 533 additions and 532 deletions

View File

@ -67,6 +67,7 @@
android:name="com.android.email.permission.ACCESS_PROVIDER"/>
<application
android:name=".EmailApplication"
android:icon="@mipmap/ic_launcher_mail"
android:label="@string/app_name"
android:theme="@style/UnifiedEmailTheme"

View File

@ -25,6 +25,7 @@ unified_email_src_dir := ../../UnifiedEmail/src
apache_src_dir := ../../UnifiedEmail/src/org
imported_unified_email_files := \
$(unified_email_src_dir)/com/android/mail/utils/LogTag.java \
$(unified_email_src_dir)/com/android/mail/utils/LogUtils.java \
$(unified_email_src_dir)/com/android/mail/providers/UIProvider.java

View File

@ -19,9 +19,9 @@ package com.android.emailcommon;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@ -62,16 +62,17 @@ public class Device {
if (id == null) {
// It's very bad if we read a null device id; let's delete that file
if (!f.delete()) {
Log.e(Logging.LOG_TAG, "Can't delete null deviceName file; try overwrite.");
LogUtils.e(Logging.LOG_TAG,
"Can't delete null deviceName file; try overwrite.");
}
} else {
return id;
}
} else {
Log.w(Logging.LOG_TAG, f.getAbsolutePath() + ": File exists, but can't read?" +
LogUtils.w(Logging.LOG_TAG, f.getAbsolutePath() + ": File exists, but can't read?" +
" Trying to remove.");
if (!f.delete()) {
Log.w(Logging.LOG_TAG, "Remove failed. Tring to overwrite.");
LogUtils.w(Logging.LOG_TAG, "Remove failed. Tring to overwrite.");
}
}
}
@ -104,7 +105,8 @@ public class Device {
return null;
}
} catch (Exception e) {
Log.d(Logging.LOG_TAG, "Error in TelephonyManager.getDeviceId(): " + e.getMessage());
LogUtils.d(Logging.LOG_TAG, "Error in TelephonyManager.getDeviceId(): "
+ e.getMessage());
return null;
}
return Utility.getSmallHash(deviceId);

View File

@ -16,8 +16,10 @@
package com.android.emailcommon;
import com.android.mail.utils.LogTag;
public class Logging {
public static final String LOG_TAG = "Email";
public static final String LOG_TAG = LogTag.getLogTag();
/**
* Set this to 'true' to enable as much Email logging as possible.

View File

@ -20,7 +20,8 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.io.Serializable;
import java.lang.reflect.Method;
@ -75,7 +76,7 @@ public class VendorPolicyLoader {
*/
public static void injectPolicyForTest(Context context, String apkPackageName, Class<?> clazz) {
String name = clazz.getName();
Log.d(Logging.LOG_TAG, String.format("Using policy: package=%s name=%s",
LogUtils.d(Logging.LOG_TAG, String.format("Using policy: package=%s name=%s",
apkPackageName, name));
sInstance = new VendorPolicyLoader(context, apkPackageName, name, true);
}
@ -117,10 +118,10 @@ public class VendorPolicyLoader {
// Package not found -- it's okay - there's no policy .apk found, which is OK
} catch (ClassNotFoundException e) {
// Class not found -- probably not OK, but let's not crash here
Log.w(Logging.LOG_TAG, "VendorPolicyLoader: " + e);
LogUtils.w(Logging.LOG_TAG, "VendorPolicyLoader: " + e);
} catch (NoSuchMethodException e) {
// Method not found -- probably not OK, but let's not crash here
Log.w(Logging.LOG_TAG, "VendorPolicyLoader: " + e);
LogUtils.w(Logging.LOG_TAG, "VendorPolicyLoader: " + e);
}
mPolicyMethod = method;
}
@ -147,7 +148,7 @@ public class VendorPolicyLoader {
try {
ret = (Bundle) mPolicyMethod.invoke(null, policy, args);
} catch (Exception e) {
Log.w(Logging.LOG_TAG, "VendorPolicyLoader", e);
LogUtils.w(Logging.LOG_TAG, "VendorPolicyLoader", e);
}
}
return (ret != null) ? ret : Bundle.EMPTY;

View File

@ -29,11 +29,11 @@ import android.os.Environment;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Log;
import com.android.emailcommon.utility.TextUtilities;
import com.android.emailcommon.utility.Utility;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.io.File;
@ -139,7 +139,7 @@ public abstract class EmailContent {
EMAIL_PACKAGE_NAME = PACKAGE_NAME.substring(0, lastDot + 1) + "email";
}
AUTHORITY = EMAIL_PACKAGE_NAME + ".provider";
Log.d("EmailContent", "init for " + AUTHORITY);
LogUtils.d("EmailContent", "init for " + AUTHORITY);
NOTIFIER_AUTHORITY = EMAIL_PACKAGE_NAME + ".notifier";
CONTENT_URI = Uri.parse("content://" + AUTHORITY);
CONTENT_NOTIFIER_URI = Uri.parse("content://" + NOTIFIER_AUTHORITY);
@ -988,7 +988,7 @@ public abstract class EmailContent {
u = results[resultIndex].uri;
} else {
// We didn't find the expected attachment, log this error
Log.e(LOG_TAG, "Invalid index into ContentProviderResults: " +
LogUtils.e(LOG_TAG, "Invalid index into ContentProviderResults: " +
resultIndex);
u = null;
}
@ -1331,7 +1331,7 @@ public abstract class EmailContent {
// Create a proper uri string using the actual provider
return ATTACHMENT_PROVIDER_URI_PREFIX + "/" + mContentUri.substring(prefix);
} else {
Log.e("Attachment", "Improper contentUri format: " + mContentUri);
LogUtils.e("Attachment", "Improper contentUri format: " + mContentUri);
// Belt & suspenders; can't really happen
return mContentUri;
}

View File

@ -24,12 +24,12 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.R;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
public class Mailbox extends EmailContent implements MailboxColumns, Parcelable {
/**
@ -336,10 +336,10 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
if (c.moveToFirst()) {
mailbox = getContent(c, Mailbox.class);
if (c.moveToNext()) {
Log.w(Logging.LOG_TAG, "Multiple mailboxes named \"" + path + "\"");
LogUtils.w(Logging.LOG_TAG, "Multiple mailboxes named \"" + path + "\"");
}
} else {
Log.i(Logging.LOG_TAG, "Could not find mailbox at \"" + path + "\"");
LogUtils.i(Logging.LOG_TAG, "Could not find mailbox at \"" + path + "\"");
}
return mailbox;
} finally {

View File

@ -21,14 +21,13 @@ import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.os.Debug;
import android.text.TextUtils;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.Mailbox;
import com.android.mail.utils.LogUtils;
import java.util.HashMap;
@ -88,7 +87,7 @@ public class MailboxUtilities {
} else {
// Mark this is having no parent, so that we don't examine this mailbox again
parentValues.put(Mailbox.PARENT_KEY, Mailbox.NO_MAILBOX);
Log.w(Logging.LOG_TAG, "Mailbox with null serverId: " +
LogUtils.w(Logging.LOG_TAG, "Mailbox with null serverId: " +
parentCursor.getString(Mailbox.CONTENT_DISPLAY_NAME_COLUMN) + ", type: " +
parentType);
}
@ -199,7 +198,7 @@ public class MailboxUtilities {
Account account = Account.restoreAccountWithId(context, accountId);
if (account == null) return;
if ((account.mFlags & ACCOUNT_MAILBOX_CHANGE_FLAG) != 0) {
Log.w(Logging.LOG_TAG, "Account " + account.mDisplayName +
LogUtils.w(Logging.LOG_TAG, "Account " + account.mDisplayName +
" has inconsistent mailbox data; fixing up...");
// Set all account mailboxes to uninitialized parent key
ContentValues values = new ContentValues();

View File

@ -17,9 +17,9 @@ package com.android.emailcommon.service;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.util.Log;
import com.android.emailcommon.service.IEmailServiceCallback.Stub;
import com.android.mail.utils.LogUtils;
public class EmailServiceCallback extends Stub {
@ -47,7 +47,8 @@ public class EmailServiceCallback extends Stub {
} catch (RuntimeException e) {
// We don't want an exception in one call to prevent other calls, so
// we'll just log this and continue
Log.e("EmailServiceCallback", "Caught RuntimeException in broadcast", e);
LogUtils.e("EmailServiceCallback", "Caught RuntimeException in broadcast",
e);
}
}
} finally {

View File

@ -21,7 +21,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.android.emailcommon.Api;
import com.android.emailcommon.Device;
@ -30,6 +29,7 @@ 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;
import java.io.IOException;
@ -221,7 +221,7 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService {
} else {
Bundle bundle = (Bundle) mReturn;
bundle.setClassLoader(Policy.class.getClassLoader());
Log.v(TAG, "validate returns " + bundle.getInt(VALIDATE_BUNDLE_RESULT_CODE));
LogUtils.v(TAG, "validate returns " + bundle.getInt(VALIDATE_BUNDLE_RESULT_CODE));
return bundle;
}
}
@ -252,7 +252,8 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService {
} else {
Bundle bundle = (Bundle) mReturn;
bundle.setClassLoader(HostAuth.class.getClassLoader());
Log.v(TAG, "autoDiscover returns " + bundle.getInt(AUTO_DISCOVER_BUNDLE_ERROR_CODE));
LogUtils.v(TAG, "autoDiscover returns "
+ bundle.getInt(AUTO_DISCOVER_BUNDLE_ERROR_CODE));
return bundle;
}
}

View File

@ -19,10 +19,10 @@ package com.android.emailcommon.service;
import android.content.Context;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.Policy;
import com.android.mail.utils.LogUtils;
public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
private static final boolean DEBUG_PROXY = false; // DO NOT CHECK THIS IN SET TO TRUE
@ -40,6 +40,7 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
mService = IPolicyService.Stub.asInterface(binder);
}
@Override
public IBinder asBinder() {
return null;
}
@ -47,13 +48,14 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
@Override
public boolean isActive(final Policy arg0) throws RemoteException {
setTask(new ProxyTask() {
@Override
public void run() throws RemoteException {
mReturn = mService.isActive(arg0);
}
}, "isActive");
waitForCompletion();
if (DEBUG_PROXY) {
Log.v(TAG, "isActive: " + ((mReturn == null) ? "null" : mReturn));
LogUtils.v(TAG, "isActive: " + ((mReturn == null) ? "null" : mReturn));
}
if (mReturn == null) {
throw new ServiceUnavailableException("isActive");
@ -66,6 +68,7 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
public void setAccountPolicy(final long accountId, final Policy policy,
final String securityKey) throws RemoteException {
setTask(new ProxyTask() {
@Override
public void run() throws RemoteException {
mService.setAccountPolicy(accountId, policy, securityKey);
}
@ -76,6 +79,7 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
@Override
public void remoteWipe() throws RemoteException {
setTask(new ProxyTask() {
@Override
public void run() throws RemoteException {
mService.remoteWipe();
}
@ -85,6 +89,7 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService {
@Override
public void setAccountHoldFlag(final long arg0, final boolean arg1) throws RemoteException {
setTask(new ProxyTask() {
@Override
public void run() throws RemoteException {
mService.setAccountHoldFlag(arg0, arg1);
}

View File

@ -26,7 +26,8 @@ import android.os.Debug;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
import com.android.mail.utils.LogUtils;
/**
* ServiceProxy is a superclass for proxy objects which make a single call to a service. It handles
@ -96,7 +97,7 @@ public abstract class ServiceProxy {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
if (DEBUG_PROXY) {
Log.v(mTag, "Connected: " + name.getShortClassName() + " at " +
LogUtils.v(mTag, "Connected: " + name.getShortClassName() + " at " +
(System.currentTimeMillis() - mStartTime) + "ms");
}
@ -122,7 +123,7 @@ public abstract class ServiceProxy {
mTaskCompleted = true;
synchronized(mConnection) {
if (DEBUG_PROXY) {
Log.v(mTag, "Task " + mName + " completed; disconnecting");
LogUtils.v(mTag, "Task " + mName + " completed; disconnecting");
}
mConnection.notify();
}
@ -134,7 +135,7 @@ public abstract class ServiceProxy {
@Override
public void onServiceDisconnected(ComponentName name) {
if (DEBUG_PROXY) {
Log.v(mTag, "Disconnected: " + name.getShortClassName() + " at " +
LogUtils.v(mTag, "Disconnected: " + name.getShortClassName() + " at " +
(System.currentTimeMillis() - mStartTime) + "ms");
}
}
@ -162,7 +163,7 @@ public abstract class ServiceProxy {
mTask = task;
mStartTime = System.currentTimeMillis();
if (DEBUG_PROXY) {
Log.v(mTag, "Bind requested for task " + mName);
LogUtils.v(mTag, "Bind requested for task " + mName);
}
return mContext.bindService(mIntent, mConnection, Context.BIND_AUTO_CREATE);
}
@ -187,14 +188,14 @@ public abstract class ServiceProxy {
long time = System.currentTimeMillis();
try {
if (DEBUG_PROXY) {
Log.v(mTag, "Waiting for task " + mName + " to complete...");
LogUtils.v(mTag, "Waiting for task " + mName + " to complete...");
}
mConnection.wait(mTimeout * 1000L);
} catch (InterruptedException e) {
// Can be ignored safely
}
if (DEBUG_PROXY) {
Log.v(mTag, "Wait for " + mName +
LogUtils.v(mTag, "Wait for " + mName +
(mTaskCompleted ? " finished in " : " timed out in ") +
(System.currentTimeMillis() - time) + "ms");
}
@ -211,7 +212,7 @@ public abstract class ServiceProxy {
@Override
public void run() throws RemoteException {
if (DEBUG_PROXY) {
Log.v(mTag, "Connection test succeeded in " +
LogUtils.v(mTag, "Connection test succeeded in " +
(System.currentTimeMillis() - mStartTime) + "ms");
}
}

View File

@ -26,7 +26,6 @@ import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.MimeTypeMap;
import com.android.emailcommon.Logging;
@ -37,6 +36,7 @@ import com.android.emailcommon.provider.EmailContent.BodyColumns;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.EmailContent.MessageColumns;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import org.apache.commons.io.IOUtils;
@ -365,7 +365,7 @@ public class AttachmentUtilities {
for (File file : files) {
boolean result = file.delete();
if (!result) {
Log.e(Logging.LOG_TAG, "Failed to delete attachment file " + file.getName());
LogUtils.e(Logging.LOG_TAG, "Failed to delete attachment file " + file.getName());
}
}
}
@ -418,7 +418,8 @@ public class AttachmentUtilities {
contentUri = dm.getUriForDownloadedFile(id).toString();
} else {
Log.w(Logging.LOG_TAG, "Trying to save an attachment without external storage?");
LogUtils.w(Logging.LOG_TAG,
"Trying to save an attachment without external storage?");
throw new IOException();
}

View File

@ -18,13 +18,12 @@
package com.android.emailcommon.utility;
import android.content.Context;
import android.net.SSLCertificateSocketFactory;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.SSLUtils.KeyChainKeyManager;
import com.android.emailcommon.utility.SSLUtils.TrackingKeyManager;
import com.android.mail.utils.LogUtils;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
@ -97,7 +96,7 @@ public class EmailClientConnectionManager extends ThreadSafeClientConnManager {
Scheme existing = registry.get(schemeName);
if (existing == null) {
if (LOG_ENABLED) {
Log.i(Logging.LOG_TAG, "Registering socket factory for certificate alias ["
LogUtils.i(Logging.LOG_TAG, "Registering socket factory for certificate alias ["
+ hostAuth.mClientCertAlias + "]");
}
KeyManager keyManager =

View File

@ -17,8 +17,7 @@
package com.android.emailcommon.utility;
import com.android.emailcommon.Logging;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.io.FilterInputStream;
import java.io.IOException;
@ -27,7 +26,7 @@ import java.io.InputStream;
/**
* Simple class used for debugging only that affords us a view of the raw IMAP or POP3 stream,
* in addition to the tokenized version.
*
*
* Use of this class *MUST* be restricted to logging-enabled situations only.
*/
public class LoggingInputStream extends FilterInputStream {
@ -44,7 +43,7 @@ public class LoggingInputStream extends FilterInputStream {
mTag = tag + " ";
mDumpEmptyLines = dumpEmptyLines;
initBuffer();
Log.d(Logging.LOG_TAG, mTag + "dump start");
LogUtils.d(Logging.LOG_TAG, mTag + "dump start");
}
private void initBuffer() {
@ -96,7 +95,7 @@ public class LoggingInputStream extends FilterInputStream {
private void flushLog() {
if (mDumpEmptyLines || (mSb.length() > mTag.length())) {
Log.d(Logging.LOG_TAG, mSb.toString());
LogUtils.d(Logging.LOG_TAG, mSb.toString());
initBuffer();
}
}

View File

@ -23,10 +23,10 @@ import android.database.Cursor;
import android.net.SSLCertificateSocketFactory;
import android.security.KeyChain;
import android.security.KeyChainException;
import android.util.Log;
import com.android.emailcommon.provider.EmailContent.HostAuthColumns;
import com.android.emailcommon.provider.HostAuth;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.io.ByteArrayInputStream;
@ -246,7 +246,7 @@ public class SSLUtils {
public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) {
if (LOG_ENABLED) {
InetAddress address = socket.getInetAddress();
Log.i(TAG, "TrackingKeyManager: requesting a client cert alias for "
LogUtils.i(TAG, "TrackingKeyManager: requesting a client cert alias for "
+ address.getCanonicalHostName());
}
mLastTimeCertRequested = System.currentTimeMillis();
@ -256,7 +256,7 @@ public class SSLUtils {
@Override
public X509Certificate[] getCertificateChain(String alias) {
if (LOG_ENABLED) {
Log.i(TAG, "TrackingKeyManager: returning a null cert chain");
LogUtils.i(TAG, "TrackingKeyManager: returning a null cert chain");
}
return null;
}
@ -264,7 +264,7 @@ public class SSLUtils {
@Override
public PrivateKey getPrivateKey(String alias) {
if (LOG_ENABLED) {
Log.i(TAG, "TrackingKeyManager: returning a null private key");
LogUtils.i(TAG, "TrackingKeyManager: returning a null private key");
}
return null;
}
@ -325,9 +325,9 @@ public class SSLUtils {
private static void logError(String alias, String type, Exception ex) {
// Avoid logging PII when explicit logging is not on.
if (LOG_ENABLED) {
Log.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex);
LogUtils.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex);
} else {
Log.e(TAG, "Unable to retrieve " + type + " due to " + ex);
LogUtils.e(TAG, "Unable to retrieve " + type + " due to " + ex);
}
}
@ -342,7 +342,7 @@ public class SSLUtils {
@Override
public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) {
if (LOG_ENABLED) {
Log.i(TAG, "Requesting a client cert alias for " + Arrays.toString(keyTypes));
LogUtils.i(TAG, "Requesting a client cert alias for " + Arrays.toString(keyTypes));
}
return mClientAlias;
}
@ -350,7 +350,7 @@ public class SSLUtils {
@Override
public X509Certificate[] getCertificateChain(String alias) {
if (LOG_ENABLED) {
Log.i(TAG, "Requesting a client certificate chain for alias [" + alias + "]");
LogUtils.i(TAG, "Requesting a client certificate chain for alias [" + alias + "]");
}
return mCertificateChain;
}
@ -358,7 +358,7 @@ public class SSLUtils {
@Override
public PrivateKey getPrivateKey(String alias) {
if (LOG_ENABLED) {
Log.i(TAG, "Requesting a client private key for alias [" + alias + "]");
LogUtils.i(TAG, "Requesting a client private key for alias [" + alias + "]");
}
return mPrivateKey;
}

View File

@ -38,7 +38,6 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.util.Base64;
import android.util.Log;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@ -58,7 +57,6 @@ import com.android.mail.utils.LogUtils;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@ -755,7 +753,7 @@ public class Utility {
return false;
}
} catch (RuntimeException re) {
Log.w(Logging.LOG_TAG, "attachmentExists RuntimeException=" + re);
LogUtils.w(Logging.LOG_TAG, "attachmentExists RuntimeException=" + re);
return false;
}
}
@ -781,7 +779,7 @@ public class Utility {
// alternative. In theory, this situation shouldn't be possible.
if ((att.mFlags & (Attachment.FLAG_DOWNLOAD_FORWARD |
Attachment.FLAG_DOWNLOAD_USER_REQUEST)) == 0) {
Log.d(Logging.LOG_TAG, "Unloaded attachment isn't marked for download: " +
LogUtils.d(Logging.LOG_TAG, "Unloaded attachment isn't marked for download: " +
att.mFileName + ", #" + att.mId);
Account acct = Account.restoreAccountWithId(context, msg.mAccountKey);
if (acct == null) return true;
@ -1027,10 +1025,10 @@ public class Utility {
return;
}
if (c.isClosed()) {
Log.w(Logging.LOG_TAG, "Cursor was closed here: Cursor=" + c,
LogUtils.w(Logging.LOG_TAG, "Cursor was closed here: Cursor=" + c,
getTraceIfAvailable(c));
} else {
Log.w(Logging.LOG_TAG, "Cursor not closed. Cursor=" + c);
LogUtils.w(Logging.LOG_TAG, "Cursor not closed. Cursor=" + c);
}
}

View File

@ -22,11 +22,11 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.util.Log;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Mailbox;
import com.android.mail.utils.LogUtils;
import java.util.concurrent.LinkedBlockingQueue;
@ -205,9 +205,9 @@ public abstract class AbstractSyncService implements Runnable {
public void userLog(String str, Exception e) {
if (mUserLog) {
Log.e(TAG, str, e);
LogUtils.e(TAG, str, e);
} else {
Log.e(TAG, str + e);
LogUtils.e(TAG, str + e);
}
if (mFileLog) {
FileLogger.log(e);
@ -216,7 +216,7 @@ public abstract class AbstractSyncService implements Runnable {
/**
* Standard logging for EAS.
* If user logging is active, we concatenate any arguments and log them using Log.d
* If user logging is active, we concatenate any arguments and log them using LogUtils.d
* We also check for file logging, and log appropriately
* @param strings strings to concatenate and log
*/
@ -232,7 +232,7 @@ public abstract class AbstractSyncService implements Runnable {
}
logText = sb.toString();
}
Log.d(TAG, logText);
LogUtils.d(TAG, logText);
if (mFileLog) {
FileLogger.log(TAG, logText);
}
@ -244,7 +244,7 @@ public abstract class AbstractSyncService implements Runnable {
* @param str the string to log
*/
public void errorLog(String str) {
Log.e(TAG, str);
LogUtils.e(TAG, str);
if (mFileLog) {
FileLogger.log(TAG, str);
}

View File

@ -22,11 +22,11 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.util.Log;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.EmailContent.MessageColumns;
import com.android.emailcommon.provider.ProviderUnavailableException;
import com.android.mail.utils.LogUtils;
import java.util.ArrayList;
@ -54,6 +54,7 @@ public class EmailSyncAlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
new Thread(new Runnable() {
@Override
public void run() {
handleReceive(context);
}
@ -105,7 +106,8 @@ public class EmailSyncAlarmReceiver extends BroadcastReceiver {
SyncManager.serviceRequest(mailboxId, SyncManager.SYNC_UPSYNC);
}
} catch (ProviderUnavailableException e) {
Log.e("EmailSyncAlarmReceiver", "EmailProvider unavailable; aborting alarm receiver");
LogUtils.e("EmailSyncAlarmReceiver",
"EmailProvider unavailable; aborting alarm receiver");
}
}
}

View File

@ -43,7 +43,6 @@ import android.provider.CalendarContract;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.provider.ContactsContract;
import android.util.Log;
import com.android.emailcommon.TempDirectory;
import com.android.emailcommon.provider.Account;
@ -63,9 +62,9 @@ import com.android.emailcommon.service.EmailServiceProxy;
import com.android.emailcommon.service.EmailServiceStatus;
import com.android.emailcommon.service.IEmailServiceCallback.Stub;
import com.android.emailcommon.service.PolicyServiceProxy;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.emailcommon.utility.EmailClientConnectionManager;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import org.apache.http.conn.params.ConnManagerPNames;
import org.apache.http.conn.params.ConnPerRoute;
@ -74,7 +73,6 @@ import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
@ -339,10 +337,11 @@ public abstract class SyncManager extends Service implements Runnable {
if (sFileLog) {
sUserLog = true;
}
Log.d("Sync Debug", "Logging: " + (sUserLog ? "User " : "") + (sFileLog ? "File" : ""));
LogUtils.d("Sync Debug", "Logging: " + (sUserLog ? "User " : "")
+ (sFileLog ? "File" : ""));
}
private boolean onSecurityHold(Account account) {
private static boolean onSecurityHold(Account account) {
return (account.mFlags & Account.FLAGS_SECURITY_HOLD) != 0;
}
@ -688,7 +687,7 @@ public abstract class SyncManager extends Service implements Runnable {
c.close();
}
} catch (ProviderUnavailableException e) {
Log.w(TAG, "Observer failed; provider unavailable");
LogUtils.w(TAG, "Observer failed; provider unavailable");
}
}}, "Calendar Observer").start();
}
@ -850,7 +849,7 @@ public abstract class SyncManager extends Service implements Runnable {
public static void log(String tag, String str) {
if (sUserLog) {
Log.d(tag, str);
LogUtils.d(tag, str);
if (sFileLog) {
FileLogger.log(tag, str);
}
@ -859,7 +858,7 @@ public abstract class SyncManager extends Service implements Runnable {
public static void alwaysLog(String str) {
if (!sUserLog) {
Log.d(TAG, str);
LogUtils.d(TAG, str);
} else {
log(str);
}
@ -1142,7 +1141,8 @@ public abstract class SyncManager extends Service implements Runnable {
// We ignore drafts completely (doesn't sync). Changes in Outbox are
// handled in the checkMailboxes loop, so we can ignore these pings.
if (sUserLog) {
Log.d(TAG, "Alert for mailbox " + id + " (" + m.mDisplayName + ")");
LogUtils.d(TAG, "Alert for mailbox " + id + " ("
+ m.mDisplayName + ")");
}
if (m.mType == Mailbox.TYPE_DRAFTS || m.mType == Mailbox.TYPE_OUTBOX) {
String[] args = new String[] {Long.toString(m.mId)};
@ -1572,12 +1572,12 @@ public abstract class SyncManager extends Service implements Runnable {
// NOTE: Sync adapters will also crash with this error, but that is already handled
// in the adapters themselves, i.e. they return cleanly via done(). When the Email
// process starts running again, remote processes will be started again in due course
Log.e(TAG, "EmailProvider unavailable; shutting down");
LogUtils.e(TAG, "EmailProvider unavailable; shutting down");
// Ask for our service to be restarted; this should kick-start the Email process as well
startService(new Intent(this, SyncManager.class));
} catch (RuntimeException e) {
// Crash; this is a completely unexpected runtime error
Log.e(TAG, "RuntimeException", e);
LogUtils.e(TAG, "RuntimeException", e);
throw e;
} finally {
shutdown();
@ -1737,7 +1737,7 @@ public abstract class SyncManager extends Service implements Runnable {
* @param account the Account in question
* @return whether Email sync is enabled
*/
private boolean canSyncEmail(android.accounts.Account account) {
private static boolean canSyncEmail(android.accounts.Account account) {
return ContentResolver.getSyncAutomatically(account, EmailContent.AUTHORITY);
}

View File

@ -1,11 +1,11 @@
/**
* Copyright (c) 2012, Google Inc.
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -14,15 +14,16 @@
* limitations under the License.
*/
package com.android.mail.utils;
package com.android.email;
public class LogTag {
private static String LOG_TAG = "Email";
import android.app.Application;
/**
* Get the log tag to apply to logging.
*/
public static String getLogTag() {
return LOG_TAG;
import com.android.mail.utils.LogTag;
public class EmailApplication extends Application {
private static final String LOG_TAG = "Email";
static {
LogTag.setLogTag(LOG_TAG);
}
}

View File

@ -27,9 +27,9 @@ import android.net.NetworkInfo.State;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import com.android.email2.ui.MailActivityEmail;
import com.android.mail.utils.LogUtils;
/**
* Encapsulates functionality of ConnectivityManager for use in the Email application. In
@ -182,14 +182,14 @@ public class EmailConnectivityManager extends BroadcastReceiver {
// We're done if there's an active network
if (waiting) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, mName + ": Connectivity wait ended");
LogUtils.d(TAG, mName + ": Connectivity wait ended");
}
}
return;
} else {
if (!waiting) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, mName + ": Connectivity waiting...");
LogUtils.d(TAG, mName + ": Connectivity waiting...");
}
waiting = true;
}

View File

@ -21,7 +21,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.internet.MimeBodyPart;
@ -42,6 +41,7 @@ import com.android.emailcommon.provider.EmailContent.AttachmentColumns;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.AttachmentUtilities;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import org.apache.commons.io.IOUtils;
@ -227,7 +227,7 @@ public class LegacyConversions {
localAttachment.mAccountKey = localMessage.mAccountKey;
if (DEBUG_ATTACHMENTS) {
Log.d(Logging.LOG_TAG, "Add attachment " + localAttachment);
LogUtils.d(Logging.LOG_TAG, "Add attachment " + localAttachment);
}
// To prevent duplication - do we already have a matching attachment?
@ -253,7 +253,7 @@ public class LegacyConversions {
attachmentFoundInDb = true;
localAttachment.mId = dbAttachment.mId;
if (DEBUG_ATTACHMENTS) {
Log.d(Logging.LOG_TAG, "Skipped, found db attachment " + dbAttachment);
LogUtils.d(Logging.LOG_TAG, "Skipped, found db attachment " + dbAttachment);
}
break;
}
@ -364,14 +364,14 @@ public class LegacyConversions {
addTextBodyPart(mp, "text/html", null,
EmailContent.Body.restoreBodyHtmlWithMessageId(context, localMessage.mId));
} catch (RuntimeException rte) {
Log.d(Logging.LOG_TAG, "Exception while reading html body " + rte.toString());
LogUtils.d(Logging.LOG_TAG, "Exception while reading html body " + rte.toString());
}
try {
addTextBodyPart(mp, "text/plain", null,
EmailContent.Body.restoreBodyTextWithMessageId(context, localMessage.mId));
} catch (RuntimeException rte) {
Log.d(Logging.LOG_TAG, "Exception while reading text body " + rte.toString());
LogUtils.d(Logging.LOG_TAG, "Exception while reading text body " + rte.toString());
}
boolean isReply = (localMessage.mFlags & EmailContent.Message.FLAG_TYPE_REPLY) != 0;
@ -385,7 +385,7 @@ public class LegacyConversions {
addTextBodyPart(mp, "text/plain", BODY_QUOTED_PART_INTRO,
EmailContent.Body.restoreIntroTextWithMessageId(context, localMessage.mId));
} catch (RuntimeException rte) {
Log.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
LogUtils.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
}
String replyTag = isReply ? BODY_QUOTED_PART_REPLY : BODY_QUOTED_PART_FORWARD;
@ -393,14 +393,14 @@ public class LegacyConversions {
addTextBodyPart(mp, "text/html", replyTag,
EmailContent.Body.restoreReplyHtmlWithMessageId(context, localMessage.mId));
} catch (RuntimeException rte) {
Log.d(Logging.LOG_TAG, "Exception while reading html reply " + rte.toString());
LogUtils.d(Logging.LOG_TAG, "Exception while reading html reply " + rte.toString());
}
try {
addTextBodyPart(mp, "text/plain", replyTag,
EmailContent.Body.restoreReplyTextWithMessageId(context, localMessage.mId));
} catch (RuntimeException rte) {
Log.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
LogUtils.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
}
}

View File

@ -19,11 +19,10 @@ package com.android.email;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import org.json.JSONArray;
import org.json.JSONException;
@ -273,7 +272,7 @@ public class Preferences {
mTrustedSenders = parseEmailSet(mSharedPreferences.getString(TRUSTED_SENDERS, ""));
} catch (JSONException e) {
// Something went wrong, and the data is corrupt. Just clear it to be safe.
Log.w(Logging.LOG_TAG, "Trusted sender set corrupted. Clearing");
LogUtils.w(Logging.LOG_TAG, "Trusted sender set corrupted. Clearing");
mSharedPreferences.edit().putString(TRUSTED_SENDERS, "").apply();
mTrustedSenders = new HashSet<String>();
}
@ -348,8 +347,7 @@ public class Preferences {
* It should only be shown once per account.
*/
public boolean getHasShownRequireManualSync(Context context, Account account) {
return getBoolean(context, account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN,
false);
return getBoolean(account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN, false);
}
/**
@ -357,7 +355,7 @@ public class Preferences {
* It should only be shown once per account.
*/
public void setHasShownRequireManualSync(Context context, Account account, boolean value) {
setBoolean(context, account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN, value);
setBoolean(account.getEmailAddress(), REQUIRE_MANUAL_SYNC_DIALOG_SHOWN, value);
}
@ -378,7 +376,7 @@ public class Preferences {
public void dump() {
if (Logging.LOGD) {
for (String key : mSharedPreferences.getAll().keySet()) {
Log.v(Logging.LOG_TAG, key + " = " + mSharedPreferences.getAll().get(key));
LogUtils.v(Logging.LOG_TAG, key + " = " + mSharedPreferences.getAll().get(key));
}
}
}
@ -386,21 +384,21 @@ public class Preferences {
/**
* Utility method for setting a boolean value on a per-account preference.
*/
private void setBoolean(Context context, String account, String key, Boolean value) {
private void setBoolean(String account, String key, Boolean value) {
mSharedPreferences.edit().putBoolean(makeKey(account, key), value).apply();
}
/**
* Utility method for getting a boolean value from a per-account preference.
*/
private boolean getBoolean(Context context, String account, String key, boolean def) {
private boolean getBoolean(String account, String key, boolean def) {
return mSharedPreferences.getBoolean(makeKey(account, key), def);
}
/**
* Utility method for creating a per account preference key.
*/
private String makeKey(String account, String key) {
private static String makeKey(String account, String key) {
return account != null ? account + "-" + key : key;
}
}

View File

@ -31,7 +31,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import com.android.email.provider.EmailProvider;
import com.android.email.service.EmailBroadcastProcessorService;
@ -45,6 +44,7 @@ import com.android.emailcommon.provider.EmailContent.PolicyColumns;
import com.android.emailcommon.provider.Policy;
import com.android.emailcommon.utility.TextUtilities;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
@ -140,7 +140,7 @@ public class SecurityPolicy {
while (c.moveToNext()) {
policy.restore(c);
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Aggregate from: " + policy);
LogUtils.d(TAG, "Aggregate from: " + policy);
}
aggregate.mPasswordMinLength =
Math.max(policy.mPasswordMinLength, aggregate.mPasswordMinLength);
@ -185,12 +185,12 @@ public class SecurityPolicy {
if (aggregate.mPasswordComplexChars == Integer.MIN_VALUE)
aggregate.mPasswordComplexChars = 0;
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Calculated Aggregate: " + aggregate);
LogUtils.d(TAG, "Calculated Aggregate: " + aggregate);
}
return aggregate;
}
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Calculated Aggregate: no policy");
LogUtils.d(TAG, "Calculated Aggregate: no policy");
}
return Policy.NO_POLICY;
}
@ -232,7 +232,7 @@ public class SecurityPolicy {
*/
public void reducePolicies() {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "reducePolicies");
LogUtils.d(TAG, "reducePolicies");
}
policiesUpdated();
}
@ -268,7 +268,7 @@ public class SecurityPolicy {
if ((reasons & INACTIVE_PROTOCOL_POLICIES) != 0) {
sb.append("protocol ");
}
Log.d(TAG, sb.toString());
LogUtils.d(TAG, sb.toString());
}
return reasons == 0;
}
@ -411,12 +411,12 @@ public class SecurityPolicy {
// if empty set, detach from policy manager
if (aggregatePolicy == Policy.NO_POLICY) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "setActivePolicies: none, remove admin");
LogUtils.d(TAG, "setActivePolicies: none, remove admin");
}
dpm.removeActiveAdmin(mAdminName);
} else if (isActiveAdmin()) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "setActivePolicies: " + aggregatePolicy);
LogUtils.d(TAG, "setActivePolicies: " + aggregatePolicy);
}
// set each policy in the policy manager
// password mode & length
@ -496,7 +496,7 @@ public class SecurityPolicy {
Policy policy = Policy.restorePolicyWithId(mContext, account.mPolicyKey);
if (policy == null) return;
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "policiesRequired for " + account.mDisplayName + ": " + policy);
LogUtils.d(TAG, "policiesRequired for " + account.mDisplayName + ": " + policy);
}
// Mark the account as "on hold".
@ -593,7 +593,7 @@ public class SecurityPolicy {
boolean policyChanged = (oldPolicy == null) || !oldPolicy.equals(policy);
if (!policyChanged && (TextUtilities.stringOrNullEquals(securityKey,
account.mSecuritySyncKey))) {
Log.d(Logging.LOG_TAG, "setAccountPolicy; policy unchanged");
LogUtils.d(Logging.LOG_TAG, "setAccountPolicy; policy unchanged");
} else {
setAccountPolicy(mContext, account, policy, securityKey);
policiesUpdated();
@ -602,7 +602,7 @@ public class SecurityPolicy {
boolean setHold = false;
if (policy.mProtocolPoliciesUnsupported != null) {
// We can't support this, reasons in unsupportedRemotePolicies
Log.d(Logging.LOG_TAG,
LogUtils.d(Logging.LOG_TAG,
"Notify policies for " + account.mDisplayName + " not supported.");
setHold = true;
NotificationController.getInstance(mContext).showSecurityUnsupportedNotification(
@ -612,16 +612,17 @@ public class SecurityPolicy {
mContext.getContentResolver().delete(uri, null, null);
} else if (isActive(policy)) {
if (policyChanged) {
Log.d(Logging.LOG_TAG, "Notify policies for " + account.mDisplayName + " changed.");
LogUtils.d(Logging.LOG_TAG, "Notify policies for " + account.mDisplayName
+ " changed.");
// Notify that policies changed
NotificationController.getInstance(mContext).showSecurityChangedNotification(
account);
} else {
Log.d(Logging.LOG_TAG, "Policy is active and unchanged; do not notify.");
LogUtils.d(Logging.LOG_TAG, "Policy is active and unchanged; do not notify.");
}
} else {
setHold = true;
Log.d(Logging.LOG_TAG, "Notify policies for " + account.mDisplayName +
LogUtils.d(Logging.LOG_TAG, "Notify policies for " + account.mDisplayName +
" are not being enforced.");
// Put up a notification
NotificationController.getInstance(mContext).showSecurityNeededNotification(account);
@ -647,7 +648,7 @@ public class SecurityPolicy {
if (dpm.isAdminActive(mAdminName)) {
dpm.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE);
} else {
Log.d(Logging.LOG_TAG, "Could not remote wipe because not device admin.");
LogUtils.d(Logging.LOG_TAG, "Could not remote wipe because not device admin.");
}
}
/**
@ -687,7 +688,7 @@ public class SecurityPolicy {
Cursor c = cr.query(Account.CONTENT_URI, EmailContent.ID_PROJECTION,
Account.SECURITY_NONZERO_SELECTION, null, null);
try {
Log.w(TAG, "Email administration disabled; deleting " + c.getCount() +
LogUtils.w(TAG, "Email administration disabled; deleting " + c.getCount() +
" secured account(s)");
while (c.moveToNext()) {
long accountId = c.getLong(EmailContent.ID_PROJECTION_COLUMN);

View File

@ -17,9 +17,9 @@
package com.android.email;
import com.android.emailcommon.Logging;
import com.android.mail.utils.LogUtils;
import android.os.SystemClock;
import android.util.Log;
/**
* A simple class to measure elapsed time.
@ -43,7 +43,7 @@ public class StopWatch {
mName = name;
mStart = getCurrentTime();
mLastSplit = mStart;
Log.w(Logging.LOG_TAG, "StopWatch(" + mName + ") start");
LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") start");
}
public static StopWatch start(String name) {
@ -53,14 +53,13 @@ public class StopWatch {
public void split(String label) {
long now = getCurrentTime() ;
long elapse = now - mLastSplit;
Log.w(Logging.LOG_TAG, "StopWatch(" + mName + ") split(" + label + ") " + elapse);
LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") split(" + label + ") " + elapse);
mLastSplit = now;
}
public void stop() {
long now = getCurrentTime();
long elapse = now - mLastSplit;
Log.w(Logging.LOG_TAG, "StopWatch(" + mName + ") stop: "
LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") stop: "
+ (now - mLastSplit)
+ " (total " + (now - mStart) + ")");
}

View File

@ -28,10 +28,10 @@ import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.StatusUpdates;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
/**
@ -134,7 +134,7 @@ public class ContactStatusLoader extends AsyncTaskLoader<ContactStatusLoader.Res
try {
photo = BitmapFactory.decodeByteArray(photoData, 0, photoData.length, null);
} catch (OutOfMemoryError e) {
Log.d(Logging.LOG_TAG, "Decoding bitmap failed with " + e.getMessage());
LogUtils.d(Logging.LOG_TAG, "Decoding bitmap failed with " + e.getMessage());
}
}
}

View File

@ -28,7 +28,6 @@ import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.R;
import com.android.email.mail.Sender;
@ -42,6 +41,7 @@ import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Policy;
import com.android.emailcommon.service.EmailServiceProxy;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
/**
* Check incoming or outgoing settings, or perform autodiscovery.
@ -440,7 +440,7 @@ public class AccountCheckSettingsFragment extends Fragment {
if ((mMode & SetupData.CHECK_AUTODISCOVER) != 0) {
if (isCancelled()) return null;
publishProgress(STATE_CHECK_AUTODISCOVER);
Log.d(Logging.LOG_TAG, "Begin auto-discover for " + mCheckEmail);
LogUtils.d(Logging.LOG_TAG, "Begin auto-discover for " + mCheckEmail);
Store store = Store.getInstance(mAccount, mContext);
Bundle result = store.autoDiscover(mContext, mCheckEmail, mCheckPassword);
// Result will be one of:
@ -467,7 +467,7 @@ public class AccountCheckSettingsFragment extends Fragment {
// Check Incoming Settings
if ((mMode & SetupData.CHECK_INCOMING) != 0) {
if (isCancelled()) return null;
Log.d(Logging.LOG_TAG, "Begin check of incoming email settings");
LogUtils.d(Logging.LOG_TAG, "Begin check of incoming email settings");
publishProgress(STATE_CHECK_INCOMING);
Store store = Store.getInstance(mAccount, mContext);
Bundle bundle = store.checkSettings();
@ -511,7 +511,7 @@ public class AccountCheckSettingsFragment extends Fragment {
// Check Outgoing Settings
if (info.usesSmtp && (mMode & SetupData.CHECK_OUTGOING) != 0) {
if (isCancelled()) return null;
Log.d(Logging.LOG_TAG, "Begin check of outgoing email settings");
LogUtils.d(Logging.LOG_TAG, "Begin check of outgoing email settings");
publishProgress(STATE_CHECK_OUTGOING);
Sender sender = Sender.getInstance(mContext, mAccount);
sender.close();
@ -660,7 +660,7 @@ public class AccountCheckSettingsFragment extends Fragment {
// Belt and suspenders here; there should always be a non-empty array here
String[] unsupportedPolicies = (String[]) ex.getExceptionData();
if (unsupportedPolicies == null) {
Log.w(TAG, "No data for unsupported policies?");
LogUtils.w(TAG, "No data for unsupported policies?");
break;
}
// Build a string, concatenating policies we don't support

View File

@ -27,7 +27,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import com.android.email.R;
import com.android.email.SecurityPolicy;
@ -36,6 +35,7 @@ import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
/**
* Psuedo-activity (no UI) to bootstrap the user up to a higher desired security level. This
@ -130,7 +130,7 @@ public class AccountSecurity extends Activity {
PasswordExpirationDialog.newInstance(mAccount.getDisplayName(),
passwordExpired);
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Showing password expiration dialog");
LogUtils.d(TAG, "Showing password expiration dialog");
}
dialog.show(fm, "password_expiration");
}
@ -146,7 +146,7 @@ public class AccountSecurity extends Activity {
SecurityNeededDialog dialog =
SecurityNeededDialog.newInstance(mAccount.getDisplayName());
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Showing security needed dialog");
LogUtils.d(TAG, "Showing security needed dialog");
}
dialog.show(fm, "security_needed");
}
@ -187,7 +187,7 @@ public class AccountSecurity extends Activity {
if (!security.isActiveAdmin()) {
if (mTriedAddAdministrator) {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Not active admin: repost notification");
LogUtils.d(TAG, "Not active admin: repost notification");
}
repostNotification(account, security);
finish();
@ -197,13 +197,13 @@ public class AccountSecurity extends Activity {
HostAuth hostAuth = HostAuth.restoreHostAuthWithId(this, account.mHostAuthKeyRecv);
if (hostAuth == null) {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "No HostAuth: repost notification");
LogUtils.d(TAG, "No HostAuth: repost notification");
}
repostNotification(account, security);
finish();
} else {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Not active admin: post initial notification");
LogUtils.d(TAG, "Not active admin: post initial notification");
}
// try to become active - must happen here in activity, to get result
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
@ -222,7 +222,7 @@ public class AccountSecurity extends Activity {
// DevicePolicyManager (the current system security level).
if (security.isActive(null)) {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Security active; clear holds");
LogUtils.d(TAG, "Security active; clear holds");
}
Account.clearSecurityHoldOnAllAccounts(this);
security.syncAccount(account);
@ -242,13 +242,13 @@ public class AccountSecurity extends Activity {
if ((inactiveReasons & SecurityPolicy.INACTIVE_NEED_PASSWORD) != 0) {
if (mTriedSetPassword) {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Password needed; repost notification");
LogUtils.d(TAG, "Password needed; repost notification");
}
repostNotification(account, security);
finish();
} else {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Password needed; request it via DPM");
LogUtils.d(TAG, "Password needed; request it via DPM");
}
mTriedSetPassword = true;
// launch the activity to have the user set a new password.
@ -262,13 +262,13 @@ public class AccountSecurity extends Activity {
if ((inactiveReasons & SecurityPolicy.INACTIVE_NEED_ENCRYPTION) != 0) {
if (mTriedSetEncryption) {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Encryption needed; repost notification");
LogUtils.d(TAG, "Encryption needed; repost notification");
}
repostNotification(account, security);
finish();
} else {
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Encryption needed; request it via DPM");
LogUtils.d(TAG, "Encryption needed; request it via DPM");
}
mTriedSetEncryption = true;
// launch the activity to start up encryption.
@ -280,7 +280,7 @@ public class AccountSecurity extends Activity {
// Step 7. No problems were found, so clear holds and exit
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Policies enforced; clear holds");
LogUtils.d(TAG, "Policies enforced; clear holds");
}
Account.clearSecurityHoldOnAllAccounts(this);
security.syncAccount(account);
@ -335,7 +335,7 @@ public class AccountSecurity extends Activity {
b.setPositiveButton(R.string.okay_action, this);
b.setNegativeButton(R.string.cancel_action, this);
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "Posting security needed dialog");
LogUtils.d(TAG, "Posting security needed dialog");
}
return b.create();
}
@ -352,13 +352,13 @@ public class AccountSecurity extends Activity {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "User accepts; advance to next step");
LogUtils.d(TAG, "User accepts; advance to next step");
}
activity.tryAdvanceSecurity(activity.mAccount);
break;
case DialogInterface.BUTTON_NEGATIVE:
if (MailActivityEmail.DEBUG || DEBUG) {
Log.d(TAG, "User declines; repost notification");
LogUtils.d(TAG, "User declines; repost notification");
}
activity.repostNotification(
activity.mAccount, SecurityPolicy.getInstance(activity));

View File

@ -35,7 +35,6 @@ import android.preference.PreferenceActivity;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@ -53,6 +52,7 @@ import com.android.emailcommon.utility.IntentUtilities;
import com.android.emailcommon.utility.Utility;
import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider.EditSettingsExtras;
import com.android.mail.utils.LogUtils;
import java.util.List;
@ -656,7 +656,7 @@ public class AccountSettings extends PreferenceActivity {
startPreferencePanel(AccountSettingsEditQuickResponsesFragment.class.getName(), args,
R.string.account_settings_edit_quick_responses_label, null, null, 0);
} catch (Exception e) {
Log.d(Logging.LOG_TAG, "Error while trying to invoke edit quick responses.", e);
LogUtils.d(Logging.LOG_TAG, "Error while trying to invoke edit quick responses.", e);
}
}
@ -670,7 +670,7 @@ public class AccountSettings extends PreferenceActivity {
AccountSetupIncomingFragment.getSettingsModeArgs(),
R.string.account_settings_incoming_label, null, null, 0);
} catch (Exception e) {
Log.d(Logging.LOG_TAG, "Error while trying to invoke store settings.", e);
LogUtils.d(Logging.LOG_TAG, "Error while trying to invoke store settings.", e);
}
}
@ -694,7 +694,7 @@ public class AccountSettings extends PreferenceActivity {
}
}
} catch (Exception e) {
Log.d(Logging.LOG_TAG, "Error while trying to invoke sender settings.", e);
LogUtils.d(Logging.LOG_TAG, "Error while trying to invoke sender settings.", e);
}
}

View File

@ -24,6 +24,7 @@ import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.QuickResponse;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.mail.utils.LogUtils;
import android.app.Activity;
import android.app.Fragment;
@ -32,7 +33,6 @@ import android.content.Context;
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -226,7 +226,7 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
@Override
public void onCreate(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsEditQuickResponsesFragment onCreate");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsEditQuickResponsesFragment onCreate");
}
super.onCreate(savedInstanceState);
@ -239,7 +239,7 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsEditQuickResponsesFragment onCreateView");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsEditQuickResponsesFragment onCreateView");
}
int layoutId = R.layout.account_settings_edit_quick_responses_fragment;
View view = inflater.inflate(layoutId, container, false);

View File

@ -39,7 +39,6 @@ import android.provider.CalendarContract;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.R;
import com.android.email.SecurityPolicy;
@ -59,6 +58,7 @@ import com.android.mail.preferences.AccountPreferences;
import com.android.mail.preferences.FolderPreferences;
import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.NotificationUtils;
import java.util.ArrayList;
@ -188,7 +188,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onCreate(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onCreate");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onCreate");
}
super.onCreate(savedInstanceState);
@ -212,7 +212,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onActivityCreated(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onActivityCreated");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onActivityCreated");
}
super.onActivityCreated(savedInstanceState);
}
@ -223,7 +223,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onStart() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onStart");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onStart");
}
super.onStart();
mStarted = true;
@ -242,7 +242,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onResume() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onResume");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onResume");
}
super.onResume();
@ -271,7 +271,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onPause() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onPause");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onPause");
}
super.onPause();
if (mSaveOnExit) {
@ -285,7 +285,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onStop() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onStop");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onStop");
}
super.onStop();
mStarted = false;
@ -394,7 +394,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onDestroy() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onDestroy");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onDestroy");
}
super.onDestroy();
@ -405,7 +405,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
@Override
public void onSaveInstanceState(Bundle outState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSettingsFragment onSaveInstanceState");
LogUtils.d(Logging.LOG_TAG, "AccountSettingsFragment onSaveInstanceState");
}
super.onSaveInstanceState(outState);
}

View File

@ -22,7 +22,6 @@ import android.content.Context;
import android.content.res.XmlResourceParser;
import android.text.Editable;
import android.text.TextUtils;
import android.util.Log;
import android.widget.EditText;
import com.android.email.R;
@ -31,14 +30,12 @@ import com.android.emailcommon.Logging;
import com.android.emailcommon.VendorPolicyLoader;
import com.android.emailcommon.VendorPolicyLoader.Provider;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.QuickResponse;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.io.Serializable;
public class AccountSettingsUtils {
/** Pattern to match any part of a domain */
@ -146,7 +143,7 @@ public class AccountSettingsUtils {
provider.note = getXmlAttribute(context, xml, "note");
}
} catch (IllegalArgumentException e) {
Log.w(Logging.LOG_TAG, "providers line: " + xml.getLineNumber() +
LogUtils.w(Logging.LOG_TAG, "providers line: " + xml.getLineNumber() +
"; Domain contains multiple globals");
}
}
@ -170,7 +167,7 @@ public class AccountSettingsUtils {
}
}
catch (Exception e) {
Log.e(Logging.LOG_TAG, "Error while trying to load provider settings.", e);
LogUtils.e(Logging.LOG_TAG, "Error while trying to load provider settings.", e);
}
return null;
}

View File

@ -18,7 +18,8 @@ package com.android.email.activity.setup;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.android.mail.utils.LogUtils;
/**
* Superclass of all of the account setup activities; ensures that SetupData state is saved/restored
@ -32,7 +33,7 @@ public class AccountSetupActivity extends Activity {
SetupData.restore(savedInstanceState);
super.onCreate(savedInstanceState);
if (DEBUG_SETUP_FLOWS) {
Log.d(getClass().getName(), SetupData.debugString());
LogUtils.d(getClass().getName(), SetupData.debugString());
}
}

View File

@ -32,7 +32,6 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@ -53,6 +52,7 @@ import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.service.ServiceProxy;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import java.net.URISyntaxException;
import java.util.concurrent.Callable;
@ -294,7 +294,7 @@ public class AccountSetupBasics extends AccountSetupActivity
if (SetupData.getFlowMode() == SetupData.FLOW_MODE_FORCE_CREATE) {
if (!DEBUG_ALLOW_NON_TEST_HARNESS_CREATION &&
!ActivityManager.isRunningInTestHarness()) {
Log.e(Logging.LOG_TAG,
LogUtils.e(Logging.LOG_TAG,
"ERROR: Force account create only allowed while in test harness");
finish();
return;
@ -305,8 +305,8 @@ public class AccountSetupBasics extends AccountSetupActivity
String outgoing = intent.getStringExtra(EXTRA_CREATE_ACCOUNT_OUTGOING);
if (TextUtils.isEmpty(email) || TextUtils.isEmpty(user) ||
TextUtils.isEmpty(incoming) || TextUtils.isEmpty(outgoing)) {
Log.e(Logging.LOG_TAG, "ERROR: Force account create requires extras EMAIL, USER, " +
"INCOMING, OUTGOING");
LogUtils.e(Logging.LOG_TAG, "ERROR: Force account create requires extras EMAIL, " +
"USER, INCOMING, OUTGOING");
finish();
return;
}

View File

@ -25,7 +25,6 @@ import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -97,7 +96,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onCreate(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onCreate");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onCreate");
}
super.onCreate(savedInstanceState);
@ -111,7 +110,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onCreateView");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onCreateView");
}
int layoutId = mSettingsMode
? R.layout.account_settings_incoming_fragment
@ -182,20 +181,25 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
// Updates the port when the user changes the security type. This allows
// us to show a reasonable default which the user can change.
mSecurityTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
updatePortFromSecurityType();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) { }
});
// After any text edits, call validateFields() which enables or disables the Next button
TextWatcher validationTextWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
validateFields();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) { }
};
// We're editing an existing account; don't allow modification of the user name
@ -220,7 +224,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onActivityCreated(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onActivityCreated");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onActivityCreated");
}
super.onActivityCreated(savedInstanceState);
mClientCertificateSelector.setHostActivity(this);
@ -232,7 +236,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onStart() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onStart");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onStart");
}
super.onStart();
mStarted = true;
@ -246,7 +250,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onResume() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onResume");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onResume");
}
super.onResume();
validateFields();
@ -255,7 +259,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onPause() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onPause");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onPause");
}
super.onPause();
}
@ -266,7 +270,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onStop() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onStop");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onStop");
}
super.onStop();
mStarted = false;
@ -278,7 +282,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onDestroy() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onDestroy");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onDestroy");
}
super.onDestroy();
}
@ -286,7 +290,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
@Override
public void onSaveInstanceState(Bundle outState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onSaveInstanceState");
LogUtils.d(Logging.LOG_TAG, "AccountSetupIncomingFragment onSaveInstanceState");
}
super.onSaveInstanceState(outState);
@ -510,7 +514,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
serverPort = Integer.parseInt(mPortView.getText().toString().trim());
} catch (NumberFormatException e) {
serverPort = getPortFromSecurityType(getSslSelected());
Log.d(Logging.LOG_TAG, "Non-integer server port; using '" + serverPort + "'");
LogUtils.d(Logging.LOG_TAG, "Non-integer server port; using '" + serverPort + "'");
}
int securityType = (Integer) ((SpinnerOption) mSecurityTypeView.getSelectedItem()).value;
recvAuth.setConnection(mBaseScheme, serverAddress, serverPort, securityType);

View File

@ -28,10 +28,8 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
@ -41,7 +39,6 @@ import android.widget.Spinner;
import com.android.email.R;
import com.android.email.activity.ActivityHelper;
import com.android.email.activity.UiUtilities;
import com.android.email.provider.EmailProvider;
import com.android.email.service.EmailServiceUtils;
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
import com.android.email.service.MailService;
@ -53,17 +50,11 @@ import com.android.emailcommon.service.EmailServiceProxy;
import com.android.emailcommon.service.SyncWindow;
import com.android.emailcommon.utility.Utility;
import com.android.mail.preferences.AccountPreferences;
import com.android.mail.preferences.FolderPreferences;
import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogTag;
import com.android.mail.utils.LogUtils;
import java.io.IOException;
public class AccountSetupOptions extends AccountSetupActivity implements OnClickListener {
private static final String LOG_TAG = LogTag.getLogTag();
private Spinner mCheckFrequencyView;
private Spinner mSyncWindowView;
private CheckBox mDefaultView;
@ -301,11 +292,11 @@ public class AccountSetupOptions extends AccountSetupActivity implements OnClick
});
return;
} catch (OperationCanceledException e) {
Log.d(Logging.LOG_TAG, "addAccount was canceled");
LogUtils.d(Logging.LOG_TAG, "addAccount was canceled");
} catch (IOException e) {
Log.d(Logging.LOG_TAG, "addAccount failed: " + e);
LogUtils.d(Logging.LOG_TAG, "addAccount failed: " + e);
} catch (AuthenticatorException e) {
Log.d(Logging.LOG_TAG, "addAccount failed: " + e);
LogUtils.d(Logging.LOG_TAG, "addAccount failed: " + e);
}
showErrorDialog(R.string.account_setup_failed_dlg_auth_message,
R.string.system_account_create_failed);

View File

@ -22,7 +22,6 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -42,6 +41,7 @@ import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
/**
* Provides UI for SMTP account settings (for IMAP/POP accounts).
@ -75,7 +75,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onCreate(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onCreate");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onCreate");
}
super.onCreate(savedInstanceState);
@ -89,7 +89,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onCreateView");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onCreateView");
}
int layoutId = mSettingsMode
? R.layout.account_settings_outgoing_fragment
@ -128,14 +128,17 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
// Updates the port when the user changes the security type. This allows
// us to show a reasonable default which the user can change.
mSecurityTypeView.post(new Runnable() {
@Override
public void run() {
mSecurityTypeView.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
updatePortFromSecurityType();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
@ -143,11 +146,14 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
// Calls validateFields() which enables or disables the Next button
TextWatcher validationTextWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
validateFields();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) { }
};
mUsernameView.addTextChangedListener(validationTextWatcher);
@ -167,7 +173,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onActivityCreated(Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onActivityCreated");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onActivityCreated");
}
super.onActivityCreated(savedInstanceState);
}
@ -178,7 +184,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onStart() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onStart");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onStart");
}
super.onStart();
mStarted = true;
@ -191,7 +197,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onResume() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onResume");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onResume");
}
super.onResume();
validateFields();
@ -200,7 +206,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onPause() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onPause");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onPause");
}
super.onPause();
}
@ -211,7 +217,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onStop() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onStop");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onStop");
}
super.onStop();
mStarted = false;
@ -223,7 +229,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onDestroy() {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onDestroy");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onDestroy");
}
super.onDestroy();
}
@ -231,7 +237,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
@Override
public void onSaveInstanceState(Bundle outState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onSaveInstanceState");
LogUtils.d(Logging.LOG_TAG, "AccountSetupOutgoingFragment onSaveInstanceState");
}
super.onSaveInstanceState(outState);
@ -369,7 +375,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
serverPort = Integer.parseInt(mPortView.getText().toString().trim());
} catch (NumberFormatException e) {
serverPort = getPortFromSecurityType();
Log.d(Logging.LOG_TAG, "Non-integer server port; using '" + serverPort + "'");
LogUtils.d(Logging.LOG_TAG, "Non-integer server port; using '" + serverPort + "'");
}
int securityType = (Integer)((SpinnerOption)mSecurityTypeView.getSelectedItem()).value;
sendAuth.setConnection(mBaseScheme, serverAddress, serverPort, securityType);

View File

@ -19,7 +19,6 @@ package com.android.email.activity.setup;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -34,6 +33,7 @@ import com.android.email.activity.UiUtilities;
import com.android.email.service.EmailServiceUtils;
import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.Logging;
import com.android.mail.utils.LogUtils;
public class DebugFragment extends Fragment implements OnCheckedChangeListener,
View.OnClickListener {
@ -49,7 +49,7 @@ public class DebugFragment extends Fragment implements OnCheckedChangeListener,
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (Logging.DEBUG_LIFECYCLE && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "AccountSetupBasicsFragment onCreateView");
LogUtils.d(Logging.LOG_TAG, "AccountSetupBasicsFragment onCreateView");
}
View view = inflater.inflate(R.layout.debug, container, false);
@ -134,7 +134,7 @@ public class DebugFragment extends Fragment implements OnCheckedChangeListener,
WebView webview = new WebView(getActivity());
try {
webview.clearCache(true);
Log.w(Logging.LOG_TAG, "Cleard WebView cache.");
LogUtils.w(Logging.LOG_TAG, "Cleard WebView cache.");
} finally {
webview.destroy();
}

View File

@ -29,7 +29,6 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.util.Log;
import android.view.MenuItem;
import com.android.email.R;
@ -41,6 +40,7 @@ import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.provider.Policy;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.mail.utils.LogUtils;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
@ -292,7 +292,7 @@ public class MailboxSettings extends PreferenceActivity {
}
mNeedsSave = true;
if (MailActivityEmail.DEBUG) {
Log.i(Logging.LOG_TAG, "Setting changed");
LogUtils.i(Logging.LOG_TAG, "Setting changed");
}
// In order to set the current entry to the summary, we need to udpate the value
// manually, rather than letting the framework do that (by returning true).
@ -310,7 +310,7 @@ public class MailboxSettings extends PreferenceActivity {
final int syncInterval = Integer.valueOf(mSyncIntervalPref.getValue());
final int syncLookback = Integer.valueOf(mSyncLookbackPref.getValue());
if (MailActivityEmail.DEBUG) {
Log.i(Logging.LOG_TAG, "Updating object: " + syncInterval + "," + syncLookback);
LogUtils.i(Logging.LOG_TAG, "Updating object: " + syncInterval + "," + syncLookback);
}
if (mMailbox.mType == Mailbox.TYPE_INBOX) {
mAccount.mSyncInterval = syncInterval;
@ -333,7 +333,7 @@ public class MailboxSettings extends PreferenceActivity {
if (!mNeedsSave) {
return;
}
Log.i(Logging.LOG_TAG, "Saving mailbox settings...");
LogUtils.i(Logging.LOG_TAG, "Saving mailbox settings...");
enablePreferences(false);
// Since the activity will be destroyed...
@ -360,7 +360,7 @@ public class MailboxSettings extends PreferenceActivity {
}
context.getContentResolver().update(uri, cv, null, null);
Log.i(Logging.LOG_TAG, "Saved: " + uri);
LogUtils.i(Logging.LOG_TAG, "Saved: " + uri);
return null;
}

View File

@ -18,13 +18,13 @@ package com.android.email.mail;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.util.Log;
import com.android.email.R;
import com.android.emailcommon.Logging;
import com.android.emailcommon.mail.MessagingException;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.mail.utils.LogUtils;
import org.xmlpull.v1.XmlPullParserException;
@ -53,7 +53,7 @@ public abstract class Sender {
c.getMethod("newInstance", Account.class, Context.class);
o = m.invoke(null, account, context);
} catch (Exception e) {
Log.d(Logging.LOG_TAG, String.format(
LogUtils.d(Logging.LOG_TAG, String.format(
"exception %s invoking method %s#newInstance(Account, Context) for %s",
e.toString(), className, account.mDisplayName));
throw new MessagingException("can not instantiate Sender for " + account.mDisplayName);

View File

@ -18,14 +18,12 @@ package com.android.email.mail;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import com.android.email.R;
import com.android.email.mail.store.ImapStore;
import com.android.email.mail.store.Pop3Store;
import com.android.email.mail.store.ServiceStore;
import com.android.email.mail.transport.MailTransport;
import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.Logging;
import com.android.emailcommon.mail.Folder;
import com.android.emailcommon.mail.MessagingException;
@ -33,6 +31,7 @@ import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Mailbox;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.lang.reflect.Method;
@ -102,7 +101,7 @@ public abstract class Store {
Method m = klass.getMethod("newInstance", Account.class, Context.class);
store = (Store)m.invoke(null, account, appContext);
} catch (Exception e) {
Log.d(Logging.LOG_TAG, String.format(
LogUtils.d(Logging.LOG_TAG, String.format(
"exception %s invoking method %s#newInstance(Account, Context) for %s",
e.toString(), klass.getName(), account.mDisplayName));
throw new MessagingException("Can't instantiate Store for " + account.mDisplayName);

View File

@ -17,7 +17,6 @@
package com.android.email.mail.store;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.mail.store.ImapStore.ImapException;
import com.android.email.mail.store.imap.ImapConstants;
@ -32,6 +31,7 @@ import com.android.emailcommon.Logging;
import com.android.emailcommon.mail.AuthenticationFailedException;
import com.android.emailcommon.mail.CertificateValidationException;
import com.android.emailcommon.mail.MessagingException;
import com.android.mail.utils.LogUtils;
import java.io.IOException;
import java.util.ArrayList;
@ -145,7 +145,7 @@ class ImapConnection {
mImapStore.ensurePrefixIsValid();
} catch (SSLException e) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, e.toString());
LogUtils.d(Logging.LOG_TAG, e.toString());
}
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
@ -153,7 +153,7 @@ class ImapConnection {
// of other code here that catches IOException and I don't want to break it.
// This catch is only here to enhance logging of connection-time issues.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw ioe;
} finally {
@ -390,7 +390,7 @@ class ImapConnection {
} catch (ImapException ie) {
// Log for debugging, but this is not a fatal problem.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ie.toString());
LogUtils.d(Logging.LOG_TAG, ie.toString());
}
} catch (IOException ioe) {
// Special case to handle malformed OK responses and ignore them.
@ -415,7 +415,7 @@ class ImapConnection {
} catch (ImapException ie) {
// Log for debugging, but this is not a fatal problem.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ie.toString());
LogUtils.d(Logging.LOG_TAG, ie.toString());
}
} catch (IOException ioe) {
// Special case to handle malformed OK responses and ignore them.
@ -446,7 +446,7 @@ class ImapConnection {
executeSimpleCommand(mLoginPhrase, true);
} catch (ImapException ie) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ie.toString());
LogUtils.d(Logging.LOG_TAG, ie.toString());
}
throw new AuthenticationFailedException(ie.getAlertText(), ie);
@ -470,7 +470,7 @@ class ImapConnection {
} catch (ImapException ie) {
// Log for debugging, but this is not a fatal problem.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ie.toString());
LogUtils.d(Logging.LOG_TAG, ie.toString());
}
} catch (IOException ioe) {
// Special case to handle malformed OK responses and ignore them.
@ -502,7 +502,7 @@ class ImapConnection {
return(queryCapabilities());
} else {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "TLS not supported but required");
LogUtils.d(Logging.LOG_TAG, "TLS not supported but required");
}
throw new MessagingException(MessagingException.TLS_REQUIRED);
}

View File

@ -19,7 +19,6 @@ package com.android.email.mail.store;
import android.content.Context;
import android.text.TextUtils;
import android.util.Base64DataException;
import android.util.Log;
import com.android.email.mail.store.ImapStore.ImapException;
import com.android.email.mail.store.ImapStore.ImapMessage;
@ -49,6 +48,7 @@ import com.android.emailcommon.service.SearchParams;
import com.android.emailcommon.utility.CountingOutputStream;
import com.android.emailcommon.utility.EOLConvertingOutputStream;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
@ -322,7 +322,7 @@ class ImapFolder extends Folder {
}
} catch (MessagingException e) {
// Log, but, don't abort; failures here don't need to be propagated
Log.d(Logging.LOG_TAG, "Failed to find message", e);
LogUtils.d(Logging.LOG_TAG, "Failed to find message", e);
} finally {
newFolder.close(false);
}
@ -396,7 +396,7 @@ class ImapFolder extends Folder {
String command = ImapConstants.UID_SEARCH + " " + searchCriteria;
return getSearchUids(mConnection.executeSimpleCommand(command));
} catch (ImapException e) {
Log.d(Logging.LOG_TAG, "ImapException in search: " + searchCriteria);
LogUtils.d(Logging.LOG_TAG, "ImapException in search: " + searchCriteria);
return Utility.EMPTY_STRINGS; // not found;
} catch (IOException ioe) {
throw ioExceptionHandler(mConnection, ioe);
@ -514,7 +514,7 @@ class ImapFolder extends Folder {
try {
fetchInternal(messages, fp, listener);
} catch (RuntimeException e) { // Probably a parser error.
Log.w(Logging.LOG_TAG, "Exception detected: " + e.getMessage());
LogUtils.w(Logging.LOG_TAG, "Exception detected: " + e.getMessage());
if (mConnection != null) {
mConnection.logLastDiscourse();
}
@ -635,7 +635,7 @@ class ImapFolder extends Folder {
parseBodyStructure(bs, message, ImapConstants.TEXT);
} catch (MessagingException e) {
if (Logging.LOGD) {
Log.v(Logging.LOG_TAG, "Error handling message", e);
LogUtils.v(Logging.LOG_TAG, "Error handling message", e);
}
message.setBody(null);
}
@ -1114,7 +1114,7 @@ class ImapFolder extends Folder {
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "IO Exception detected: ", ioe);
LogUtils.d(Logging.LOG_TAG, "IO Exception detected: ", ioe);
}
connection.close();
if (connection == mConnection) {

View File

@ -22,11 +22,9 @@ import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.android.email.LegacyConversions;
import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.mail.Store;
import com.android.email.mail.store.imap.ImapConstants;
import com.android.email.mail.store.imap.ImapResponse;
@ -45,6 +43,7 @@ import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.service.EmailServiceProxy;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import com.beetstra.jutf7.CharsetProvider;
import com.google.common.annotations.VisibleForTesting;
@ -204,7 +203,7 @@ public class ImapStore extends Store {
id.append(hexUid);
id.append('\"');
} catch (NoSuchAlgorithmException e) {
Log.d(Logging.LOG_TAG, "couldn't obtain SHA-1 hash for device UID");
LogUtils.d(Logging.LOG_TAG, "couldn't obtain SHA-1 hash for device UID");
}
return id.toString();
}

View File

@ -18,9 +18,7 @@ package com.android.email.mail.store;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import com.android.email.R;
import com.android.email.mail.Store;
import com.android.email.mail.transport.MailTransport;
import com.android.email2.ui.MailActivityEmail;
@ -40,6 +38,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.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import org.apache.james.mime4j.EOLConvertingInputStream;
@ -216,7 +215,7 @@ public class Pop3Store extends Store {
mTransport.reopenTls();
} else {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "TLS not supported but required");
LogUtils.d(Logging.LOG_TAG, "TLS not supported but required");
}
throw new MessagingException(MessagingException.TLS_REQUIRED);
}
@ -227,14 +226,14 @@ public class Pop3Store extends Store {
executeSensitiveCommand("PASS " + mPassword, "PASS /redacted/");
} catch (MessagingException me) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, me.toString());
LogUtils.d(Logging.LOG_TAG, me.toString());
}
throw new AuthenticationFailedException(null, me);
}
} catch (IOException ioe) {
mTransport.close();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}
@ -258,7 +257,7 @@ public class Pop3Store extends Store {
if (statException != null) {
mTransport.close();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, statException.toString());
LogUtils.d(Logging.LOG_TAG, statException.toString());
}
throw new MessagingException("POP3 STAT", statException);
}
@ -329,7 +328,7 @@ public class Pop3Store extends Store {
} catch (IOException ioe) {
mTransport.close();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "Unable to index during getMessage " + ioe);
LogUtils.d(Logging.LOG_TAG, "Unable to index during getMessage " + ioe);
}
throw new MessagingException("getMessages", ioe);
}
@ -351,7 +350,7 @@ public class Pop3Store extends Store {
} catch (IOException ioe) {
mTransport.close();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException("getMessages", ioe);
}
@ -569,7 +568,7 @@ public class Pop3Store extends Store {
response = executeSimpleCommand(
String.format(Locale.US, "RETR %d", messageId));
} catch (MessagingException e) {
Log.w(Logging.LOG_TAG, "Can't read message " + messageId);
LogUtils.w(Logging.LOG_TAG, "Can't read message " + messageId);
}
}
}
@ -660,7 +659,7 @@ public class Pop3Store extends Store {
catch (IOException ioe) {
mTransport.close();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException("setFlags()", ioe);
}

View File

@ -19,8 +19,7 @@ package com.android.email.mail.store.imap;
import com.android.email.FixedLengthInputStream;
import com.android.emailcommon.Logging;
import com.android.emailcommon.utility.Utility;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@ -45,7 +44,7 @@ public class ImapMemoryLiteral extends ImapString {
pos += read;
}
if (pos != mData.length) {
Log.w(Logging.LOG_TAG, "");
LogUtils.w(Logging.LOG_TAG, "");
}
}

View File

@ -17,7 +17,6 @@
package com.android.email.mail.store.imap;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.FixedLengthInputStream;
import com.android.email.PeekableInputStream;
@ -26,6 +25,7 @@ import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.Logging;
import com.android.emailcommon.mail.MessagingException;
import com.android.emailcommon.utility.LoggingInputStream;
import com.android.mail.utils.LogUtils;
import java.io.IOException;
import java.io.InputStream;
@ -100,7 +100,7 @@ public class ImapResponseParser {
private static IOException newEOSException() {
final String message = "End of stream reached";
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, message);
LogUtils.d(Logging.LOG_TAG, message);
}
return new IOException(message);
}
@ -162,7 +162,7 @@ public class ImapResponseParser {
try {
response = parseResponse();
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "<<< " + response.toString());
LogUtils.d(Logging.LOG_TAG, "<<< " + response.toString());
}
} catch (RuntimeException e) {
@ -177,7 +177,7 @@ public class ImapResponseParser {
// Handle this outside of try-catch. We don't have to dump protocol log when getting BYE.
if (response.is(0, ImapConstants.BYE)) {
Log.w(Logging.LOG_TAG, ByeException.MESSAGE);
LogUtils.w(Logging.LOG_TAG, ByeException.MESSAGE);
response.destroy();
throw new ByeException();
}
@ -201,7 +201,7 @@ public class ImapResponseParser {
}
} catch (IOException ignore) {
}
Log.w(Logging.LOG_TAG, "Exception detected: " + e.getMessage());
LogUtils.w(Logging.LOG_TAG, "Exception detected: " + e.getMessage());
mDiscourseLogger.logLastDiscourse();
}

View File

@ -17,8 +17,7 @@
package com.android.email.mail.store.imap;
import com.android.emailcommon.Logging;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@ -132,7 +131,7 @@ public abstract class ImapString extends ImapElement {
mParsedDate = DATE_TIME_FORMAT.parse(getString());
return true;
} catch (ParseException e) {
Log.w(Logging.LOG_TAG, getString() + " can't be parsed as a date.");
LogUtils.w(Logging.LOG_TAG, getString() + " can't be parsed as a date.");
return false;
}
}

View File

@ -16,12 +16,11 @@
package com.android.email.mail.store.imap;
import android.util.Log;
import com.android.email.FixedLengthInputStream;
import com.android.emailcommon.Logging;
import com.android.emailcommon.TempDirectory;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import org.apache.commons.io.IOUtils;
@ -77,7 +76,7 @@ public class ImapTempFileLiteral extends ImapString {
return new FileInputStream(mFile);
} catch (FileNotFoundException e) {
// It's probably possible if we're low on storage and the system clears the cache dir.
Log.w(Logging.LOG_TAG, "ImapTempFileLiteral: Temp file not found");
LogUtils.w(Logging.LOG_TAG, "ImapTempFileLiteral: Temp file not found");
// Return 0 byte stream as a dummy...
return new ByteArrayInputStream(new byte[0]);
@ -95,7 +94,7 @@ public class ImapTempFileLiteral extends ImapString {
}
return Utility.fromAscii(bytes);
} catch (IOException e) {
Log.w(Logging.LOG_TAG, "ImapTempFileLiteral: Error while reading temp file", e);
LogUtils.w(Logging.LOG_TAG, "ImapTempFileLiteral: Error while reading temp file", e);
return "";
}
}
@ -108,7 +107,7 @@ public class ImapTempFileLiteral extends ImapString {
}
} catch (RuntimeException re) {
// Just log and ignore.
Log.w(Logging.LOG_TAG, "Failed to remove temp file: " + re.getMessage());
LogUtils.w(Logging.LOG_TAG, "Failed to remove temp file: " + re.getMessage());
}
super.destroy();
}

View File

@ -17,8 +17,7 @@
package com.android.email.mail.store.imap;
import com.android.emailcommon.Logging;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.util.ArrayList;
@ -76,7 +75,7 @@ public class ImapUtility {
Integer.parseInt(item); // Don't need the value; just ensure it's valid
list.add(item);
} catch (NumberFormatException e) {
Log.d(Logging.LOG_TAG, "Invalid UID value", e);
LogUtils.d(Logging.LOG_TAG, "Invalid UID value", e);
}
} else {
// range
@ -119,7 +118,7 @@ public class ImapUtility {
}
}
} catch (NumberFormatException e) {
Log.d(Logging.LOG_TAG, "Invalid range value", e);
LogUtils.d(Logging.LOG_TAG, "Invalid range value", e);
}
String[] stringList = new String[list.size()];
return list.toArray(stringList);

View File

@ -17,8 +17,7 @@
package com.android.email.mail.transport;
import com.android.emailcommon.Logging;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.util.ArrayList;
@ -111,9 +110,9 @@ public class DiscourseLogger {
return;
}
Log.w(Logging.LOG_TAG, "Last network activities:");
LogUtils.w(Logging.LOG_TAG, "Last network activities:");
for (String r : getLines()) {
Log.w(Logging.LOG_TAG, r);
LogUtils.w(Logging.LOG_TAG, r);
}
initBuffer();
}

View File

@ -17,7 +17,6 @@
package com.android.email.mail.transport;
import android.content.Context;
import android.util.Log;
import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.Logging;
@ -25,6 +24,7 @@ import com.android.emailcommon.mail.CertificateValidationException;
import com.android.emailcommon.mail.MessagingException;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.SSLUtils;
import com.android.mail.utils.LogUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@ -104,7 +104,7 @@ public class MailTransport {
*/
public void open() throws MessagingException, CertificateValidationException {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "*** " + mDebugLabel + " open " +
LogUtils.d(Logging.LOG_TAG, "*** " + mDebugLabel + " open " +
getHost() + ":" + String.valueOf(getPort()));
}
@ -126,17 +126,17 @@ public class MailTransport {
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
} catch (SSLException e) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, e.toString());
LogUtils.d(Logging.LOG_TAG, e.toString());
}
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
} catch (IllegalArgumentException iae) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, iae.toString());
LogUtils.d(Logging.LOG_TAG, iae.toString());
}
throw new MessagingException(MessagingException.UNSPECIFIED_EXCEPTION, iae.toString());
}
@ -160,12 +160,12 @@ public class MailTransport {
} catch (SSLException e) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, e.toString());
LogUtils.d(Logging.LOG_TAG, e.toString());
}
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}
@ -261,9 +261,9 @@ public class MailTransport {
public void writeLine(String s, String sensitiveReplacement) throws IOException {
if (MailActivityEmail.DEBUG) {
if (sensitiveReplacement != null && !Logging.DEBUG_SENSITIVE) {
Log.d(Logging.LOG_TAG, ">>> " + sensitiveReplacement);
LogUtils.d(Logging.LOG_TAG, ">>> " + sensitiveReplacement);
} else {
Log.d(Logging.LOG_TAG, ">>> " + s);
LogUtils.d(Logging.LOG_TAG, ">>> " + s);
}
}
@ -292,11 +292,11 @@ public class MailTransport {
}
}
if (d == -1 && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "End of stream reached while trying to read line.");
LogUtils.d(Logging.LOG_TAG, "End of stream reached while trying to read line.");
}
String ret = sb.toString();
if (loggable && MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "<<< " + ret);
LogUtils.d(Logging.LOG_TAG, "<<< " + ret);
}
return ret;
}

View File

@ -18,7 +18,6 @@ package com.android.email.mail.transport;
import android.content.Context;
import android.util.Base64;
import android.util.Log;
import com.android.email.mail.Sender;
import com.android.email2.ui.MailActivityEmail;
@ -32,6 +31,7 @@ import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.EOLConvertingOutputStream;
import com.android.mail.utils.LogUtils;
import java.io.IOException;
import java.net.Inet6Address;
@ -122,7 +122,7 @@ public class SmtpSender extends Sender {
result = executeSimpleCommand("EHLO " + localHost);
} else {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "TLS not supported but required");
LogUtils.d(Logging.LOG_TAG, "TLS not supported but required");
}
throw new MessagingException(MessagingException.TLS_REQUIRED);
}
@ -144,19 +144,19 @@ public class SmtpSender extends Sender {
}
else {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "No valid authentication mechanism found.");
LogUtils.d(Logging.LOG_TAG, "No valid authentication mechanism found.");
}
throw new MessagingException(MessagingException.AUTH_REQUIRED);
}
}
} catch (SSLException e) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, e.toString());
LogUtils.d(Logging.LOG_TAG, e.toString());
}
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, ioe.toString());
LogUtils.d(Logging.LOG_TAG, ioe.toString());
}
throw new MessagingException(MessagingException.IOERROR, ioe.toString());
}

View File

@ -17,8 +17,7 @@
package com.android.email.mail.transport;
import com.android.emailcommon.Logging;
import android.util.Log;
import com.android.mail.utils.LogUtils;
import java.io.FilterOutputStream;
import java.io.IOException;
@ -26,7 +25,7 @@ import java.io.OutputStream;
public class StatusOutputStream extends FilterOutputStream {
private long mCount = 0;
public StatusOutputStream(OutputStream out) {
super(out);
}
@ -37,7 +36,7 @@ public class StatusOutputStream extends FilterOutputStream {
mCount++;
if (Logging.LOGD) {
if (mCount % 1024 == 0) {
Log.v(Logging.LOG_TAG, "# " + mCount);
LogUtils.v(Logging.LOG_TAG, "# " + mCount);
}
}
}

View File

@ -22,13 +22,13 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.android.email.NotificationController;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.Mailbox;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
@ -118,10 +118,10 @@ public class AccountReconciler {
if (EmailContent.count(providerContext, Mailbox.CONTENT_URI,
Mailbox.ACCOUNT_KEY + "=?",
new String[] { Long.toString(providerAccount.mId) } ) > 0) {
Log.w(Logging.LOG_TAG,
LogUtils.w(Logging.LOG_TAG,
"Account reconciler found wrongly incomplete account");
} else {
Log.w(Logging.LOG_TAG,
LogUtils.w(Logging.LOG_TAG,
"Account reconciler noticed incomplete account; ignoring");
continue;
}
@ -130,7 +130,7 @@ public class AccountReconciler {
needsReconciling = true;
if (performReconciliation) {
// This account has been deleted in the AccountManager!
Log.d(Logging.LOG_TAG,
LogUtils.d(Logging.LOG_TAG,
"Account deleted in AccountManager; deleting from provider: " +
providerAccountName);
Uri uri = EmailProvider.uiUri("uiaccount", providerAccount.mId);
@ -159,7 +159,7 @@ public class AccountReconciler {
needsReconciling = true;
if (performReconciliation) {
Log.d(Logging.LOG_TAG,
LogUtils.d(Logging.LOG_TAG,
"Account deleted from provider; deleting from AccountManager: " +
accountManagerAccountName);
// Delete the account
@ -170,11 +170,11 @@ public class AccountReconciler {
// here, as there is nothing to actually do about them.
blockingResult.getResult();
} catch (OperationCanceledException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
} catch (AuthenticatorException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
} catch (IOException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
}
}
}

View File

@ -28,7 +28,6 @@ import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Binder;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.internet.MimeUtility;
@ -37,6 +36,7 @@ import com.android.emailcommon.provider.EmailContent.Attachment;
import com.android.emailcommon.provider.EmailContent.AttachmentColumns;
import com.android.emailcommon.utility.AttachmentUtilities;
import com.android.emailcommon.utility.AttachmentUtilities.Columns;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.MatrixCursorWithCachedColumns;
import java.io.File;
@ -202,11 +202,11 @@ public class AttachmentProvider extends ContentProvider {
out.close();
in.close();
} catch (IOException ioe) {
Log.d(Logging.LOG_TAG, "openFile/thumbnail failed with " +
LogUtils.d(Logging.LOG_TAG, "openFile/thumbnail failed with " +
ioe.getMessage());
return null;
} catch (OutOfMemoryError oome) {
Log.d(Logging.LOG_TAG, "openFile/thumbnail failed with " +
LogUtils.d(Logging.LOG_TAG, "openFile/thumbnail failed with " +
oome.getMessage());
return null;
}
@ -305,22 +305,22 @@ public class AttachmentProvider extends ContentProvider {
return 0;
}
private Bitmap createThumbnail(String type, InputStream data) {
private static Bitmap createThumbnail(String type, InputStream data) {
if(MimeUtility.mimeTypeMatches(type, "image/*")) {
return createImageThumbnail(data);
}
return null;
}
private Bitmap createImageThumbnail(InputStream data) {
private static Bitmap createImageThumbnail(InputStream data) {
try {
Bitmap bitmap = BitmapFactory.decodeStream(data);
return bitmap;
} catch (OutOfMemoryError oome) {
Log.d(Logging.LOG_TAG, "createImageThumbnail failed with " + oome.getMessage());
LogUtils.d(Logging.LOG_TAG, "createImageThumbnail failed with " + oome.getMessage());
return null;
} catch (Exception e) {
Log.d(Logging.LOG_TAG, "createImageThumbnail failed with " + e.getMessage());
LogUtils.d(Logging.LOG_TAG, "createImageThumbnail failed with " + e.getMessage());
return null;
}
}

View File

@ -23,10 +23,10 @@ import android.database.CursorWindow;
import android.database.CursorWrapper;
import android.database.MatrixCursor;
import android.net.Uri;
import android.util.Log;
import android.util.LruCache;
import com.android.email2.ui.MailActivityEmail;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.MatrixCursorWithCachedColumns;
import com.google.common.annotations.VisibleForTesting;
@ -186,7 +186,7 @@ public final class ContentCache {
/*package*/ int invalidateTokens(String id) {
if (MailActivityEmail.DEBUG && DEBUG_TOKENS) {
Log.d(mLogTag, "============ Invalidate tokens for: " + id);
LogUtils.d(mLogTag, "============ Invalidate tokens for: " + id);
}
ArrayList<CacheToken> removeList = new ArrayList<CacheToken>();
int count = 0;
@ -205,7 +205,7 @@ public final class ContentCache {
/*package*/ void invalidate() {
if (MailActivityEmail.DEBUG && DEBUG_TOKENS) {
Log.d(mLogTag, "============ List invalidated");
LogUtils.d(mLogTag, "============ List invalidated");
}
for (CacheToken token: this) {
token.invalidate();
@ -217,9 +217,9 @@ public final class ContentCache {
boolean result = super.remove(token);
if (MailActivityEmail.DEBUG && DEBUG_TOKENS) {
if (result) {
Log.d(mLogTag, "============ Removing token for: " + token.mId);
LogUtils.d(mLogTag, "============ Removing token for: " + token.mId);
} else {
Log.d(mLogTag, "============ No token found for: " + token.mId);
LogUtils.d(mLogTag, "============ No token found for: " + token.mId);
}
}
return result;
@ -229,7 +229,7 @@ public final class ContentCache {
CacheToken token = new CacheToken(id);
super.add(token);
if (MailActivityEmail.DEBUG && DEBUG_TOKENS) {
Log.d(mLogTag, "============ Taking token for: " + token.mId);
LogUtils.d(mLogTag, "============ Taking token for: " + token.mId);
}
return token;
}
@ -484,14 +484,14 @@ public final class ContentCache {
try {
if (!token.isValid()) {
if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
Log.d(mLogTag, "============ Stale token for " + id);
LogUtils.d(mLogTag, "============ Stale token for " + id);
}
mStats.mStaleCount++;
return c;
}
if (c != null && Arrays.equals(projection, mBaseProjection) && !sLockCache) {
if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
Log.d(mLogTag, "============ Caching cursor for: " + id);
LogUtils.d(mLogTag, "============ Caching cursor for: " + id);
}
// If we've already cached this cursor, invalidate the older one
Cursor existingCursor = get(id);
@ -596,7 +596,7 @@ public final class ContentCache {
// Invalidate current tokens
int count = mTokenList.invalidateTokens(id);
if (MailActivityEmail.DEBUG && DEBUG_TOKENS) {
Log.d(mTokenList.mLogTag, "============ Lock invalidated " + count +
LogUtils.d(mTokenList.mLogTag, "============ Lock invalidated " + count +
" tokens for: " + id);
}
}
@ -633,13 +633,13 @@ public final class ContentCache {
Cursor c = get(id);
if (c != null) {
if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
Log.d(mLogTag, "=========== Unlocking cache for: " + id);
LogUtils.d(mLogTag, "=========== Unlocking cache for: " + id);
}
if (values != null && !sLockCache) {
MatrixCursor cursor = getMatrixCursor(id, mBaseProjection, values);
if (cursor != null) {
if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
Log.d(mLogTag, "=========== Recaching with new values: " + id);
LogUtils.d(mLogTag, "=========== Recaching with new values: " + id);
}
cursor.moveToFirst();
mLruCache.put(id, cursor);
@ -676,7 +676,7 @@ public final class ContentCache {
*/
public synchronized void invalidate(String operation, Uri uri, String selection) {
if (DEBUG_CACHE && (operation != null)) {
Log.d(mLogTag, "============ INVALIDATED BY " + operation + ": " + uri +
LogUtils.d(mLogTag, "============ INVALIDATED BY " + operation + ": " + uri +
", SELECTION: " + selection);
}
mStats.mInvalidateCount++;
@ -740,7 +740,7 @@ public final class ContentCache {
}
Arrays.sort(array);
for (CacheCounter cc: array) {
Log.d("NotCacheable", cc.count + ": " + cc.uri);
LogUtils.d("NotCacheable", cc.count + ": " + cc.uri);
}
}
@ -842,10 +842,10 @@ public final class ContentCache {
for (ContentCache cache: sContentCaches) {
if (cache != null) {
Log.d(cache.mName, cache.mStats.toString());
LogUtils.d(cache.mName, cache.mStats.toString());
totals.addCacheStatistics(cache);
}
}
Log.d(totals.mName, totals.toString());
LogUtils.d(totals.mName, totals.toString());
}
}

View File

@ -27,7 +27,6 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.provider.CalendarContract;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.R;
import com.android.email2.ui.MailActivityEmail;
@ -514,7 +513,7 @@ public final class DBHelper {
+ " add " + BodyColumns.INTRO_TEXT + " text");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProviderBody.db from v5 to v6", e);
LogUtils.w(TAG, "Exception upgrading EmailProviderBody.db from v5 to v6", e);
}
oldVersion = 6;
}
@ -524,7 +523,7 @@ public final class DBHelper {
+ " add " + BodyColumns.QUOTED_TEXT_START_POS + " integer");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProviderBody.db from v6 to v8", e);
LogUtils.w(TAG, "Exception upgrading EmailProviderBody.db from v6 to v8", e);
}
oldVersion = 8;
}
@ -541,7 +540,7 @@ public final class DBHelper {
@Override
public void onCreate(SQLiteDatabase db) {
Log.d(TAG, "Creating EmailProviderBody database");
LogUtils.d(TAG, "Creating EmailProviderBody database");
createBodyTable(db);
}
@ -574,7 +573,7 @@ public final class DBHelper {
@Override
public void onCreate(SQLiteDatabase db) {
Log.d(TAG, "Creating EmailProvider database");
LogUtils.d(TAG, "Creating EmailProvider database");
// Create all tables here; each class has its own method
createMessageTable(db);
createAttachmentTable(db);
@ -588,7 +587,7 @@ public final class DBHelper {
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion == 101 && newVersion == 100) {
Log.d(TAG, "Downgrade from v101 to v100");
LogUtils.d(TAG, "Downgrade from v101 to v100");
} else {
super.onDowngrade(db, oldVersion, newVersion);
}
@ -623,7 +622,7 @@ public final class DBHelper {
+ " add column " + SyncColumns.SERVER_TIMESTAMP + " integer" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v5 to v6", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v5 to v6", e);
}
oldVersion = 6;
}
@ -640,7 +639,7 @@ public final class DBHelper {
+ " add column " + AccountColumns.SECURITY_FLAGS + " integer" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 7 to 8 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 7 to 8 " + e);
}
oldVersion = 8;
}
@ -653,7 +652,7 @@ public final class DBHelper {
+ " add column " + AccountColumns.SIGNATURE + " text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 8 to 9 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 8 to 9 " + e);
}
oldVersion = 9;
}
@ -668,7 +667,7 @@ public final class DBHelper {
+ " add column " + MessageColumns.MEETING_INFO + " text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 9 to 10 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 9 to 10 " + e);
}
oldVersion = 10;
}
@ -681,7 +680,7 @@ public final class DBHelper {
+ " add column " + AttachmentColumns.FLAGS + " integer" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 10 to 11 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 10 to 11 " + e);
}
oldVersion = 11;
}
@ -692,7 +691,7 @@ public final class DBHelper {
+ " add column " + AttachmentColumns.CONTENT_BYTES + " blob" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 11 to 12 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 11 to 12 " + e);
}
oldVersion = 12;
}
@ -704,7 +703,7 @@ public final class DBHelper {
recalculateMessageCount(db);
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 12 to 13 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 12 to 13 " + e);
}
oldVersion = 13;
}
@ -715,7 +714,7 @@ public final class DBHelper {
+" text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 13 to 14 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 13 to 14 " + e);
}
oldVersion = 14;
}
@ -727,7 +726,7 @@ public final class DBHelper {
+ " add column " + Message.SNIPPET +" text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 14 to 15 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 14 to 15 " + e);
}
oldVersion = 15;
}
@ -743,7 +742,7 @@ public final class DBHelper {
Attachment.TABLE_NAME + "." + Attachment.MESSAGE_KEY + ")");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 15 to 16 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 15 to 16 " + e);
}
oldVersion = 16;
}
@ -753,7 +752,7 @@ public final class DBHelper {
+ " add column " + Mailbox.PARENT_KEY + " integer;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 16 to 17 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 16 to 17 " + e);
}
oldVersion = 17;
}
@ -771,7 +770,7 @@ public final class DBHelper {
convertPolicyFlagsToPolicyTable(db);
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 18 to 19 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 18 to 19 " + e);
}
oldVersion = 19;
}
@ -803,7 +802,7 @@ public final class DBHelper {
" integer;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 19 to 20 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 19 to 20 " + e);
}
oldVersion = 20;
}
@ -840,7 +839,7 @@ public final class DBHelper {
+ " add column " + Message.PROTOCOL_SEARCH_INFO +" text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 26 to 27 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 26 to 27 " + e);
}
oldVersion = 27;
}
@ -855,7 +854,7 @@ public final class DBHelper {
+ " add column " + Policy.PROTOCOL_POLICIES_UNSUPPORTED + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 28 to 29 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 28 to 29 " + e);
}
oldVersion = 29;
}
@ -871,7 +870,7 @@ public final class DBHelper {
+ " add column " + Mailbox.UI_LAST_SYNC_RESULT + " integer;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 30 to 31 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 30 to 31 " + e);
}
oldVersion = 31;
}
@ -887,7 +886,7 @@ public final class DBHelper {
"=0 where " + Mailbox.LAST_NOTIFIED_MESSAGE_COUNT + " IS NULL");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 31 to 32 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 31 to 32 " + e);
}
oldVersion = 32;
}
@ -906,7 +905,7 @@ public final class DBHelper {
AttachmentColumns.CONTENT_URI + " is not null;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 32 to 33 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 32 to 33 " + e);
}
oldVersion = 33;
}
@ -916,7 +915,7 @@ public final class DBHelper {
+ " add column " + MailboxColumns.TOTAL_COUNT + " integer;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 33 to 34 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 33 to 34 " + e);
}
oldVersion = 34;
}
@ -932,7 +931,7 @@ public final class DBHelper {
" = " + Mailbox.TYPE_SENT);
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 34 to 35 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 34 to 35 " + e);
}
oldVersion = 35;
}
@ -951,7 +950,7 @@ public final class DBHelper {
LEGACY_SCHEME_EAS + "')");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 35 to 36 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 35 to 36 " + e);
}
oldVersion = 37;
}
@ -961,7 +960,7 @@ public final class DBHelper {
+ " add column " + MessageColumns.THREAD_TOPIC + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 37 to 38 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 37 to 38 " + e);
}
oldVersion = 38;
}
@ -973,7 +972,7 @@ public final class DBHelper {
+ " add column " + MessageColumns.THREAD_TOPIC + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 38 to 39 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 38 to 39 " + e);
}
oldVersion = 39;
}
@ -987,7 +986,7 @@ public final class DBHelper {
+ " add " + MailboxColumns.HIERARCHICAL_NAME + " text");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v10x to v103", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v10x to v103", e);
}
oldVersion = 103;
}
@ -997,7 +996,7 @@ public final class DBHelper {
+ " add " + MessageColumns.SYNC_DATA + " text");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v103 to v104", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v103 to v104", e);
}
oldVersion = 104;
}
@ -1009,7 +1008,7 @@ public final class DBHelper {
+ " add " + MessageColumns.SYNC_DATA + " text");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v104 to v105", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v104 to v105", e);
}
oldVersion = 105;
}
@ -1019,7 +1018,7 @@ public final class DBHelper {
+ " add " + HostAuthColumns.SERVER_CERT + " blob");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v105 to v106", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v105 to v106", e);
}
oldVersion = 106;
}
@ -1033,7 +1032,7 @@ public final class DBHelper {
+ " add " + MessageColumns.FLAG_SEEN + " integer");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v106 to v107", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v106 to v107", e);
}
oldVersion = 107;
}
@ -1044,7 +1043,7 @@ public final class DBHelper {
oldVersion = 108;
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from v107 to v108", e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v107 to v108", e);
}
}
@ -1128,7 +1127,7 @@ public final class DBHelper {
+ HostAuth.TABLE_NAME + "." + HostAuthColumns.PROTOCOL + "='pop3' ) )");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 17 to 18 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 17 to 18 " + e);
}
ContentCache.invalidateAllCaches();
}
@ -1213,9 +1212,9 @@ public final class DBHelper {
// If this is a pop3 or imap account, create the account manager
// account
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Create AccountManager account for " + protocol +
"account: " +
accountCursor.getString(V21_ACCOUNT_EMAIL));
LogUtils.d(TAG, "Create AccountManager account for " + protocol
+ "account: "
+ accountCursor.getString(V21_ACCOUNT_EMAIL));
}
createAccountManagerAccount(accountManagerContext,
accountCursor.getString(V21_ACCOUNT_EMAIL),
@ -1242,7 +1241,7 @@ public final class DBHelper {
}
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception while migrating accounts " + e);
LogUtils.w(TAG, "Exception while migrating accounts " + e);
}
}
@ -1253,7 +1252,7 @@ public final class DBHelper {
+ " add column " + Mailbox.LAST_TOUCHED_TIME + " integer default 0;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 22 to 23 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 22 to 23 " + e);
}
}
@ -1264,7 +1263,7 @@ public final class DBHelper {
+ " add column " + HostAuth.CLIENT_CERT_ALIAS + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 23 to 24 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 23 to 24 " + e);
}
}
@ -1274,7 +1273,7 @@ public final class DBHelper {
createQuickResponseTable(db);
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 24 to 25 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 24 to 25 " + e);
}
}
@ -1323,7 +1322,7 @@ public final class DBHelper {
}
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 25 to 26 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 25 to 26 " + e);
}
}
@ -1359,7 +1358,7 @@ public final class DBHelper {
}
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 29 to 30 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 29 to 30 " + e);
}
}
@ -1374,7 +1373,7 @@ public final class DBHelper {
db.execSQL("update Mailbox set " + Mailbox.LAST_NOTIFIED_MESSAGE_COUNT +
"=0 where " + Mailbox.LAST_NOTIFIED_MESSAGE_COUNT + " IS NULL");
} catch (SQLException e) {
Log.w(TAG, "Exception upgrading EmailProvider.db from 31 to 32/100 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 31 to 32/100 " + e);
}
// From 32->33 upgrade
@ -1383,7 +1382,7 @@ public final class DBHelper {
"=" + UIProvider.AttachmentState.SAVED + " where " +
AttachmentColumns.CONTENT_URI + " is not null;");
} catch (SQLException e) {
Log.w(TAG, "Exception upgrading EmailProvider.db from 32 to 33/100 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 32 to 33/100 " + e);
}
// From 34->35 upgrade
@ -1397,7 +1396,7 @@ public final class DBHelper {
Mailbox.SENT_DEFAULT_TOUCH_TIME + " WHERE " + MailboxColumns.TYPE +
" = " + Mailbox.TYPE_SENT);
} catch (SQLException e) {
Log.w(TAG, "Exception upgrading EmailProvider.db from 34 to 35/100 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 34 to 35/100 " + e);
}
// From 35/36->37
@ -1413,7 +1412,7 @@ public final class DBHelper {
HostAuthColumns.ID + " and " + HostAuthColumns.PROTOCOL + "='" +
LEGACY_SCHEME_EAS + "')");
} catch (SQLException e) {
Log.w(TAG, "Exception upgrading EmailProvider.db from 35/36 to 37/100 " + e);
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from 35/36 to 37/100 " + e);
}
}
}

View File

@ -48,7 +48,6 @@ import android.provider.BaseColumns;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Base64;
import android.util.Log;
import com.android.common.content.ProjectionMap;
import com.android.email.Preferences;
@ -94,6 +93,7 @@ import com.android.mail.providers.UIProvider.ConversationPriority;
import com.android.mail.providers.UIProvider.ConversationSendingState;
import com.android.mail.providers.UIProvider.DraftType;
import com.android.mail.utils.AttachmentUtils;
import com.android.mail.utils.LogTag;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.MatrixCursorWithCachedColumns;
import com.android.mail.utils.MatrixCursorWithExtra;
@ -122,7 +122,7 @@ import java.util.regex.Pattern;
*/
public class EmailProvider extends ContentProvider {
private static final String TAG = "EmailProvider";
private static final String TAG = LogTag.getLogTag();
public static String EMAIL_APP_MIME_TYPE;
@ -307,7 +307,7 @@ public class EmailProvider extends ContentProvider {
if (match < 0) {
throw new IllegalArgumentException("Unknown uri: " + uri);
} else if (Logging.LOGD) {
Log.v(TAG, methodName + ": uri=" + uri + ", match is " + match);
LogUtils.v(TAG, methodName + ": uri=" + uri + ", match is " + match);
}
return match;
}
@ -347,7 +347,7 @@ public class EmailProvider extends ContentProvider {
int count = db.delete(table, column + " not in (select " + foreignColumn + " from " +
foreignTable + ")", null);
if (count > 0) {
Log.w(TAG, "Found " + count + " orphaned row(s) in " + table);
LogUtils.w(TAG, "Found " + count + " orphaned row(s) in " + table);
}
}
@ -401,7 +401,7 @@ public class EmailProvider extends ContentProvider {
*/
private static void restoreIfNeeded(Context context, SQLiteDatabase mainDatabase) {
if (MailActivityEmail.DEBUG) {
Log.w(TAG, "restoreIfNeeded...");
LogUtils.w(TAG, "restoreIfNeeded...");
}
// Check for legacy backup
String legacyBackup = Preferences.getLegacyBackupPreference(context);
@ -411,7 +411,7 @@ public class EmailProvider extends ContentProvider {
if (!TextUtils.isEmpty(legacyBackup)) {
backupAccounts(context, mainDatabase);
Preferences.clearLegacyBackupPreference(context);
Log.w(TAG, "Created new EmailProvider backup database");
LogUtils.w(TAG, "Created new EmailProvider backup database");
return;
}
@ -421,7 +421,7 @@ public class EmailProvider extends ContentProvider {
try {
if (c.moveToFirst()) {
if (MailActivityEmail.DEBUG) {
Log.w(TAG, "restoreIfNeeded: Account exists.");
LogUtils.w(TAG, "restoreIfNeeded: Account exists.");
}
return; // At least one account exists.
}
@ -985,10 +985,10 @@ public class EmailProvider extends ContentProvider {
// TODO Make sure attachments are deleted
if (databaseFile.exists() && !bodyFile.exists()) {
Log.w(TAG, "Deleting orphaned EmailProvider database...");
LogUtils.w(TAG, "Deleting orphaned EmailProvider database...");
databaseFile.delete();
} else if (bodyFile.exists() && !databaseFile.exists()) {
Log.w(TAG, "Deleting orphaned EmailProviderBody database...");
LogUtils.w(TAG, "Deleting orphaned EmailProviderBody database...");
bodyFile.delete();
}
}
@ -1170,7 +1170,8 @@ public class EmailProvider extends ContentProvider {
// TODO: There are actually cases where c == null is expected, for example
// UI_FOLDER_LOAD_MORE.
// Demoting this to a warning for now until we figure out what to do with it.
Log.w(TAG, "Query returning null for uri: " + uri + ", selection: " + selection);
LogUtils.w(TAG, "Query returning null for uri: " + uri + ", selection: "
+ selection);
}
}
@ -1259,7 +1260,7 @@ public class EmailProvider extends ContentProvider {
Cursor c = fromDatabase.query(Account.TABLE_NAME, Account.CONTENT_PROJECTION,
null, null, null, null, null);
if (c == null) return 0;
Log.d(TAG, "fromDatabase accounts: " + c.getCount());
LogUtils.d(TAG, "fromDatabase accounts: " + c.getCount());
try {
// Loop through accounts, copying them and associated host auth's
while (c.moveToNext()) {
@ -1306,14 +1307,14 @@ public class EmailProvider extends ContentProvider {
toDatabase.setTransactionSuccessful();
} finally {
// STOPSHIP: Remove logging here and in at endTransaction() below
Log.d(TAG, "ending toDatabase transaction; copyCount = " + copyCount);
LogUtils.d(TAG, "ending toDatabase transaction; copyCount = " + copyCount);
toDatabase.endTransaction();
}
} catch (SQLiteException ex) {
Log.w(TAG, "Exception while copying account tables", ex);
LogUtils.w(TAG, "Exception while copying account tables", ex);
copyCount = -1;
} finally {
Log.d(TAG, "ending fromDatabase transaction; copyCount = " + copyCount);
LogUtils.d(TAG, "ending fromDatabase transaction; copyCount = " + copyCount);
fromDatabase.endTransaction();
}
return copyCount;
@ -1329,15 +1330,15 @@ public class EmailProvider extends ContentProvider {
*/
private static int backupAccounts(Context context, SQLiteDatabase mainDatabase) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "backupAccounts...");
LogUtils.d(TAG, "backupAccounts...");
}
SQLiteDatabase backupDatabase = getBackupDatabase(context);
try {
int numBackedUp = copyAccountTables(mainDatabase, backupDatabase);
if (numBackedUp < 0) {
Log.e(TAG, "Account backup failed!");
LogUtils.e(TAG, "Account backup failed!");
} else if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Backed up " + numBackedUp + " accounts...");
LogUtils.d(TAG, "Backed up " + numBackedUp + " accounts...");
}
return numBackedUp;
} finally {
@ -1352,17 +1353,17 @@ public class EmailProvider extends ContentProvider {
*/
private static int restoreAccounts(Context context, SQLiteDatabase mainDatabase) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "restoreAccounts...");
LogUtils.d(TAG, "restoreAccounts...");
}
SQLiteDatabase backupDatabase = getBackupDatabase(context);
try {
int numRecovered = copyAccountTables(backupDatabase, mainDatabase);
if (numRecovered > 0) {
Log.e(TAG, "Recovered " + numRecovered + " accounts!");
LogUtils.e(TAG, "Recovered " + numRecovered + " accounts!");
} else if (numRecovered < 0) {
Log.e(TAG, "Account recovery failed?");
LogUtils.e(TAG, "Account recovery failed?");
} else if (MailActivityEmail.DEBUG) {
Log.d(TAG, "No accounts to restore...");
LogUtils.d(TAG, "No accounts to restore...");
}
return numRecovered;
} finally {
@ -2509,16 +2510,17 @@ public class EmailProvider extends ContentProvider {
service.setTimeout(10);
acct = Account.restoreAccountWithId(context, accountId);
if (acct == null) {
Log.d(TAG, "getCapabilities() for " + accountId + ": returning 0x0 (no account)");
LogUtils.d(TAG, "getCapabilities() for " + accountId
+ ": returning 0x0 (no account)");
return 0;
}
capabilities = service.getCapabilities(acct);
// STOPSHIP
Log.d(TAG, "getCapabilities() for " + acct.mDisplayName + ": 0x" +
LogUtils.d(TAG, "getCapabilities() for " + acct.mDisplayName + ": 0x" +
Integer.toHexString(capabilities) + getBits(capabilities));
} catch (RemoteException e) {
// Nothing to do
Log.w(TAG, "getCapabilities() for " + acct.mDisplayName + ": RemoteException");
LogUtils.w(TAG, "getCapabilities() for " + acct.mDisplayName + ": RemoteException");
}
// If the configuration states that feedback is supported, add that capability
@ -3288,7 +3290,7 @@ public class EmailProvider extends ContentProvider {
@Override
public void close() {
super.close();
Log.d(TAG, "Closing cursor", new Error());
LogUtils.d(TAG, "Closing cursor", new Error());
}
}
@ -4097,7 +4099,7 @@ public class EmailProvider extends ContentProvider {
notifyUI(UIPROVIDER_CONVERSATION_NOTIFIER, Long.toString(id));
Mailbox mailbox = Mailbox.restoreMailboxWithId(getContext(), id);
if (mailbox == null) {
Log.w(TAG, "No mailbox for notification: " + id);
LogUtils.w(TAG, "No mailbox for notification: " + id);
return;
}
// Notify combined inbox...
@ -4246,7 +4248,7 @@ public class EmailProvider extends ContentProvider {
return;
}
Log.d(TAG, "Setting sync interval for account " + accountId + " to " + syncInterval +
LogUtils.d(TAG, "Setting sync interval for account " + accountId + " to " + syncInterval +
" minutes");
// TODO: Ideally we don't need to do this every time we change the sync interval.
@ -4348,7 +4350,7 @@ public class EmailProvider extends ContentProvider {
mSearchParams.mTotalCount);
notifyUIFolder(searchMailboxId, accountId);
} catch (RemoteException e) {
Log.e("searchMessages", "RemoteException", e);
LogUtils.e("searchMessages", "RemoteException", e);
}
}
return null;
@ -4364,7 +4366,8 @@ public class EmailProvider extends ContentProvider {
// TODO: Check the actual mailbox
Mailbox inbox = Mailbox.restoreMailboxOfType(getContext(), accountId, Mailbox.TYPE_INBOX);
if (inbox == null) {
Log.w(Logging.LOG_TAG, "In uiSearch, inbox doesn't exist for account " + accountId);
LogUtils.w(Logging.LOG_TAG, "In uiSearch, inbox doesn't exist for account "
+ accountId);
return null;
}
@ -4434,7 +4437,7 @@ public class EmailProvider extends ContentProvider {
MailActivityEmail.setServicesEnabledSync(context);
return 1;
} catch (Exception e) {
Log.w(Logging.LOG_TAG, "Exception while deleting account", e);
LogUtils.w(Logging.LOG_TAG, "Exception while deleting account", e);
}
return 0;
}

View File

@ -27,7 +27,6 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import com.android.email.R;
import com.android.emailcommon.provider.Account;
@ -36,6 +35,7 @@ import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.mail.providers.Folder;
import com.android.mail.utils.LogUtils;
public class FolderPickerActivity extends Activity implements FolderPickerCallback {
private static final String TAG = "FolderPickerActivity";
@ -47,6 +47,7 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
private String mAccountName;
private boolean mInSetup = true;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Intent i = getIntent();
@ -58,14 +59,14 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
if (uri != null) {
String id = uri.getQueryParameter("account");
if (id == null) {
Log.w(TAG, "No account # in Uri?");
LogUtils.w(TAG, "No account # in Uri?");
finish();
return;
}
try {
mAccountId = Long.parseLong(id);
} catch (NumberFormatException e) {
Log.w(TAG, "Invalid account # in Uri?");
LogUtils.w(TAG, "Invalid account # in Uri?");
finish();
return;
}
@ -75,13 +76,13 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
long trashMailboxId = Mailbox.findMailboxOfType(this, mAccountId, Mailbox.TYPE_TRASH);
// If we already have a trash mailbox, we're done (if in setup; a race?)
if (trashMailboxId != Mailbox.NO_MAILBOX && mInSetup) {
Log.w(TAG, "Trash folder already exists");
LogUtils.w(TAG, "Trash folder already exists");
finish();
return;
}
Account account = Account.restoreAccountWithId(this, mAccountId);
if (account == null) {
Log.w(TAG, "No account?");
LogUtils.w(TAG, "No account?");
finish();
} else {
mAccountName = account.mDisplayName;
@ -109,6 +110,7 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
}
}
@Override
public void onDestroy() {
super.onDestroy();
// Clean up
@ -130,6 +132,7 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
mContext = context;
}
@Override
public void onChange(boolean selfChange) {
Account account = Account.restoreAccountWithId(mContext, mAccountId);
// All we care about is whether the folder list is now loaded
@ -208,6 +211,7 @@ public class FolderPickerActivity extends Activity implements FolderPickerCallba
finish();
}
@Override
public void cancel() {
finish();
}

View File

@ -21,7 +21,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import com.android.email.LegacyConversions;
import com.android.emailcommon.Logging;
@ -35,6 +34,7 @@ import com.android.emailcommon.provider.EmailContent.MessageColumns;
import com.android.emailcommon.provider.EmailContent.SyncColumns;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.ConversionUtilities;
import com.android.mail.utils.LogUtils;
import java.io.IOException;
import java.util.ArrayList;
@ -158,13 +158,13 @@ public class Utilities {
context.getContentResolver().update(uri, cv, null, null);
} catch (MessagingException me) {
Log.e(Logging.LOG_TAG, "Error while copying downloaded message." + me);
LogUtils.e(Logging.LOG_TAG, "Error while copying downloaded message." + me);
}
} catch (RuntimeException rte) {
Log.e(Logging.LOG_TAG, "Error while storing downloaded message." + rte.toString());
LogUtils.e(Logging.LOG_TAG, "Error while storing downloaded message." + rte.toString());
} catch (IOException ioe) {
Log.e(Logging.LOG_TAG, "Error while storing attachment." + ioe.toString());
LogUtils.e(Logging.LOG_TAG, "Error while storing attachment." + ioe.toString());
}
}

View File

@ -30,7 +30,6 @@ import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.format.DateUtils;
import android.util.Log;
import com.android.email.AttachmentInfo;
import com.android.email.EmailConnectivityManager;
@ -46,6 +45,7 @@ import com.android.emailcommon.service.EmailServiceStatus;
import com.android.emailcommon.service.IEmailServiceCallback;
import com.android.emailcommon.utility.AttachmentUtilities;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import java.io.File;
import java.io.FileDescriptor;
@ -257,14 +257,14 @@ public class AttachmentDownloadService extends Service implements Runnable {
long priority = getPriority(att);
if (priority == PRIORITY_NONE) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Attachment changed: " + att.mId);
LogUtils.d(TAG, "== Attachment changed: " + att.mId);
}
// In this case, there is no download priority for this attachment
if (req != null) {
// If it exists in the map, remove it
// NOTE: We don't yet support deleting downloads in progress
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Attachment " + att.mId + " was in queue, removing");
LogUtils.d(TAG, "== Attachment " + att.mId + " was in queue, removing");
}
remove(req);
}
@ -279,7 +279,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
// If the request already existed, we'll update the priority (so that the time is
// up-to-date); otherwise, we create a new request
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Download queued for attachment " + att.mId + ", class " +
LogUtils.d(TAG, "== Download queued for attachment " + att.mId + ", class " +
req.priority + ", priority time " + req.time);
}
}
@ -314,7 +314,8 @@ public class AttachmentDownloadService extends Service implements Runnable {
*/
/*package*/ synchronized void processQueue() {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Checking attachment queue, " + mDownloadSet.size() + " entries");
LogUtils.d(TAG, "== Checking attachment queue, " + mDownloadSet.size()
+ " entries");
}
Iterator<DownloadRequest> iterator = mDownloadSet.descendingIterator();
@ -325,7 +326,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
// Enforce per-account limit here
if (downloadsForAccount(req.accountId) >= MAX_SIMULTANEOUS_DOWNLOADS_PER_ACCOUNT) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Skip #" + req.attachmentId + "; maxed for acct #" +
LogUtils.d(TAG, "== Skip #" + req.attachmentId + "; maxed for acct #" +
req.accountId);
}
continue;
@ -424,7 +425,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
long timeSinceCallback = now - req.lastCallbackTime;
if (timeSinceCallback > CALLBACK_TIMEOUT) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Download of " + req.attachmentId + " timed out");
LogUtils.d(TAG, "== Download of " + req.attachmentId + " timed out");
}
cancelDownload(req);
}
@ -436,7 +437,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
// If there are downloads in progress, reset alarm
if (!mDownloadsInProgress.isEmpty()) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Reschedule watchdog...");
LogUtils.d(TAG, "Reschedule watchdog...");
}
setWatchdogAlarm();
}
@ -458,7 +459,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
try {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, ">> Starting download for attachment #" + req.attachmentId);
LogUtils.d(TAG, ">> Starting download for attachment #" + req.attachmentId);
}
startDownload(service, req);
} catch (RemoteException e) {
@ -537,7 +538,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
if (statusCode == EmailServiceStatus.CONNECTION_ERROR) {
// If this needs to be retried, just process the queue again
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== The download for attachment #" + attachmentId +
LogUtils.d(TAG, "== The download for attachment #" + attachmentId +
" will be retried");
}
if (req != null) {
@ -558,8 +559,8 @@ public class AttachmentDownloadService extends Service implements Runnable {
}
String status = (statusCode == EmailServiceStatus.SUCCESS) ? "Success" :
"Error " + statusCode;
Log.d(TAG, "<< Download finished for attachment #" + attachmentId + "; " + secs +
" seconds from request, status: " + status);
LogUtils.d(TAG, "<< Download finished for attachment #" + attachmentId + "; " + secs
+ " seconds from request, status: " + status);
}
Attachment attachment = Attachment.restoreAttachmentWithId(mContext, attachmentId);
@ -588,7 +589,8 @@ public class AttachmentDownloadService extends Service implements Runnable {
if ((req != null) &&
!Utility.hasUnloadedAttachments(mContext, attachment.mMessageKey)) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "== Downloads finished for outgoing msg #" + req.messageId);
LogUtils.d(TAG, "== Downloads finished for outgoing msg #"
+ req.messageId);
}
EmailServiceProxy service = EmailServiceUtils.getServiceForAccount(
mContext, null, accountId);
@ -670,9 +672,9 @@ public class AttachmentDownloadService extends Service implements Runnable {
default: code = Integer.toString(statusCode); break;
}
if (statusCode != EmailServiceStatus.IN_PROGRESS) {
Log.d(TAG, ">> Attachment " + attachmentId + ": " + code);
LogUtils.d(TAG, ">> Attachment " + attachmentId + ": " + code);
} else if (progress >= (req.lastProgress + 15)) {
Log.d(TAG, ">> Attachment " + attachmentId + ": " + progress + "%");
LogUtils.d(TAG, ">> Attachment " + attachmentId + ": " + progress + "%");
}
}
req.lastStatusCode = statusCode;
@ -738,7 +740,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
DownloadRequest req = mDownloadSet.findDownloadRequest(attachmentId);
if (req != null) {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Dequeued attachmentId: " + attachmentId);
LogUtils.d(TAG, "Dequeued attachmentId: " + attachmentId);
}
mDownloadSet.remove(req);
return true;
@ -859,7 +861,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
return true;
} else {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, ">> Prefetch not allowed for account " + account.mId + "; used " +
LogUtils.d(TAG, ">> Prefetch not allowed for account " + account.mId + "; used " +
accountStorage + ", limit " + perAccountMaxStorage);
}
return false;
@ -880,7 +882,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
EmailContent.ID_PROJECTION, "(" + Attachment.FLAGS + " & ?) != 0",
new String[] {Integer.toString(mask)}, null);
try {
Log.d(TAG, "Count: " + c.getCount());
LogUtils.d(TAG, "Count: " + c.getCount());
while (c.moveToNext()) {
Attachment attachment = Attachment.restoreAttachmentWithId(
this, c.getLong(EmailContent.ID_PROJECTION_COLUMN));
@ -901,7 +903,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
mConnectivityManager.waitForConnectivity();
mDownloadSet.processQueue();
if (mDownloadSet.isEmpty()) {
Log.d(TAG, "*** All done; shutting down service");
LogUtils.d(TAG, "*** All done; shutting down service");
stopSelf();
break;
}

View File

@ -27,7 +27,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import com.android.email.Preferences;
import com.android.email.R;
@ -38,6 +37,7 @@ import com.android.emailcommon.VendorPolicyLoader;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.HostAuth;
import com.android.mail.utils.LogUtils;
/**
* The service that really handles broadcast intents on a worker thread.
@ -139,7 +139,7 @@ public class EmailBroadcastProcessorService extends IntentService {
final int initialProgress = progress;
if (progress < 1) {
Log.i(Logging.LOG_TAG, "Onetime initialization: 1");
LogUtils.i(Logging.LOG_TAG, "Onetime initialization: 1");
progress = 1;
if (VendorPolicyLoader.getInstance(this).useAlternateExchangeStrings()) {
setComponentEnabled(EasAuthenticatorServiceAlternate.class, true);
@ -148,7 +148,7 @@ public class EmailBroadcastProcessorService extends IntentService {
}
if (progress < 2) {
Log.i(Logging.LOG_TAG, "Onetime initialization: 2");
LogUtils.i(Logging.LOG_TAG, "Onetime initialization: 2");
progress = 2;
setImapDeletePolicy(this);
}
@ -160,7 +160,7 @@ public class EmailBroadcastProcessorService extends IntentService {
if (progress != initialProgress) {
pref.setOneTimeInitializationProgress(progress);
Log.i(Logging.LOG_TAG, "Onetime initialization: completed.");
LogUtils.i(Logging.LOG_TAG, "Onetime initialization: completed.");
}
}
@ -202,7 +202,7 @@ public class EmailBroadcastProcessorService extends IntentService {
}
private void onSystemAccountChanged() {
Log.i(Logging.LOG_TAG, "System accounts updated.");
LogUtils.i(Logging.LOG_TAG, "System accounts updated.");
reconcileAndStartServices();
}
}

View File

@ -25,7 +25,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.NotificationController;
import com.android.email.mail.Sender;
@ -63,6 +62,7 @@ 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.utils.LogUtils;
import java.util.HashSet;
@ -190,7 +190,7 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
mCallback.loadMessageStatus(messageId, 0, 100);
} catch (MessagingException me) {
if (Logging.LOGD) Log.v(Logging.LOG_TAG, "", me);
if (Logging.LOGD) LogUtils.v(Logging.LOG_TAG, "", me);
mCallback.loadMessageStatus(messageId, EmailServiceStatus.REMOTE_EXCEPTION, 0);
} catch (RuntimeException rte) {
mCallback.loadMessageStatus(messageId, EmailServiceStatus.REMOTE_EXCEPTION, 0);
@ -313,7 +313,7 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
remoteFolder.close(false);
}
catch (MessagingException me) {
if (Logging.LOGD) Log.v(Logging.LOG_TAG, "", me);
if (Logging.LOGD) LogUtils.v(Logging.LOG_TAG, "", me);
// TODO: Fix this up; consider the best approach
ContentValues cv = new ContentValues();
@ -536,7 +536,7 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
// Don't send messages with unloaded attachments
if (Utility.hasUnloadedAttachments(context, messageId)) {
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "Can't send #" + messageId +
LogUtils.d(Logging.LOG_TAG, "Can't send #" + messageId +
"; unloaded attachments");
}
continue;

View File

@ -43,7 +43,6 @@ import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.SyncState;
import android.provider.ContactsContract;
import android.provider.SyncStateContract;
import android.util.Log;
import com.android.email.R;
import com.android.emailcommon.Api;
@ -57,6 +56,7 @@ import com.android.emailcommon.service.IEmailService;
import com.android.emailcommon.service.IEmailServiceCallback;
import com.android.emailcommon.service.SearchParams;
import com.android.emailcommon.service.SyncWindow;
import com.android.mail.utils.LogUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -202,7 +202,7 @@ public class EmailServiceUtils {
info = getServiceInfo(context, protocol);
}
if (info == null) {
Log.w(Logging.LOG_TAG, "Returning NullService for " + protocol);
LogUtils.w(Logging.LOG_TAG, "Returning NullService for " + protocol);
return new EmailServiceProxy(context, NullService.class, null);
} else {
return getServiceFromInfo(context, callback, info);
@ -245,11 +245,11 @@ public class EmailServiceUtils {
// here, as there is nothing to actually do about them.
future.getResult();
} catch (OperationCanceledException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
} catch (AuthenticatorException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
} catch (IOException e) {
Log.w(Logging.LOG_TAG, e.toString());
LogUtils.w(Logging.LOG_TAG, e.toString());
}
}
@ -316,7 +316,8 @@ public class EmailServiceUtils {
if (!hostAuth.mProtocol.equals(oldInfo.protocol)) {
return;
}
Log.w(Logging.LOG_TAG, "Converting " + amAccount.name + " to " + newInfo.protocol);
LogUtils.w(Logging.LOG_TAG, "Converting " + amAccount.name + " to "
+ newInfo.protocol);
final ContentValues accountValues = new ContentValues();
int oldFlags = account.mFlags;
@ -333,7 +334,7 @@ public class EmailServiceUtils {
hostValues.put(HostAuth.PROTOCOL, newInfo.protocol);
resolver.update(ContentUris.withAppendedId(HostAuth.CONTENT_URI, hostAuth.mId),
hostValues, null, null);
Log.w(Logging.LOG_TAG, "Updated HostAuths");
LogUtils.w(Logging.LOG_TAG, "Updated HostAuths");
try {
// Get current settings for the existing AccountManager account
@ -348,8 +349,8 @@ public class EmailServiceUtils {
ContactsContract.AUTHORITY);
final boolean calendar = ContentResolver.getSyncAutomatically(amAccount,
CalendarContract.AUTHORITY);
Log.w(Logging.LOG_TAG, "Email: " + email + ", Contacts: " + contacts + "," +
" Calendar: " + calendar);
LogUtils.w(Logging.LOG_TAG, "Email: " + email + ", Contacts: " + contacts + ","
+ " Calendar: " + calendar);
// Get sync keys for calendar/contacts
final String amName = amAccount.name;
@ -362,7 +363,7 @@ public class EmailServiceUtils {
asCalendarSyncAdapter(SyncState.CONTENT_URI, amName, oldType),
new android.accounts.Account(amName, oldType));
} catch (RemoteException e) {
Log.w(Logging.LOG_TAG, "Get calendar key FAILED");
LogUtils.w(Logging.LOG_TAG, "Get calendar key FAILED");
} finally {
client.release();
}
@ -374,28 +375,30 @@ public class EmailServiceUtils {
ContactsContract.SyncState.CONTENT_URI,
new android.accounts.Account(amName, oldType));
} catch (RemoteException e) {
Log.w(Logging.LOG_TAG, "Get contacts key FAILED");
LogUtils.w(Logging.LOG_TAG, "Get contacts key FAILED");
} finally {
client.release();
}
if (calendarSyncKey != null) {
Log.w(Logging.LOG_TAG, "Got calendar key: " + new String(calendarSyncKey));
LogUtils.w(Logging.LOG_TAG, "Got calendar key: "
+ new String(calendarSyncKey));
}
if (contactsSyncKey != null) {
Log.w(Logging.LOG_TAG, "Got contacts key: " + new String(contactsSyncKey));
LogUtils.w(Logging.LOG_TAG, "Got contacts key: "
+ new String(contactsSyncKey));
}
// Set up a new AccountManager account with new type and old settings
AccountManagerFuture<?> amFuture = MailService.setupAccountManagerAccount(
context, account, email, calendar, contacts, null);
finishAccountManagerBlocker(amFuture);
Log.w(Logging.LOG_TAG, "Created new AccountManager account");
LogUtils.w(Logging.LOG_TAG, "Created new AccountManager account");
// Delete the AccountManager account
amFuture = AccountManager.get(context)
.removeAccount(amAccount, null, null);
finishAccountManagerBlocker(amFuture);
Log.w(Logging.LOG_TAG, "Deleted old AccountManager account");
LogUtils.w(Logging.LOG_TAG, "Deleted old AccountManager account");
// Restore sync keys for contacts/calendar
if (calendarSyncKey != null && calendarSyncKey.length != 0) {
@ -407,9 +410,9 @@ public class EmailServiceUtils {
newInfo.accountType),
new android.accounts.Account(amName, newInfo.accountType),
calendarSyncKey);
Log.w(Logging.LOG_TAG, "Set calendar key...");
LogUtils.w(Logging.LOG_TAG, "Set calendar key...");
} catch (RemoteException e) {
Log.w(Logging.LOG_TAG, "Set calendar key FAILED");
LogUtils.w(Logging.LOG_TAG, "Set calendar key FAILED");
} finally {
client.release();
}
@ -422,9 +425,9 @@ public class EmailServiceUtils {
ContactsContract.SyncState.CONTENT_URI,
new android.accounts.Account(amName, newInfo.accountType),
contactsSyncKey);
Log.w(Logging.LOG_TAG, "Set contacts key...");
LogUtils.w(Logging.LOG_TAG, "Set contacts key...");
} catch (RemoteException e) {
Log.w(Logging.LOG_TAG, "Set contacts key FAILED");
LogUtils.w(Logging.LOG_TAG, "Set contacts key FAILED");
}
}
@ -433,19 +436,19 @@ public class EmailServiceUtils {
EmailServiceUtils.getServiceFromInfo(context, null, newInfo);
try {
service.serviceUpdated(amAccount.name);
Log.w(Logging.LOG_TAG, "Updated account settings");
LogUtils.w(Logging.LOG_TAG, "Updated account settings");
} catch (RemoteException e) {
// Old settings won't hurt anyone
}
}
// That's all folks!
Log.w(Logging.LOG_TAG, "Account update completed.");
LogUtils.w(Logging.LOG_TAG, "Account update completed.");
} finally {
// Clear the incomplete flag on the provider account
accountValues.put(AccountColumns.FLAGS, oldFlags);
resolver.update(accountUri, accountValues, null, null);
Log.w(Logging.LOG_TAG, "[Incomplete flag cleared]");
LogUtils.w(Logging.LOG_TAG, "[Incomplete flag cleared]");
}
}
} finally {
@ -454,7 +457,7 @@ public class EmailServiceUtils {
}
private static void disableComponent(Context context, Class<?> klass) {
Log.w(Logging.LOG_TAG, "Disabling legacy authenticator " + klass.getSimpleName());
LogUtils.w(Logging.LOG_TAG, "Disabling legacy authenticator " + klass.getSimpleName());
final ComponentName c = new ComponentName(context, klass);
context.getPackageManager().setComponentEnabledSetting(c,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,

View File

@ -29,7 +29,6 @@ import android.os.IBinder;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import com.android.email.LegacyConversions;
import com.android.email.NotificationController;
@ -62,6 +61,7 @@ import com.android.emailcommon.service.IEmailServiceCallback;
import com.android.emailcommon.service.SearchParams;
import com.android.emailcommon.utility.AttachmentUtilities;
import com.android.mail.providers.UIProvider.AccountCapabilities;
import com.android.mail.utils.LogUtils;
import java.util.ArrayList;
import java.util.Arrays;
@ -71,9 +71,6 @@ import java.util.HashMap;
import java.util.HashSet;
public class ImapService extends Service {
private static final String TAG = "ImapService";
private static final int MAX_SMALL_MESSAGE_SIZE = (25 * 1024);
private static final Flag[] FLAG_LIST_SEEN = new Flag[] { Flag.SEEN };
private static final Flag[] FLAG_LIST_FLAGGED = new Flag[] { Flag.FLAGGED };
private static final Flag[] FLAG_LIST_ANSWERED = new Flag[] { Flag.ANSWERED };
@ -185,7 +182,7 @@ public class ImapService extends Service {
sendMailboxStatus(folder, EmailServiceStatus.SUCCESS);
} catch (MessagingException e) {
if (Logging.LOGD) {
Log.v(Logging.LOG_TAG, "synchronizeMailbox", e);
LogUtils.v(Logging.LOG_TAG, "synchronizeMailbox", e);
}
if (e instanceof AuthenticationFailedException) {
// Generate authentication notification
@ -310,14 +307,14 @@ public class ImapService extends Service {
unseenMessages.add(localMessage.mId);
}
} catch (MessagingException me) {
Log.e(Logging.LOG_TAG,
LogUtils.e(Logging.LOG_TAG,
"Error while copying downloaded message." + me);
}
}
}
catch (Exception e) {
Log.e(Logging.LOG_TAG,
LogUtils.e(Logging.LOG_TAG,
"Error while storing downloaded message." + e.toString());
}
}
@ -684,7 +681,7 @@ public class ImapService extends Service {
// Presumably an error here is an account connection failure, so there is
// no point in continuing through the rest of the pending updates.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "Unable to process pending delete for id="
LogUtils.d(Logging.LOG_TAG, "Unable to process pending delete for id="
+ lastMessageId + ": " + me);
}
} finally {
@ -792,7 +789,7 @@ public class ImapService extends Service {
// Presumably an error here is an account connection failure, so there is
// no point in continuing through the rest of the pending updates.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "Unable to process pending upsync for id="
LogUtils.d(Logging.LOG_TAG, "Unable to process pending upsync for id="
+ lastMessageId + ": " + me);
}
} finally {
@ -881,7 +878,7 @@ public class ImapService extends Service {
// Presumably an error here is an account connection failure, so there is
// no point in continuing through the rest of the pending updates.
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG, "Unable to process pending update for id="
LogUtils.d(Logging.LOG_TAG, "Unable to process pending update for id="
+ lastMessageId + ": " + me);
}
} finally {
@ -915,21 +912,21 @@ public class ImapService extends Service {
final boolean deleteUpdate;
if (newMessage == null) {
deleteUpdate = true;
Log.d(Logging.LOG_TAG, "Upsync failed for null message, id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsync failed for null message, id=" + messageId);
} else if (mailbox.mType == Mailbox.TYPE_DRAFTS) {
deleteUpdate = false;
Log.d(Logging.LOG_TAG, "Upsync skipped for mailbox=drafts, id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsync skipped for mailbox=drafts, id=" + messageId);
} else if (mailbox.mType == Mailbox.TYPE_OUTBOX) {
deleteUpdate = false;
Log.d(Logging.LOG_TAG, "Upsync skipped for mailbox=outbox, id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsync skipped for mailbox=outbox, id=" + messageId);
} else if (mailbox.mType == Mailbox.TYPE_TRASH) {
deleteUpdate = false;
Log.d(Logging.LOG_TAG, "Upsync skipped for mailbox=trash, id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsync skipped for mailbox=trash, id=" + messageId);
} else if (newMessage != null && newMessage.mMailboxKey != mailbox.mId) {
deleteUpdate = false;
Log.d(Logging.LOG_TAG, "Upsync skipped; mailbox changed, id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsync skipped; mailbox changed, id=" + messageId);
} else {
Log.d(Logging.LOG_TAG, "Upsyc triggered for message id=" + messageId);
LogUtils.d(Logging.LOG_TAG, "Upsyc triggered for message id=" + messageId);
deleteUpdate = processPendingAppend(context, remoteStore, account, mailbox, newMessage);
}
if (deleteUpdate) {
@ -988,7 +985,7 @@ public class ImapService extends Service {
return;
}
if (MailActivityEmail.DEBUG) {
Log.d(Logging.LOG_TAG,
LogUtils.d(Logging.LOG_TAG,
"Update for msg id=" + newMessage.mId
+ " read=" + newMessage.mFlagRead
+ " flagged=" + newMessage.mFlagFavorite
@ -1320,7 +1317,7 @@ public class ImapService extends Service {
final Mailbox mailbox = Mailbox.restoreMailboxWithId(context, searchParams.mMailboxId);
final Mailbox destMailbox = Mailbox.restoreMailboxWithId(context, destMailboxId);
if (account == null || mailbox == null || destMailbox == null) {
Log.d(Logging.LOG_TAG, "Attempted search for " + searchParams
LogUtils.d(Logging.LOG_TAG, "Attempted search for " + searchParams
+ " but account or mailbox information was missing");
return 0;
}
@ -1401,11 +1398,11 @@ public class ImapService extends Service {
}
Utilities.copyOneMessageToProvider(context, message, localMessage, flag);
} catch (MessagingException me) {
Log.e(Logging.LOG_TAG,
LogUtils.e(Logging.LOG_TAG,
"Error while copying downloaded message." + me);
}
} catch (Exception e) {
Log.e(Logging.LOG_TAG,
LogUtils.e(Logging.LOG_TAG,
"Error while storing downloaded message." + e.toString());
}
}

View File

@ -16,8 +16,6 @@
package com.android.email.service;
import android.util.Log;
import com.android.email.FixedLengthInputStream;
import com.android.email.mail.store.imap.ImapResponse;
import com.android.email.mail.store.imap.ImapResponseParser;
@ -25,6 +23,7 @@ import com.android.email.mail.store.imap.ImapString;
import com.android.emailcommon.Logging;
import com.android.emailcommon.TempDirectory;
import com.android.emailcommon.utility.Utility;
import com.android.mail.utils.LogUtils;
import org.apache.commons.io.IOUtils;
@ -80,7 +79,7 @@ public class ImapTempFileLiteral extends ImapString {
return new FileInputStream(mFile);
} catch (FileNotFoundException e) {
// It's probably possible if we're low on storage and the system clears the cache dir.
Log.w(Logging.LOG_TAG, "ImapTempFileLiteral: Temp file not found");
LogUtils.w(Logging.LOG_TAG, "ImapTempFileLiteral: Temp file not found");
// Return 0 byte stream as a dummy...
return new ByteArrayInputStream(new byte[0]);
@ -98,7 +97,7 @@ public class ImapTempFileLiteral extends ImapString {
}
return Utility.fromAscii(bytes);
} catch (IOException e) {
Log.w(Logging.LOG_TAG, "ImapTempFileLiteral: Error while reading temp file", e);
LogUtils.w(Logging.LOG_TAG, "ImapTempFileLiteral: Error while reading temp file", e);
return "";
}
}
@ -111,7 +110,7 @@ public class ImapTempFileLiteral extends ImapString {
}
} catch (RuntimeException re) {
// Just log and ignore.
Log.w(Logging.LOG_TAG, "Failed to remove temp file: " + re.getMessage());
LogUtils.w(Logging.LOG_TAG, "Failed to remove temp file: " + re.getMessage());
}
super.destroy();
}

View File

@ -25,7 +25,6 @@ import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import com.android.email.provider.AccountReconciler;
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
@ -33,6 +32,7 @@ import com.android.email2.ui.MailActivityEmail;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
@ -104,7 +104,7 @@ public class MailService extends Service {
@Override
public void run() {
Log.d("MailService", "Reconciling accounts of type " + mInfo.accountType +
LogUtils.d("MailService", "Reconciling accounts of type " + mInfo.accountType +
", protocol " + mInfo.protocol);
android.accounts.Account[] accountManagerAccounts = AccountManager.get(mContext)
.getAccountsByType(mInfo.accountType);

View File

@ -28,7 +28,6 @@ import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.util.Log;
import com.android.email.NotificationController;
import com.android.email.mail.Store;
@ -46,7 +45,6 @@ import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.EmailContent.Attachment;
import com.android.emailcommon.provider.EmailContent.AttachmentColumns;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.EmailContent.MessageColumns;
import com.android.emailcommon.provider.EmailContent.SyncColumns;
@ -58,6 +56,7 @@ 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;
import org.apache.james.mime4j.EOLConvertingInputStream;
@ -148,7 +147,7 @@ public class Pop3Service extends Service {
sendMailboxStatus(folder, EmailServiceStatus.SUCCESS);
} catch (MessagingException e) {
if (Logging.LOGD) {
Log.v(Logging.LOG_TAG, "synchronizeMailbox", e);
LogUtils.v(Logging.LOG_TAG, "synchronizeMailbox", e);
}
if (e instanceof AuthenticationFailedException) {
// Generate authentication notification
@ -198,7 +197,7 @@ public class Pop3Service extends Service {
Pop3Folder remoteFolder, ArrayList<Pop3Message> unsyncedMessages,
final Mailbox toMailbox) throws MessagingException {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Loading " + unsyncedMessages.size() + " unsynced messages");
LogUtils.d(TAG, "Loading " + unsyncedMessages.size() + " unsynced messages");
}
try {
int cnt = unsyncedMessages.size();
@ -214,7 +213,8 @@ public class Pop3Service extends Service {
flag = EmailContent.Message.FLAG_LOADED_UNKNOWN;
}
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "Message is " + (message.isComplete() ? "" : "NOT ") + "complete");
LogUtils.d(TAG, "Message is " + (message.isComplete() ? "" : "NOT ")
+ "complete");
}
// If message is incomplete, create a "fake" attachment
Utilities.copyOneMessageToProvider(context, message, account, toMailbox, flag);
@ -364,7 +364,7 @@ public class Pop3Service extends Service {
}
} else {
if (MailActivityEmail.DEBUG) {
Log.d(TAG, "*** Message count is zero??");
LogUtils.d(TAG, "*** Message count is zero??");
}
remoteFolder.close(false);
return;
@ -405,7 +405,7 @@ public class Pop3Service extends Service {
int flag = EmailContent.Message.FLAG_LOADED_COMPLETE;
if (!popMessage.isComplete()) {
Log.e(TAG, "How is this possible?");
LogUtils.e(TAG, "How is this possible?");
}
Utilities.copyOneMessageToProvider(
context, popMessage, account, mailbox, flag);

View File

@ -29,7 +29,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import com.android.email.R;
import com.android.emailcommon.TempDirectory;
@ -40,6 +39,7 @@ import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.service.EmailServiceProxy;
import com.android.mail.utils.LogUtils;
import java.util.ArrayList;
@ -113,7 +113,7 @@ public class PopImapSyncAdapterService extends Service {
new String[] {Long.toString(mailbox.mId)});
return;
}
Log.d(TAG, "Mailbox: " + mailbox.mDisplayName);
LogUtils.d(TAG, "Mailbox: " + mailbox.mDisplayName);
Uri mailboxUri = ContentUris.withAppendedId(Mailbox.CONTENT_URI, mailboxId);
ContentValues values = new ContentValues();
@ -168,7 +168,7 @@ public class PopImapSyncAdapterService extends Service {
Account acct = new Account();
acct.restore(c);
if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD)) {
Log.d(TAG, "Upload sync request for " + acct.mDisplayName);
LogUtils.d(TAG, "Upload sync request for " + acct.mDisplayName);
// See if any boxes have mail...
ArrayList<Long> mailboxesToUpdate;
Cursor updatesCursor = provider.query(Message.UPDATED_CONTENT_URI,
@ -194,8 +194,8 @@ public class PopImapSyncAdapterService extends Service {
sync(context, mailboxId, syncResult, false, 0);
}
} else {
Log.d(TAG, "Sync request for " + acct.mDisplayName);
Log.d(TAG, extras.toString());
LogUtils.d(TAG, "Sync request for " + acct.mDisplayName);
LogUtils.d(TAG, extras.toString());
long mailboxId =
extras.getLong(Mailbox.SYNC_EXTRA_MAILBOX_ID, Mailbox.NO_MAILBOX);
boolean isInbox = false;

View File

@ -25,7 +25,6 @@ import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import com.android.email.NotificationController;
import com.android.email.Preferences;
@ -49,12 +48,10 @@ import com.android.mail.utils.LogTag;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.Utils;
import java.util.List;
public class MailActivityEmail extends com.android.mail.ui.MailActivity {
/**
* If this is enabled there will be additional logging information sent to
* Log.d, including protocol dumps.
* LogUtils.d, including protocol dumps.
*
* This should only be used for logs that are useful for debbuging user problems,
* not for internal/development logs.
@ -239,7 +236,7 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
* The calls to log() must be guarded with "if (Email.LOGD)" for performance reasons.
*/
public static void log(String message) {
Log.d(Logging.LOG_TAG, message);
LogUtils.d(Logging.LOG_TAG, message);
}
/**
@ -261,7 +258,8 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
public static void warnIfUiThread() {
if (Thread.currentThread().equals(sUiThread)) {
Log.w(Logging.LOG_TAG, "Method called on the UI thread", new Exception("STACK TRACE"));
LogUtils.w(Logging.LOG_TAG, "Method called on the UI thread",
new Exception("STACK TRACE"));
}
}

View File

@ -24,7 +24,6 @@ import com.android.emailcommon.provider.Account;
import android.content.Context;
import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import junit.framework.Assert;
@ -173,7 +172,7 @@ public class RefreshManagerTest extends InstrumentationTestCase {
assertEquals(0, mTarget.getMailboxListStatusForTest(ACCOUNT_1).getLastRefreshTime());
// Done.
Log.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
LogUtils.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
mController.mListener.updateMailboxListCallback(null, ACCOUNT_1, 100);
assertTrue(mListener.mCalledOnRefreshStatusChanged);
@ -271,7 +270,7 @@ public class RefreshManagerTest extends InstrumentationTestCase {
assertEquals(0, mTarget.getMessageListStatusForTest(MAILBOX_1).getLastRefreshTime());
// Done.
Log.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
LogUtils.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
mController.mListener.updateMailboxCallback(null, ACCOUNT_1, MAILBOX_1, 100, 0, null);
assertTrue(mListener.mCalledOnRefreshStatusChanged);
@ -373,7 +372,7 @@ public class RefreshManagerTest extends InstrumentationTestCase {
mListener.reset();
// Done.
Log.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
LogUtils.w(Logging.LOG_TAG, "" + mController.mListener.getClass());
mController.mListener.sendMailCallback(null, ACCOUNT_1, -1, 100);
assertFalse(mListener.mCalledOnConnectionError);

View File

@ -23,7 +23,6 @@ import android.content.Context;
import android.os.PowerManager;
import android.test.MoreAsserts;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import android.view.View;
import android.view.ViewParent;
@ -114,7 +113,7 @@ public class TestUtils extends TestCase /* It tests itself */ {
* Wait until a {@code Condition} is met.
*/
public static void waitUntil(String message, Condition condition, int timeoutSeconds) {
Log.d(Logging.LOG_TAG, message + ": Waiting...");
LogUtils.d(Logging.LOG_TAG, message + ": Waiting...");
final long timeout = System.currentTimeMillis() + timeoutSeconds * 1000;
while (System.currentTimeMillis() < timeout) {
if (condition.isMet()) {

View File

@ -24,7 +24,6 @@ import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.MultiAutoCompleteTextView;

View File

@ -18,8 +18,6 @@ package com.android.email.mail.transport;
import com.android.email.mail.Transport;
import android.util.Log;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -296,12 +294,12 @@ public class MockTransport implements Transport {
}
if (mQueuedInput.size() == 0) {
// MailTransport returns "" at EOS.
Log.w(LOG_TAG, "Underflow reading from MockTransport");
LogUtils.w(LOG_TAG, "Underflow reading from MockTransport");
return "";
}
String line = mQueuedInput.remove(0);
if (DEBUG_LOG_STREAMS) {
Log.d(LOG_TAG, "<<< " + line);
LogUtils.d(LOG_TAG, "<<< " + line);
}
if (SPECIAL_RESPONSE_IOEXCEPTION.equals(line)) {
throw new IOException("Expected IOException.");
@ -339,7 +337,7 @@ public class MockTransport implements Transport {
@Override
public void writeLine(String s, String sensitiveReplacement) throws IOException {
if (DEBUG_LOG_STREAMS) {
Log.d(LOG_TAG, ">>> " + s);
LogUtils.d(LOG_TAG, ">>> " + s);
}
SmtpSenderUnitTests.assertTrue(mOpen);
SmtpSenderUnitTests.assertTrue("Overflow writing to MockTransport: Getting " + s,

View File

@ -20,7 +20,6 @@ package com.android.emailcommon;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.test.AndroidTestCase;
import android.util.Log;
public class DeviceTests extends AndroidTestCase {
@ -28,7 +27,7 @@ public class DeviceTests extends AndroidTestCase {
TelephonyManager tm =
(TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
if (tm == null) {
Log.w(Logging.LOG_TAG, "TelephonyManager not supported. Skipping.");
LogUtils.w(Logging.LOG_TAG, "TelephonyManager not supported. Skipping.");
return;
}