commit
05df114eb1
105 changed files with 948 additions and 1276 deletions
|
@ -34,6 +34,7 @@ dependencies {
|
|||
compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
|
||||
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
|
||||
compile 'com.squareup.moshi:moshi:1.2.0'
|
||||
compile 'com.jakewharton.timber:timber:4.5.1'
|
||||
|
||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
|
@ -760,7 +760,7 @@ public class Account implements BaseAccount, StoreConfig {
|
|||
try {
|
||||
getLocalStore().resetVisibleLimits(getDisplayCount());
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to reset visible limits", e);
|
||||
Timber.e(e, "Unable to reset visible limits");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -953,8 +953,7 @@ public class Account implements BaseAccount, StoreConfig {
|
|||
switchLocalStorage(id);
|
||||
successful = true;
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Switching local storage provider from " +
|
||||
mLocalStorageProviderId + " to " + id + " failed.", e);
|
||||
Timber.e(e, "Switching local storage provider from %s to %s failed.", mLocalStorageProviderId, id);
|
||||
}
|
||||
|
||||
// if migration to/from SD-card failed once, it will fail again.
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.os.Handler;
|
|||
import android.os.Looper;
|
||||
import android.os.StrictMode;
|
||||
import android.text.format.Time;
|
||||
import android.util.Log;
|
||||
|
||||
import com.fsck.k9.Account.SortType;
|
||||
import com.fsck.k9.activity.MessageCompose;
|
||||
|
@ -45,6 +44,9 @@ import com.fsck.k9.service.MailService;
|
|||
import com.fsck.k9.service.ShutdownReceiver;
|
||||
import com.fsck.k9.service.StorageGoneReceiver;
|
||||
import com.fsck.k9.widget.list.MessageListWidgetProvider;
|
||||
import timber.log.Timber;
|
||||
import timber.log.Timber.DebugTree;
|
||||
|
||||
|
||||
public class K9 extends Application {
|
||||
/**
|
||||
|
@ -135,7 +137,7 @@ public class K9 extends Application {
|
|||
* Log.d, including protocol dumps.
|
||||
* Controlled by Preferences at run-time
|
||||
*/
|
||||
public static boolean DEBUG = false;
|
||||
private static boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* If this is enabled than logging that normally hides sensitive information
|
||||
|
@ -416,7 +418,7 @@ public class K9 extends Application {
|
|||
try {
|
||||
queue.put(new Handler());
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(K9.LOG_TAG, "", e);
|
||||
Timber.e(e);
|
||||
}
|
||||
Looper.loop();
|
||||
}
|
||||
|
@ -426,13 +428,13 @@ public class K9 extends Application {
|
|||
try {
|
||||
final Handler storageGoneHandler = queue.take();
|
||||
registerReceiver(receiver, filter, null, storageGoneHandler);
|
||||
Log.i(K9.LOG_TAG, "Registered: unmount receiver");
|
||||
Timber.i("Registered: unmount receiver");
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to register unmount receiver", e);
|
||||
Timber.e(e, "Unable to register unmount receiver");
|
||||
}
|
||||
|
||||
registerReceiver(new ShutdownReceiver(), new IntentFilter(Intent.ACTION_SHUTDOWN));
|
||||
Log.i(K9.LOG_TAG, "Registered: shutdown receiver");
|
||||
Timber.i("Registered: shutdown receiver");
|
||||
}
|
||||
|
||||
public static void save(StorageEditor editor) {
|
||||
|
@ -565,21 +567,19 @@ public class K9 extends Application {
|
|||
intent.putExtra(K9.Intents.EmailReceived.EXTRA_SUBJECT, message.getSubject());
|
||||
intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM_SELF, account.isAnIdentity(message.getFrom()));
|
||||
K9.this.sendBroadcast(intent);
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "Broadcasted: action=" + action
|
||||
+ " account=" + account.getDescription()
|
||||
+ " folder=" + folder
|
||||
+ " message uid=" + message.getUid()
|
||||
);
|
||||
|
||||
Timber.d("Broadcasted: action=%s account=%s folder=%s message uid=%s",
|
||||
action,
|
||||
account.getDescription(),
|
||||
folder,
|
||||
message.getUid());
|
||||
}
|
||||
|
||||
private void updateUnreadWidget() {
|
||||
try {
|
||||
UnreadWidgetProvider.updateUnreadCount(K9.this);
|
||||
} catch (Exception e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(LOG_TAG, "Error while updating unread widget(s)", e);
|
||||
}
|
||||
Timber.e(e, "Error while updating unread widget(s)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,8 +589,8 @@ public class K9 extends Application {
|
|||
} catch (RuntimeException e) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
throw e;
|
||||
} else if (K9.DEBUG) {
|
||||
Log.e(LOG_TAG, "Error while updating message list widget", e);
|
||||
} else {
|
||||
Timber.e(e, "Error while updating message list widget");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ public class K9 extends Application {
|
|||
*/
|
||||
public static void loadPrefs(Preferences prefs) {
|
||||
Storage storage = prefs.getStorage();
|
||||
DEBUG = storage.getBoolean("enableDebugLogging", BuildConfig.DEVELOPER_MODE);
|
||||
setDebug(storage.getBoolean("enableDebugLogging", BuildConfig.DEVELOPER_MODE));
|
||||
DEBUG_SENSITIVE = storage.getBoolean("enableSensitiveLogging", false);
|
||||
mAnimations = storage.getBoolean("animations", true);
|
||||
mGesturesEnabled = storage.getBoolean("gesturesEnabled", false);
|
||||
|
@ -799,13 +799,12 @@ public class K9 extends Application {
|
|||
protected void notifyObservers() {
|
||||
synchronized (observers) {
|
||||
for (final ApplicationAware aware : observers) {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Initializing observer: " + aware);
|
||||
}
|
||||
Timber.v("Initializing observer: %s", aware);
|
||||
|
||||
try {
|
||||
aware.initializeComponent(this);
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "Failure when notifying " + aware, e);
|
||||
Timber.w(e, "Failure when notifying %s", aware);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1016,14 @@ public class K9 extends Application {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void setDebug(boolean debug) {
|
||||
K9.DEBUG = debug;
|
||||
updateLoggingStatus();
|
||||
}
|
||||
|
||||
public static boolean isDebug() {
|
||||
return DEBUG;
|
||||
}
|
||||
|
||||
public static boolean startIntegratedInbox() {
|
||||
return mStartIntegratedInbox;
|
||||
|
@ -1419,4 +1425,13 @@ public class K9 extends Application {
|
|||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateLoggingStatus() {
|
||||
Timber.uprootAll();
|
||||
boolean enableDebugLogging = BuildConfig.DEBUG || DEBUG;
|
||||
if (enableDebugLogging) {
|
||||
Timber.plant(new DebugTree());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,13 +10,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.mail.store.RemoteStore;
|
||||
import com.fsck.k9.mailstore.LocalStore;
|
||||
import com.fsck.k9.preferences.StorageEditor;
|
||||
import com.fsck.k9.preferences.Storage;
|
||||
|
||||
|
||||
public class Preferences {
|
||||
|
||||
private static Preferences preferences;
|
||||
|
@ -40,7 +41,7 @@ public class Preferences {
|
|||
mStorage = Storage.getStorage(context);
|
||||
mContext = context;
|
||||
if (mStorage.isEmpty()) {
|
||||
Log.i(K9.LOG_TAG, "Preferences storage is zero-size, importing from Android-style preferences");
|
||||
Timber.i("Preferences storage is zero-size, importing from Android-style preferences");
|
||||
StorageEditor editor = mStorage.edit();
|
||||
editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE));
|
||||
editor.commit();
|
||||
|
@ -128,7 +129,7 @@ public class Preferences {
|
|||
try {
|
||||
RemoteStore.removeInstance(account);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e);
|
||||
Timber.e(e, "Failed to reset remote store for account %s", account.getUuid());
|
||||
}
|
||||
LocalStore.removeAccount(account);
|
||||
|
||||
|
@ -176,8 +177,8 @@ public class Preferences {
|
|||
try {
|
||||
return Enum.valueOf(defaultEnum.getDeclaringClass(), stringPref);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Log.w(K9.LOG_TAG, "Unable to convert preference key [" + key +
|
||||
"] value [" + stringPref + "] to enum of type " + defaultEnum.getDeclaringClass(), ex);
|
||||
Timber.w(ex, "Unable to convert preference key [%s] value [%s] to enum of type %s",
|
||||
key, stringPref, defaultEnum.getDeclaringClass());
|
||||
|
||||
return defaultEnum;
|
||||
}
|
||||
|
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
package com.fsck.k9;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
/**
|
||||
* This class used to "throttle" a flow of events.
|
||||
*
|
||||
|
@ -94,7 +97,7 @@ public class Throttle {
|
|||
}
|
||||
|
||||
private void debugLog(String message) {
|
||||
Log.d(K9.LOG_TAG, "Throttle: [" + mName + "] " + message);
|
||||
Timber.d("Throttle: [%s] %s", mName, message);
|
||||
}
|
||||
|
||||
private boolean isCallbackScheduled() {
|
||||
|
|
|
@ -33,7 +33,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
|
@ -256,12 +256,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
try {
|
||||
AccountStats stats = account.getStats(Accounts.this);
|
||||
if (stats == null) {
|
||||
Log.w(K9.LOG_TAG, "Unable to get account stats");
|
||||
Timber.w("Unable to get account stats");
|
||||
} else {
|
||||
accountStatusChanged(account, stats);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get account stats", e);
|
||||
Timber.e(e, "Unable to get account stats");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
@ -652,7 +652,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
|
||||
Log.i(K9.LOG_TAG, "refusing to open account that is not available");
|
||||
Timber.i("refusing to open account that is not available");
|
||||
return false;
|
||||
}
|
||||
if (K9.FOLDER_NONE.equals(realAccount.getAutoExpandFolderName())) {
|
||||
|
@ -995,7 +995,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
// Get list of folders from remote server
|
||||
MessagingController.getInstance(mApplication).listFolders(mAccount, true, null);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Something went while setting account passwords", e);
|
||||
Timber.e(e, "Something went while setting account passwords");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1411,7 +1411,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.i(K9.LOG_TAG, "onActivityResult requestCode = " + requestCode + ", resultCode = " + resultCode + ", data = " + data);
|
||||
Timber.i("onActivityResult requestCode = %d, resultCode = %s, data = %s", requestCode, resultCode, data);
|
||||
if (resultCode != RESULT_OK)
|
||||
return;
|
||||
if (data == null) {
|
||||
|
@ -1926,7 +1926,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
mFileName = SettingsExporter.exportToFile(mContext, mIncludeGlobals,
|
||||
mAccountUuids);
|
||||
} catch (SettingsImportExportException e) {
|
||||
Log.w(K9.LOG_TAG, "Exception during export", e);
|
||||
Timber.w(e, "Exception during export");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1993,13 +1993,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
}
|
||||
}
|
||||
} catch (SettingsImportExportException e) {
|
||||
Log.w(K9.LOG_TAG, "Exception during import", e);
|
||||
Timber.w(e, "Exception during import");
|
||||
return false;
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.w(K9.LOG_TAG, "Couldn't open import file", e);
|
||||
Timber.w(e, "Couldn't open import file");
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "Unknown error", e);
|
||||
Timber.w(e, "Unknown error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -2066,10 +2066,10 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
}
|
||||
}
|
||||
} catch (SettingsImportExportException e) {
|
||||
Log.w(K9.LOG_TAG, "Exception during export", e);
|
||||
Timber.w(e, "Exception during export");
|
||||
return false;
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.w(K9.LOG_TAG, "Couldn't read content from URI " + mUri);
|
||||
Timber.w("Couldn't read content from URI %s", mUri);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ActivityListener extends SimpleMessagingListener {
|
|||
return context.getString(R.string.status_next_poll,
|
||||
DateUtils.getRelativeTimeSpanString(nextPollTime, System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS, 0));
|
||||
} else if (K9.DEBUG && MailService.isSyncDisabled()) {
|
||||
} else if (K9.isDebug() && MailService.isSyncDisabled()) {
|
||||
if (MailService.hasNoConnectivity()) {
|
||||
return context.getString(R.string.status_no_network);
|
||||
} else if (MailService.isSyncNoBackground()) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import android.os.Handler;
|
|||
import android.os.PowerManager;
|
||||
import android.text.TextUtils.TruncateAt;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -379,7 +379,7 @@ public class FolderList extends K9ListActivity {
|
|||
super.onResume();
|
||||
|
||||
if (!mAccount.isAvailable(this)) {
|
||||
Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
|
||||
Timber.i("account unavaliabale, not showing folder-list but account-list");
|
||||
Accounts.listAccounts(this);
|
||||
finish();
|
||||
return;
|
||||
|
@ -800,7 +800,7 @@ public class FolderList extends K9ListActivity {
|
|||
try {
|
||||
if (account != null && folderName != null) {
|
||||
if (!account.isAvailable(FolderList.this)) {
|
||||
Log.i(K9.LOG_TAG, "not refreshing folder of unavailable account");
|
||||
Timber.i("not refreshing folder of unavailable account");
|
||||
return;
|
||||
}
|
||||
localFolder = account.getLocalStore().getFolder(folderName);
|
||||
|
@ -813,7 +813,7 @@ public class FolderList extends K9ListActivity {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while populating folder", e);
|
||||
Timber.e(e, "Exception while populating folder");
|
||||
} finally {
|
||||
if (localFolder != null) {
|
||||
localFolder.close();
|
||||
|
@ -939,8 +939,7 @@ public class FolderList extends K9ListActivity {
|
|||
if (position <= getCount()) {
|
||||
return getItemView(position, convertView, parent);
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "getView with illegal positon=" + position
|
||||
+ " called! count is only " + getCount());
|
||||
Timber.e("getView with illegal position=%d called! count is only %d", position, getCount());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1019,8 +1018,7 @@ public class FolderList extends K9ListActivity {
|
|||
try {
|
||||
folder.unreadMessageCount = folder.folder.getUnreadMessageCount();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get unreadMessageCount for " + mAccount.getDescription() + ":"
|
||||
+ folder.name);
|
||||
Timber.e("Unable to get unreadMessageCount for %s:%s", mAccount.getDescription(), folder.name);
|
||||
}
|
||||
}
|
||||
if (folder.unreadMessageCount > 0) {
|
||||
|
@ -1039,11 +1037,9 @@ public class FolderList extends K9ListActivity {
|
|||
try {
|
||||
folder.flaggedMessageCount = folder.folder.getFlaggedMessageCount();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get flaggedMessageCount for " + mAccount.getDescription() + ":"
|
||||
+ folder.name);
|
||||
Timber.e("Unable to get flaggedMessageCount for %s:%s", mAccount.getDescription(), folder.name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (K9.messageListStars() && folder.flaggedMessageCount > 0) {
|
||||
holder.flaggedMessageCount.setText(String.format("%d", folder.flaggedMessageCount));
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Filter;
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class FolderListFilter<T> extends Filter {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "FolderListFilter.publishResults - null search-result ");
|
||||
Timber.w("FolderListFilter.publishResults - null search-result ");
|
||||
}
|
||||
|
||||
// Send notification that the data set changed now
|
||||
|
|
|
@ -28,7 +28,7 @@ import android.support.annotation.Nullable;
|
|||
import android.support.annotation.StringRes;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -345,7 +345,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
this.action = Action.EDIT_DRAFT;
|
||||
} else {
|
||||
// This shouldn't happen
|
||||
Log.w(K9.LOG_TAG, "MessageCompose was started with an unsupported action");
|
||||
Timber.w("MessageCompose was started with an unsupported action");
|
||||
this.action = Action.COMPOSE;
|
||||
}
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
if ((requestCode & REQUEST_MASK_MESSAGE_BUILDER) == REQUEST_MASK_MESSAGE_BUILDER) {
|
||||
requestCode ^= REQUEST_MASK_MESSAGE_BUILDER;
|
||||
if (currentMessageBuilder == null) {
|
||||
Log.e(K9.LOG_TAG, "Got a message builder activity result for no message builder, " +
|
||||
Timber.e("Got a message builder activity result for no message builder, " +
|
||||
"this is an illegal state!");
|
||||
return;
|
||||
}
|
||||
|
@ -792,9 +792,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
private void onAccountChosen(Account account, Identity identity) {
|
||||
if (!this.account.equals(account)) {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Switching account from " + this.account + " to " + account);
|
||||
}
|
||||
Timber.v("Switching account from %s to %s", this.account, account);
|
||||
|
||||
// on draft edit, make sure we don't keep previous message UID
|
||||
if (action == Action.EDIT_DRAFT) {
|
||||
|
@ -812,15 +810,12 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
// actual account switch
|
||||
this.account = account;
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Account switch, saving new draft in new account");
|
||||
}
|
||||
Timber.v("Account switch, saving new draft in new account");
|
||||
checkToSaveDraftImplicitly();
|
||||
|
||||
if (previousDraftId != INVALID_DRAFT_ID) {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Account switch, deleting draft from previous account: " + previousDraftId);
|
||||
}
|
||||
Timber.v("Account switch, deleting draft from previous account: %d", previousDraftId);
|
||||
|
||||
MessagingController.getInstance(getApplication()).deleteDraft(previousAccount,
|
||||
previousDraftId);
|
||||
}
|
||||
|
@ -1148,7 +1143,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
Log.w(K9.LOG_TAG, "processSourceMessage() called with unsupported action");
|
||||
Timber.w("processSourceMessage() called with unsupported action");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1157,7 +1152,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
* Let the user continue composing their message even if we have a problem processing
|
||||
* the source message. Log it as an error, though.
|
||||
*/
|
||||
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
|
||||
Timber.e(me, "Error while processing source message: ");
|
||||
} finally {
|
||||
relatedMessageProcessed = true;
|
||||
changesMadeSinceLastSave = false;
|
||||
|
@ -1199,9 +1194,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
}
|
||||
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "could not get Message-ID.");
|
||||
}
|
||||
Timber.d("could not get Message-ID.");
|
||||
}
|
||||
|
||||
// Quote the message and setup the UI.
|
||||
|
@ -1235,9 +1228,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
repliedToMessageId = message.getMessageId();
|
||||
referencedMessageIds = repliedToMessageId;
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "could not get Message-ID.");
|
||||
}
|
||||
Timber.d("could not get Message-ID.");
|
||||
}
|
||||
|
||||
// Quote the message and setup the UI.
|
||||
|
@ -1352,7 +1343,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
contacts.markAsContacted(message.getRecipients(RecipientType.BCC));
|
||||
updateReferencedMessage();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Failed to mark contact as contacted.", e);
|
||||
Timber.e(e, "Failed to mark contact as contacted.");
|
||||
}
|
||||
|
||||
MessagingController.getInstance(context).sendMessage(account, message, null);
|
||||
|
@ -1369,12 +1360,11 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
**/
|
||||
private void updateReferencedMessage() {
|
||||
if (messageReference != null && messageReference.getFlag() != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Setting referenced message (" +
|
||||
messageReference.getFolderName() + ", " +
|
||||
messageReference.getUid() + ") flag to " +
|
||||
messageReference.getFlag());
|
||||
}
|
||||
Timber.d("Setting referenced message (%s, %s) flag to %s",
|
||||
messageReference.getFolderName(),
|
||||
messageReference.getUid(),
|
||||
messageReference.getFlag());
|
||||
|
||||
final Account account = Preferences.getPreferences(context)
|
||||
.getAccount(messageReference.getAccountUuid());
|
||||
final String folderName = messageReference.getFolderName();
|
||||
|
@ -1481,7 +1471,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
@Override
|
||||
public void onMessageBuildException(MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Error sending message", me);
|
||||
Timber.e(me, "Error sending message");
|
||||
Toast.makeText(MessageCompose.this,
|
||||
getString(R.string.send_failed_reason, me.getLocalizedMessage()), Toast.LENGTH_LONG).show();
|
||||
currentMessageBuilder = null;
|
||||
|
@ -1494,7 +1484,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
try {
|
||||
startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "Error starting pending intent from builder!", e);
|
||||
Timber.e(e, "Error starting pending intent from builder!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1508,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
} catch (MessagingException e) {
|
||||
// Hm, if we couldn't populate the UI after source reprocessing, let's just delete it?
|
||||
quotedMessagePresenter.showOrHideQuotedText(QuotedTextMode.HIDE);
|
||||
Log.e(K9.LOG_TAG, "Could not re-process source message; deleting quoted text to be safe.", e);
|
||||
Timber.e(e, "Could not re-process source message; deleting quoted text to be safe.");
|
||||
}
|
||||
updateMessageFormat();
|
||||
} else {
|
||||
|
@ -1563,7 +1553,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
requestCode |= REQUEST_MASK_LOADER_HELPER;
|
||||
startIntentSenderForResult(si, requestCode, fillIntent, flagsMask, flagValues, extraFlags);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "Irrecoverable error calling PendingIntent!", e);
|
||||
Timber.e(e, "Irrecoverable error calling PendingIntent!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -479,7 +479,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
mSingleFolderMode = mSingleAccountMode && (mSearch.getFolderNames().size() == 1);
|
||||
|
||||
if (mSingleAccountMode && (mAccount == null || !mAccount.isAvailable(this))) {
|
||||
Log.i(K9.LOG_TAG, "not opening MessageList of unavailable account");
|
||||
Timber.i("not opening MessageList of unavailable account");
|
||||
onAccountUnavailable();
|
||||
return false;
|
||||
}
|
||||
|
@ -757,8 +757,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
// Swallow these events too to avoid the audible notification of a volume change
|
||||
if (K9.useVolumeKeysForListNavigationEnabled()) {
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "Swallowed key up.");
|
||||
Timber.v("Swallowed key up.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.os.Parcelable;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -111,7 +111,7 @@ public class MessageLoaderHelper {
|
|||
if (cachedDecryptionResult instanceof OpenPgpDecryptionResult) {
|
||||
this.cachedDecryptionResult = (OpenPgpDecryptionResult) cachedDecryptionResult;
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "Got decryption result of unknown type - ignoring");
|
||||
Timber.e("Got decryption result of unknown type - ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,12 +182,12 @@ public class MessageLoaderHelper {
|
|||
boolean isLoaderStale = (loader == null) || !loader.isCreatedFor(messageReference);
|
||||
|
||||
if (isLoaderStale) {
|
||||
Log.d(K9.LOG_TAG, "Creating new local message loader");
|
||||
Timber.d("Creating new local message loader");
|
||||
cancelAndClearCryptoOperation();
|
||||
cancelAndClearDecodeLoader();
|
||||
loaderManager.restartLoader(LOCAL_MESSAGE_LOADER_ID, null, localMessageLoaderCallback);
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "Reusing local message loader");
|
||||
Timber.d("Reusing local message loader");
|
||||
loaderManager.initLoader(LOCAL_MESSAGE_LOADER_ID, null, localMessageLoaderCallback);
|
||||
}
|
||||
}
|
||||
|
@ -336,10 +336,10 @@ public class MessageLoaderHelper {
|
|||
boolean isLoaderStale = (loader == null) || !loader.isCreatedFor(localMessage, messageCryptoAnnotations);
|
||||
|
||||
if (isLoaderStale) {
|
||||
Log.d(K9.LOG_TAG, "Creating new decode message loader");
|
||||
Timber.d("Creating new decode message loader");
|
||||
loaderManager.restartLoader(DECODE_MESSAGE_LOADER_ID, null, decodeMessageLoaderCallback);
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "Reusing decode message loader");
|
||||
Timber.d("Reusing decode message loader");
|
||||
loaderManager.initLoader(DECODE_MESSAGE_LOADER_ID, null, decodeMessageLoaderCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.activity;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class MessageReferenceHelper {
|
|||
if (messageReference != null) {
|
||||
messageReferences.add(messageReference);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Invalid message reference: " + messageReferenceString);
|
||||
Timber.w("Invalid message reference: %s", messageReferenceString);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.Menu;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
|
@ -548,7 +548,7 @@ public class RecipientPresenter implements PermissionPingCallback {
|
|||
void onClickCryptoStatus() {
|
||||
switch (cryptoProviderState) {
|
||||
case UNCONFIGURED:
|
||||
Log.e(K9.LOG_TAG, "click on crypto status while unconfigured - this should not really happen?!");
|
||||
Timber.e("click on crypto status while unconfigured - this should not really happen?!");
|
||||
return;
|
||||
case OK:
|
||||
if (cachedCryptoStatus.isSignOnly()) {
|
||||
|
@ -678,7 +678,7 @@ public class RecipientPresenter implements PermissionPingCallback {
|
|||
// TODO handle error case better
|
||||
recipientMvpView.showErrorOpenPgpConnection();
|
||||
cryptoProviderState = CryptoProviderState.ERROR;
|
||||
Log.e(K9.LOG_TAG, "error connecting to crypto provider!", e);
|
||||
Timber.e(e, "error connecting to crypto provider!");
|
||||
updateCryptoStatus();
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ public class RecipientPresenter implements PermissionPingCallback {
|
|||
|
||||
private OpenPgpApi getOpenPgpApi() {
|
||||
if (openPgpServiceConnection == null || !openPgpServiceConnection.isBound()) {
|
||||
Log.e(K9.LOG_TAG, "obtained openpgpapi object, but service is not bound! inconsistent state?");
|
||||
Timber.e("obtained openpgpapi object, but service is not bound! inconsistent state?");
|
||||
}
|
||||
return new OpenPgpApi(context, openPgpServiceConnection.getService());
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.io.InputStream;
|
|||
|
||||
import android.content.AsyncTaskLoader;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.activity.misc.Attachment;
|
||||
|
@ -58,9 +58,7 @@ public class AttachmentContentLoader extends AsyncTaskLoader<Attachment> {
|
|||
File file = File.createTempFile(FILENAME_PREFIX, null, context.getCacheDir());
|
||||
file.deleteOnExit();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Saving attachment to " + file.getAbsolutePath());
|
||||
}
|
||||
Timber.v("Saving attachment to %s", file.getAbsolutePath());
|
||||
|
||||
SafeContentResolver safeContentResolver = SafeContentResolverCompat.newInstance(context);
|
||||
InputStream in = safeContentResolver.openInputStream(sourceAttachment.uri);
|
||||
|
@ -78,7 +76,7 @@ public class AttachmentContentLoader extends AsyncTaskLoader<Attachment> {
|
|||
cachedResultAttachment = sourceAttachment.deriveWithLoadComplete(file.getAbsolutePath());
|
||||
return cachedResultAttachment;
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "Error saving attachment!", e);
|
||||
Timber.e(e, "Error saving attachment!");
|
||||
}
|
||||
|
||||
cachedResultAttachment = sourceAttachment.deriveWithLoadCancelled();
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.activity.misc.Attachment;
|
||||
|
@ -87,16 +87,15 @@ public class AttachmentInfoLoader extends AsyncTaskLoader<Attachment> {
|
|||
if (size <= 0) {
|
||||
String uriString = uri.toString();
|
||||
if (uriString.startsWith("file://")) {
|
||||
Log.v(K9.LOG_TAG, uriString.substring("file://".length()));
|
||||
File f = new File(uriString.substring("file://".length()));
|
||||
size = f.length();
|
||||
} else {
|
||||
Log.v(K9.LOG_TAG, "Not a file: " + uriString);
|
||||
Timber.v("Not a file: %s", uriString);
|
||||
}
|
||||
} else {
|
||||
Log.v(K9.LOG_TAG, "old attachment.size: " + size);
|
||||
Timber.v("old attachment.size: %d", size);
|
||||
}
|
||||
Log.v(K9.LOG_TAG, "new attachment.size: " + size);
|
||||
Timber.v("new attachment.size: %d", size);
|
||||
|
||||
cachedResultAttachment = sourceAttachment.deriveWithMetadataLoaded(usableContentType, name, size);
|
||||
return cachedResultAttachment;
|
||||
|
|
|
@ -22,7 +22,7 @@ import android.preference.Preference.OnPreferenceChangeListener;
|
|||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
|
@ -219,7 +219,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||
mIsExpungeCapable = store.isExpungeCapable();
|
||||
mIsSeenFlagSupported = store.isSeenFlagSupported();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
||||
Timber.e(e, "Could not get remote store");
|
||||
}
|
||||
|
||||
addPreferencesFromResource(R.xml.account_settings_preferences);
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.activity.setup;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Toast;
|
||||
|
@ -125,7 +125,7 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
|
|||
}
|
||||
|
||||
private void failure(Exception use) {
|
||||
Log.e(K9.LOG_TAG, "Failure", use);
|
||||
Timber.e(use, "Failure");
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
||||
|
|
|
@ -17,7 +17,7 @@ import android.os.Bundle;
|
|||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
@ -232,7 +232,7 @@ public class AccountSetupBasics extends K9Activity
|
|||
try {
|
||||
name = getDefaultAccountName();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get default account name", e);
|
||||
Timber.e(e, "Could not get default account name");
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
|
@ -496,7 +496,7 @@ public class AccountSetupBasics extends K9Activity
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while trying to load provider settings.", e);
|
||||
Timber.e(e, "Error while trying to load provider settings.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.net.Uri;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ProgressBar;
|
||||
|
@ -101,7 +101,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
}
|
||||
|
||||
private void handleCertificateValidationException(CertificateValidationException cve) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", cve);
|
||||
Timber.e(cve, "Error while testing settings");
|
||||
|
||||
X509Certificate[] chain = cve.getCertChain();
|
||||
// Avoid NullPointerException in acceptKeyDialog()
|
||||
|
@ -155,7 +155,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
try {
|
||||
sha1 = MessageDigest.getInstance("SHA-1");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e(K9.LOG_TAG, "Error while initializing MessageDigest", e);
|
||||
Timber.e(e, "Error while initializing MessageDigest");
|
||||
}
|
||||
|
||||
final X509Certificate[] chain = ex.getCertChain();
|
||||
|
@ -188,7 +188,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
String name;
|
||||
switch (type.intValue()) {
|
||||
case 0:
|
||||
Log.w(K9.LOG_TAG, "SubjectAltName of type OtherName not supported.");
|
||||
Timber.w("SubjectAltName of type OtherName not supported.");
|
||||
continue;
|
||||
case 1: // RFC822Name
|
||||
name = (String)value;
|
||||
|
@ -197,13 +197,13 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
name = (String)value;
|
||||
break;
|
||||
case 3:
|
||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type x400Address");
|
||||
Timber.w("unsupported SubjectAltName of type x400Address");
|
||||
continue;
|
||||
case 4:
|
||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type directoryName");
|
||||
Timber.w("unsupported SubjectAltName of type directoryName");
|
||||
continue;
|
||||
case 5:
|
||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type ediPartyName");
|
||||
Timber.w("unsupported SubjectAltName of type ediPartyName");
|
||||
continue;
|
||||
case 6: // Uri
|
||||
name = (String)value;
|
||||
|
@ -212,7 +212,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
name = (String)value;
|
||||
break;
|
||||
default:
|
||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of unknown type");
|
||||
Timber.w("unsupported SubjectAltName of unknown type");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
}
|
||||
} catch (Exception e1) {
|
||||
// don't fail just because of subjectAltNames
|
||||
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
|
||||
Timber.w(e1, "cannot display SubjectAltNames in dialog");
|
||||
}
|
||||
|
||||
chainInfo.append("Issuer: ").append(chain[i].getIssuerDN().toString()).append("\n");
|
||||
|
@ -242,7 +242,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
String sha1sum = Hex.encodeHex(sha1.digest(chain[i].getEncoded()));
|
||||
chainInfo.append("Fingerprint (SHA-1): ").append(sha1sum).append("\n");
|
||||
} catch (CertificateEncodingException e) {
|
||||
Log.e(K9.LOG_TAG, "Error while encoding certificate", e);
|
||||
Timber.e(e, "Error while encoding certificate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -429,14 +429,14 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||
finish();
|
||||
|
||||
} catch (AuthenticationFailedException afe) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", afe);
|
||||
Timber.e(afe, "Error while testing settings");
|
||||
showErrorDialog(
|
||||
R.string.account_setup_failed_dlg_auth_message_fmt,
|
||||
afe.getMessage() == null ? "" : afe.getMessage());
|
||||
} catch (CertificateValidationException cve) {
|
||||
handleCertificateValidationException(cve);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", e);
|
||||
Timber.e(e, "Error while testing settings");
|
||||
String message = e.getMessage() == null ? "" : e.getMessage();
|
||||
showErrorDialog(R.string.account_setup_failed_dlg_server_message_fmt, message);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.os.Bundle;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.*;
|
||||
|
@ -494,7 +494,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||
Store store = mAccount.getRemoteStore();
|
||||
isPushCapable = store.isPushCapable();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
||||
Timber.e(e, "Could not get remote store");
|
||||
}
|
||||
if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) {
|
||||
MailService.actionRestartPushers(this, null);
|
||||
|
@ -602,7 +602,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||
}
|
||||
|
||||
private void failure(Exception use) {
|
||||
Log.e(K9.LOG_TAG, "Failure", use);
|
||||
Timber.e(use, "Failure");
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.activity.setup;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -115,7 +115,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||
Store store = mAccount.getRemoteStore();
|
||||
isPushCapable = store.isPushCapable();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
||||
Timber.e(e, "Could not get remote store");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.os.Bundle;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -487,7 +487,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||
}
|
||||
|
||||
private void failure(Exception use) {
|
||||
Log.e(K9.LOG_TAG, "Failure", use);
|
||||
Timber.e(use, "Failure");
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.os.Bundle;
|
|||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.*;
|
||||
import com.fsck.k9.activity.FolderInfoHolder;
|
||||
import com.fsck.k9.activity.K9PreferenceActivity;
|
||||
|
@ -62,7 +62,7 @@ public class FolderSettings extends K9PreferenceActivity {
|
|||
mFolder = localStore.getFolder(folderName);
|
||||
mFolder.open(Folder.OPEN_MODE_RW);
|
||||
} catch (MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Unable to edit folder " + folderName + " preferences", me);
|
||||
Timber.e(me, "Unable to edit folder %s preferences", folderName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class FolderSettings extends K9PreferenceActivity {
|
|||
Store store = mAccount.getRemoteStore();
|
||||
isPushCapable = store.isPushCapable();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
||||
Timber.e(e, "Could not get remote store");
|
||||
}
|
||||
|
||||
addPreferencesFromResource(R.xml.folder_settings_preferences);
|
||||
|
@ -167,7 +167,7 @@ public class FolderSettings extends K9PreferenceActivity {
|
|||
try {
|
||||
saveSettings();
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Saving folder settings failed", e);
|
||||
Timber.e(e, "Saving folder settings failed");
|
||||
}
|
||||
|
||||
super.onPause();
|
||||
|
|
|
@ -357,7 +357,7 @@ public class Prefs extends K9PreferenceActivity {
|
|||
mHideUserAgent = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_USERAGENT);
|
||||
mHideTimeZone = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_TIMEZONE);
|
||||
|
||||
mDebugLogging.setChecked(K9.DEBUG);
|
||||
mDebugLogging.setChecked(K9.isDebug());
|
||||
mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE);
|
||||
mHideUserAgent.setChecked(K9.hideUserAgent());
|
||||
mHideTimeZone.setChecked(K9.hideTimeZone());
|
||||
|
@ -529,10 +529,10 @@ public class Prefs extends K9PreferenceActivity {
|
|||
K9.setAttachmentDefaultPath(mAttachmentPathPreference.getSummary().toString());
|
||||
boolean needsRefresh = K9.setBackgroundOps(mBackgroundOps.getValue());
|
||||
|
||||
if (!K9.DEBUG && mDebugLogging.isChecked()) {
|
||||
if (!K9.isDebug() && mDebugLogging.isChecked()) {
|
||||
Toast.makeText(this, R.string.debug_logging_enabled, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
K9.DEBUG = mDebugLogging.isChecked();
|
||||
K9.setDebug(mDebugLogging.isChecked());
|
||||
K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked();
|
||||
K9.setHideUserAgent(mHideUserAgent.isChecked());
|
||||
K9.setHideTimeZone(mHideTimeZone.isChecked());
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.helper.FileHelper;
|
||||
|
@ -53,11 +53,9 @@ public class TemporaryAttachmentStore {
|
|||
for (File file : files) {
|
||||
if (file.lastModified() < cutOffTime) {
|
||||
if (file.delete()) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Deleted from temporary attachment store: " + file.getName());
|
||||
}
|
||||
Timber.d("Deleted from temporary attachment store: %s", file.getName());
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Couldn't delete from temporary attachment store: " + file.getName());
|
||||
Timber.w("Couldn't delete from temporary attachment store: %s", file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
package com.fsck.k9.controller;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -40,8 +40,8 @@ public class MessagingControllerPushReceiver implements PushReceiver {
|
|||
}
|
||||
|
||||
public void syncFolder(Folder folder) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "syncFolder(" + folder.getName() + ")");
|
||||
Timber.v("syncFolder(%s)", folder.getName());
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
controller.synchronizeMailbox(account, folder.getName(), new SimpleMessagingListener() {
|
||||
@Override
|
||||
|
@ -57,14 +57,13 @@ public class MessagingControllerPushReceiver implements PushReceiver {
|
|||
}
|
||||
}, folder);
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "syncFolder(" + folder.getName() + ") about to await latch release");
|
||||
Timber.v("syncFolder(%s) about to await latch release", folder.getName());
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "syncFolder(" + folder.getName() + ") got latch release");
|
||||
Timber.v("syncFolder(%s) got latch release", folder.getName());
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Interrupted while awaiting latch release", e);
|
||||
Timber.e(e, "Interrupted while awaiting latch release");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,8 +95,7 @@ public class MessagingControllerPushReceiver implements PushReceiver {
|
|||
localFolder.open(Folder.OPEN_MODE_RW);
|
||||
return localFolder.getPushState();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get push state from account " + account.getDescription()
|
||||
+ ", folder " + folderName, e);
|
||||
Timber.e(e, "Unable to get push state from account %s, folder %s", account.getDescription(), folderName);
|
||||
return null;
|
||||
} finally {
|
||||
if (localFolder != null) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -108,8 +108,7 @@ public class ConfirmationDialogFragment extends DialogFragment implements OnClic
|
|||
try {
|
||||
mListener = (ConfirmationDialogFragmentListener) activity;
|
||||
} catch (ClassCastException e) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, activity.toString() + " did not implement ConfirmationDialogFragmentListener");
|
||||
Timber.d("%s did not implement ConfirmationDialogFragmentListener", activity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import android.text.TextUtils;
|
|||
import android.text.format.DateUtils;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ActionMode;
|
||||
import android.view.ContextMenu;
|
||||
|
@ -1164,7 +1164,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
|||
LocalFolder firstMsgFolder = getFolder(firstMsg.getFolderName(), account);
|
||||
firstMsgFolder.setLastSelectedFolderName(destFolderName);
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Error getting folder for setLastSelectedFolderName()", e);
|
||||
Timber.e(e, "Error getting folder for setLastSelectedFolderName()");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2814,11 +2814,11 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
|||
// If we represent a remote search, then kill that before going back.
|
||||
if (isRemoteSearch() && mRemoteSearchFuture != null) {
|
||||
try {
|
||||
Log.i(K9.LOG_TAG, "Remote search in progress, attempting to abort...");
|
||||
Timber.i("Remote search in progress, attempting to abort...");
|
||||
// Canceling the future stops any message fetches in progress.
|
||||
final boolean cancelSuccess = mRemoteSearchFuture.cancel(true); // mayInterruptIfRunning = true
|
||||
if (!cancelSuccess) {
|
||||
Log.e(K9.LOG_TAG, "Could not cancel remote search future.");
|
||||
Timber.e("Could not cancel remote search future.");
|
||||
}
|
||||
// Closing the folder will kill off the connection if we're mid-search.
|
||||
final Account searchAccount = mAccount;
|
||||
|
@ -2828,7 +2828,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
|||
mListener.remoteSearchFinished(mCurrentFolder.name, 0, searchAccount.getRemoteSearchNumResults(), null);
|
||||
} catch (Exception e) {
|
||||
// Since the user is going back, log and squash any exceptions.
|
||||
Log.e(K9.LOG_TAG, "Could not abort remote search before going back", e);
|
||||
Timber.e(e, "Could not abort remote search before going back");
|
||||
}
|
||||
}
|
||||
super.onStop();
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.Intent;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Address;
|
||||
|
@ -265,7 +265,7 @@ public class Contacts {
|
|||
Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId);
|
||||
return Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Couldn't fetch photo for contact with email " + address, e);
|
||||
Timber.e(e, "Couldn't fetch photo for contact with email %s", address);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -74,15 +74,15 @@ public class FileHelper {
|
|||
try {
|
||||
if (!file.exists()) {
|
||||
if (!file.createNewFile()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to create file: " + file.getAbsolutePath());
|
||||
Timber.d("Unable to create file: %s", file.getAbsolutePath());
|
||||
}
|
||||
} else {
|
||||
if (!file.setLastModified(System.currentTimeMillis())) {
|
||||
Log.d(K9.LOG_TAG, "Unable to change last modification date: " + file.getAbsolutePath());
|
||||
Timber.d("Unable to change last modification date: %s", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(K9.LOG_TAG, "Unable to touch file: " + file.getAbsolutePath(), e);
|
||||
Timber.d(e, "Unable to touch file: %s", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class FileHelper {
|
|||
|
||||
boolean deleteFromFailed = !from.delete();
|
||||
if (deleteFromFailed) {
|
||||
Log.e(K9.LOG_TAG, "Unable to delete source file after copying to destination!");
|
||||
Timber.e("Unable to delete source file after copying to destination!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,12 +133,12 @@ public class FileHelper {
|
|||
public static boolean move(final File from, final File to) {
|
||||
if (to.exists()) {
|
||||
if (!to.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to delete file: " + to.getAbsolutePath());
|
||||
Timber.d("Unable to delete file: %s", to.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
if (!to.getParentFile().mkdirs()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to make directories: " + to.getParentFile().getAbsolutePath());
|
||||
Timber.d("Unable to make directories: %s", to.getParentFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -146,11 +146,11 @@ public class FileHelper {
|
|||
|
||||
boolean deleteFromFailed = !from.delete();
|
||||
if (deleteFromFailed) {
|
||||
Log.e(K9.LOG_TAG, "Unable to delete source file after copying to destination!");
|
||||
Timber.e("Unable to delete source file after copying to destination!");
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath(), e);
|
||||
Timber.w(e, "cannot move %s to %s", from.getAbsolutePath(), to.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ public class FileHelper {
|
|||
if (!fromDir.isDirectory()) {
|
||||
if (toDir.exists()) {
|
||||
if (!toDir.delete()) {
|
||||
Log.w(K9.LOG_TAG, "cannot delete already existing file/directory " + toDir.getAbsolutePath());
|
||||
Timber.w("cannot delete already existing file/directory %s", toDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
if (!fromDir.renameTo(toDir)) {
|
||||
Log.w(K9.LOG_TAG, "cannot rename " + fromDir.getAbsolutePath() + " to " + toDir.getAbsolutePath() + " - moving instead");
|
||||
Timber.w("cannot rename %s to %s - moving instead", fromDir.getAbsolutePath(), toDir.getAbsolutePath());
|
||||
move(fromDir, toDir);
|
||||
}
|
||||
return;
|
||||
|
@ -174,11 +174,11 @@ public class FileHelper {
|
|||
if (!toDir.exists() || !toDir.isDirectory()) {
|
||||
if (toDir.exists()) {
|
||||
if (!toDir.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to delete file: " + toDir.getAbsolutePath());
|
||||
Timber.d("Unable to delete file: %s", toDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
if (!toDir.mkdirs()) {
|
||||
Log.w(K9.LOG_TAG, "cannot create directory " + toDir.getAbsolutePath());
|
||||
Timber.w("cannot create directory %s", toDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
File[] files = fromDir.listFiles();
|
||||
|
@ -186,18 +186,19 @@ public class FileHelper {
|
|||
if (file.isDirectory()) {
|
||||
moveRecursive(file, new File(toDir, file.getName()));
|
||||
if (!file.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to delete file: " + toDir.getAbsolutePath());
|
||||
Timber.d("Unable to delete file: %s", toDir.getAbsolutePath());
|
||||
}
|
||||
} else {
|
||||
File target = new File(toDir, file.getName());
|
||||
if (!file.renameTo(target)) {
|
||||
Log.w(K9.LOG_TAG, "cannot rename " + file.getAbsolutePath() + " to " + target.getAbsolutePath() + " - moving instead");
|
||||
Timber.w("cannot rename %s to %s - moving instead",
|
||||
file.getAbsolutePath(), target.getAbsolutePath());
|
||||
move(file, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!fromDir.delete()) {
|
||||
Log.w(K9.LOG_TAG, "cannot delete " + fromDir.getAbsolutePath());
|
||||
Timber.w("cannot delete %s", fromDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import android.os.Looper;
|
|||
import android.provider.ContactsContract;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -381,15 +381,12 @@ public class Utility {
|
|||
while (imgMatches.find()) {
|
||||
String uriScheme = imgMatches.group(1);
|
||||
if (uriScheme.equals("http") || uriScheme.equals("https")) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "External images found");
|
||||
}
|
||||
Timber.d("External images found");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "No external images.");
|
||||
}
|
||||
|
||||
Timber.d("No external images.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.net.Uri;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Body;
|
||||
|
@ -72,7 +72,7 @@ public class AttachmentResolver {
|
|||
result.put(contentId, attachmentInfo.internalUri);
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Error extracting attachment info", e);
|
||||
Timber.e(e, "Error extracting attachment info");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.io.OutputStream;
|
|||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
|
@ -70,11 +70,11 @@ public class DeferredFileBody implements RawDataBody, SizeAware {
|
|||
public InputStream getInputStream() throws MessagingException {
|
||||
try {
|
||||
if (file != null) {
|
||||
Log.d(K9.LOG_TAG, "Decrypted data is file-backed.");
|
||||
Timber.d("Decrypted data is file-backed.");
|
||||
return new BufferedInputStream(new FileInputStream(file));
|
||||
}
|
||||
if (data != null) {
|
||||
Log.d(K9.LOG_TAG, "Decrypted data is memory-backed.");
|
||||
Timber.d("Decrypted data is memory-backed.");
|
||||
return new ByteArrayInputStream(data);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class DeferredFileBody implements RawDataBody, SizeAware {
|
|||
throw new IllegalStateException("Data must be fully written before it can be read!");
|
||||
}
|
||||
|
||||
Log.d(K9.LOG_TAG, "Writing body to file for attachment access");
|
||||
Timber.d("Writing body to file for attachment access");
|
||||
|
||||
file = fileFactory.createFile();
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.content.ContentValues;
|
|||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -166,7 +166,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
open(cursor);
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Creating folder " + getName() + " with existing id " + getId());
|
||||
Timber.w("Creating folder %s with existing id %d", getName(), getId());
|
||||
create(FolderType.HOLDS_MESSAGES);
|
||||
open(mode);
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
prefHolder.displayClass = FolderClass.valueOf(storage.getString(id + ".displayMode",
|
||||
prefHolder.displayClass.name()));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to load displayMode for " + getName(), e);
|
||||
Timber.e(e, "Unable to load displayMode for %s", getName());
|
||||
}
|
||||
if (prefHolder.displayClass == FolderClass.NONE) {
|
||||
prefHolder.displayClass = FolderClass.NO_CLASS;
|
||||
|
@ -622,7 +622,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
prefHolder.syncClass = FolderClass.valueOf(storage.getString(id + ".syncMode",
|
||||
prefHolder.syncClass.name()));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to load syncMode for " + getName(), e);
|
||||
Timber.e(e, "Unable to load syncMode for %s", getName());
|
||||
|
||||
}
|
||||
if (prefHolder.syncClass == FolderClass.NONE) {
|
||||
|
@ -633,7 +633,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
prefHolder.notifyClass = FolderClass.valueOf(storage.getString(id + ".notifyMode",
|
||||
prefHolder.notifyClass.name()));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to load notifyMode for " + getName(), e);
|
||||
Timber.e(e, "Unable to load notifyMode for %s", getName());
|
||||
}
|
||||
if (prefHolder.notifyClass == FolderClass.NONE) {
|
||||
prefHolder.notifyClass = FolderClass.INHERITED;
|
||||
|
@ -643,7 +643,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
prefHolder.pushClass = FolderClass.valueOf(storage.getString(id + ".pushMode",
|
||||
prefHolder.pushClass.name()));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to load pushMode for " + getName(), e);
|
||||
Timber.e(e, "Unable to load pushMode for %s", getName());
|
||||
}
|
||||
if (prefHolder.pushClass == FolderClass.NONE) {
|
||||
prefHolder.pushClass = FolderClass.INHERITED;
|
||||
|
@ -1036,10 +1036,12 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
|
||||
String oldUID = message.getUid();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Updating folder_id to " + lDestFolder.getId() + " for message with UID "
|
||||
+ message.getUid() + ", id " + lMessage.getId() + " currently in folder " + getName());
|
||||
}
|
||||
Timber.d("Updating folder_id to %s for message with UID %s, " +
|
||||
"id %d currently in folder %s",
|
||||
lDestFolder.getId(),
|
||||
message.getUid(),
|
||||
lMessage.getId(),
|
||||
getName());
|
||||
|
||||
String newUid = K9.LOCAL_UID_PREFIX + UUID.randomUUID().toString();
|
||||
message.setUid(newUid);
|
||||
|
@ -1660,7 +1662,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
try {
|
||||
updateOrInsertMessagePart(db, new ContentValues(), part, messagePartId);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error writing message part", e);
|
||||
Timber.e(e, "Error writing message part");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1708,7 +1710,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
try {
|
||||
message.setFlags(flags, value);
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Something went wrong while setting flag", e);
|
||||
Timber.e(e, "Something went wrong while setting flag");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1871,8 +1873,8 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
String messagePartId = cursor.getString(0);
|
||||
File file = localStore.getAttachmentFile(messagePartId);
|
||||
if (file.exists()) {
|
||||
if (!file.delete() && K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Couldn't delete message part file: " + file.getAbsolutePath());
|
||||
if (!file.delete() && K9.isDebug()) {
|
||||
Timber.d("Couldn't delete message part file: %s", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1924,15 +1926,15 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
return cursor.getInt(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to updateLastUid: ", e);
|
||||
Timber.e(e, "Unable to updateLastUid: ");
|
||||
} finally {
|
||||
Utility.closeQuietly(cursor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "Updated last UID for folder " + mName + " to " + lastUid);
|
||||
|
||||
Timber.d("Updated last UID for folder %s to %s", mName, lastUid);
|
||||
mLastUid = lastUid;
|
||||
}
|
||||
|
||||
|
@ -1949,7 +1951,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
return cursor.getLong(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to fetch oldest message date: ", e);
|
||||
Timber.e(e, "Unable to fetch oldest message date: ");
|
||||
} finally {
|
||||
Utility.closeQuietly(cursor);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.content.ContentValues;
|
|||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.BuildConfig;
|
||||
|
@ -77,7 +77,7 @@ public class LocalMessage extends MimeMessage {
|
|||
|
||||
catch (Exception e) {
|
||||
if (!"X_BAD_FLAG".equals(flag)) {
|
||||
Log.w(K9.LOG_TAG, "Unable to parse flag " + flag);
|
||||
Timber.w("Unable to parse flag %s", flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class LocalMessage extends MimeMessage {
|
|||
if (header != null) {
|
||||
MessageHeaderParser.parse(this, new ByteArrayInputStream(header));
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "No headers available for this message!");
|
||||
Timber.d("No headers available for this message!");
|
||||
}
|
||||
|
||||
headerNeedsUpdating = false;
|
||||
|
|
|
@ -29,7 +29,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -249,7 +249,7 @@ public class LocalStore extends Store implements Serializable {
|
|||
try {
|
||||
removeInstance(account);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Failed to reset local store for account " + account.getUuid(), e);
|
||||
Timber.e(e, "Failed to reset local store for account %s", account.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,8 +301,9 @@ public class LocalStore extends Store implements Serializable {
|
|||
}
|
||||
|
||||
public void compact() throws MessagingException {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Before compaction size = " + getSize());
|
||||
if (K9.isDebug()) {
|
||||
Timber.i("Before compaction size = %d", getSize());
|
||||
}
|
||||
|
||||
database.execute(false, new DbCallback<Void>() {
|
||||
@Override
|
||||
|
@ -311,23 +312,25 @@ public class LocalStore extends Store implements Serializable {
|
|||
return null;
|
||||
}
|
||||
});
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "After compaction size = " + getSize());
|
||||
|
||||
if (K9.isDebug()) {
|
||||
Timber.i("After compaction size = %d", getSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void clear() throws MessagingException {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Before prune size = " + getSize());
|
||||
if (K9.isDebug()) {
|
||||
Timber.i("Before prune size = %d", getSize());
|
||||
}
|
||||
|
||||
deleteAllMessageDataFromDisk();
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "After prune / before compaction size = " + getSize());
|
||||
|
||||
Log.i(K9.LOG_TAG, "Before clear folder count = " + getFolderCount());
|
||||
Log.i(K9.LOG_TAG, "Before clear message count = " + getMessageCount());
|
||||
|
||||
Log.i(K9.LOG_TAG, "After prune / before clear size = " + getSize());
|
||||
if (K9.isDebug()) {
|
||||
Timber.i("After prune / before compaction size = %d", getSize());
|
||||
Timber.i("Before clear folder count = %d", getFolderCount());
|
||||
Timber.i("Before clear message count = %d", getMessageCount());
|
||||
Timber.i("After prune / before clear size = %d", getSize());
|
||||
}
|
||||
|
||||
database.execute(false, new DbCallback<Void>() {
|
||||
|
@ -349,10 +352,9 @@ public class LocalStore extends Store implements Serializable {
|
|||
|
||||
compact();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "After clear message count = " + getMessageCount());
|
||||
|
||||
Log.i(K9.LOG_TAG, "After clear size = " + getSize());
|
||||
if (K9.isDebug()) {
|
||||
Timber.i("After clear message count = %d", getMessageCount());
|
||||
Timber.i("After clear size = %d", getSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,9 +584,7 @@ public class LocalStore extends Store implements Serializable {
|
|||
((!TextUtils.isEmpty(where)) ? " AND (" + where + ")" : "") +
|
||||
" ORDER BY date DESC";
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Query = " + sqlQuery);
|
||||
}
|
||||
Timber.d("Query = %s", sqlQuery);
|
||||
|
||||
return getMessages(retrievalListener, null, sqlQuery, selectionArgs);
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ public class LocalStore extends Store implements Serializable {
|
|||
i++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(K9.LOG_TAG, "Got an exception", e);
|
||||
Timber.d(e, "Got an exception");
|
||||
} finally {
|
||||
Utility.closeQuietly(cursor);
|
||||
}
|
||||
|
|
|
@ -10,12 +10,15 @@ import android.content.Context;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.helper.FileHelper;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
|
||||
import static java.lang.System.currentTimeMillis;
|
||||
|
||||
|
||||
public class LockableDatabase {
|
||||
|
||||
/**
|
||||
|
@ -72,9 +75,7 @@ public class LockableDatabase {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "LockableDatabase: Closing DB " + uUid + " due to unmount event on StorageProvider: " + providerId);
|
||||
}
|
||||
Timber.d("LockableDatabase: Closing DB %s due to unmount event on StorageProvider: %s", uUid, providerId);
|
||||
|
||||
try {
|
||||
lockWrite();
|
||||
|
@ -84,7 +85,7 @@ public class LockableDatabase {
|
|||
unlockWrite();
|
||||
}
|
||||
} catch (UnavailableStorageException e) {
|
||||
Log.w(K9.LOG_TAG, "Unable to writelock on unmount", e);
|
||||
Timber.w(e, "Unable to writelock on unmount");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,14 +95,12 @@ public class LockableDatabase {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "LockableDatabase: Opening DB " + uUid + " due to mount event on StorageProvider: " + providerId);
|
||||
}
|
||||
Timber.d("LockableDatabase: Opening DB %s due to mount event on StorageProvider: %s", uUid, providerId);
|
||||
|
||||
try {
|
||||
openOrCreateDataspace();
|
||||
} catch (UnavailableStorageException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to open DB on mount", e);
|
||||
Timber.e(e, "Unable to open DB on mount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +265,7 @@ public class LockableDatabase {
|
|||
lockRead();
|
||||
final boolean doTransaction = transactional && inTransaction.get() == null;
|
||||
try {
|
||||
final boolean debug = K9.DEBUG;
|
||||
final boolean debug = K9.isDebug();
|
||||
if (doTransaction) {
|
||||
inTransaction.set(Boolean.TRUE);
|
||||
mDb.beginTransaction();
|
||||
|
@ -288,7 +287,9 @@ public class LockableDatabase {
|
|||
// not doing endTransaction in the same 'finally' block of unlockRead() because endTransaction() may throw an exception
|
||||
mDb.endTransaction();
|
||||
if (debug) {
|
||||
Log.v(K9.LOG_TAG, "LockableDatabase: Transaction ended, took " + Long.toString(System.currentTimeMillis() - begin) + "ms / " + new Exception().getStackTrace()[1].toString());
|
||||
Timber.v("LockableDatabase: Transaction ended, took %d ms / %s",
|
||||
currentTimeMillis() - begin,
|
||||
new Exception().getStackTrace()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +308,7 @@ public class LockableDatabase {
|
|||
*/
|
||||
public void switchProvider(final String newProviderId) throws MessagingException {
|
||||
if (newProviderId.equals(mStorageProviderId)) {
|
||||
Log.v(K9.LOG_TAG, "LockableDatabase: Ignoring provider switch request as they are equal: " + newProviderId);
|
||||
Timber.v("LockableDatabase: Ignoring provider switch request as they are equal: %s", newProviderId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ public class LockableDatabase {
|
|||
try {
|
||||
mDb.close();
|
||||
} catch (Exception e) {
|
||||
Log.i(K9.LOG_TAG, "Unable to close DB on local store migration", e);
|
||||
Timber.i(e, "Unable to close DB on local store migration");
|
||||
}
|
||||
|
||||
final StorageManager storageManager = getStorageManager();
|
||||
|
@ -371,9 +372,9 @@ public class LockableDatabase {
|
|||
doOpenOrCreateDb(databaseFile);
|
||||
} catch (SQLiteException e) {
|
||||
// TODO handle this error in a better way!
|
||||
Log.w(K9.LOG_TAG, "Unable to open DB " + databaseFile + " - removing file and retrying", e);
|
||||
Timber.w(e, "Unable to open DB %s - removing file and retrying", databaseFile);
|
||||
if (databaseFile.exists() && !databaseFile.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Failed to remove " + databaseFile + " that couldn't be opened");
|
||||
Timber.d("Failed to remove %s that couldn't be opened", databaseFile);
|
||||
}
|
||||
doOpenOrCreateDb(databaseFile);
|
||||
}
|
||||
|
@ -458,8 +459,7 @@ public class LockableDatabase {
|
|||
try {
|
||||
mDb.close();
|
||||
} catch (Exception e) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "Exception caught in DB close: " + e.getMessage());
|
||||
Timber.d("Exception caught in DB close: %s", e.getMessage());
|
||||
}
|
||||
final StorageManager storageManager = getStorageManager();
|
||||
try {
|
||||
|
@ -468,25 +468,24 @@ public class LockableDatabase {
|
|||
for (File attachment : attachments) {
|
||||
if (attachment.exists()) {
|
||||
boolean attachmentWasDeleted = attachment.delete();
|
||||
if (!attachmentWasDeleted && K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Attachment was not deleted!");
|
||||
if (!attachmentWasDeleted) {
|
||||
Timber.d("Attachment was not deleted!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attachmentDirectory.exists()) {
|
||||
boolean attachmentDirectoryWasDeleted = attachmentDirectory.delete();
|
||||
if (!attachmentDirectoryWasDeleted && K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Attachment directory was not deleted!");
|
||||
if (!attachmentDirectoryWasDeleted) {
|
||||
Timber.d("Attachment directory was not deleted!");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "Exception caught in clearing attachments: " + e.getMessage());
|
||||
Timber.d("Exception caught in clearing attachments: %s", e.getMessage());
|
||||
}
|
||||
try {
|
||||
deleteDatabase(storageManager.getDatabase(uUid, mStorageProviderId));
|
||||
} catch (Exception e) {
|
||||
Log.i(K9.LOG_TAG, "LockableDatabase: delete(): Unable to delete backing DB file", e);
|
||||
Timber.i(e, "LockableDatabase: delete(): Unable to delete backing DB file");
|
||||
}
|
||||
|
||||
if (recreate) {
|
||||
|
@ -510,8 +509,7 @@ public class LockableDatabase {
|
|||
deleted |= new File(database.getPath() + "-journal").delete();
|
||||
}
|
||||
if (!deleted) {
|
||||
Log.i(K9.LOG_TAG,
|
||||
"LockableDatabase: deleteDatabase(): No files deleted.");
|
||||
Timber.i("LockableDatabase: deleteDatabase(): No files deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.content.Context;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Globals;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -82,7 +82,7 @@ public class MessageViewInfoExtractor {
|
|||
extraParts = cryptoMessageParts.extraParts;
|
||||
} else {
|
||||
if (annotations != null && !annotations.isEmpty()) {
|
||||
Log.e(K9.LOG_TAG, "Got message annotations but no crypto root part!");
|
||||
Timber.e("Got message annotations but no crypto root part!");
|
||||
}
|
||||
rootPart = message;
|
||||
cryptoResultAnnotation = null;
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
|
@ -204,7 +204,7 @@ public class StorageManager {
|
|||
return isMountPoint(root)
|
||||
&& Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
|
||||
} catch (IOException e) {
|
||||
Log.w(K9.LOG_TAG, "Specified root isn't ready: " + mRoot, e);
|
||||
Timber.w(e, "Specified root isn't ready: %s", mRoot);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ public class StorageManager {
|
|||
public boolean isReady(final String providerId) {
|
||||
StorageProvider provider = getProvider(providerId);
|
||||
if (provider == null) {
|
||||
Log.w(K9.LOG_TAG, "Storage-Provider \"" + providerId + "\" does not exist");
|
||||
Timber.w("Storage-Provider \"%s\" does not exist", providerId);
|
||||
return false;
|
||||
}
|
||||
return provider.isReady(context);
|
||||
|
@ -632,7 +632,7 @@ public class StorageManager {
|
|||
* @param path
|
||||
*/
|
||||
public void onBeforeUnmount(final String path) {
|
||||
Log.i(K9.LOG_TAG, "storage path \"" + path + "\" unmounting");
|
||||
Timber.i("storage path \"%s\" unmounting", path);
|
||||
final StorageProvider provider = resolveProvider(path);
|
||||
if (provider == null) {
|
||||
return;
|
||||
|
@ -641,7 +641,7 @@ public class StorageManager {
|
|||
try {
|
||||
listener.onUnmount(provider.getId());
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "Error while notifying StorageListener", e);
|
||||
Timber.w(e, "Error while notifying StorageListener");
|
||||
}
|
||||
}
|
||||
final SynchronizationAid sync = mProviderLocks.get(resolveProvider(path));
|
||||
|
@ -651,7 +651,7 @@ public class StorageManager {
|
|||
}
|
||||
|
||||
public void onAfterUnmount(final String path) {
|
||||
Log.i(K9.LOG_TAG, "storage path \"" + path + "\" unmounted");
|
||||
Timber.i("storage path \"%s\" unmounted", path);
|
||||
final StorageProvider provider = resolveProvider(path);
|
||||
if (provider == null) {
|
||||
return;
|
||||
|
@ -669,7 +669,7 @@ public class StorageManager {
|
|||
* @param readOnly
|
||||
*/
|
||||
public void onMount(final String path, final boolean readOnly) {
|
||||
Log.i(K9.LOG_TAG, "storage path \"" + path + "\" mounted readOnly=" + readOnly);
|
||||
Timber.i("storage path \"%s\" mounted readOnly=%s", path, readOnly);
|
||||
if (readOnly) {
|
||||
return;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ public class StorageManager {
|
|||
try {
|
||||
listener.onMount(provider.getId());
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "Error while notifying StorageListener", e);
|
||||
Timber.w(e, "Error while notifying StorageListener");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Locale;
|
|||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.BuildConfig;
|
||||
|
@ -17,6 +17,10 @@ import com.fsck.k9.mailstore.migrations.Migrations;
|
|||
import com.fsck.k9.mailstore.migrations.MigrationsHelper;
|
||||
import com.fsck.k9.preferences.Storage;
|
||||
|
||||
import static com.fsck.k9.mailstore.LocalStore.DB_VERSION;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.Locale.US;
|
||||
|
||||
|
||||
class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition {
|
||||
private final LocalStore localStore;
|
||||
|
@ -40,15 +44,14 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition {
|
|||
throw new Error("Exception while upgrading database", e);
|
||||
}
|
||||
|
||||
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0", e);
|
||||
Timber.e(e, "Exception while upgrading database. Resetting the DB to v0");
|
||||
db.setVersion(0);
|
||||
upgradeDatabase(db);
|
||||
}
|
||||
}
|
||||
|
||||
private void upgradeDatabase(final SQLiteDatabase db) {
|
||||
Log.i(K9.LOG_TAG, String.format(Locale.US, "Upgrading database from version %d to version %d",
|
||||
db.getVersion(), LocalStore.DB_VERSION));
|
||||
Timber.i("Upgrading database from version %d to version %d", db.getVersion(), DB_VERSION);
|
||||
|
||||
db.beginTransaction();
|
||||
try {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MigrationTo35 {
|
|||
try {
|
||||
db.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get rid of obsolete flag X_NO_SEEN_INFO", e);
|
||||
Timber.e(e, "Unable to get rid of obsolete flag X_NO_SEEN_INFO");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MigrationTo36 {
|
|||
try {
|
||||
db.execSQL("ALTER TABLE attachments ADD content_id TEXT");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to add content_id column to attachments");
|
||||
Timber.e("Unable to add content_id column to attachments");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MigrationTo37 {
|
|||
try {
|
||||
db.execSQL("ALTER TABLE attachments ADD content_disposition TEXT");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to add content_disposition column to attachments");
|
||||
Timber.e("Unable to add content_disposition column to attachments");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MigrationTo39 {
|
|||
try {
|
||||
db.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
|
||||
Timber.e("Unable to remove extra header data from the database");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MigrationTo40 {
|
|||
try {
|
||||
db.execSQL("ALTER TABLE messages ADD mime_type TEXT");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to add mime_type column to messages");
|
||||
Timber.e("Unable to add mime_type column to messages");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -38,11 +38,11 @@ class MigrationTo41 {
|
|||
String name = cursor.getString(1);
|
||||
update41Metadata(db, migrationsHelper, id, name);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, " error trying to ugpgrade a folder class", e);
|
||||
Timber.e(e, " error trying to ugpgrade a folder class");
|
||||
}
|
||||
}
|
||||
} catch (SQLiteException e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while upgrading database to v41. folder classes may have vanished", e);
|
||||
Timber.e(e, "Exception while upgrading database to v41. folder classes may have vanished");
|
||||
} finally {
|
||||
Utility.closeQuietly(cursor);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class MigrationTo41 {
|
|||
inTopGroup = storage.getBoolean(accountUuid + "." + name + ".inTopGroup", inTopGroup);
|
||||
integrate = storage.getBoolean(accountUuid + "." + name + ".integrate", integrate);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, " Throwing away an error while trying to upgrade folder metadata", e);
|
||||
Timber.e(e, " Throwing away an error while trying to upgrade folder metadata");
|
||||
}
|
||||
|
||||
if (displayClass == Folder.FolderClass.NONE) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore.migrations;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Folder;
|
||||
|
@ -32,10 +32,10 @@ class MigrationTo42 {
|
|||
|
||||
editor.commit();
|
||||
long endTime = System.currentTimeMillis();
|
||||
Log.i(K9.LOG_TAG, "Putting folder preferences for " + folders.size() +
|
||||
" folders back into Preferences took " + (endTime - startTime) + " ms");
|
||||
Timber.i("Putting folder preferences for %d folders back into Preferences took %d ms",
|
||||
folders.size(), endTime - startTime);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not replace Preferences in upgrade from DB_VERSION 41", e);
|
||||
Timber.e(e, "Could not replace Preferences in upgrade from DB_VERSION 41");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.content.ContentValues;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -17,6 +17,8 @@ import com.fsck.k9.mail.Message;
|
|||
import com.fsck.k9.mailstore.LocalFolder;
|
||||
import com.fsck.k9.mailstore.LocalStore;
|
||||
|
||||
import static com.fsck.k9.Account.OUTBOX;
|
||||
|
||||
|
||||
class MigrationTo43 {
|
||||
public static void fixOutboxFolders(SQLiteDatabase db, MigrationsHelper migrationsHelper) {
|
||||
|
@ -32,7 +34,7 @@ class MigrationTo43 {
|
|||
ContentValues cv = new ContentValues();
|
||||
cv.put("name", Account.OUTBOX);
|
||||
db.update("folders", cv, "name = ?", new String[] { "OUTBOX" });
|
||||
Log.i(K9.LOG_TAG, "Renamed folder OUTBOX to " + Account.OUTBOX);
|
||||
Timber.i("Renamed folder OUTBOX to %s", OUTBOX);
|
||||
}
|
||||
|
||||
// Check if old (pre v3.800) localized outbox folder exists
|
||||
|
@ -54,7 +56,7 @@ class MigrationTo43 {
|
|||
obsoleteOutbox.delete(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error trying to fix the outbox folders", e);
|
||||
Timber.e(e, "Error trying to fix the outbox folders");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -73,7 +73,7 @@ class MigrationTo51 {
|
|||
new String[] { "id", "flags", "html_content", "text_content", "mime_type", "attachment_count" },
|
||||
null, null, null, null, null);
|
||||
try {
|
||||
Log.d(K9.LOG_TAG, "migrating " + msgCursor.getCount() + " messages");
|
||||
Timber.d("migrating %d messages", msgCursor.getCount());
|
||||
ContentValues cv = new ContentValues();
|
||||
while (msgCursor.moveToNext()) {
|
||||
long messageId = msgCursor.getLong(0);
|
||||
|
@ -124,7 +124,7 @@ class MigrationTo51 {
|
|||
cv.put("attachment_count", attachmentCount);
|
||||
db.update("messages", cv, "id = ?", new String[] { Long.toString(messageId) });
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "error inserting into database", e);
|
||||
Timber.e(e, "error inserting into database");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,18 +144,18 @@ class MigrationTo51 {
|
|||
boolean moveOk = attachmentDirNew.renameTo(attachmentDirOld);
|
||||
if (!moveOk) {
|
||||
// TODO escalate?
|
||||
Log.e(K9.LOG_TAG, "Error moving attachment dir! All attachments might be lost!");
|
||||
Timber.e("Error moving attachment dir! All attachments might be lost!");
|
||||
}
|
||||
boolean mkdirOk = attachmentDirNew.mkdir();
|
||||
if (!mkdirOk) {
|
||||
// TODO escalate?
|
||||
Log.e(K9.LOG_TAG, "Error creating new attachment dir!");
|
||||
Timber.e("Error creating new attachment dir!");
|
||||
}
|
||||
return attachmentDirOld;
|
||||
}
|
||||
|
||||
private static void dropOldMessagesTable(SQLiteDatabase db) {
|
||||
Log.d(K9.LOG_TAG, "Migration succeeded, dropping old tables.");
|
||||
Timber.d("Migration succeeded, dropping old tables.");
|
||||
db.execSQL("DROP TABLE messages_old");
|
||||
db.execSQL("DROP TABLE attachments");
|
||||
db.execSQL("DROP TABLE headers");
|
||||
|
@ -163,19 +163,19 @@ class MigrationTo51 {
|
|||
|
||||
private static void cleanUpOldAttachmentDirectory(File attachmentDirOld) {
|
||||
if (!attachmentDirOld.exists()) {
|
||||
Log.d(K9.LOG_TAG, "Old attachment directory doesn't exist: " + attachmentDirOld.getAbsolutePath());
|
||||
Timber.d("Old attachment directory doesn't exist: %s", attachmentDirOld.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
for (File file : attachmentDirOld.listFiles()) {
|
||||
Log.d(K9.LOG_TAG, "deleting stale attachment file: " + file.getName());
|
||||
Timber.d("deleting stale attachment file: %s", file.getName());
|
||||
if (file.exists() && !file.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Failed to delete stale attachement file: " + file.getAbsolutePath());
|
||||
Timber.d("Failed to delete stale attachement file: %s", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(K9.LOG_TAG, "deleting old attachment directory");
|
||||
Timber.d("deleting old attachment directory");
|
||||
if (attachmentDirOld.exists() && !attachmentDirOld.delete()) {
|
||||
Log.d(K9.LOG_TAG, "Failed to delete old attachement directory: " + attachmentDirOld.getAbsolutePath());
|
||||
Timber.d("Failed to delete old attachement directory: %s", attachmentDirOld.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ class MigrationTo51 {
|
|||
private static MimeStructureState migratePgpMimeEncryptedContent(SQLiteDatabase db, long messageId,
|
||||
File attachmentDirOld, File attachmentDirNew, MimeHeader mimeHeader, MimeStructureState structureState) {
|
||||
|
||||
Log.d(K9.LOG_TAG, "Attempting to migrate multipart/encrypted as pgp/mime");
|
||||
Timber.d("Attempting to migrate multipart/encrypted as pgp/mime");
|
||||
|
||||
// we only handle attachment count == 2 here, so simply sorting application/pgp-encrypted
|
||||
// to the front (and application/octet-stream second) should suffice.
|
||||
|
@ -269,7 +269,7 @@ class MigrationTo51 {
|
|||
|
||||
try {
|
||||
if (cursor.getCount() != 2) {
|
||||
Log.e(K9.LOG_TAG, "Found multipart/encrypted but bad number of attachments, handling as regular mail");
|
||||
Timber.e("Found multipart/encrypted but bad number of attachments, handling as regular mail");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -283,8 +283,8 @@ class MigrationTo51 {
|
|||
String firstPartContentUriString = cursor.getString(5);
|
||||
|
||||
if (!MimeUtil.isSameMimeType(firstPartMimeType, "application/pgp-encrypted")) {
|
||||
Log.e(K9.LOG_TAG,
|
||||
"First part in multipart/encrypted wasn't application/pgp-encrypted, not handling as pgp/mime");
|
||||
Timber.e("First part in multipart/encrypted wasn't application/pgp-encrypted, " +
|
||||
"not handling as pgp/mime");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -298,8 +298,7 @@ class MigrationTo51 {
|
|||
String secondPartContentUriString = cursor.getString(5);
|
||||
|
||||
if (!MimeUtil.isSameMimeType(secondPartMimeType, "application/octet-stream")) {
|
||||
Log.e(K9.LOG_TAG,
|
||||
"First part in multipart/encrypted wasn't application/octet-stream, not handling as pgp/mime");
|
||||
Timber.e("First part in multipart/encrypted wasn't application/octet-stream, not handling as pgp/mime");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -342,7 +341,7 @@ class MigrationTo51 {
|
|||
private static MimeStructureState migrateComplexMailContent(SQLiteDatabase db,
|
||||
File attachmentDirOld, File attachmentDirNew, long messageId, String htmlContent, String textContent,
|
||||
MimeHeader mimeHeader, MimeStructureState structureState) throws IOException {
|
||||
Log.d(K9.LOG_TAG, "Processing mail with complex data structure as multipart/mixed");
|
||||
Timber.d("Processing mail with complex data structure as multipart/mixed");
|
||||
|
||||
String boundary = MimeUtility.getHeaderParameter(
|
||||
mimeHeader.getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE), "boundary");
|
||||
|
@ -403,7 +402,7 @@ class MigrationTo51 {
|
|||
private static MimeStructureState migrateSimpleMailContent(SQLiteDatabase db, String htmlContent,
|
||||
String textContent, String mimeType, MimeHeader mimeHeader, MimeStructureState structureState)
|
||||
throws IOException {
|
||||
Log.d(K9.LOG_TAG, "Processing mail with simple structure");
|
||||
Timber.d("Processing mail with simple structure");
|
||||
|
||||
if (MimeUtil.isSameMimeType(mimeType, "text/plain")) {
|
||||
return insertTextualPartIntoDatabase(db, structureState, mimeHeader, textContent, false);
|
||||
|
@ -451,10 +450,13 @@ class MigrationTo51 {
|
|||
private static MimeStructureState insertMimeAttachmentPart(SQLiteDatabase db, File attachmentDirOld,
|
||||
File attachmentDirNew, MimeStructureState structureState, long id, int size, String name, String mimeType,
|
||||
String storeData, String contentUriString, String contentId, String contentDisposition) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "processing attachment " + id + ", " + name + ", "
|
||||
+ mimeType + ", " + storeData + ", " + contentUriString);
|
||||
}
|
||||
|
||||
Timber.d("processing attachment %d, %s, %s, %s, %s",
|
||||
id,
|
||||
name,
|
||||
mimeType,
|
||||
storeData,
|
||||
contentUriString);
|
||||
|
||||
if (contentDisposition == null) {
|
||||
contentDisposition = "attachment";
|
||||
|
@ -483,10 +485,10 @@ class MigrationTo51 {
|
|||
boolean isExistingAttachmentFile = attachmentFile.exists();
|
||||
|
||||
if (!isMatchingAttachmentId) {
|
||||
Log.e(K9.LOG_TAG, "mismatched attachment id. mark as missing");
|
||||
Timber.e("mismatched attachment id. mark as missing");
|
||||
attachmentFileToMove = null;
|
||||
} else if (!isExistingAttachmentFile) {
|
||||
Log.e(K9.LOG_TAG, "attached file doesn't exist. mark as missing");
|
||||
Timber.e("attached file doesn't exist. mark as missing");
|
||||
attachmentFileToMove = null;
|
||||
} else {
|
||||
attachmentFileToMove = attachmentFile;
|
||||
|
@ -498,8 +500,8 @@ class MigrationTo51 {
|
|||
} else {
|
||||
attachmentFileToMove = null;
|
||||
}
|
||||
if (K9.DEBUG && attachmentFileToMove == null) {
|
||||
Log.d(K9.LOG_TAG, "matching attachment is in local cache");
|
||||
if (attachmentFileToMove == null) {
|
||||
Timber.d("matching attachment is in local cache");
|
||||
}
|
||||
|
||||
boolean hasContentTypeAndIsInline = !TextUtils.isEmpty(contentId) && "inline".equalsIgnoreCase(contentDisposition);
|
||||
|
@ -524,7 +526,7 @@ class MigrationTo51 {
|
|||
if (attachmentFileToMove != null) {
|
||||
boolean moveOk = attachmentFileToMove.renameTo(new File(attachmentDirNew, Long.toString(partId)));
|
||||
if (!moveOk) {
|
||||
Log.e(K9.LOG_TAG, "Moving attachment to new dir failed!");
|
||||
Timber.e("Moving attachment to new dir failed!");
|
||||
}
|
||||
}
|
||||
return structureState;
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import android.content.ContentValues;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.FetchProfile;
|
||||
|
@ -38,18 +38,18 @@ class MigrationTo55 {
|
|||
|
||||
String fulltext = fulltextCreator.createFulltext(localMessage);
|
||||
if (!TextUtils.isEmpty(fulltext)) {
|
||||
Log.d(K9.LOG_TAG, "fulltext for msg id " + localMessage.getId() + " is " + fulltext.length() + " chars long");
|
||||
Timber.d("fulltext for msg id %d is %d chars long", localMessage.getId(), fulltext.length());
|
||||
cv.clear();
|
||||
cv.put("docid", localMessage.getId());
|
||||
cv.put("fulltext", fulltext);
|
||||
db.insert("messages_fulltext", null, cv);
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "no fulltext for msg id " + localMessage.getId() + " :(");
|
||||
Timber.d("no fulltext for msg id %d :(", localMessage.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "error indexing fulltext - skipping rest, fts index is incomplete!", e);
|
||||
Timber.e(e, "error indexing fulltext - skipping rest, fts index is incomplete!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.message;
|
|||
|
||||
import android.net.Uri;
|
||||
import android.net.Uri.Builder;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account.QuoteStyle;
|
||||
import com.fsck.k9.Identity;
|
||||
|
@ -97,10 +97,7 @@ public class IdentityHeaderBuilder {
|
|||
|
||||
String k9identity = IdentityField.IDENTITY_VERSION_1 + uri.build().getEncodedQuery();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Generated identity: " + k9identity);
|
||||
}
|
||||
|
||||
Timber.d("Generated identity: %s", k9identity);
|
||||
return k9identity;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.filter.Base64;
|
||||
|
@ -24,9 +24,7 @@ public class IdentityHeaderParser {
|
|||
public static Map<IdentityField, String> parse(final String identityString) {
|
||||
Map<IdentityField, String> identity = new HashMap<IdentityField, String>();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Decoding identity: " + identityString);
|
||||
}
|
||||
Timber.d("Decoding identity: %s", identityString);
|
||||
|
||||
if (identityString == null || identityString.length() < 1) {
|
||||
return identity;
|
||||
|
@ -44,9 +42,7 @@ public class IdentityHeaderParser {
|
|||
}
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Decoded identity: " + identity.toString());
|
||||
}
|
||||
Timber.d("Decoded identity: %s", identity);
|
||||
|
||||
// Sanity check our Integers so that recipients of this result don't have to.
|
||||
for (IdentityField key : IdentityField.getIntegerFields()) {
|
||||
|
@ -54,16 +50,15 @@ public class IdentityHeaderParser {
|
|||
try {
|
||||
Integer.parseInt(identity.get(key));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(K9.LOG_TAG, "Invalid " + key.name() + " field in identity: " + identity.get(key));
|
||||
Timber.e("Invalid %s field in identity: %s", key.name(), identity.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Legacy identity
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Got a saved legacy identity: " + identityString);
|
||||
}
|
||||
Timber.d("Got a saved legacy identity: %s", identityString);
|
||||
|
||||
StringTokenizer tokenizer = new StringTokenizer(identityString, ":", false);
|
||||
|
||||
// First item is the body length. We use this to separate the composed reply from the quoted text.
|
||||
|
@ -72,7 +67,7 @@ public class IdentityHeaderParser {
|
|||
try {
|
||||
identity.put(IdentityField.LENGTH, Integer.valueOf(bodyLengthS).toString());
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to parse bodyLength '" + bodyLengthS + "'");
|
||||
Timber.e("Unable to parse bodyLength '%s'", bodyLengthS);
|
||||
}
|
||||
}
|
||||
if (tokenizer.hasMoreTokens()) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account.QuoteStyle;
|
||||
import com.fsck.k9.Identity;
|
||||
|
@ -585,7 +585,7 @@ public abstract class MessageBuilder {
|
|||
final protected void deliverResult() {
|
||||
synchronized (callbackLock) {
|
||||
if (asyncCallback == null) {
|
||||
Log.d(K9.LOG_TAG, "Keeping message builder result in queue for later delivery");
|
||||
Timber.d("Keeping message builder result in queue for later delivery");
|
||||
return;
|
||||
}
|
||||
if (queuedMimeMessage != null) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.content.Intent;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Globals;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -218,7 +218,7 @@ public class PgpMessageBuilder extends MessageBuilder {
|
|||
throw new IllegalStateException(
|
||||
"Got opportunistic error, but encryption wasn't supposed to be opportunistic!");
|
||||
}
|
||||
Log.d(K9.LOG_TAG, "Skipping encryption due to opportunistic mode");
|
||||
Timber.d("Skipping encryption due to opportunistic mode");
|
||||
return null;
|
||||
}
|
||||
throw new MessagingException(error.getMessage());
|
||||
|
@ -295,7 +295,7 @@ public class PgpMessageBuilder extends MessageBuilder {
|
|||
String micAlgParameter = result.getStringExtra(OpenPgpApi.RESULT_SIGNATURE_MICALG);
|
||||
contentType += String.format("; micalg=\"%s\"", micAlgParameter);
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "missing micalg parameter for pgp multipart/signed!");
|
||||
Timber.e("missing micalg parameter for pgp multipart/signed!");
|
||||
}
|
||||
currentProcessedMimeMessage.setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.fsck.k9.message;
|
|||
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.message.html.HtmlConverter;
|
||||
|
@ -47,8 +47,8 @@ class TextBodyBuilder {
|
|||
if (mIncludeQuotedText) {
|
||||
InsertableHtmlContent quotedHtmlContent = getQuotedTextHtml();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "insertable: " + quotedHtmlContent.toDebugString());
|
||||
if (K9.isDebug()) {
|
||||
Timber.d("insertable: %s", quotedHtmlContent.toDebugString());
|
||||
}
|
||||
|
||||
if (mAppendSignature) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.content.Context;
|
|||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.support.annotation.WorkerThread;
|
||||
|
||||
import com.fsck.k9.Globals;
|
||||
|
@ -99,7 +99,7 @@ public class AttachmentInfoExtractor {
|
|||
uri = DecryptedFileProvider.getUriForProvidedFile(
|
||||
context, file, decryptedTempFileBody.getEncoding(), mimeType);
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "Decrypted temp file (no longer?) exists!", e);
|
||||
Timber.e(e, "Decrypted temp file (no longer?) exists!");
|
||||
uri = null;
|
||||
}
|
||||
return uri;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.fsck.k9.message.extractors;
|
||||
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Part;
|
||||
|
@ -22,17 +22,13 @@ public class BodyTextExtractor {
|
|||
// HTML takes precedence, then text.
|
||||
part = MimeUtility.findFirstPartByMimeType(messagePart, "text/html");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: HTML requested, HTML found.");
|
||||
}
|
||||
Timber.d("getBodyTextFromMessage: HTML requested, HTML found.");
|
||||
return MessageExtractor.getTextFromPart(part);
|
||||
}
|
||||
|
||||
part = MimeUtility.findFirstPartByMimeType(messagePart, "text/plain");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: HTML requested, text found.");
|
||||
}
|
||||
Timber.d("getBodyTextFromMessage: HTML requested, text found.");
|
||||
String text = MessageExtractor.getTextFromPart(part);
|
||||
return HtmlConverter.textToHtml(text);
|
||||
}
|
||||
|
@ -40,17 +36,13 @@ public class BodyTextExtractor {
|
|||
// Text takes precedence, then html.
|
||||
part = MimeUtility.findFirstPartByMimeType(messagePart, "text/plain");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: Text requested, text found.");
|
||||
}
|
||||
Timber.d("getBodyTextFromMessage: Text requested, text found.");
|
||||
return MessageExtractor.getTextFromPart(part);
|
||||
}
|
||||
|
||||
part = MimeUtility.findFirstPartByMimeType(messagePart, "text/html");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: Text requested, HTML found.");
|
||||
}
|
||||
Timber.d("getBodyTextFromMessage: Text requested, HTML found.");
|
||||
String text = MessageExtractor.getTextFromPart(part);
|
||||
return HtmlConverter.htmlToText(text);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account.QuoteStyle;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -149,9 +149,7 @@ public class HtmlQuoteCreator {
|
|||
hasBodyTag = true;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Open: hasHtmlTag:" + hasHtmlTag + " hasHeadTag:" + hasHeadTag + " hasBodyTag:" + hasBodyTag);
|
||||
}
|
||||
Timber.d("Open: hasHtmlTag:%s hasHeadTag:%s hasBodyTag:%s", hasHtmlTag, hasHeadTag, hasBodyTag);
|
||||
|
||||
// Given our inspections, let's figure out where to start our content.
|
||||
// This is the ideal case -- there's a BODY tag and we insert ourselves just after it.
|
||||
|
@ -202,9 +200,7 @@ public class HtmlQuoteCreator {
|
|||
hasBodyEndTag = true;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Close: hasHtmlEndTag:" + hasHtmlEndTag + " hasBodyEndTag:" + hasBodyEndTag);
|
||||
}
|
||||
Timber.d("Close: hasHtmlEndTag:%s hasBodyEndTag:%s", hasHtmlEndTag, hasBodyEndTag);
|
||||
|
||||
// Now figure out where to put our footer.
|
||||
// This is the ideal case -- there's a BODY tag and we insert ourselves just before it.
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import org.htmlcleaner.CleanerProperties;
|
||||
|
@ -36,8 +36,8 @@ public class HtmlSignatureRemover {
|
|||
end.add(blockquoteEnd.start());
|
||||
}
|
||||
if (start.size() != end.size()) {
|
||||
Log.d(K9.LOG_TAG, "There are " + start.size() + " <blockquote> tags, but " +
|
||||
end.size() + " </blockquote> tags. Refusing to strip.");
|
||||
Timber.d("There are %d <blockquote> tags, but %d </blockquote> tags. Refusing to strip.",
|
||||
start.size(), end.size());
|
||||
} else if (start.size() > 0) {
|
||||
// Ignore quoted signatures in blockquotes.
|
||||
dashSignatureHtml.region(0, start.get(0));
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -122,16 +122,14 @@ public class NotificationActionService extends CoreService {
|
|||
|
||||
@Override
|
||||
public int startService(Intent intent, int startId) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "NotificationActionService started with startId = " + startId);
|
||||
}
|
||||
Timber.i("NotificationActionService started with startId = %d", startId);
|
||||
|
||||
String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT_UUID);
|
||||
Preferences preferences = Preferences.getPreferences(this);
|
||||
Account account = preferences.getAccount(accountUuid);
|
||||
|
||||
if (account == null) {
|
||||
Log.w(K9.LOG_TAG, "Could not find account for notification action.");
|
||||
Timber.w("Could not find account for notification action.");
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
|
@ -147,9 +145,7 @@ public class NotificationActionService extends CoreService {
|
|||
} else if (ACTION_SPAM.equals(action)) {
|
||||
markMessageAsSpam(intent, account, controller);
|
||||
} else if (ACTION_DISMISS.equals(action)) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "Notification dismissed");
|
||||
}
|
||||
Timber.i("Notification dismissed");
|
||||
}
|
||||
|
||||
cancelNotifications(intent, account, controller);
|
||||
|
@ -158,9 +154,7 @@ public class NotificationActionService extends CoreService {
|
|||
}
|
||||
|
||||
private void markMessagesAsRead(Intent intent, Account account, MessagingController controller) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "NotificationActionService marking messages as read");
|
||||
}
|
||||
Timber.i("NotificationActionService marking messages as read");
|
||||
|
||||
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
|
||||
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
|
||||
|
@ -172,9 +166,7 @@ public class NotificationActionService extends CoreService {
|
|||
}
|
||||
|
||||
private void deleteMessages(Intent intent, MessagingController controller) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "NotificationActionService deleting messages");
|
||||
}
|
||||
Timber.i("NotificationActionService deleting messages");
|
||||
|
||||
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
|
||||
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
|
||||
|
@ -182,15 +174,13 @@ public class NotificationActionService extends CoreService {
|
|||
}
|
||||
|
||||
private void archiveMessages(Intent intent, Account account, MessagingController controller) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "NotificationActionService archiving messages");
|
||||
}
|
||||
Timber.i("NotificationActionService archiving messages");
|
||||
|
||||
String archiveFolderName = account.getArchiveFolderName();
|
||||
if (archiveFolderName == null ||
|
||||
(archiveFolderName.equals(account.getSpamFolderName()) && K9.confirmSpam()) ||
|
||||
!isMovePossible(controller, account, archiveFolderName)) {
|
||||
Log.w(K9.LOG_TAG, "Can not archive messages");
|
||||
Timber.w("Can not archive messages");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -205,14 +195,12 @@ public class NotificationActionService extends CoreService {
|
|||
}
|
||||
|
||||
private void markMessageAsSpam(Intent intent, Account account, MessagingController controller) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "NotificationActionService moving messages to spam");
|
||||
}
|
||||
Timber.i("NotificationActionService moving messages to spam");
|
||||
|
||||
String messageReferenceString = intent.getStringExtra(EXTRA_MESSAGE_REFERENCE);
|
||||
MessageReference messageReference = MessageReference.parse(messageReferenceString);
|
||||
if (messageReference == null) {
|
||||
Log.w(K9.LOG_TAG, "Invalid message reference: " + messageReferenceString);
|
||||
Timber.w("Invalid message reference: %s", messageReferenceString);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -230,7 +218,7 @@ public class NotificationActionService extends CoreService {
|
|||
if (messageReference != null) {
|
||||
controller.cancelNotificationForMessage(account, messageReference);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Invalid message reference: " + messageReferenceString);
|
||||
Timber.w("Invalid message reference: %s", messageReferenceString);
|
||||
}
|
||||
} else if (intent.hasExtra(EXTRA_MESSAGE_REFERENCES)) {
|
||||
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.content.Context;
|
|||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Set;
|
|||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.FontSizes;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -66,8 +66,10 @@ public class Settings {
|
|||
|
||||
boolean useDefaultValue;
|
||||
if (!importedSettings.containsKey(key)) {
|
||||
Log.v(K9.LOG_TAG, "Key \"" + key + "\" wasn't found in the imported file." +
|
||||
((useDefaultValues) ? " Using default value." : ""));
|
||||
Timber.v("Key \"%s\" wasn't found in the imported file.%s",
|
||||
key,
|
||||
(useDefaultValues) ? " Using default value." : "");
|
||||
|
||||
useDefaultValue = useDefaultValues;
|
||||
} else {
|
||||
String prettyValue = importedSettings.get(key);
|
||||
|
@ -76,9 +78,11 @@ public class Settings {
|
|||
validatedSettings.put(key, internalValue);
|
||||
useDefaultValue = false;
|
||||
} catch (InvalidSettingValueException e) {
|
||||
Log.v(K9.LOG_TAG, "Key \"" + key + "\" has invalid value \"" + prettyValue +
|
||||
"\" in imported file. " +
|
||||
((useDefaultValues) ? "Using default value." : "Skipping."));
|
||||
Timber.v("Key \"%s\" has invalid value \"%s\" in imported file. %s",
|
||||
key,
|
||||
prettyValue,
|
||||
(useDefaultValues) ? "Using default value." : "Skipping.");
|
||||
|
||||
useDefaultValue = useDefaultValues;
|
||||
}
|
||||
}
|
||||
|
@ -162,9 +166,9 @@ public class Settings {
|
|||
T defaultValue = setting.getDefaultValue();
|
||||
validatedSettingsMutable.put(settingName, defaultValue);
|
||||
|
||||
if (K9.DEBUG) {
|
||||
if (K9.isDebug()) {
|
||||
String prettyValue = setting.toPrettyString(defaultValue);
|
||||
Log.v(K9.LOG_TAG, "Added new setting \"" + settingName + "\" with default value \"" + prettyValue + "\"");
|
||||
Timber.v("Added new setting \"%s\" with default value \"%s\"", settingName, prettyValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,9 +177,7 @@ public class Settings {
|
|||
validatedSettingsMutable.remove(settingName);
|
||||
deletedSettingsMutable.add(settingName);
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Removed setting \"" + settingName + "\"");
|
||||
}
|
||||
Timber.v("Removed setting \"%s\"", settingName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,10 +209,7 @@ public class Settings {
|
|||
|
||||
serializedSettings.put(settingName, stringValue);
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.w(K9.LOG_TAG, "Settings.serialize() called with a setting that should " +
|
||||
"have been removed: " + settingName);
|
||||
}
|
||||
Timber.w("Settings.convert() called with a setting that should have been removed: %s", settingName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.TreeMap;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.util.Xml;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
|
@ -84,7 +84,7 @@ public class SettingsExporter {
|
|||
try {
|
||||
File dir = new File(Environment.getExternalStorageDirectory() + File.separator + context.getPackageName());
|
||||
if (!dir.mkdirs()) {
|
||||
Log.d(K9.LOG_TAG, "Unable to create directory: " + dir.getAbsolutePath());
|
||||
Timber.d("Unable to create directory: %s", dir.getAbsolutePath());
|
||||
}
|
||||
|
||||
File file = FileHelper.createUniqueFile(dir, EXPORT_FILENAME);
|
||||
|
@ -102,7 +102,7 @@ public class SettingsExporter {
|
|||
try {
|
||||
os.close();
|
||||
} catch (IOException ioe) {
|
||||
Log.w(K9.LOG_TAG, "Couldn't close exported settings file: " + filename);
|
||||
Timber.w("Couldn't close exported settings file: %s", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class SettingsExporter {
|
|||
serializer.attribute(null, VERSION_ATTRIBUTE, Integer.toString(Settings.VERSION));
|
||||
serializer.attribute(null, FILE_FORMAT_ATTRIBUTE, Integer.toString(FILE_FORMAT_VERSION));
|
||||
|
||||
Log.i(K9.LOG_TAG, "Exporting preferences");
|
||||
Timber.i("Exporting preferences");
|
||||
|
||||
Preferences preferences = Preferences.getPreferences(context);
|
||||
Storage storage = preferences.getStorage();
|
||||
|
@ -183,14 +183,11 @@ public class SettingsExporter {
|
|||
try {
|
||||
writeKeyAndPrettyValueFromSetting(serializer, key, setting, valueString);
|
||||
} catch (InvalidSettingValueException e) {
|
||||
Log.w(K9.LOG_TAG, "Global setting \"" + key + "\" has invalid value \"" +
|
||||
valueString + "\" in preference storage. This shouldn't happen!");
|
||||
Timber.w("Global setting \"%s\" has invalid value \"%s\" in preference storage. " +
|
||||
"This shouldn't happen!", key, valueString);
|
||||
}
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Couldn't find key \"" + key + "\" in preference storage. Using default value.");
|
||||
}
|
||||
|
||||
Timber.d("Couldn't find key \"%s\" in preference storage. Using default value.", key);
|
||||
writeKeyAndDefaultValueFromSetting(serializer, key, setting);
|
||||
}
|
||||
}
|
||||
|
@ -331,9 +328,8 @@ public class SettingsExporter {
|
|||
try {
|
||||
writeKeyAndPrettyValueFromSetting(serializer, keyPart, setting, valueString);
|
||||
} catch (InvalidSettingValueException e) {
|
||||
Log.w(K9.LOG_TAG, "Account setting \"" + keyPart + "\" (" +
|
||||
account.getDescription() + ") has invalid value \"" + valueString +
|
||||
"\" in preference storage. This shouldn't happen!");
|
||||
Timber.w("Account setting \"%s\" (%s) has invalid value \"%s\" in preference storage. " +
|
||||
"This shouldn't happen!", keyPart, account.getDescription(), valueString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +419,8 @@ public class SettingsExporter {
|
|||
try {
|
||||
writeKeyAndPrettyValueFromSetting(serializer, identityKey, setting, valueString);
|
||||
} catch (InvalidSettingValueException e) {
|
||||
Log.w(K9.LOG_TAG, "Identity setting \"" + identityKey + "\" has invalid value \"" +
|
||||
valueString + "\" in preference storage. This shouldn't happen!");
|
||||
Timber.w("Identity setting \"%s\" has invalid value \"%s\" in preference storage. " +
|
||||
"This shouldn't happen!", identityKey, valueString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -472,8 +468,8 @@ public class SettingsExporter {
|
|||
try {
|
||||
writeKeyAndPrettyValueFromSetting(serializer, folderKey, setting, valueString);
|
||||
} catch (InvalidSettingValueException e) {
|
||||
Log.w(K9.LOG_TAG, "Folder setting \"" + folderKey + "\" has invalid value \"" + valueString +
|
||||
"\" in preference storage. This shouldn't happen!");
|
||||
Timber.w("Folder setting \"%s\" has invalid value \"%s\" in preference storage. " +
|
||||
"This shouldn't happen!", folderKey, valueString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Identity;
|
||||
|
@ -180,20 +180,16 @@ public class SettingsImporter {
|
|||
if (imported.globalSettings != null) {
|
||||
importGlobalSettings(storage, editor, imported.contentVersion, imported.globalSettings);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Was asked to import global settings but none found.");
|
||||
Timber.w("Was asked to import global settings but none found.");
|
||||
}
|
||||
if (editor.commit()) {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Committed global settings to the preference storage.");
|
||||
}
|
||||
Timber.v("Committed global settings to the preference storage.");
|
||||
globalSettingsImported = true;
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Failed to commit global settings to the preference storage");
|
||||
}
|
||||
Timber.v("Failed to commit global settings to the preference storage");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while importing global settings", e);
|
||||
Timber.e(e, "Exception while importing global settings");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,10 +205,8 @@ public class SettingsImporter {
|
|||
imported.contentVersion, account, overwrite);
|
||||
|
||||
if (editor.commit()) {
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Committed settings for account \"" +
|
||||
importResult.imported.name + "\" to the settings database.");
|
||||
}
|
||||
Timber.v("Committed settings for account \"%s\" to the settings database.",
|
||||
importResult.imported.name);
|
||||
|
||||
// Add UUID of the account we just imported to the list of
|
||||
// account UUIDs
|
||||
|
@ -236,25 +230,23 @@ public class SettingsImporter {
|
|||
|
||||
importedAccounts.add(importResult);
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.w(K9.LOG_TAG, "Error while committing settings for account \"" +
|
||||
importResult.original.name + "\" to the settings database.");
|
||||
}
|
||||
Timber.w("Error while committing settings for account \"%s\" to the settings " +
|
||||
"database.", importResult.original.name);
|
||||
|
||||
erroneousAccounts.add(importResult.original);
|
||||
}
|
||||
} catch (InvalidSettingValueException e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(K9.LOG_TAG, "Encountered invalid setting while " +
|
||||
"importing account \"" + account.name + "\"", e);
|
||||
}
|
||||
Timber.e(e, "Encountered invalid setting while importing account \"%s\"",
|
||||
account.name);
|
||||
|
||||
erroneousAccounts.add(new AccountDescription(account.name, account.uuid));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while importing account \"" + account.name + "\"", e);
|
||||
Timber.e(e, "Exception while importing account \"%s\"", account.name);
|
||||
erroneousAccounts.add(new AccountDescription(account.name, account.uuid));
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Was asked to import account with UUID " + accountUuid +
|
||||
". But this account wasn't found.");
|
||||
Timber.w("Was asked to import account with UUID %s. But this account wasn't found.",
|
||||
accountUuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +261,7 @@ public class SettingsImporter {
|
|||
throw new SettingsImportExportException("Failed to set default account");
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Was asked to import at least one account but none found.");
|
||||
Timber.w("Was asked to import at least one account but none found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,12 +609,12 @@ public class SettingsImporter {
|
|||
* The new value for the preference.
|
||||
*/
|
||||
private static void putString(StorageEditor editor, String key, String value) {
|
||||
if (K9.DEBUG) {
|
||||
if (K9.isDebug()) {
|
||||
String outputValue = value;
|
||||
if (!K9.DEBUG_SENSITIVE && (key.endsWith(".transportUri") || key.endsWith(".storeUri"))) {
|
||||
outputValue = "*sensitive*";
|
||||
}
|
||||
Log.v(K9.LOG_TAG, "Setting " + key + "=" + outputValue);
|
||||
Timber.v("Setting %s=%s", key, outputValue);
|
||||
}
|
||||
editor.putString(key, value);
|
||||
}
|
||||
|
@ -650,7 +642,7 @@ public class SettingsImporter {
|
|||
if (SettingsExporter.ROOT_ELEMENT.equals(xpp.getName())) {
|
||||
imported = parseRoot(xpp, globalSettings, accountUuids, overview);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -707,20 +699,20 @@ public class SettingsImporter {
|
|||
}
|
||||
} else {
|
||||
skipToEndTag(xpp, SettingsExporter.GLOBAL_ELEMENT);
|
||||
Log.w(K9.LOG_TAG, "More than one global settings element. Only using the first one!");
|
||||
Timber.w("More than one global settings element. Only using the first one!");
|
||||
}
|
||||
} else {
|
||||
skipToEndTag(xpp, SettingsExporter.GLOBAL_ELEMENT);
|
||||
Log.i(K9.LOG_TAG, "Skipping global settings");
|
||||
Timber.i("Skipping global settings");
|
||||
}
|
||||
} else if (SettingsExporter.ACCOUNTS_ELEMENT.equals(element)) {
|
||||
if (result.accounts == null) {
|
||||
result.accounts = parseAccounts(xpp, accountUuids, overview);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "More than one accounts element. Only using the first one!");
|
||||
Timber.w("More than one accounts element. Only using the first one!");
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -786,12 +778,12 @@ public class SettingsImporter {
|
|||
}
|
||||
|
||||
if (result.settings.containsKey(key)) {
|
||||
Log.w(K9.LOG_TAG, "Already read key \"" + key + "\". Ignoring value \"" + value + "\"");
|
||||
Timber.w("Already read key \"%s\". Ignoring value \"%s\"", key, value);
|
||||
} else {
|
||||
result.settings.put(key, value);
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -821,10 +813,10 @@ public class SettingsImporter {
|
|||
} else if (!accounts.containsKey(account.uuid)) {
|
||||
accounts.put(account.uuid, account);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Duplicate account entries with UUID " + account.uuid + ". Ignoring!");
|
||||
Timber.w("Duplicate account entries with UUID %s. Ignoring!", account.uuid);
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -842,7 +834,7 @@ public class SettingsImporter {
|
|||
UUID.fromString(uuid);
|
||||
} catch (Exception e) {
|
||||
skipToEndTag(xpp, SettingsExporter.ACCOUNT_ELEMENT);
|
||||
Log.w(K9.LOG_TAG, "Skipping account with invalid UUID " + uuid);
|
||||
Timber.w("Skipping account with invalid UUID %s", uuid);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -883,14 +875,14 @@ public class SettingsImporter {
|
|||
account.folders = parseFolders(xpp);
|
||||
}
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
}
|
||||
} else {
|
||||
skipToEndTag(xpp, SettingsExporter.ACCOUNT_ELEMENT);
|
||||
Log.i(K9.LOG_TAG, "Skipping account with UUID " + uuid);
|
||||
Timber.i("Skipping account with UUID %s", uuid);
|
||||
}
|
||||
|
||||
// If we couldn't find an account name use the UUID
|
||||
|
@ -929,7 +921,7 @@ public class SettingsImporter {
|
|||
} else if (SettingsExporter.EXTRA_ELEMENT.equals(element)) {
|
||||
server.extras = parseSettings(xpp, SettingsExporter.EXTRA_ELEMENT);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -954,7 +946,7 @@ public class SettingsImporter {
|
|||
ImportedIdentity identity = parseIdentity(xpp);
|
||||
identities.add(identity);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -980,7 +972,7 @@ public class SettingsImporter {
|
|||
} else if (SettingsExporter.SETTINGS_ELEMENT.equals(element)) {
|
||||
identity.settings = parseSettings(xpp, SettingsExporter.SETTINGS_ELEMENT);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
@ -1004,7 +996,7 @@ public class SettingsImporter {
|
|||
ImportedFolder folder = parseFolder(xpp);
|
||||
folders.add(folder);
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "Unexpected start tag: " + xpp.getName());
|
||||
Timber.w("Unexpected start tag: %s", xpp.getName());
|
||||
}
|
||||
}
|
||||
eventType = xpp.next();
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
|
@ -41,7 +41,7 @@ public class Storage {
|
|||
SQLiteDatabase mDb = context.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null);
|
||||
|
||||
if (mDb.getVersion() == 1) {
|
||||
Log.i(K9.LOG_TAG, "Updating preferences to urlencoded username/password");
|
||||
Timber.i("Updating preferences to urlencoded username/password");
|
||||
|
||||
String accountUuids = readValue(mDb, "accountUuids");
|
||||
if (accountUuids != null && accountUuids.length() != 0) {
|
||||
|
@ -119,7 +119,7 @@ public class Storage {
|
|||
writeValue(mDb, uuid + ".storeUri", newStoreUriStr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "ooops", e);
|
||||
Timber.e(e, "ooops");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class Storage {
|
|||
}
|
||||
|
||||
if (mDb.getVersion() != DB_VERSION) {
|
||||
Log.i(K9.LOG_TAG, "Creating Storage database");
|
||||
Timber.i("Creating Storage database");
|
||||
mDb.execSQL("DROP TABLE IF EXISTS preferences_storage");
|
||||
mDb.execSQL("CREATE TABLE preferences_storage " +
|
||||
"(primkey TEXT PRIMARY KEY ON CONFLICT REPLACE, value TEXT)");
|
||||
|
@ -141,25 +141,17 @@ public class Storage {
|
|||
public static Storage getStorage(Context context) {
|
||||
Storage tmpStorage = storages.get(context);
|
||||
if (tmpStorage != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Returning already existing Storage");
|
||||
}
|
||||
Timber.d("Returning already existing Storage");
|
||||
return tmpStorage;
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Creating provisional storage");
|
||||
}
|
||||
Timber.d("Creating provisional storage");
|
||||
tmpStorage = new Storage(context);
|
||||
Storage oldStorage = storages.putIfAbsent(context, tmpStorage);
|
||||
if (oldStorage != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Another thread beat us to creating the Storage, returning that one");
|
||||
}
|
||||
Timber.d("Another thread beat us to creating the Storage, returning that one");
|
||||
return oldStorage;
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Returning the Storage we created");
|
||||
}
|
||||
Timber.d("Returning the Storage we created");
|
||||
return tmpStorage;
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +159,7 @@ public class Storage {
|
|||
|
||||
private void loadValues() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
Log.i(K9.LOG_TAG, "Loading preferences from DB into Storage");
|
||||
Timber.i("Loading preferences from DB into Storage");
|
||||
Cursor cursor = null;
|
||||
SQLiteDatabase mDb = null;
|
||||
try {
|
||||
|
@ -177,9 +169,7 @@ public class Storage {
|
|||
while (cursor.moveToNext()) {
|
||||
String key = cursor.getString(0);
|
||||
String value = cursor.getString(1);
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Loading key '" + key + "', value = '" + value + "'");
|
||||
}
|
||||
Timber.d("Loading key '%s', value = '%s'", key, value);
|
||||
storage.put(key, value);
|
||||
}
|
||||
} finally {
|
||||
|
@ -188,7 +178,7 @@ public class Storage {
|
|||
mDb.close();
|
||||
}
|
||||
long endTime = System.currentTimeMillis();
|
||||
Log.i(K9.LOG_TAG, "Preferences load took " + (endTime - startTime) + "ms");
|
||||
Timber.i("Preferences load took %d ms", endTime - startTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +284,7 @@ public class Storage {
|
|||
try {
|
||||
return Integer.parseInt(val);
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e(K9.LOG_TAG, "Could not parse int", nfe);
|
||||
Timber.e(nfe, "Could not parse int");
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +297,7 @@ public class Storage {
|
|||
try {
|
||||
return Long.parseLong(val);
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e(K9.LOG_TAG, "Could not parse long", nfe);
|
||||
Timber.e(nfe, "Could not parse long");
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
|
@ -335,9 +325,7 @@ public class Storage {
|
|||
|
||||
if (cursor.moveToNext()) {
|
||||
value = cursor.getString(0);
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Loading key '" + key + "', value = '" + value + "'");
|
||||
}
|
||||
Timber.d("Loading key '%s', value = '%s'", key, value);
|
||||
}
|
||||
} finally {
|
||||
Utility.closeQuietly(cursor);
|
||||
|
@ -354,7 +342,7 @@ public class Storage {
|
|||
long result = mDb.insert("preferences_storage", "primkey", cv);
|
||||
|
||||
if (result == -1) {
|
||||
Log.e(K9.LOG_TAG, "Error writing key '" + key + "', value = '" + value + "'");
|
||||
Timber.e("Error writing key '%s', value = '%s'", key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.fsck.k9.preferences;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -29,14 +29,10 @@ public class StorageEditor {
|
|||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (key != null && value != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Copying key '" + key + "', value '" + value + "'");
|
||||
}
|
||||
Timber.d("Copying key '%s', value '%s'", key, value);
|
||||
changes.put(key, "" + value);
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Skipping copying key '" + key + "', value '" + value + "'");
|
||||
}
|
||||
Timber.d("Skipping copying key '%s', value '%s'", key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,14 +42,14 @@ public class StorageEditor {
|
|||
commitChanges();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Failed to save preferences", e);
|
||||
Timber.e(e, "Failed to save preferences");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void commitChanges() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
Log.i(K9.LOG_TAG, "Committing preference changes");
|
||||
Timber.i("Committing preference changes");
|
||||
Runnable committer = new Runnable() {
|
||||
public void run() {
|
||||
for (String removeKey : removals) {
|
||||
|
@ -73,7 +69,7 @@ public class StorageEditor {
|
|||
};
|
||||
storage.doInTransaction(committer);
|
||||
long endTime = System.currentTimeMillis();
|
||||
Log.i(K9.LOG_TAG, "Preferences commit took " + (endTime - startTime) + "ms");
|
||||
Timber.i("Preferences commit took %d ms", endTime - startTime);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.net.Uri;
|
|||
import android.os.ParcelFileDescriptor;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.BuildConfig;
|
||||
|
@ -96,14 +96,12 @@ public class AttachmentProvider extends ContentProvider {
|
|||
final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
|
||||
attachmentInfo = LocalStore.getInstance(account, getContext()).getAttachmentInfo(id);
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to retrieve attachment info from local store for ID: " + id, e);
|
||||
Timber.e(e, "Unable to retrieve attachment info from local store for ID: %s", id);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (attachmentInfo == null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "No attachment info for ID: " + id);
|
||||
}
|
||||
Timber.d("No attachment info for ID: %s", id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -154,7 +152,7 @@ public class AttachmentProvider extends ContentProvider {
|
|||
type = attachmentInfo.type;
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to retrieve LocalStore for " + account, e);
|
||||
Timber.e(e, "Unable to retrieve LocalStore for %s", account);
|
||||
type = MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE;
|
||||
}
|
||||
|
||||
|
@ -166,15 +164,15 @@ public class AttachmentProvider extends ContentProvider {
|
|||
try {
|
||||
OpenPgpDataSource openPgpDataSource = getAttachmentDataSource(accountUuid, attachmentId);
|
||||
if (openPgpDataSource == null) {
|
||||
Log.e(K9.LOG_TAG, "Error getting data source for attachment (part doesn't exist?)");
|
||||
Timber.e("Error getting data source for attachment (part doesn't exist?)");
|
||||
return null;
|
||||
}
|
||||
return openPgpDataSource.startPumpThread();
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Error getting InputStream for attachment", e);
|
||||
Timber.e(e, "Error getting InputStream for attachment");
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "Error creating ParcelFileDescriptor", e);
|
||||
Timber.e(e, "Error creating ParcelFileDescriptor");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.support.annotation.MainThread;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.BuildConfig;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -101,15 +101,15 @@ public class AttachmentTempFileProvider extends FileProvider {
|
|||
if (lastModified < deletionThreshold) {
|
||||
boolean fileDeleted = tempFile.delete();
|
||||
if (!fileDeleted) {
|
||||
Log.e(K9.LOG_TAG, "Failed to delete temporary file");
|
||||
Timber.e("Failed to delete temporary file");
|
||||
// TODO really do this? might cause our service to stay up indefinitely if a file can't be deleted
|
||||
allFilesDeleted = false;
|
||||
}
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
if (K9.isDebug()) {
|
||||
String timeLeftStr = String.format(
|
||||
Locale.ENGLISH, "%.2f", (lastModified - deletionThreshold) / 1000 / 60.0);
|
||||
Log.e(K9.LOG_TAG, "Not deleting temp file (for another " + timeLeftStr + " minutes)");
|
||||
Timber.e("Not deleting temp file (for another %s minutes)", timeLeftStr);
|
||||
}
|
||||
allFilesDeleted = false;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class AttachmentTempFileProvider extends FileProvider {
|
|||
File directory = new File(context.getCacheDir(), CACHE_DIRECTORY);
|
||||
if (!directory.exists()) {
|
||||
if (!directory.mkdir()) {
|
||||
Log.e(K9.LOG_TAG, "Error creating directory: " + directory.getAbsolutePath());
|
||||
Timber.e("Error creating directory: %s", directory.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,9 +167,7 @@ public class AttachmentTempFileProvider extends FileProvider {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Unregistering temp file cleanup receiver");
|
||||
}
|
||||
Timber.d("Unregistering temp file cleanup receiver");
|
||||
context.unregisterReceiver(cleanupReceiver);
|
||||
cleanupReceiver = null;
|
||||
}
|
||||
|
@ -180,9 +178,8 @@ public class AttachmentTempFileProvider extends FileProvider {
|
|||
if (cleanupReceiver != null) {
|
||||
return;
|
||||
}
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Registering temp file cleanup receiver");
|
||||
}
|
||||
|
||||
Timber.d("Registering temp file cleanup receiver");
|
||||
cleanupReceiver = new AttachmentTempFileProviderCleanupReceiver();
|
||||
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
|
@ -199,9 +196,7 @@ public class AttachmentTempFileProvider extends FileProvider {
|
|||
throw new IllegalArgumentException("onReceive called with action that isn't screen off!");
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Cleaning up temp files");
|
||||
}
|
||||
Timber.d("Cleaning up temp files");
|
||||
|
||||
boolean allFilesDeleted = deleteOldTemporaryFiles(context);
|
||||
if (allFilesDeleted) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.BuildConfig;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -80,15 +80,15 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
if (lastModified < deletionThreshold) {
|
||||
boolean fileDeleted = tempFile.delete();
|
||||
if (!fileDeleted) {
|
||||
Log.e(K9.LOG_TAG, "Failed to delete temporary file");
|
||||
Timber.e("Failed to delete temporary file");
|
||||
// TODO really do this? might cause our service to stay up indefinitely if a file can't be deleted
|
||||
allFilesDeleted = false;
|
||||
}
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
if (K9.isDebug()) {
|
||||
String timeLeftStr = String.format(
|
||||
Locale.ENGLISH, "%.2f", (lastModified - deletionThreshold) / 1000 / 60.0);
|
||||
Log.e(K9.LOG_TAG, "Not deleting temp file (for another " + timeLeftStr + " minutes)");
|
||||
Timber.e("Not deleting temp file (for another %s minutes)", timeLeftStr);
|
||||
}
|
||||
allFilesDeleted = false;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
File directory = new File(context.getCacheDir(), DECRYPTED_CACHE_DIRECTORY);
|
||||
if (!directory.exists()) {
|
||||
if (!directory.mkdir()) {
|
||||
Log.e(K9.LOG_TAG, "Error creating directory: " + directory.getAbsolutePath());
|
||||
Timber.e("Error creating directory: %s", directory.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
InputStream inputStream = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
|
||||
decodedInputStream = new QuotedPrintableInputStream(inputStream);
|
||||
} else { // no or unknown encoding
|
||||
if (K9.DEBUG && !TextUtils.isEmpty(encoding)) {
|
||||
Log.e(K9.LOG_TAG, "unsupported encoding, returning raw stream");
|
||||
if (!TextUtils.isEmpty(encoding)) {
|
||||
Timber.e("unsupported encoding, returning raw stream");
|
||||
}
|
||||
return pfd;
|
||||
}
|
||||
|
@ -173,9 +173,7 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Unregistering temp file cleanup receiver");
|
||||
}
|
||||
Timber.d("Unregistering temp file cleanup receiver");
|
||||
context.unregisterReceiver(cleanupReceiver);
|
||||
cleanupReceiver = null;
|
||||
}
|
||||
|
@ -186,9 +184,8 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
if (cleanupReceiver != null) {
|
||||
return;
|
||||
}
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Registering temp file cleanup receiver");
|
||||
}
|
||||
|
||||
Timber.d("Registering temp file cleanup receiver");
|
||||
cleanupReceiver = new DecryptedFileProviderCleanupReceiver();
|
||||
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
|
@ -205,9 +202,7 @@ public class DecryptedFileProvider extends FileProvider {
|
|||
throw new IllegalArgumentException("onReceive called with action that isn't screen off!");
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Cleaning up temp files");
|
||||
}
|
||||
Timber.d("Cleaning up temp files");
|
||||
|
||||
boolean allFilesDeleted = deleteOldTemporaryFiles(context);
|
||||
if (allFilesDeleted) {
|
||||
|
|
|
@ -34,7 +34,7 @@ import android.os.Binder;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.BaseColumns;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.AccountStats;
|
||||
|
@ -103,7 +103,7 @@ public class MessageProvider extends ContentProvider {
|
|||
K9.registerApplicationAware(new K9.ApplicationAware() {
|
||||
@Override
|
||||
public void initializeComponent(final Application application) {
|
||||
Log.v(K9.LOG_TAG, "Registering content resolver notifier");
|
||||
Timber.v("Registering content resolver notifier");
|
||||
|
||||
MessagingController.getInstance(application).addListener(new SimpleMessagingListener() {
|
||||
@Override
|
||||
|
@ -123,9 +123,7 @@ public class MessageProvider extends ContentProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "MessageProvider/getType: " + uri);
|
||||
}
|
||||
Timber.v("MessageProvider/getType: %s", uri);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -136,9 +134,7 @@ public class MessageProvider extends ContentProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "MessageProvider/query: " + uri);
|
||||
}
|
||||
Timber.v("MessageProvider/query: %s", uri);
|
||||
|
||||
int code = uriMatcher.match(uri);
|
||||
if (code == -1) {
|
||||
|
@ -150,7 +146,7 @@ public class MessageProvider extends ContentProvider {
|
|||
QueryHandler handler = queryHandlers.get(code);
|
||||
cursor = handler.query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to execute query for URI: " + uri, e);
|
||||
Timber.e(e, "Unable to execute query for URI: %s", uri);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -163,9 +159,7 @@ public class MessageProvider extends ContentProvider {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "MessageProvider/delete: " + uri);
|
||||
}
|
||||
Timber.v("MessageProvider/delete: %s", uri);
|
||||
|
||||
// Note: can only delete a message
|
||||
|
||||
|
@ -180,14 +174,14 @@ public class MessageProvider extends ContentProvider {
|
|||
if (account.getAccountNumber() == accountId) {
|
||||
myAccount = account;
|
||||
if (!account.isAvailable(getContext())) {
|
||||
Log.w(K9.LOG_TAG, "not deleting messages because account is unavailable at the moment");
|
||||
Timber.w("not deleting messages because account is unavailable at the moment");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myAccount == null) {
|
||||
Log.e(K9.LOG_TAG, "Could not find account with id " + accountId);
|
||||
Timber.e("Could not find account with id %d", accountId);
|
||||
}
|
||||
|
||||
if (myAccount != null) {
|
||||
|
@ -206,9 +200,7 @@ public class MessageProvider extends ContentProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "MessageProvider/insert: " + uri);
|
||||
}
|
||||
Timber.v("MessageProvider/insert: %s", uri);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -219,9 +211,7 @@ public class MessageProvider extends ContentProvider {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "MessageProvider/update: " + uri);
|
||||
}
|
||||
Timber.v("MessageProvider/update: %s", uri);
|
||||
|
||||
// TBD
|
||||
|
||||
|
@ -712,7 +702,7 @@ public class MessageProvider extends ContentProvider {
|
|||
values[1] = myAccountStats.unreadMessageCount;
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, e.getMessage());
|
||||
Timber.e(e.getMessage());
|
||||
values[0] = "Unknown";
|
||||
values[1] = 0;
|
||||
}
|
||||
|
@ -750,7 +740,7 @@ public class MessageProvider extends ContentProvider {
|
|||
public void close() {
|
||||
if (closed.compareAndSet(false, true)) {
|
||||
cursor.close();
|
||||
Log.d(K9.LOG_TAG, "Cursor closed, null'ing & releasing semaphore");
|
||||
Timber.d("Cursor closed, null'ing & releasing semaphore");
|
||||
cursor = null;
|
||||
semaphore.release();
|
||||
}
|
||||
|
@ -1055,7 +1045,7 @@ public class MessageProvider extends ContentProvider {
|
|||
|
||||
// Android content resolvers can only process CrossProcessCursor instances
|
||||
if (!(cursor instanceof CrossProcessCursor)) {
|
||||
Log.w(K9.LOG_TAG, "Unsupported cursor, returning null: " + cursor);
|
||||
Timber.w("Unsupported cursor, returning null: %s", cursor);
|
||||
semaphore.release();
|
||||
return null;
|
||||
}
|
||||
|
@ -1072,11 +1062,11 @@ public class MessageProvider extends ContentProvider {
|
|||
public void run() {
|
||||
MonitoredCursor monitored = weakReference.get();
|
||||
if (monitored != null && !monitored.isClosed()) {
|
||||
Log.w(K9.LOG_TAG, "Forcibly closing remotely exposed cursor");
|
||||
Timber.w("Forcibly closing remotely exposed cursor");
|
||||
try {
|
||||
monitored.close();
|
||||
} catch (Exception e) {
|
||||
Log.w(K9.LOG_TAG, "Exception while forcibly closing cursor", e);
|
||||
Timber.w(e, "Exception while forcibly closing cursor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1119,7 +1109,7 @@ public class MessageProvider extends ContentProvider {
|
|||
try {
|
||||
queue.put(holders);
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to return message list back to caller", e);
|
||||
Timber.e(e, "Unable to return message list back to caller");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.appwidget.AppWidgetProvider;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
|
@ -99,9 +99,7 @@ public class UnreadWidgetProvider extends AppWidgetProvider {
|
|||
unreadCount = stats.unreadMessageCount;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(K9.LOG_TAG, "Error getting widget configuration", e);
|
||||
}
|
||||
Timber.e(e, "Error getting widget configuration");
|
||||
}
|
||||
|
||||
if (unreadCount <= 0) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
class AccountReceiver extends BroadcastReceiver {
|
||||
K9AccountReceptor receptor = null;
|
||||
|
@ -18,7 +18,7 @@ class AccountReceiver extends BroadcastReceiver {
|
|||
if (K9RemoteControl.K9_REQUEST_ACCOUNTS.equals(intent.getAction())) {
|
||||
Bundle bundle = getResultExtras(false);
|
||||
if (bundle == null) {
|
||||
Log.w(K9RemoteControl.LOG_TAG, "Response bundle is empty");
|
||||
Timber.w("Response bundle is empty");
|
||||
return;
|
||||
}
|
||||
receptor.accounts(bundle.getStringArray(K9RemoteControl.K9_ACCOUNT_UUIDS), bundle.getStringArray(K9RemoteControl.K9_ACCOUNT_DESCRIPTIONS));
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.fsck.k9.search;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -78,7 +78,7 @@ public class SqlQueryBuilder {
|
|||
case MESSAGE_CONTENTS: {
|
||||
String fulltextQueryString = condition.value;
|
||||
if (condition.attribute != Attribute.CONTAINS) {
|
||||
Log.e(K9.LOG_TAG, "message contents can only be matched!");
|
||||
Timber.e("message contents can only be matched!");
|
||||
}
|
||||
query.append("(EXISTS (SELECT docid FROM messages_fulltext WHERE docid = id AND fulltext MATCH ?))");
|
||||
selectionArgs.add(fulltextQueryString);
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.helper.K9AlarmManager;
|
||||
|
@ -25,8 +25,7 @@ public class BootReceiver extends CoreReceiver {
|
|||
|
||||
@Override
|
||||
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver.onReceive" + intent);
|
||||
Timber.i("BootReceiver.onReceive %s", intent);
|
||||
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
|
||||
|
@ -50,16 +49,14 @@ public class BootReceiver extends CoreReceiver {
|
|||
} else if (FIRE_INTENT.equals(action)) {
|
||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||
String alarmedAction = alarmedIntent.getAction();
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction);
|
||||
Timber.i("BootReceiver Got alarm to fire alarmedIntent %s", alarmedAction);
|
||||
alarmedIntent.putExtra(WAKE_LOCK_ID, tmpWakeLockId);
|
||||
tmpWakeLockId = null;
|
||||
context.startService(alarmedIntent);
|
||||
} else if (SCHEDULE_INTENT.equals(action)) {
|
||||
long atTime = intent.getLongExtra(AT_TIME, -1);
|
||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver Scheduling intent " + alarmedIntent + " for " + new Date(atTime));
|
||||
Timber.i("BootReceiver Scheduling intent %s for %tc", alarmedIntent, atTime);
|
||||
|
||||
PendingIntent pi = buildPendingIntent(context, intent);
|
||||
K9AlarmManager alarmMgr = K9AlarmManager.getAlarmManager(context);
|
||||
|
@ -67,8 +64,7 @@ public class BootReceiver extends CoreReceiver {
|
|||
alarmMgr.set(AlarmManager.RTC_WAKEUP, atTime, pi);
|
||||
} else if (CANCEL_INTENT.equals(action)) {
|
||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver Canceling alarmedIntent " + alarmedIntent);
|
||||
Timber.i("BootReceiver Canceling alarmedIntent %s", alarmedIntent);
|
||||
|
||||
PendingIntent pi = buildPendingIntent(context, intent);
|
||||
|
||||
|
@ -94,8 +90,8 @@ public class BootReceiver extends CoreReceiver {
|
|||
}
|
||||
|
||||
public static void scheduleIntent(Context context, long atTime, Intent alarmedIntent) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver Got request to schedule alarmedIntent " + alarmedIntent.getAction());
|
||||
Timber.i("BootReceiver Got request to schedule alarmedIntent %s", alarmedIntent.getAction());
|
||||
|
||||
Intent i = new Intent();
|
||||
i.setClass(context, BootReceiver.class);
|
||||
i.setAction(SCHEDULE_INTENT);
|
||||
|
@ -105,8 +101,8 @@ public class BootReceiver extends CoreReceiver {
|
|||
}
|
||||
|
||||
public static void cancelIntent(Context context, Intent alarmedIntent) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "BootReceiver Got request to cancel alarmedIntent " + alarmedIntent.getAction());
|
||||
Timber.i("BootReceiver Got request to cancel alarmedIntent %s", alarmedIntent.getAction());
|
||||
|
||||
Intent i = new Intent();
|
||||
i.setClass(context, BootReceiver.class);
|
||||
i.setAction(CANCEL_INTENT);
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.power.TracingPowerManager;
|
||||
|
@ -30,8 +30,7 @@ public class CoreReceiver extends BroadcastReceiver {
|
|||
wakeLock.acquire(K9.BOOT_RECEIVER_WAKE_LOCK_TIMEOUT);
|
||||
Integer tmpWakeLockId = wakeLockSeq.getAndIncrement();
|
||||
wakeLocks.put(tmpWakeLockId, wakeLock);
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "CoreReceiver Created wakeLock " + tmpWakeLockId);
|
||||
Timber.v("CoreReceiver Created wakeLock %d", tmpWakeLockId);
|
||||
return tmpWakeLockId;
|
||||
}
|
||||
|
||||
|
@ -39,11 +38,10 @@ public class CoreReceiver extends BroadcastReceiver {
|
|||
if (wakeLockId != null) {
|
||||
TracingWakeLock wl = wakeLocks.remove(wakeLockId);
|
||||
if (wl != null) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "CoreReceiver Releasing wakeLock " + wakeLockId);
|
||||
Timber.v("CoreReceiver Releasing wakeLock %d", wakeLockId);
|
||||
wl.release();
|
||||
} else {
|
||||
Log.w(K9.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist");
|
||||
Timber.w("BootReceiver WakeLock %d doesn't exist", wakeLockId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,13 +50,12 @@ public class CoreReceiver extends BroadcastReceiver {
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
Integer tmpWakeLockId = CoreReceiver.getWakeLock(context);
|
||||
try {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "CoreReceiver.onReceive" + intent);
|
||||
Timber.i("CoreReceiver.onReceive %s", intent);
|
||||
|
||||
if (CoreReceiver.WAKE_LOCK_RELEASE.equals(intent.getAction())) {
|
||||
Integer wakeLockId = intent.getIntExtra(WAKE_LOCK_ID, -1);
|
||||
if (wakeLockId != -1) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "CoreReceiver Release wakeLock " + wakeLockId);
|
||||
Timber.v("CoreReceiver Release wakeLock %d", wakeLockId);
|
||||
CoreReceiver.releaseWakeLock(wakeLockId);
|
||||
}
|
||||
} else {
|
||||
|
@ -74,8 +71,8 @@ public class CoreReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
public static void releaseWakeLock(Context context, int wakeLockId) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "CoreReceiver Got request to release wakeLock " + wakeLockId);
|
||||
Timber.v("CoreReceiver Got request to release wakeLock %d", wakeLockId);
|
||||
|
||||
Intent i = new Intent();
|
||||
i.setClass(context, CoreReceiver.class);
|
||||
i.setAction(WAKE_LOCK_RELEASE);
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.controller.MessagingController;
|
||||
import com.fsck.k9.mail.power.TracingPowerManager;
|
||||
|
@ -190,9 +190,7 @@ public abstract class CoreService extends Service {
|
|||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "CoreService: " + className + ".onCreate()");
|
||||
}
|
||||
Timber.i("CoreService: %s.onCreate()", className);
|
||||
|
||||
mThreadPool = Executors.newFixedThreadPool(1); // Must be single threaded
|
||||
}
|
||||
|
@ -217,9 +215,7 @@ public abstract class CoreService extends Service {
|
|||
TracingWakeLock wakeLock = acquireWakeLock(this, "CoreService onStart",
|
||||
K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT);
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "CoreService: " + className + ".onStart(" + intent + ", " + startId + ")");
|
||||
}
|
||||
Timber.i("CoreService: %s.onStart(%s, %d)", className, intent, startId);
|
||||
|
||||
// If we were started by BootReceiver, release the wake lock acquired there.
|
||||
int wakeLockId = intent.getIntExtra(BootReceiver.WAKE_LOCK_ID, -1);
|
||||
|
@ -231,19 +227,14 @@ public abstract class CoreService extends Service {
|
|||
// release it.
|
||||
int coreWakeLockId = intent.getIntExtra(WAKE_LOCK_ID, -1);
|
||||
if (coreWakeLockId != -1) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Got core wake lock id " + coreWakeLockId);
|
||||
}
|
||||
Timber.d("Got core wake lock id %d", coreWakeLockId);
|
||||
|
||||
// Remove wake lock from the registry
|
||||
TracingWakeLock coreWakeLock = sWakeLocks.remove(coreWakeLockId);
|
||||
|
||||
// Release wake lock
|
||||
if (coreWakeLock != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Found core wake lock with id " + coreWakeLockId +
|
||||
", releasing");
|
||||
}
|
||||
Timber.d("Found core wake lock with id %d, releasing", coreWakeLockId);
|
||||
coreWakeLock.release();
|
||||
}
|
||||
}
|
||||
|
@ -306,10 +297,8 @@ public abstract class CoreService extends Service {
|
|||
// Get the sync status
|
||||
boolean oldIsSyncDisabled = MailService.isSyncDisabled();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "CoreService (" + className + ") running Runnable " +
|
||||
runner.hashCode() + " with startId " + startId);
|
||||
}
|
||||
Timber.d("CoreService (%s) running Runnable %d with startId %d",
|
||||
className, runner.hashCode(), startId);
|
||||
|
||||
// Run the supplied code
|
||||
runner.run();
|
||||
|
@ -322,10 +311,9 @@ public abstract class CoreService extends Service {
|
|||
} finally {
|
||||
// Making absolutely sure stopSelf() will be called
|
||||
try {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "CoreService (" + className + ") completed " +
|
||||
"Runnable " + runner.hashCode() + " with startId " + startId);
|
||||
}
|
||||
Timber.d("CoreService (%s) completed Runnable %d with startId %d",
|
||||
className, runner.hashCode(), startId);
|
||||
|
||||
wakeLock.release();
|
||||
} finally {
|
||||
if (autoShutdown && startId != null) {
|
||||
|
@ -338,19 +326,15 @@ public abstract class CoreService extends Service {
|
|||
|
||||
// TODO: remove this. we never set mThreadPool to null
|
||||
if (mThreadPool == null) {
|
||||
Log.e(K9.LOG_TAG, "CoreService.execute (" + className + ") called with no thread " +
|
||||
"pool available; running Runnable " + runner.hashCode() +
|
||||
" in calling thread");
|
||||
Timber.e("CoreService.execute (%s) called with no thread pool available; " +
|
||||
"running Runnable %d in calling thread", className, runner.hashCode());
|
||||
|
||||
synchronized (this) {
|
||||
myRunner.run();
|
||||
serviceShutdownScheduled = startId != null;
|
||||
}
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "CoreService (" + className + ") queueing Runnable " +
|
||||
runner.hashCode() + " with startId " + startId);
|
||||
}
|
||||
Timber.d("CoreService (%s) queueing Runnable %d with startId %d", className, runner.hashCode(), startId);
|
||||
|
||||
try {
|
||||
mThreadPool.execute(myRunner);
|
||||
|
@ -362,8 +346,8 @@ public abstract class CoreService extends Service {
|
|||
throw e;
|
||||
}
|
||||
|
||||
Log.i(K9.LOG_TAG, "CoreService: " + className + " is shutting down, ignoring " +
|
||||
"rejected execution exception: " + e.getMessage());
|
||||
Timber.i("CoreService: %s is shutting down, ignoring rejected execution exception: %s",
|
||||
className, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,7 +375,7 @@ public abstract class CoreService extends Service {
|
|||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
Log.w(K9.LOG_TAG, "CoreService: " + className + ".onLowMemory() - Running low on memory");
|
||||
Timber.w("CoreService: %s.onLowMemory() - Running low on memory", className);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,9 +383,7 @@ public abstract class CoreService extends Service {
|
|||
*/
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "CoreService: " + className + ".onDestroy()");
|
||||
}
|
||||
Timber.i("CoreService: %s.onDestroy()", className);
|
||||
|
||||
// Shut down thread pool
|
||||
mShutdown = true;
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.content.Intent;
|
|||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -120,10 +120,7 @@ public class DatabaseUpgradeService extends Service {
|
|||
boolean success = mRunning.compareAndSet(false, true);
|
||||
if (success) {
|
||||
// The service wasn't running yet.
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "DatabaseUpgradeService started");
|
||||
}
|
||||
Timber.i("DatabaseUpgradeService started");
|
||||
|
||||
acquireWakelock();
|
||||
|
||||
|
@ -159,10 +156,7 @@ public class DatabaseUpgradeService extends Service {
|
|||
*/
|
||||
private void stopService() {
|
||||
stopSelf();
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "DatabaseUpgradeService stopped");
|
||||
}
|
||||
Timber.i("DatabaseUpgradeService stopped");
|
||||
|
||||
releaseWakelock();
|
||||
mRunning.set(false);
|
||||
|
@ -200,9 +194,9 @@ public class DatabaseUpgradeService extends Service {
|
|||
// Account.getLocalStore() is blocking and will upgrade the database if necessary
|
||||
account.getLocalStore();
|
||||
} catch (UnavailableStorageException e) {
|
||||
Log.e(K9.LOG_TAG, "Database unavailable");
|
||||
Timber.e("Database unavailable");
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while upgrading database", e);
|
||||
Timber.e(e, "Error while upgrading database");
|
||||
}
|
||||
|
||||
mProgress++;
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.ContentResolver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -20,6 +20,8 @@ import com.fsck.k9.mail.Pusher;
|
|||
import com.fsck.k9.preferences.Storage;
|
||||
import com.fsck.k9.preferences.StorageEditor;
|
||||
|
||||
import static java.lang.System.currentTimeMillis;
|
||||
|
||||
|
||||
public class MailService extends CoreService {
|
||||
private static final String ACTION_CHECK_MAIL = "com.fsck.k9.intent.action.MAIL_SERVICE_WAKEUP";
|
||||
|
@ -81,8 +83,7 @@ public class MailService extends CoreService {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: onCreate");
|
||||
Timber.v("***** MailService *****: onCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,40 +113,34 @@ public class MailService extends CoreService {
|
|||
syncNoConnectivity = !hasConnectivity;
|
||||
syncBlocked = !(doBackground && hasConnectivity);
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId
|
||||
+ "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
||||
Timber.i("MailService.onStart(%s, %d), hasConnectivity = %s, doBackground = %s",
|
||||
intent, startId, hasConnectivity, doBackground);
|
||||
|
||||
// MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||
if (ACTION_CHECK_MAIL.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "***** MailService *****: checking mail");
|
||||
Timber.i("***** MailService *****: checking mail");
|
||||
if (hasConnectivity && doBackground) {
|
||||
PollService.startService(this);
|
||||
}
|
||||
reschedulePollInBackground(hasConnectivity, doBackground, startId, false);
|
||||
} else if (ACTION_CANCEL.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: cancel");
|
||||
Timber.v("***** MailService *****: cancel");
|
||||
cancel();
|
||||
} else if (ACTION_RESET.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: reschedule");
|
||||
Timber.v("***** MailService *****: reschedule");
|
||||
rescheduleAllInBackground(hasConnectivity, doBackground, startId);
|
||||
} else if (ACTION_RESTART_PUSHERS.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: restarting pushers");
|
||||
Timber.v("***** MailService *****: restarting pushers");
|
||||
reschedulePushersInBackground(hasConnectivity, doBackground, startId);
|
||||
} else if (ACTION_RESCHEDULE_POLL.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: rescheduling poll");
|
||||
Timber.v("***** MailService *****: rescheduling poll");
|
||||
reschedulePollInBackground(hasConnectivity, doBackground, startId, true);
|
||||
} else if (ACTION_REFRESH_PUSHERS.equals(intent.getAction())) {
|
||||
refreshPushersInBackground(hasConnectivity, doBackground, startId);
|
||||
} else if (CONNECTIVITY_CHANGE.equals(intent.getAction())) {
|
||||
rescheduleAllInBackground(hasConnectivity, doBackground, startId);
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Got connectivity action with hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
||||
Timber.i("Got connectivity action with hasConnectivity = %s, doBackground = %s",
|
||||
hasConnectivity, doBackground);
|
||||
} else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction())) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
@ -154,16 +149,14 @@ public class MailService extends CoreService {
|
|||
MessagingController.getInstance(getApplication()).systemStatusChanged();
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "MailService.onStart took " + (System.currentTimeMillis() - startTime) + "ms");
|
||||
Timber.i("MailService.onStart took %d ms", currentTimeMillis() - startTime);
|
||||
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** MailService *****: onDestroy()");
|
||||
Timber.v("***** MailService *****: onDestroy()");
|
||||
super.onDestroy();
|
||||
// MessagingController.getInstance(getApplication()).removeListener(mListener);
|
||||
}
|
||||
|
@ -179,8 +172,8 @@ public class MailService extends CoreService {
|
|||
|
||||
public static void saveLastCheckEnd(Context context) {
|
||||
long lastCheckEnd = System.currentTimeMillis();
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Saving lastCheckEnd = " + new Date(lastCheckEnd));
|
||||
Timber.i("Saving lastCheckEnd = %tc", lastCheckEnd);
|
||||
|
||||
Preferences prefs = Preferences.getPreferences(context);
|
||||
Storage storage = prefs.getStorage();
|
||||
StorageEditor editor = storage.edit();
|
||||
|
@ -237,10 +230,7 @@ public class MailService extends CoreService {
|
|||
boolean considerLastCheckEnd) {
|
||||
|
||||
if (!(hasConnectivity && doBackground)) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "No connectivity, canceling check for " +
|
||||
getApplication().getPackageName());
|
||||
}
|
||||
Timber.i("No connectivity, canceling check for %s", getApplication().getPackageName());
|
||||
|
||||
nextCheck = -1;
|
||||
cancel();
|
||||
|
@ -253,11 +243,12 @@ public class MailService extends CoreService {
|
|||
int previousInterval = storage.getInt(PREVIOUS_INTERVAL, -1);
|
||||
long lastCheckEnd = storage.getLong(LAST_CHECK_END, -1);
|
||||
|
||||
if (lastCheckEnd > System.currentTimeMillis()) {
|
||||
Log.i(K9.LOG_TAG, "The database claims that the last time mail was checked was in " +
|
||||
"the future (" + lastCheckEnd + "). To try to get things back to normal, " +
|
||||
"the last check time has been reset to: " + System.currentTimeMillis());
|
||||
lastCheckEnd = System.currentTimeMillis();
|
||||
long now = System.currentTimeMillis();
|
||||
if (lastCheckEnd > now) {
|
||||
Timber.i("The database claims that the last time mail was checked was in the future (%tc). To try to get " +
|
||||
"things back to normal, the last check time has been reset to: %tc", lastCheckEnd, now);
|
||||
|
||||
lastCheckEnd = now;
|
||||
}
|
||||
|
||||
int shortestInterval = -1;
|
||||
|
@ -274,10 +265,7 @@ public class MailService extends CoreService {
|
|||
editor.commit();
|
||||
|
||||
if (shortestInterval == -1) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "No next check scheduled for package " +
|
||||
getApplication().getPackageName());
|
||||
}
|
||||
Timber.i("No next check scheduled for package %s", getApplication().getPackageName());
|
||||
|
||||
nextCheck = -1;
|
||||
pollingRequested = false;
|
||||
|
@ -288,25 +276,20 @@ public class MailService extends CoreService {
|
|||
!considerLastCheckEnd ? System.currentTimeMillis() : lastCheckEnd);
|
||||
long nextTime = base + delay;
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "previousInterval = " + previousInterval +
|
||||
", shortestInterval = " + shortestInterval +
|
||||
", lastCheckEnd = " + new Date(lastCheckEnd) +
|
||||
", considerLastCheckEnd = " + considerLastCheckEnd);
|
||||
}
|
||||
Timber.i("previousInterval = %d, shortestInterval = %d, lastCheckEnd = %tc, considerLastCheckEnd = %tc",
|
||||
previousInterval,
|
||||
shortestInterval,
|
||||
lastCheckEnd,
|
||||
considerLastCheckEnd);
|
||||
|
||||
nextCheck = nextTime;
|
||||
pollingRequested = true;
|
||||
|
||||
try {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "Next check for package " +
|
||||
getApplication().getPackageName() + " scheduled for " +
|
||||
new Date(nextTime));
|
||||
}
|
||||
Timber.i("Next check for package %s scheduled for %tc", getApplication().getPackageName(), nextTime);
|
||||
} catch (Exception e) {
|
||||
// I once got a NullPointerException deep in new Date();
|
||||
Log.e(K9.LOG_TAG, "Exception while logging", e);
|
||||
Timber.e(e, "Exception while logging");
|
||||
}
|
||||
|
||||
Intent i = new Intent(this, MailService.class);
|
||||
|
@ -341,17 +324,12 @@ public class MailService extends CoreService {
|
|||
}
|
||||
|
||||
private void reschedulePushers(boolean hasConnectivity, boolean doBackground) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "Rescheduling pushers");
|
||||
}
|
||||
Timber.i("Rescheduling pushers");
|
||||
|
||||
stopPushers();
|
||||
|
||||
if (!(hasConnectivity && doBackground)) {
|
||||
if (K9.DEBUG) {
|
||||
Log.i(K9.LOG_TAG, "Not scheduling pushers: connectivity? " + hasConnectivity +
|
||||
" -- doBackground? " + doBackground);
|
||||
}
|
||||
Timber.i("Not scheduling pushers: connectivity? %s -- doBackground? %s", hasConnectivity, doBackground);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -363,8 +341,8 @@ public class MailService extends CoreService {
|
|||
private void setupPushers() {
|
||||
boolean pushing = false;
|
||||
for (Account account : Preferences.getPreferences(MailService.this).getAccounts()) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Setting up pushers for account " + account.getDescription());
|
||||
Timber.i("Setting up pushers for account %s", account.getDescription());
|
||||
|
||||
if (account.isEnabled() && account.isAvailable(getApplicationContext())) {
|
||||
pushing |= MessagingController.getInstance(getApplication()).setupPushing(account);
|
||||
} else {
|
||||
|
@ -380,36 +358,39 @@ public class MailService extends CoreService {
|
|||
private void refreshPushers() {
|
||||
try {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Refreshing pushers");
|
||||
Timber.i("Refreshing pushers");
|
||||
|
||||
Collection<Pusher> pushers = MessagingController.getInstance(getApplication()).getPushers();
|
||||
for (Pusher pusher : pushers) {
|
||||
long lastRefresh = pusher.getLastRefresh();
|
||||
int refreshInterval = pusher.getRefreshInterval();
|
||||
long sinceLast = nowTime - lastRefresh;
|
||||
if (sinceLast + 10000 > refreshInterval) { // Add 10 seconds to keep pushers in sync, avoid drift
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "PUSHREFRESH: refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
||||
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
||||
}
|
||||
Timber.d("PUSHREFRESH: refreshing lastRefresh = %d, interval = %d, nowTime = %d, " +
|
||||
"sinceLast = %d",
|
||||
lastRefresh,
|
||||
refreshInterval,
|
||||
nowTime,
|
||||
sinceLast);
|
||||
|
||||
pusher.refresh();
|
||||
pusher.setLastRefresh(nowTime);
|
||||
} else {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "PUSHREFRESH: NOT refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
||||
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
||||
}
|
||||
Timber.d("PUSHREFRESH: NOT refreshing lastRefresh = %d, interval = %d, nowTime = %d, " +
|
||||
"sinceLast = %d",
|
||||
lastRefresh,
|
||||
refreshInterval,
|
||||
nowTime,
|
||||
sinceLast);
|
||||
}
|
||||
}
|
||||
// Whenever we refresh our pushers, send any unsent messages
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "PUSHREFRESH: trying to send mail in all folders!");
|
||||
}
|
||||
Timber.d("PUSHREFRESH: trying to send mail in all folders!");
|
||||
|
||||
MessagingController.getInstance(getApplication()).sendPendingMessages(null);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while refreshing pushers", e);
|
||||
Timber.e(e, "Exception while refreshing pushers");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,13 +404,13 @@ public class MailService extends CoreService {
|
|||
minInterval = interval;
|
||||
}
|
||||
}
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "Pusher refresh interval = " + minInterval);
|
||||
}
|
||||
|
||||
Timber.v("Pusher refresh interval = %d", minInterval);
|
||||
|
||||
if (minInterval > 0) {
|
||||
long nextTime = System.currentTimeMillis() + minInterval;
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime));
|
||||
Timber.d("Next pusher refresh scheduled for %tc", nextTime);
|
||||
|
||||
Intent i = new Intent(this, MailService.class);
|
||||
i.setAction(ACTION_REFRESH_PUSHERS);
|
||||
BootReceiver.scheduleIntent(MailService.this, nextTime, i);
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.*;
|
||||
import com.fsck.k9.controller.MessagingController;
|
||||
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||
|
@ -45,27 +45,23 @@ public class PollService extends CoreService {
|
|||
@Override
|
||||
public int startService(Intent intent, int startId) {
|
||||
if (START_SERVICE.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "PollService started with startId = " + startId);
|
||||
Timber.i("PollService started with startId = %d", startId);
|
||||
|
||||
MessagingController controller = MessagingController.getInstance(getApplication());
|
||||
Listener listener = (Listener)controller.getCheckMailListener();
|
||||
if (listener == null) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "***** PollService *****: starting new check");
|
||||
Timber.i("***** PollService *****: starting new check");
|
||||
mListener.setStartId(startId);
|
||||
mListener.wakeLockAcquire();
|
||||
controller.setCheckMailListener(mListener);
|
||||
controller.checkMail(this, null, false, false, mListener);
|
||||
} else {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "***** PollService *****: renewing WakeLock");
|
||||
Timber.i("***** PollService *****: renewing WakeLock");
|
||||
listener.setStartId(startId);
|
||||
listener.wakeLockAcquire();
|
||||
}
|
||||
} else if (STOP_SERVICE.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "PollService stopping");
|
||||
Timber.i("PollService stopping");
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
|
@ -131,17 +127,14 @@ public class PollService extends CoreService {
|
|||
|
||||
MailService.actionReschedulePoll(PollService.this, null);
|
||||
wakeLockRelease();
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "PollService stopping with startId = " + startId);
|
||||
|
||||
Timber.i("PollService stopping with startId = %d", startId);
|
||||
stopSelf(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMailFinished(Context context, Account account) {
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "***** PollService *****: checkMailFinished");
|
||||
Timber.v("***** PollService *****: checkMailFinished");
|
||||
release();
|
||||
}
|
||||
public int getStartId() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.service;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
public class PushService extends CoreService {
|
||||
|
@ -30,11 +30,9 @@ public class PushService extends CoreService {
|
|||
public int startService(Intent intent, int startId) {
|
||||
int startFlag = START_STICKY;
|
||||
if (START_SERVICE.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "PushService started with startId = " + startId);
|
||||
Timber.i("PushService started with startId = %d", startId);
|
||||
} else if (STOP_SERVICE.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "PushService stopping with startId = " + startId);
|
||||
Timber.i("PushService stopping with startId = %d", startId);
|
||||
stopSelf(startId);
|
||||
startFlag = START_NOT_STICKY;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.service;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -18,8 +18,7 @@ import static com.fsck.k9.remotecontrol.K9RemoteControl.*;
|
|||
public class RemoteControlReceiver extends CoreReceiver {
|
||||
@Override
|
||||
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlReceiver.onReceive" + intent);
|
||||
Timber.i("RemoteControlReceiver.onReceive %s", intent);
|
||||
|
||||
if (K9RemoteControl.K9_SET.equals(intent.getAction())) {
|
||||
RemoteControlService.set(context, intent, tmpWakeLockId);
|
||||
|
@ -41,7 +40,7 @@ public class RemoteControlReceiver extends CoreReceiver {
|
|||
bundle.putStringArray(K9_ACCOUNT_UUIDS, uuids);
|
||||
bundle.putStringArray(K9_ACCOUNT_DESCRIPTIONS, descriptions);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not handle K9_RESPONSE_INTENT", e);
|
||||
Timber.e(e, "Could not handle K9_RESPONSE_INTENT");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import static com.fsck.k9.remotecontrol.K9RemoteControl.*;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -37,22 +37,18 @@ public class RemoteControlService extends CoreService {
|
|||
|
||||
@Override
|
||||
public int startService(final Intent intent, final int startId) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService started with startId = " + startId);
|
||||
Timber.i("RemoteControlService started with startId = %d", startId);
|
||||
final Preferences preferences = Preferences.getPreferences(this);
|
||||
|
||||
if (RESCHEDULE_ACTION.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService requesting MailService poll reschedule");
|
||||
Timber.i("RemoteControlService requesting MailService poll reschedule");
|
||||
MailService.actionReschedulePoll(this, null);
|
||||
}
|
||||
if (PUSH_RESTART_ACTION.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService requesting MailService push restart");
|
||||
Timber.i("RemoteControlService requesting MailService push restart");
|
||||
MailService.actionRestartPushers(this, null);
|
||||
} else if (RemoteControlService.SET_ACTION.equals(intent.getAction())) {
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService got request to change settings");
|
||||
Timber.i("RemoteControlService got request to change settings");
|
||||
execute(getApplication(), new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
@ -60,20 +56,20 @@ public class RemoteControlService extends CoreService {
|
|||
boolean needsPushRestart = false;
|
||||
String uuid = intent.getStringExtra(K9_ACCOUNT_UUID);
|
||||
boolean allAccounts = intent.getBooleanExtra(K9_ALL_ACCOUNTS, false);
|
||||
if (K9.DEBUG) {
|
||||
if (allAccounts) {
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService changing settings for all accounts");
|
||||
} else {
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService changing settings for account with UUID " + uuid);
|
||||
}
|
||||
|
||||
if (allAccounts) {
|
||||
Timber.i("RemoteControlService changing settings for all accounts");
|
||||
} else {
|
||||
Timber.i("RemoteControlService changing settings for account with UUID %s", uuid);
|
||||
}
|
||||
|
||||
List<Account> accounts = preferences.getAccounts();
|
||||
for (Account account : accounts) {
|
||||
//warning: account may not be isAvailable()
|
||||
if (allAccounts || account.getUuid().equals(uuid)) {
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService changing settings for account " + account.getDescription());
|
||||
Timber.i("RemoteControlService changing settings for account %s",
|
||||
account.getDescription());
|
||||
|
||||
String notificationEnabled = intent.getStringExtra(K9_NOTIFICATION_ENABLED);
|
||||
String ringEnabled = intent.getStringExtra(K9_RING_ENABLED);
|
||||
|
@ -109,8 +105,8 @@ public class RemoteControlService extends CoreService {
|
|||
account.save(Preferences.getPreferences(RemoteControlService.this));
|
||||
}
|
||||
}
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "RemoteControlService changing global settings");
|
||||
|
||||
Timber.i("RemoteControlService changing global settings");
|
||||
|
||||
String backgroundOps = intent.getStringExtra(K9_BACKGROUND_OPERATIONS);
|
||||
if (K9RemoteControl.K9_BACKGROUND_OPERATIONS_ALWAYS.equals(backgroundOps)
|
||||
|
@ -146,7 +142,7 @@ public class RemoteControlService extends CoreService {
|
|||
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not handle K9_SET", e);
|
||||
Timber.e(e, "Could not handle K9_SET");
|
||||
Toast toast = Toast.makeText(RemoteControlService.this, e.getMessage(), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.service;
|
|||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ShutdownReceiver extends BroadcastReceiver {
|
|||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
|
||||
Log.i(K9.LOG_TAG, "System is shutting down, releasing resources");
|
||||
Timber.i("System is shutting down, releasing resources");
|
||||
|
||||
// prevent any scheduled intent from waking up K-9
|
||||
BootReceiver.purgeSchedule(context);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.fsck.k9.service;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
||||
|
||||
|
@ -11,6 +11,9 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.lang.Thread.currentThread;
|
||||
|
||||
|
||||
public class SleepService extends CoreService {
|
||||
|
||||
private static String ALARM_FIRED = "com.fsck.k9.service.SleepService.ALARM_FIRED";
|
||||
|
@ -23,8 +26,8 @@ public class SleepService extends CoreService {
|
|||
|
||||
public static void sleep(Context context, long sleepTime, TracingWakeLock wakeLock, long wakeLockTimeout) {
|
||||
Integer id = latchId.getAndIncrement();
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService Preparing CountDownLatch with id = " + id + ", thread " + Thread.currentThread().getName());
|
||||
Timber.d("SleepService Preparing CountDownLatch with id = %d, thread %s", id, currentThread().getName());
|
||||
|
||||
SleepDatum sleepDatum = new SleepDatum();
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
sleepDatum.latch = latch;
|
||||
|
@ -45,23 +48,26 @@ public class SleepService extends CoreService {
|
|||
try {
|
||||
boolean countedDown = latch.await(sleepTime, TimeUnit.MILLISECONDS);
|
||||
if (!countedDown) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
|
||||
Timber.d("SleepService latch timed out for id = %d, thread %s", id, currentThread().getName());
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e(K9.LOG_TAG, "SleepService Interrupted while awaiting latch", ie);
|
||||
Timber.e(ie, "SleepService Interrupted while awaiting latch");
|
||||
}
|
||||
SleepDatum releaseDatum = sleepData.remove(id);
|
||||
if (releaseDatum == null) {
|
||||
try {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService waiting for reacquireLatch for id = " + id + ", thread " + Thread.currentThread().getName());
|
||||
Timber.d("SleepService waiting for reacquireLatch for id = %d, thread %s",
|
||||
id, currentThread().getName());
|
||||
|
||||
if (!sleepDatum.reacquireLatch.await(5000, TimeUnit.MILLISECONDS)) {
|
||||
Log.w(K9.LOG_TAG, "SleepService reacquireLatch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
|
||||
} else if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService reacquireLatch finished for id = " + id + ", thread " + Thread.currentThread().getName());
|
||||
Timber.w("SleepService reacquireLatch timed out for id = %d, thread %s",
|
||||
id, currentThread().getName());
|
||||
} else {
|
||||
Timber.d("SleepService reacquireLatch finished for id = %d, thread %s",
|
||||
id, currentThread().getName());
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e(K9.LOG_TAG, "SleepService Interrupted while awaiting reacquireLatch", ie);
|
||||
Timber.e(ie, "SleepService Interrupted while awaiting reacquireLatch");
|
||||
}
|
||||
} else {
|
||||
reacquireWakeLock(releaseDatum);
|
||||
|
@ -71,10 +77,9 @@ public class SleepService extends CoreService {
|
|||
long actualSleep = endTime - startTime;
|
||||
|
||||
if (actualSleep < sleepTime) {
|
||||
Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep);
|
||||
Timber.w("SleepService sleep time too short: requested was %d, actual was %d", sleepTime, actualSleep);
|
||||
} else {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep);
|
||||
Timber.d("SleepService requested sleep time was %d, actual was %d", sleepTime, actualSleep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,17 +89,15 @@ public class SleepService extends CoreService {
|
|||
if (sleepDatum != null) {
|
||||
CountDownLatch latch = sleepDatum.latch;
|
||||
if (latch == null) {
|
||||
Log.e(K9.LOG_TAG, "SleepService No CountDownLatch available with id = " + id);
|
||||
Timber.e("SleepService No CountDownLatch available with id = %s", id);
|
||||
} else {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService Counting down CountDownLatch with id = " + id);
|
||||
Timber.d("SleepService Counting down CountDownLatch with id = %d", id);
|
||||
latch.countDown();
|
||||
}
|
||||
reacquireWakeLock(sleepDatum);
|
||||
sleepDatum.reacquireLatch.countDown();
|
||||
} else {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService Sleep for id " + id + " already finished");
|
||||
Timber.d("SleepService Sleep for id %d already finished", id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +107,7 @@ public class SleepService extends CoreService {
|
|||
if (wakeLock != null) {
|
||||
synchronized (wakeLock) {
|
||||
long timeout = sleepDatum.timeout;
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "SleepService Acquiring wakeLock for " + timeout + "ms");
|
||||
Timber.d("SleepService Acquiring wakeLock for %d ms", timeout);
|
||||
wakeLock.acquire(timeout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mailstore.StorageManager;
|
||||
|
@ -28,9 +28,7 @@ public class StorageGoneReceiver extends BroadcastReceiver {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "StorageGoneReceiver: " + intent.toString());
|
||||
}
|
||||
Timber.v("StorageGoneReceiver: %s", intent);
|
||||
|
||||
final String path = uri.getPath();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mailstore.StorageManager;
|
||||
|
@ -23,9 +23,7 @@ public class StorageReceiver extends BroadcastReceiver {
|
|||
return;
|
||||
}
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.v(K9.LOG_TAG, "StorageReceiver: " + intent.toString());
|
||||
}
|
||||
Timber.v("StorageReceiver: %s", intent);
|
||||
|
||||
final String path = uri.getPath();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Account.MessageFormat;
|
||||
|
@ -190,7 +190,7 @@ public class QuotedMessagePresenter {
|
|||
try {
|
||||
cursorPosition = Integer.parseInt(k9identity.get(IdentityField.CURSOR_POSITION));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not parse cursor position for MessageCompose; continuing.", e);
|
||||
Timber.e(e, "Could not parse cursor position for MessageCompose; continuing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,14 +250,13 @@ public class QuotedMessagePresenter {
|
|||
if (part != null) { // Shouldn't happen if we were the one who saved it.
|
||||
quotedTextFormat = SimpleMessageFormat.HTML;
|
||||
String text = MessageExtractor.getTextFromPart(part);
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Loading message with offset " + bodyOffset + ", length " + bodyLength +
|
||||
". Text length is " + text.length() + ".");
|
||||
}
|
||||
|
||||
Timber.d("Loading message with offset %d, length %d. Text length is %d.",
|
||||
bodyOffset, bodyLength, text.length());
|
||||
|
||||
if (bodyOffset + bodyLength > text.length()) {
|
||||
// The draft was edited outside of K-9 Mail?
|
||||
Log.d(K9.LOG_TAG, "The identity field from the draft contains an invalid LENGTH/OFFSET");
|
||||
Timber.d("The identity field from the draft contains an invalid LENGTH/OFFSET");
|
||||
bodyOffset = 0;
|
||||
bodyLength = 0;
|
||||
}
|
||||
|
@ -291,14 +290,14 @@ public class QuotedMessagePresenter {
|
|||
quotedTextFormat = SimpleMessageFormat.TEXT;
|
||||
processSourceMessageText(messageViewInfo.rootPart, bodyOffset, bodyLength, true);
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "Unhandled message format.");
|
||||
Timber.e("Unhandled message format.");
|
||||
}
|
||||
|
||||
// Set the cursor position if we have it.
|
||||
try {
|
||||
view.setMessageContentCursorPosition(cursorPosition);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not set cursor position in MessageCompose; ignoring.", e);
|
||||
Timber.e(e, "Could not set cursor position in MessageCompose; ignoring.");
|
||||
}
|
||||
|
||||
showOrHideQuotedText(quotedMode);
|
||||
|
@ -319,10 +318,9 @@ public class QuotedMessagePresenter {
|
|||
}
|
||||
|
||||
String messageText = MessageExtractor.getTextFromPart(textPart);
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Loading message with offset " + bodyOffset + ", length " + bodyLength +
|
||||
". Text length is " + messageText.length() + ".");
|
||||
}
|
||||
|
||||
Timber.d("Loading message with offset %d, length %d. Text length is %d.",
|
||||
bodyOffset, bodyLength, messageText.length());
|
||||
|
||||
// If we had a body length (and it was valid), separate the composition from the quoted text
|
||||
// and put them in their respective places in the UI.
|
||||
|
@ -348,7 +346,7 @@ public class QuotedMessagePresenter {
|
|||
messageText = messageText.substring(bodyOffset, bodyOffset + bodyLength);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// Invalid bodyOffset or bodyLength. The draft was edited outside of K-9 Mail?
|
||||
Log.d(K9.LOG_TAG, "The identity field from the draft contains an invalid bodyOffset/bodyLength");
|
||||
Timber.d("The identity field from the draft contains an invalid bodyOffset/bodyLength");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import android.content.Intent;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.crypto.MessageDecryptVerifier;
|
||||
|
@ -226,7 +226,7 @@ public class MessageCryptoHelper {
|
|||
@Override
|
||||
public void onError(Exception e) {
|
||||
// TODO actually handle (hand to ui, offer retry?)
|
||||
Log.e(K9.LOG_TAG, "Couldn't connect to OpenPgpService", e);
|
||||
Timber.e(e, "Couldn't connect to OpenPgpService");
|
||||
}
|
||||
});
|
||||
openPgpServiceConnection.bindToService();
|
||||
|
@ -276,9 +276,9 @@ public class MessageCryptoHelper {
|
|||
|
||||
throw new IllegalStateException("Unknown crypto part type: " + cryptoPartType);
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "IOException", e);
|
||||
Timber.e(e, "IOException");
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "MessagingException", e);
|
||||
Timber.e(e, "MessagingException");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class MessageCryptoHelper {
|
|||
new IOpenPgpSinkResultCallback<MimeBodyPart>() {
|
||||
@Override
|
||||
public void onProgress(int current, int max) {
|
||||
Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max);
|
||||
Timber.d("received progress status: %d / %d", current, max);
|
||||
callbackProgress(current, max);
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ public class MessageCryptoHelper {
|
|||
TextBody body = new TextBody(new String(decryptedByteOutputStream.toByteArray()));
|
||||
return new MimeBodyPart(body, "text/plain");
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "MessagingException", e);
|
||||
Timber.e(e, "MessagingException");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -344,7 +344,7 @@ public class MessageCryptoHelper {
|
|||
|
||||
@Override
|
||||
public void onProgress(int current, int max) {
|
||||
Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max);
|
||||
Timber.d("received progress status: %d / %d", current, max);
|
||||
callbackProgress(current, max);
|
||||
}
|
||||
});
|
||||
|
@ -366,7 +366,7 @@ public class MessageCryptoHelper {
|
|||
|
||||
@Override
|
||||
public void onProgress(int current, int max) {
|
||||
Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max);
|
||||
Timber.d("received progress status: %d / %d", current, max);
|
||||
callbackProgress(current, max);
|
||||
}
|
||||
});
|
||||
|
@ -379,10 +379,10 @@ public class MessageCryptoHelper {
|
|||
try {
|
||||
Multipart multipartSignedMultipart = (Multipart) signedPart.getBody();
|
||||
BodyPart signatureBodyPart = multipartSignedMultipart.getBodyPart(0);
|
||||
Log.d(K9.LOG_TAG, "signed data type: " + signatureBodyPart.getMimeType());
|
||||
Timber.d("signed data type: %s", signatureBodyPart.getMimeType());
|
||||
signatureBodyPart.writeTo(os);
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Exception while writing message to crypto provider", e);
|
||||
Timber.e(e, "Exception while writing message to crypto provider");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -431,7 +431,7 @@ public class MessageCryptoHelper {
|
|||
throw new IllegalStateException("part to stream must be encrypted or inline!");
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "MessagingException while writing message to crypto provider", e);
|
||||
Timber.e(e, "MessagingException while writing message to crypto provider");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -447,7 +447,7 @@ public class MessageCryptoHelper {
|
|||
DecryptedFileProvider.getFileFactory(context);
|
||||
return MimePartStreamParser.parse(fileFactory, is);
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "Something went wrong while parsing the decrypted MIME part", e);
|
||||
Timber.e(e, "Something went wrong while parsing the decrypted MIME part");
|
||||
//TODO: pass error to main thread and display error message to user
|
||||
return null;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ public class MessageCryptoHelper {
|
|||
|
||||
private void onCryptoOperationReturned(MimeBodyPart decryptedPart) {
|
||||
if (currentCryptoResult == null) {
|
||||
Log.e(K9.LOG_TAG, "Internal error: we should have a result here!");
|
||||
Timber.e("Internal error: we should have a result here!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -470,13 +470,11 @@ public class MessageCryptoHelper {
|
|||
|
||||
private void handleCryptoOperationResult(MimeBodyPart outputPart) {
|
||||
int resultCode = currentCryptoResult.getIntExtra(OpenPgpApi.RESULT_CODE, INVALID_OPENPGP_RESULT_CODE);
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "OpenPGP API decryptVerify result code: " + resultCode);
|
||||
}
|
||||
Timber.d("OpenPGP API decryptVerify result code: %d", resultCode);
|
||||
|
||||
switch (resultCode) {
|
||||
case INVALID_OPENPGP_RESULT_CODE: {
|
||||
Log.e(K9.LOG_TAG, "Internal error: no result code!");
|
||||
Timber.e("Internal error: no result code!");
|
||||
break;
|
||||
}
|
||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
|
||||
|
@ -505,9 +503,7 @@ public class MessageCryptoHelper {
|
|||
|
||||
private void handleCryptoOperationError() {
|
||||
OpenPgpError error = currentCryptoResult.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
|
||||
if (K9.DEBUG) {
|
||||
Log.w(K9.LOG_TAG, "OpenPGP API error: " + error.getMessage());
|
||||
}
|
||||
Timber.w("OpenPGP API error: %s", error.getMessage());
|
||||
|
||||
onCryptoOperationFailed(error);
|
||||
}
|
||||
|
@ -596,7 +592,7 @@ public class MessageCryptoHelper {
|
|||
partsToDecryptOrVerify.removeFirst();
|
||||
currentCryptoPart = null;
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "Got to onCryptoFinished() with no part in processing!", new Throwable());
|
||||
Timber.e(new Throwable(), "Got to onCryptoFinished() with no part in processing!");
|
||||
}
|
||||
decryptOrVerifyNextPart();
|
||||
}
|
||||
|
@ -634,7 +630,7 @@ public class MessageCryptoHelper {
|
|||
|
||||
boolean hasCachedResult = queuedResult != null || queuedPendingIntent != null;
|
||||
if (hasCachedResult) {
|
||||
Log.d(K9.LOG_TAG, "Returning cached result or pending intent to reattached callback");
|
||||
Timber.d("Returning cached result or pending intent to reattached callback");
|
||||
deliverResult();
|
||||
}
|
||||
}
|
||||
|
@ -673,7 +669,7 @@ public class MessageCryptoHelper {
|
|||
}
|
||||
|
||||
if (callback == null) {
|
||||
Log.d(K9.LOG_TAG, "Keeping crypto helper result in queue for later delivery");
|
||||
Timber.d("Keeping crypto helper result in queue for later delivery");
|
||||
return;
|
||||
}
|
||||
if (queuedResult != null) {
|
||||
|
@ -721,12 +717,12 @@ public class MessageCryptoHelper {
|
|||
String clearsignedText = MessageExtractor.getTextFromPart(part);
|
||||
String replacementText = OpenPgpUtils.extractClearsignedMessage(clearsignedText);
|
||||
if (replacementText == null) {
|
||||
Log.e(K9.LOG_TAG, "failed to extract clearsigned text for replacement part");
|
||||
Timber.e("failed to extract clearsigned text for replacement part");
|
||||
return NO_REPLACEMENT_PART;
|
||||
}
|
||||
return new MimeBodyPart(new TextBody(replacementText), "text/plain");
|
||||
} catch (MessagingException e) {
|
||||
Log.e(K9.LOG_TAG, "failed to create clearsigned text replacement part", e);
|
||||
Timber.e(e, "failed to create clearsigned text replacement part");
|
||||
return NO_REPLACEMENT_PART;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.content.AsyncTaskLoader;
|
|||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Message;
|
||||
|
@ -54,7 +54,7 @@ public class LocalMessageExtractorLoader extends AsyncTaskLoader<MessageViewInfo
|
|||
try {
|
||||
return messageViewInfoExtractor.extractMessageForView(message, annotations);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while decoding message", e);
|
||||
Timber.e(e, "Error while decoding message");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.ui.message;
|
|||
|
||||
import android.content.AsyncTaskLoader;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -49,7 +49,7 @@ public class LocalMessageLoader extends AsyncTaskLoader<LocalMessage> {
|
|||
try {
|
||||
return loadMessageFromDatabase();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while loading message from database", e);
|
||||
Timber.e(e, "Error while loading message from database");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.net.Uri;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
|
@ -181,7 +181,7 @@ public class AttachmentController {
|
|||
try {
|
||||
intentDataUri = AttachmentTempFileProvider.createTempUriForContentUri(context, attachment.internalUri);
|
||||
} catch (IOException e) {
|
||||
Log.e(K9.LOG_TAG, "Error creating temp file for attachment!", e);
|
||||
Timber.e(e, "Error creating temp file for attachment!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -211,9 +211,7 @@ public class AttachmentController {
|
|||
writeAttachmentToStorage(tempFile);
|
||||
viewIntent = createViewIntentForFileUri(resolvedIntentInfo.getMimeType(), Uri.fromFile(tempFile));
|
||||
} catch (IOException e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(K9.LOG_TAG, "Error while saving attachment to use file:// URI with ACTION_VIEW Intent", e);
|
||||
}
|
||||
Timber.e(e, "Error while saving attachment to use file:// URI with ACTION_VIEW Intent");
|
||||
viewIntent = createViewIntentForAttachmentProviderUri(intentDataUri, MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE);
|
||||
}
|
||||
} else {
|
||||
|
@ -332,7 +330,7 @@ public class AttachmentController {
|
|||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(K9.LOG_TAG, "Could not display attachment of type " + attachment.mimeType, e);
|
||||
Timber.e(e, "Could not display attachment of type %s", attachment.mimeType);
|
||||
|
||||
String message = context.getString(R.string.message_view_no_viewer, attachment.mimeType);
|
||||
displayMessageToUser(message);
|
||||
|
@ -353,9 +351,7 @@ public class AttachmentController {
|
|||
File directory = params[0];
|
||||
return saveAttachmentWithUniqueFileName(directory);
|
||||
} catch (IOException e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(K9.LOG_TAG, "Error saving attachment", e);
|
||||
}
|
||||
Timber.e(e, "Error saving attachment");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -57,7 +57,7 @@ class DownloadImageTask extends AsyncTask<String, Void, String> {
|
|||
|
||||
return fileName;
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while downloading image", e);
|
||||
Timber.e(e, "Error while downloading image");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import android.os.Bundle;
|
|||
import android.os.Parcelable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
|
@ -200,7 +200,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
|
|||
pendingIntent.getIntentSender(), REQUEST_CODE_UNKNOWN_KEY, null, 0, 0, 0);
|
||||
}
|
||||
} catch (IntentSender.SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
Timber.e(e, "SendIntentException");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
|
|||
pendingIntent.getIntentSender(), null, null, 0, 0, 0);
|
||||
}
|
||||
} catch (IntentSender.SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
Timber.e(e, "SendIntentException");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -208,9 +208,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
|
||||
private void displayMessage(MessageReference messageReference) {
|
||||
mMessageReference = messageReference;
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference);
|
||||
}
|
||||
Timber.d("MessageView displaying message %s", mMessageReference);
|
||||
|
||||
mAccount = Preferences.getPreferences(getApplicationContext()).getAccount(mMessageReference.getAccountUuid());
|
||||
messageLoaderHelper.asyncStartOrResumeLoadingMessage(messageReference, null);
|
||||
|
@ -789,7 +787,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
getActivity().startIntentSenderForResult(
|
||||
si, requestCode, fillIntent, flagsMask, flagValues, extraFlags);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "Irrecoverable error calling PendingIntent!", e);
|
||||
Timber.e(e, "Irrecoverable error calling PendingIntent!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.content.Context;
|
|||
import android.security.KeyChain;
|
||||
import android.security.KeyChainAliasCallback;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
@ -39,7 +39,7 @@ public class ClientCertificateSpinner extends LinearLayout {
|
|||
if (context instanceof Activity) {
|
||||
mActivity = (Activity) context;
|
||||
} else {
|
||||
Log.e(K9.LOG_TAG, "ClientCertificateSpinner init failed! Please inflate with Activity!");
|
||||
Timber.e("ClientCertificateSpinner init failed! Please inflate with Activity!");
|
||||
}
|
||||
|
||||
setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
@ -102,8 +102,7 @@ public class ClientCertificateSpinner extends LinearLayout {
|
|||
KeyChain.choosePrivateKeyAlias(mActivity, new KeyChainAliasCallback() {
|
||||
@Override
|
||||
public void alias(String alias) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "User has selected client certificate alias: " + alias);
|
||||
Timber.d("User has selected client certificate alias: %s", alias);
|
||||
|
||||
setAlias(alias);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import android.os.Build.VERSION_CODES;
|
|||
import android.provider.Browser;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebView;
|
||||
|
@ -111,7 +111,7 @@ abstract class K9WebViewClient extends WebViewClient {
|
|||
|
||||
return new WebResourceResponse(mimeType, null, inputStream);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while intercepting URI: " + uri, e);
|
||||
Timber.e(e, "Error while intercepting URI: %s", uri);
|
||||
return RESULT_DUMMY_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import android.text.TextUtils;
|
|||
import android.text.format.DateUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -188,7 +188,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
final Address senderEmail = mMessage.getFrom()[0];
|
||||
mContacts.createContact(senderEmail);
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Couldn't create contact", e);
|
||||
Timber.e(e, "Couldn't create contact");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.content.pm.PackageManager;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import timber.log.Timber;
|
||||
import android.view.KeyEvent;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
|
@ -146,7 +146,7 @@ public class MessageWebView extends RigidWebView {
|
|||
shiftPressEvent.dispatch(this, null, null);
|
||||
Toast.makeText(getContext() , R.string.select_text_now, Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Exception in emulateShiftHeld()", e);
|
||||
Timber.e(e, "Exception in emulateShiftHeld()");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue