Use Timber instead of Android.Log

This commit is contained in:
Vincent Breitmoser 2018-01-20 02:12:43 +01:00
parent 73b65bf50b
commit 22c65f2ab8
161 changed files with 782 additions and 947 deletions

View file

@ -88,6 +88,8 @@ dependencies {
exclude module: 'recyclerview-v7'
}
compile "com.jakewharton.timber:timber:4.5.1"
compile 'org.glassfish:javax.annotation:10.0-b28'
provided "com.google.auto.value:auto-value:1.4.1"
apt "com.google.auto.value:auto-value:1.4.1"

View file

@ -16,12 +16,14 @@
package android.support.v4.widget;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@ -37,7 +39,6 @@ import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.FocusFinder;
import android.view.KeyEvent;
@ -49,11 +50,11 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.ScrollView;
import java.util.ArrayList;
import timber.log.Timber;
/**
* Workaround for bug in support lib. From https://code.google.com/p/android/issues/detail?id=177729
@ -444,7 +445,7 @@ public class FlingNestedScrollView extends FrameLayout implements NestedScrollin
if(y != -1) {
int pointerIndex = MotionEventCompat.findPointerIndex(ev, y);
if(pointerIndex == -1) {
Log.e("FlingNestedScrollView", "Invalid pointerId=" + y + " in onInterceptTouchEvent");
Timber.e("Invalid pointerId=" + y + " in onInterceptTouchEvent");
} else {
int y1 = (int)MotionEventCompat.getY(ev, pointerIndex);
int yDiff = Math.abs(y1 - this.mLastMotionY);
@ -521,7 +522,7 @@ public class FlingNestedScrollView extends FrameLayout implements NestedScrollin
case 2:
int activePointerIndex = MotionEventCompat.findPointerIndex(ev, this.mActivePointerId);
if(activePointerIndex == -1) {
Log.e("FlingNestedScrollView", "Invalid pointerId=" + this.mActivePointerId + " in onTouchEvent");
Timber.e("Invalid pointerId=" + this.mActivePointerId + " in onTouchEvent");
} else {
int y = (int)MotionEventCompat.getY(ev, activePointerIndex);
int deltaY = this.mLastMotionY - y;

View file

@ -29,7 +29,6 @@ import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.widget.Toast;
@ -39,9 +38,9 @@ import org.sufficientlysecure.keychain.provider.TemporaryFileProvider;
import org.sufficientlysecure.keychain.service.ContactSyncAdapterService;
import org.sufficientlysecure.keychain.service.KeyserverSyncAdapterService;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.PRNGFixes;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class KeychainApplication extends Application {
@ -72,7 +71,7 @@ public class KeychainApplication extends Application {
* LinuxPRNGSecureRandomProvider(), 1) for Android <= SDK 17
*/
PRNGFixes.apply();
Log.d(Constants.TAG, "Bouncy Castle set and PRNG Fixes applied!");
Timber.d("Bouncy Castle set and PRNG Fixes applied!");
/*
if (Constants.DEBUG) {
@ -127,7 +126,7 @@ public class KeychainApplication extends Application {
Account account = new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE);
if (accounts.length == 0) {
if (!manager.addAccountExplicitly(account, null, null)) {
Log.d(Constants.TAG, "error when adding account via addAccountExplicitly");
Timber.d("error when adding account via addAccountExplicitly");
return null;
} else {
return account;
@ -136,7 +135,7 @@ public class KeychainApplication extends Application {
return accounts[0];
}
} catch (SecurityException e) {
Log.e(Constants.TAG, "SecurityException when adding the account", e);
Timber.e(e, "SecurityException when adding the account");
Toast.makeText(context, R.string.reinstall_openkeychain, Toast.LENGTH_LONG).show();
return null;
}

View file

@ -23,8 +23,8 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.support.annotation.Nullable;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class ClipboardReflection {
@ -37,7 +37,7 @@ public class ClipboardReflection {
ClipData clip = clipboard.getPrimaryClip();
if (clip == null || clip.getItemCount() == 0) {
Log.e(Constants.TAG, "No clipboard data!");
Timber.e("No clipboard data!");
return null;
}

View file

@ -19,10 +19,9 @@ package org.sufficientlysecure.keychain.keyimport;
import android.support.annotation.NonNull;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.net.Proxy;
import java.util.ArrayList;
@ -98,7 +97,7 @@ public class CloudSearch {
if (!problems.isEmpty()) {
for (KeyserverClient.CloudSearchFailureException e : problems) {
Log.d(Constants.TAG, "Cloud search exception: " + e.getLocalizedMessage());
Timber.d("Cloud search exception: " + e.getLocalizedMessage());
}
// only throw exception if we didnt get any results

View file

@ -32,15 +32,15 @@ import android.support.annotation.Nullable;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.network.OkHttpClientFactory;
import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
import org.sufficientlysecure.keychain.pgp.UncachedPublicKey;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import timber.log.Timber;
public class FacebookKeyserverClient implements KeyserverClient {
private static final String FB_KEY_URL_FORMAT
@ -69,10 +69,10 @@ public class FacebookKeyserverClient implements KeyserverClient {
try {
entry.add(getEntry(keyRing, fbUsername));
} catch (UnsupportedOperationException e) {
Log.e(Constants.TAG, "Parsing retrieved Facebook key failed!");
Timber.e("Parsing retrieved Facebook key failed!");
}
} catch (PgpGeneralException | IOException e) {
Log.e(Constants.TAG, "Failed parsing key from Facebook during search", e);
Timber.e(e, "Failed parsing key from Facebook during search");
throw new QueryFailedException("No valid key found on Facebook");
}
return entry;
@ -80,7 +80,7 @@ public class FacebookKeyserverClient implements KeyserverClient {
@Override
public String get(String fbUsername, ParcelableProxy proxy) throws QueryFailedException {
Log.d(Constants.TAG, "FacebookKeyserver get: " + fbUsername + " using Proxy: " + proxy.getProxy());
Timber.d("FacebookKeyserver get: " + fbUsername + " using Proxy: " + proxy.getProxy());
String data = query(fbUsername, proxy);
@ -98,7 +98,7 @@ public class FacebookKeyserverClient implements KeyserverClient {
private String query(String fbUsername, ParcelableProxy proxy) throws QueryFailedException {
try {
URL url = new URL(String.format(FB_KEY_URL_FORMAT, fbUsername));
Log.d(Constants.TAG, "fetching from Facebook with: " + url + " proxy: " + proxy.getProxy());
Timber.d("fetching from Facebook with: " + url + " proxy: " + proxy.getProxy());
/*
* For some URLs such as https://www.facebook.com/adithya.abraham/publickey/download
@ -125,7 +125,7 @@ public class FacebookKeyserverClient implements KeyserverClient {
}
} catch (IOException e) {
Log.e(Constants.TAG, "IOException at Facebook key download", e);
Timber.e(e, "IOException at Facebook key download");
throw new QueryFailedException("Cannot connect to Facebook. "
+ "Check your Internet connection!"
+ (proxy.getProxy() == Proxy.NO_PROXY ? "" : " Using proxy " + proxy.getProxy()));
@ -163,7 +163,7 @@ public class FacebookKeyserverClient implements KeyserverClient {
try {
if (key.isEC()) { // unsupported key format (ECDH or ECDSA)
Log.e(Constants.TAG, "ECDH/ECDSA key - not supported.");
Timber.e("ECDH/ECDSA key - not supported.");
throw new UnsupportedOperationException(
"ECDH/ECDSA keys not supported yet");
}
@ -172,7 +172,7 @@ public class FacebookKeyserverClient implements KeyserverClient {
entry.setAlgorithm(KeyFormattingUtils.getAlgorithmInfo(algorithm, key.getBitStrength(),
key.getCurveOid()));
} catch (NumberFormatException | NullPointerException e) {
Log.e(Constants.TAG, "Conversion for bit size, algorithm, or creation date failed.", e);
Timber.e(e, "Conversion for bit size, algorithm, or creation date failed.");
// can't use this key
throw new UnsupportedOperationException(
"Conversion for bit size, algorithm, or creation date failed.");

View file

@ -41,12 +41,13 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.network.OkHttpClientFactory;
import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import timber.log.Timber;
import static java.util.Locale.ENGLISH;
public class HkpKeyserverClient implements KeyserverClient {
@ -148,14 +149,14 @@ public class HkpKeyserverClient implements KeyserverClient {
.addQueryParameter("search", query)
.build();
Log.d(Constants.TAG, "Keyserver search: " + url + " using Proxy: " + proxy.getProxy());
Timber.d("Keyserver search: " + url + " using Proxy: " + proxy.getProxy());
data = query(url, proxy);
} catch (URISyntaxException e) {
throw new IllegalStateException("Unsupported keyserver URI");
} catch (HttpError e) {
if (e.getData() != null) {
Log.d(Constants.TAG, "returned error data: " + e.getData().toLowerCase(Locale.ENGLISH));
Timber.d("returned error data: " + e.getData().toLowerCase(ENGLISH));
if (e.getData().toLowerCase(Locale.ENGLISH).contains("no keys found")) {
// NOTE: This is also a 404 error for some keyservers!
@ -193,7 +194,7 @@ public class HkpKeyserverClient implements KeyserverClient {
// set key id only
entry.setKeyIdHex("0x" + fingerprintOrKeyId);
} else {
Log.e(Constants.TAG, "Wrong length for fingerprint/long key id.");
Timber.e("Wrong length for fingerprint/long key id.");
// skip this key
continue;
}
@ -209,7 +210,7 @@ public class HkpKeyserverClient implements KeyserverClient {
calendar.setTimeInMillis(creationDate * 1000);
entry.setDate(calendar.getTime());
} catch (NumberFormatException e) {
Log.e(Constants.TAG, "Conversation for bit size, algorithm, or creation date failed.", e);
Timber.e(e, "Conversation for bit size, algorithm, or creation date failed.");
// skip this key
continue;
}
@ -229,7 +230,7 @@ public class HkpKeyserverClient implements KeyserverClient {
}
entry.setExpired(expired);
} catch (NullPointerException e) {
Log.e(Constants.TAG, "Check for revocation or expiry failed.", e);
Timber.e(e, "Check for revocation or expiry failed.");
// skip this key
continue;
}
@ -251,7 +252,7 @@ public class HkpKeyserverClient implements KeyserverClient {
} catch (UnsupportedEncodingException ignored) {
// will never happen, because "UTF8" is supported
} catch (IllegalArgumentException e) {
Log.e(Constants.TAG, "User ID encoding broken", e);
Timber.e(e, "User ID encoding broken");
// skip this user id
continue;
}
@ -278,13 +279,13 @@ public class HkpKeyserverClient implements KeyserverClient {
.addQueryParameter("search", keyIdHex)
.build();
Log.d(Constants.TAG, "Keyserver get: " + url + " using Proxy: " + proxy.getProxy());
Timber.d("Keyserver get: " + url + " using Proxy: " + proxy.getProxy());
data = query(url, proxy);
} catch (URISyntaxException e) {
throw new IllegalStateException("Unsupported keyserver URI");
} catch (HttpError httpError) {
Log.d(Constants.TAG, "Failed to get key at HkpKeyserver", httpError);
Timber.d(httpError, "Failed to get key at HkpKeyserver");
if (httpError.getCode() == 404) {
throw new KeyserverClient.QueryNotFoundException("not found");
}
@ -324,7 +325,7 @@ public class HkpKeyserverClient implements KeyserverClient {
String responseBody = getResponseBodyAsUtf8(response);
Log.d(Constants.TAG, "Adding key with URL: " + url
Timber.d("Adding key with URL: " + url
+ ", response code: " + response.code()
+ ", body: " + responseBody);
@ -333,10 +334,10 @@ public class HkpKeyserverClient implements KeyserverClient {
}
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
Timber.e(e, "IOException");
throw new KeyserverClient.AddKeyException();
} catch (URISyntaxException e) {
Log.e(Constants.TAG, "Unsupported keyserver URI", e);
Timber.e(e, "Unsupported keyserver URI");
throw new KeyserverClient.AddKeyException();
}
}
@ -373,7 +374,7 @@ public class HkpKeyserverClient implements KeyserverClient {
throw new HttpError(response.code(), responseBody);
}
} catch (IOException e) {
Log.e(Constants.TAG, "IOException at HkpKeyserver", e);
Timber.e(e, "IOException at HkpKeyserver");
String proxyInfo = proxy.getProxy() == Proxy.NO_PROXY ? "" : " Using proxy " + proxy.getProxy();
Throwable cause = e.getCause();
String causeName = cause != null ? cause.getClass().getSimpleName() : "generic";

View file

@ -22,11 +22,10 @@ import com.textuality.keybase.lib.KeybaseQuery;
import com.textuality.keybase.lib.Match;
import com.textuality.keybase.lib.User;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.network.OkHttpKeybaseClient;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import timber.log.Timber;
import java.util.ArrayList;
import java.util.List;
@ -60,7 +59,7 @@ public class KeybaseKeyserverClient implements KeyserverClient {
results.add(makeEntry(match, query));
}
} catch (KeybaseException e) {
Log.e(Constants.TAG, "keybase result parsing error", e);
Timber.e(e, "keybase result parsing error");
throw new QueryFailedException("Unexpected structure in keybase search result: " + e.getMessage());
}

View file

@ -21,7 +21,6 @@ import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.content.AsyncTaskLoader;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.keyimport.CloudSearch;
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
import org.sufficientlysecure.keychain.keyimport.KeyserverClient;
@ -31,10 +30,10 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
import timber.log.Timber;
import java.util.ArrayList;
@ -71,12 +70,12 @@ public class ImportKeysListCloudLoader
mEntryListWrapper = new AsyncTaskResultWrapper<>(mEntryList, null);
if (mState.mServerQuery == null) {
Log.e(Constants.TAG, "mServerQuery is null!");
Timber.e("mServerQuery is null!");
return mEntryListWrapper;
}
if (mState.mServerQuery.startsWith("0x") && mState.mServerQuery.length() == 42) {
Log.d(Constants.TAG, "This search is based on a unique fingerprint. Enforce a fingerprint check!");
Timber.d("This search is based on a unique fingerprint. Enforce a fingerprint check!");
queryServer(true);
} else {
queryServer(false);
@ -148,7 +147,7 @@ public class ImportKeysListCloudLoader
// add result to data
if (enforceFingerprint) {
String fingerprintHex = mState.mServerQuery.substring(2);
Log.d(Constants.TAG, "fingerprint: " + fingerprintHex);
Timber.d("fingerprint: " + fingerprintHex);
// query must return only one result!
if (searchResult.size() == 1) {
if (fingerprintHex.length() != 40) {

View file

@ -22,7 +22,6 @@ import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.AsyncTaskLoader;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
import org.sufficientlysecure.keychain.operations.results.GetKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
@ -32,8 +31,8 @@ import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.PositionAwareInputStream;
import timber.log.Timber;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
@ -70,7 +69,7 @@ public class ImportKeysListLoader
}
if (mState == null) {
Log.e(Constants.TAG, "Input data is null!");
Timber.e("Input data is null!");
return mEntryListWrapper;
}
@ -123,7 +122,7 @@ public class ImportKeysListLoader
mData.add(new ImportKeysListEntry(mContext, it.next()));
}
} catch (IOException e) {
Log.e(Constants.TAG, "IOException on parsing key file! Return NoValidKeysException!", e);
Timber.e(e, "IOException on parsing key file! Return NoValidKeysException!");
OperationResult.OperationLog log = new OperationResult.OperationLog();
log.add(OperationResult.LogType.MSG_GET_NO_VALID_KEYS, 0);
GetKeyResult getKeyResult = new GetKeyResult(GetKeyResult.RESULT_ERROR_NO_VALID_KEYS, log);

View file

@ -24,7 +24,6 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONException;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.linked.resources.GenericHttpsResource;
import org.sufficientlysecure.keychain.linked.resources.GithubResource;
import org.sufficientlysecure.keychain.linked.resources.TwitterResource;
@ -32,8 +31,8 @@ import org.sufficientlysecure.keychain.operations.results.LinkedVerifyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.network.OkHttpClientFactory;
import timber.log.Timber;
import java.io.IOException;
import java.net.MalformedURLException;
@ -83,18 +82,18 @@ public abstract class LinkedTokenResource extends LinkedResource {
if (!"openpgpid+token".equals(uri.getScheme())
&& !"openpgpid+cookie".equals(uri.getScheme())) {
Log.e(Constants.TAG, "unknown uri scheme in (suspected) linked id packet");
Timber.e("unknown uri scheme in (suspected) linked id packet");
return null;
}
if (!uri.isOpaque()) {
Log.e(Constants.TAG, "non-opaque uri in (suspected) linked id packet");
Timber.e("non-opaque uri in (suspected) linked id packet");
return null;
}
String specific = uri.getSchemeSpecificPart();
if (!specific.contains("@")) {
Log.e(Constants.TAG, "unknown uri scheme in linked id packet");
Timber.e("unknown uri scheme in linked id packet");
return null;
}
@ -192,15 +191,15 @@ public abstract class LinkedTokenResource extends LinkedResource {
res = fetchResource(context, log, 1);
} catch (HttpStatusException e) {
// log verbose output to logcat
Log.e(Constants.TAG, "http error (" + e.getStatus() + "): " + e.getReason());
Timber.e("http error (" + e.getStatus() + "): " + e.getReason());
log.add(LogType.MSG_LV_FETCH_ERROR, 2, Integer.toString(e.getStatus()));
} catch (MalformedURLException e) {
log.add(LogType.MSG_LV_FETCH_ERROR_URL, 2);
} catch (IOException e) {
Log.e(Constants.TAG, "io error", e);
Timber.e(e, "io error");
log.add(LogType.MSG_LV_FETCH_ERROR_IO, 2);
} catch (JSONException e) {
Log.e(Constants.TAG, "json error", e);
Timber.e(e, "json error");
log.add(LogType.MSG_LV_FETCH_ERROR_FORMAT, 2);
}
@ -209,7 +208,7 @@ public abstract class LinkedTokenResource extends LinkedResource {
return new LinkedVerifyResult(LinkedVerifyResult.RESULT_ERROR, log);
}
Log.d(Constants.TAG, "Resource data: '" + res + "'");
Timber.d("Resource data: '" + res + "'");
return verifyString(log, 1, res, fingerprint);
@ -258,7 +257,7 @@ public abstract class LinkedTokenResource extends LinkedResource {
public static String getResponseBody(Request request, String... pins)
throws IOException, HttpStatusException {
Log.d("Connection to: " + request.url().url().getHost(), "");
Timber.d("");
OkHttpClient client;
if (pins != null) {
client = OkHttpClientFactory.getSimpleClientPinned(getCertificatePinner(request.url().url().getHost(), pins));

View file

@ -18,10 +18,9 @@
package org.sufficientlysecure.keychain.linked;
import org.bouncycastle.util.Strings;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
import java.net.URI;
@ -67,7 +66,7 @@ public class UriAttribute {
return new LinkedAttribute(uri, res);
} catch (IllegalArgumentException e) {
Log.e(Constants.TAG, "error parsing uri in (suspected) linked id packet");
Timber.e("error parsing uri in (suspected) linked id packet");
return null;
}
}

View file

@ -27,12 +27,11 @@ import okhttp3.Request;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.linked.LinkedTokenResource;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
import java.net.MalformedURLException;
@ -166,15 +165,15 @@ public class GithubResource extends LinkedTokenResource {
} catch (HttpStatusException e) {
// log verbose output to logcat
Log.e(Constants.TAG, "http error (" + e.getStatus() + "): " + e.getReason());
Timber.e("http error (" + e.getStatus() + "): " + e.getReason());
log.add(LogType.MSG_LV_FETCH_ERROR, 2, Integer.toString(e.getStatus()));
} catch (MalformedURLException e) {
log.add(LogType.MSG_LV_FETCH_ERROR_URL, 2);
} catch (IOException e) {
Log.e(Constants.TAG, "io error", e);
Timber.e(e, "io error");
log.add(LogType.MSG_LV_FETCH_ERROR_IO, 2);
} catch (JSONException e) {
Log.e(Constants.TAG, "json error", e);
Timber.e(e, "json error");
log.add(LogType.MSG_LV_FETCH_ERROR_FORMAT, 2);
}

View file

@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.linked.LinkedTokenResource;
import timber.log.Timber;
import java.io.IOException;
import java.net.MalformedURLException;
@ -207,15 +208,15 @@ public class TwitterResource extends LinkedTokenResource {
} catch (HttpStatusException e) {
// log verbose output to logcat
Log.e(Constants.TAG, "http error (" + e.getStatus() + "): " + e.getReason());
Timber.e("http error (" + e.getStatus() + "): " + e.getReason());
log.add(LogType.MSG_LV_FETCH_ERROR, 1, Integer.toString(e.getStatus()));
} catch (MalformedURLException e) {
log.add(LogType.MSG_LV_FETCH_ERROR_URL, 1);
} catch (IOException e) {
Log.e(Constants.TAG, "io error", e);
Timber.e(e, "io error");
log.add(LogType.MSG_LV_FETCH_ERROR_IO, 1);
} catch (JSONException e) {
Log.e(Constants.TAG, "json error", e);
Timber.e(e, "json error");
log.add(LogType.MSG_LV_FETCH_ERROR_FORMAT, 1);
}

View file

@ -56,8 +56,7 @@ import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManager;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
@RequiresApi(api = VERSION_CODES.LOLLIPOP)
@ -171,12 +170,12 @@ public class KeyTransferInteractor {
try {
handleOpenConnection(socket);
Log.d(Constants.TAG, "connection closed ok!");
Timber.d("connection closed ok!");
} catch (SSLHandshakeException e) {
Log.d(Constants.TAG, "ssl handshake error!", e);
Timber.d(e, "ssl handshake error!");
invokeListener(CONNECTION_ERROR_CONNECT, null);
} catch (IOException e) {
Log.e(Constants.TAG, "communication error!", e);
Timber.e(e, "communication error!");
invokeListener(CONNECTION_ERROR_WHILE_CONNECTED, e.getLocalizedMessage());
}
} finally {
@ -200,7 +199,7 @@ public class KeyTransferInteractor {
socket = serverSocket.accept();
} catch (IOException e) {
Log.e(Constants.TAG, "error while listening!", e);
Timber.e(e, "error while listening!");
invokeListener(CONNECTION_ERROR_LISTEN, null);
return null;
}
@ -214,7 +213,7 @@ public class KeyTransferInteractor {
socket = sslSocket;
socket.connect(new InetSocketAddress(InetAddress.getByName(clientHost), clientPort), TIMEOUT_CONNECTING);
} catch (IOException e) {
Log.e(Constants.TAG, "error while connecting!", e);
Timber.e(e, "error while connecting!");
if (e instanceof NoRouteToHostException) {
invokeListener(CONNECTION_ERROR_NO_ROUTE_TO_HOST, wifiSsid);
} else {
@ -252,7 +251,7 @@ public class KeyTransferInteractor {
break;
}
}
Log.d(Constants.TAG, "disconnected");
Timber.d("disconnected");
invokeListener(CONNECTION_LOST, null);
}
@ -270,7 +269,7 @@ public class KeyTransferInteractor {
boolean lineIsDelimiter = delimiterStart.equals(firstLine);
if (!lineIsDelimiter) {
Log.d(Constants.TAG, "bad beginning of key block?");
Timber.d("bad beginning of key block?");
return false;
}

View file

@ -25,9 +25,9 @@ import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.service.KeyserverSyncAdapterService;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class NetworkReceiver extends BroadcastReceiver {
@ -60,11 +60,11 @@ public class NetworkReceiver extends BroadcastReceiver {
if (isEnabled) {
pm.setComponentEnabledSetting(compName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Log.d(Constants.TAG, "Wifi Receiver is enabled!");
Timber.d("Wifi Receiver is enabled!");
} else {
pm.setComponentEnabledSetting(compName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Log.d(Constants.TAG, "Wifi Receiver is disabled!");
Timber.d("Wifi Receiver is disabled!");
}
}
}

View file

@ -28,7 +28,8 @@ import com.google.auto.value.AutoValue;
import org.bouncycastle.util.encoders.DecoderException;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
@AutoValue
abstract class SktUri {
@ -75,7 +76,7 @@ abstract class SktUri {
try {
wifiSsid = new String(Hex.decode(optarg[1]));
} catch (DecoderException e) {
Log.d(Constants.TAG, "error parsing ssid in skt uri, ignoring: " + input);
Timber.d("error parsing ssid in skt uri, ignoring: " + input);
}
}
}

View file

@ -19,9 +19,6 @@ package org.sufficientlysecure.keychain.network;
import android.content.res.AssetManager;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -45,6 +42,8 @@ import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import okhttp3.OkHttpClient;
import timber.log.Timber;
public class TlsCertificatePinning {
@ -68,7 +67,7 @@ public class TlsCertificatePinning {
sCertificatePins.put(host, baos.toByteArray());
} catch (IOException e) {
Log.w(Constants.TAG, e);
Timber.w(e);
}
}
@ -89,7 +88,7 @@ public class TlsCertificatePinning {
* to URLs with passed certificate.
*/
void pinCertificate(OkHttpClient.Builder builder) {
Log.d(Constants.TAG, "Pinning certificate for " + url);
Timber.d("Pinning certificate for " + url);
// We don't use OkHttp's CertificatePinner since it can not be used to pin self-signed
// certificate if such certificate is not accepted by TrustManager.

View file

@ -65,18 +65,18 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.dialog.SupportInstallDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.OrbotStartDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.PreferenceInstallDialogFragment;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.util.List;
/**
* This class is taken from the NetCipher library: https://github.com/guardianproject/NetCipher/
* All calls that use a shell have been removed.
@ -221,7 +221,7 @@ public class OrbotHelper {
*/
public static boolean requestStartTor(Context context) {
if (OrbotHelper.isOrbotInstalled(context)) {
Log.i("OrbotHelper", "requestStartTor " + context.getPackageName());
Timber.i("requestStartTor " + context.getPackageName());
Intent intent = getOrbotStartIntent();
intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName());
context.sendBroadcast(intent);
@ -245,7 +245,7 @@ public class OrbotHelper {
String foundPackageName = null;
for (ResolveInfo r : resInfos) {
Log.i("OrbotHelper", "market: " + r.activityInfo.packageName);
Timber.i("market: " + r.activityInfo.packageName);
if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME)
|| TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) {
foundPackageName = r.activityInfo.packageName;
@ -416,7 +416,7 @@ public class OrbotHelper {
private ProgressDialog mProgressDialog;
public void startOrbotAndListen(final Context context, final boolean showProgress) {
Log.d(Constants.TAG, "starting orbot listener");
Timber.d("starting orbot listener");
if (showProgress) {
showProgressDialog(context);
}
@ -447,8 +447,8 @@ public class OrbotHelper {
break;
}
Log.d(Constants.TAG, "Orbot silent start broadcast: " +
intent.getStringExtra(OrbotHelper.EXTRA_STATUS));
Timber.d("Orbot silent start broadcast: " +
intent.getStringExtra(EXTRA_STATUS));
}
};
context.registerReceiver(receiver, new IntentFilter(OrbotHelper.ACTION_STATUS));

View file

@ -22,8 +22,8 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
* BroadcastReceiver that receives Orbots status
@ -58,18 +58,18 @@ public class OrbotStatusReceiver extends BroadcastReceiver {
String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS);
this.torRunning = (intent.getStringExtra(OrbotHelper.EXTRA_STATUS).equals(OrbotHelper.STATUS_ON));
Log.d(Constants.TAG, "Receiver: Orbot status: " + status);
Timber.d("Receiver: Orbot status: " + status);
if (torRunning) {
Bundle extras = intent.getExtras();
if (extras.containsKey(EXTRA_PROXY_PORT_HTTP)) {
this.proxyPortHttp = extras.getInt(EXTRA_PROXY_PORT_HTTP, -1);
Log.i(Constants.TAG, "Receiver: Orbot Http proxy at " + proxyPortHttp);
Timber.i("Receiver: Orbot Http proxy at " + proxyPortHttp);
}
if (extras.containsKey(EXTRA_PROXY_PORT_SOCKS)) {
this.proxyPortSocks = extras.getInt(EXTRA_PROXY_PORT_SOCKS, -1);
Log.i(Constants.TAG, "Receiver: Orbot Socks proxy at " + proxyPortSocks);
Timber.i("Receiver: Orbot Socks proxy at " + proxyPortSocks);
}
}
}

View file

@ -46,7 +46,6 @@ import org.sufficientlysecure.keychain.operations.results.PgpSignEncryptResult;
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptData;
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptInputParcel;
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptOperation;
import org.sufficientlysecure.keychain.pgp.Progressable;
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
@ -61,7 +60,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.CountingOutputStream;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
@ -259,7 +258,7 @@ public class BackupOperation extends BaseOperation<BackupKeyringParcel> {
if (outStream != null) try {
outStream.close();
} catch (Exception e) {
Log.e(Constants.TAG, "error closing stream", e);
Timber.e(e, "error closing stream");
}
cursor.close();
}

View file

@ -45,9 +45,9 @@ import org.sufficientlysecure.keychain.pgp.SignEncryptParcel;
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
import org.sufficientlysecure.keychain.service.BenchmarkInputParcel;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.ProgressScaler;
import timber.log.Timber;
public class BenchmarkOperation extends BaseOperation<BenchmarkInputParcel> {
@ -139,7 +139,7 @@ public class BenchmarkOperation extends BaseOperation<BenchmarkInputParcel> {
iterationsFor100ms = iterations;
} catch (PGPException e) {
Log.e(Constants.TAG, "internal error during benchmark", e);
Timber.e(e, "internal error during benchmark");
log.add(LogType.MSG_INTERNAL_ERROR, 0);
return new BenchmarkResult(BenchmarkResult.RESULT_ERROR, log);
}

View file

@ -35,7 +35,6 @@ import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.keyimport.FacebookKeyserverClient;
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
@ -62,11 +61,12 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.IteratorWithSize;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.ProgressScaler;
import timber.log.Timber;
/**
* An operation class which implements high level import
@ -248,7 +248,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
log.add(result, 2);
} catch (IOException | PgpGeneralException e) {
Log.e(Constants.TAG, "Encountered bad key on import!", e);
Timber.e(e, "Encountered bad key on import!");
++badKeys;
}
@ -400,7 +400,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
} catch (KeyserverClient.QueryNotFoundException e) {
throw e;
} catch (KeyserverClient.QueryFailedException e) {
Log.d(Constants.TAG, "query failed", e);
Timber.d(e, "query failed");
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
return null;
}
@ -426,7 +426,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
return keybaseKey;
} catch (KeyserverClient.QueryFailedException e) {
// download failed, too bad. just proceed
Log.e(Constants.TAG, "query failed", e);
Timber.e(e, "query failed");
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
return null;
}
@ -452,7 +452,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
return facebookKey;
} catch (KeyserverClient.QueryFailedException e) {
// download failed, too bad. just proceed
Log.e(Constants.TAG, "query failed", e);
Timber.e(e, "query failed");
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
return null;
}
@ -515,7 +515,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
private ImportKeyResult multiThreadedKeyImport(List<ParcelableKeyRing> keyList,
final HkpKeyserverAddress keyServer, final ParcelableProxy proxy,
final boolean skipSave) {
Log.d(Constants.TAG, "Multi-threaded key import starting");
Timber.d("Multi-threaded key import starting");
final Iterator<ParcelableKeyRing> keyListIterator = keyList.iterator();
final int totKeys = keyList.size();
@ -555,8 +555,8 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
try {
accumulator.accumulateKeyImport(importCompletionService.take().get());
} catch (InterruptedException | ExecutionException e) {
Log.e(Constants.TAG, "A key could not be imported during multi-threaded " +
"import", e);
Timber.e(e, "A key could not be imported during multi-threaded " +
"import");
// do nothing?
if (e instanceof ExecutionException) {
// Since serialKeyRingImport does not throw any exceptions, this is what

View file

@ -22,7 +22,6 @@ import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.operations.results.RevokeResult;
@ -35,7 +34,8 @@ import org.sufficientlysecure.keychain.service.RevokeKeyringParcel;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class RevokeOperation extends BaseReadWriteOperation<RevokeKeyringParcel> {
@ -97,7 +97,7 @@ public class RevokeOperation extends BaseReadWriteOperation<RevokeKeyringParcel>
}
} catch (PgpKeyNotFoundException | KeyWritableRepository.NotFoundException e) {
Log.e(Constants.TAG, "could not find key to revoke", e);
Timber.e(e, "could not find key to revoke");
log.add(OperationResult.LogType.MSG_REVOKE_ERROR_KEY_FAIL, 1);
return new RevokeResult(RevokeResult.RESULT_ERROR, log, masterKeyId);
}

View file

@ -23,7 +23,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverClient;
import org.sufficientlysecure.keychain.keyimport.KeyserverClient.AddKeyException;
@ -42,10 +41,10 @@ import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
import timber.log.Timber;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -130,7 +129,7 @@ public class UploadOperation extends BaseOperation<UploadKeyringParcel> {
return null;
} catch (IOException | PgpGeneralException e) {
log.add(LogType.MSG_UPLOAD_ERROR_IO, 1);
Log.e(Constants.TAG, "error uploading key", e);
Timber.e(e, "error uploading key");
return null;
}
@ -159,12 +158,12 @@ public class UploadOperation extends BaseOperation<UploadKeyringParcel> {
log.add(LogType.MSG_UPLOAD_SUCCESS, 1);
return new UploadResult(UploadResult.RESULT_OK, log);
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
Timber.e(e, "IOException");
log.add(LogType.MSG_UPLOAD_ERROR_IO, 1);
return new UploadResult(UploadResult.RESULT_ERROR, log);
} catch (AddKeyException e) {
Log.e(Constants.TAG, "AddKeyException", e);
Timber.e(e, "AddKeyException");
log.add(LogType.MSG_UPLOAD_ERROR_UPLOAD, 1);
return new UploadResult(UploadResult.RESULT_ERROR, log);

View file

@ -24,7 +24,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.LogDisplayActivity;
import org.sufficientlysecure.keychain.ui.LogDisplayFragment;
@ -33,8 +32,8 @@ import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener;
import org.sufficientlysecure.keychain.ui.util.Notify.Showable;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableCache;
import timber.log.Timber;
import java.util.ArrayList;
import java.util.Arrays;
@ -122,7 +121,7 @@ public abstract class OperationResult implements Parcelable {
mType = type;
mParameters = parameters;
mIndent = indent;
Log.v(Constants.TAG, "log: " + this);
Timber.v("log: " + this);
}
/** Clones this LogEntryParcel, adding extra indent. Note that the parameter array is NOT cloned! */
@ -206,7 +205,7 @@ public abstract class OperationResult implements Parcelable {
super(type, indent, parameters);
mSubResult = subResult;
Log.v(Constants.TAG, "log: " + this);
Timber.v("log: " + this);
}
public SubLogEntryParcel(Parcel source) {
@ -264,7 +263,7 @@ public abstract class OperationResult implements Parcelable {
LogEntryParcel entryParcel = mLog.getLast();
if (entryParcel == null) {
Log.e(Constants.TAG, "Tried to show empty log!");
Timber.e("Tried to show empty log!");
return Notify.create(activity, R.string.error_empty_log, Style.ERROR);
}
// special case: first parameter may be a quantity

View file

@ -18,6 +18,14 @@
package org.sufficientlysecure.keychain.pgp;
import java.io.IOException;
import java.security.PublicKey;
import java.security.interfaces.ECPublicKey;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.bcpg.ECDHPublicBCPGKey;
@ -31,18 +39,9 @@ import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
import org.bouncycastle.openpgp.operator.RFC6637Utils;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyConverter;
import org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyKeyEncryptionMethodGenerator;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import java.io.IOException;
import java.security.PublicKey;
import java.security.interfaces.ECPublicKey;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import timber.log.Timber;
/** Wrapper for a PGPPublicKey.
*
@ -185,7 +184,7 @@ public class CanonicalizedPublicKey extends UncachedPublicKey {
long seconds = getValidSeconds();
if (seconds > Integer.MAX_VALUE) {
Log.e(Constants.TAG, "error, expiry time too large");
Timber.e("error, expiry time too large");
return null;
}
if (seconds == 0) {

View file

@ -37,14 +37,21 @@ import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PGPContentSignerBuilder;
import org.bouncycastle.openpgp.operator.jcajce.*;
import org.bouncycastle.openpgp.operator.jcajce.CachingDataDecryptorFactory;
import org.bouncycastle.openpgp.operator.jcajce.EdDsaAuthenticationContentSignerBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyConverter;
import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder;
import org.bouncycastle.openpgp.operator.jcajce.NfcSyncPGPContentSignerBuilder;
import org.bouncycastle.openpgp.operator.jcajce.SessionKeySecretKeyDecryptorBuilder;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
/**
@ -204,7 +211,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
mPrivateKey = mSecretKey.extractPrivateKey(keyDecryptor);
mPrivateKeyState = PRIVATE_KEY_STATE_UNLOCKED;
} catch (PGPException e) {
Log.e(Constants.TAG, "Error extracting private key!", e);
Timber.e(e, "Error extracting private key!");
return false;
}
if (mPrivateKey == null) {
@ -241,7 +248,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
signatureGenerator.init(PGPSignature.DEFAULT_CERTIFICATION, mPrivateKey);
return signatureGenerator;
} catch (PGPException e) {
Log.e(Constants.TAG, "signing error", e);
Timber.e(e, "signing error");
return null;
}
}

View file

@ -17,19 +17,19 @@
package org.sufficientlysecure.keychain.pgp;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import org.bouncycastle.openpgp.PGPKeyRing;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import timber.log.Timber;
public class CanonicalizedSecretKeyRing extends CanonicalizedKeyRing {
@ -47,10 +47,10 @@ public class CanonicalizedSecretKeyRing extends CanonicalizedKeyRing {
PGPKeyRing keyRing = null;
try {
if ((keyRing = (PGPKeyRing) factory.nextObject()) == null) {
Log.e(Constants.TAG, "No keys given!");
Timber.e("No keys given!");
}
} catch (IOException e) {
Log.e(Constants.TAG, "Error while converting to PGPKeyRing!", e);
Timber.e(e, "Error while converting to PGPKeyRing!");
}
mRing = (PGPSecretKeyRing) keyRing;

View file

@ -18,8 +18,8 @@
package org.sufficientlysecure.keychain.pgp;
import org.openintents.openpgp.OpenPgpDecryptionResult;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
class OpenPgpDecryptionResultBuilder {
@ -39,16 +39,16 @@ class OpenPgpDecryptionResultBuilder {
public OpenPgpDecryptionResult build() {
if (isInsecure) {
Log.d(Constants.TAG, "RESULT_INSECURE");
Timber.d("RESULT_INSECURE");
return new OpenPgpDecryptionResult(OpenPgpDecryptionResult.RESULT_INSECURE, sessionKey, decryptedSessionKey);
}
if (isEncrypted) {
Log.d(Constants.TAG, "RESULT_ENCRYPTED");
Timber.d("RESULT_ENCRYPTED");
return new OpenPgpDecryptionResult(OpenPgpDecryptionResult.RESULT_ENCRYPTED, sessionKey, decryptedSessionKey);
}
Log.d(Constants.TAG, "RESULT_NOT_ENCRYPTED");
Timber.d("RESULT_NOT_ENCRYPTED");
return new OpenPgpDecryptionResult(OpenPgpDecryptionResult.RESULT_NOT_ENCRYPTED);
}

View file

@ -25,11 +25,11 @@ import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.OpenPgpSignatureResult.SenderStatusResult;
import org.openintents.openpgp.util.OpenPgpUtils;
import org.openintents.openpgp.util.OpenPgpUtils.UserId;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
* This class can be used to build OpenPgpSignatureResult objects based on several checks.
@ -121,7 +121,7 @@ public class OpenPgpSignatureResultBuilder {
try {
setPrimaryUserId(signingRing.getPrimaryUserIdWithFallback());
} catch (PgpKeyNotFoundException e) {
Log.d(Constants.TAG, "No primary user id in keyring with master key id " + signingRing.getMasterKeyId());
Timber.d("No primary user id in keyring with master key id " + signingRing.getMasterKeyId());
}
setSignatureKeyCertified(signingRing.getVerified() > 0);
@ -168,35 +168,35 @@ public class OpenPgpSignatureResultBuilder {
public OpenPgpSignatureResult build() {
if (!mSignatureAvailable) {
Log.d(Constants.TAG, "RESULT_NO_SIGNATURE");
Timber.d("RESULT_NO_SIGNATURE");
return OpenPgpSignatureResult.createWithNoSignature();
}
if (!mKnownKey) {
Log.d(Constants.TAG, "RESULT_KEY_MISSING");
Timber.d("RESULT_KEY_MISSING");
return OpenPgpSignatureResult.createWithKeyMissing(mKeyId, mSignatureTimestamp);
}
if (!mValidSignature) {
Log.d(Constants.TAG, "RESULT_INVALID_SIGNATURE");
Timber.d("RESULT_INVALID_SIGNATURE");
return OpenPgpSignatureResult.createWithInvalidSignature();
}
int signatureStatus;
if (mIsKeyRevoked) {
Log.d(Constants.TAG, "RESULT_INVALID_KEY_REVOKED");
Timber.d("RESULT_INVALID_KEY_REVOKED");
signatureStatus = OpenPgpSignatureResult.RESULT_INVALID_KEY_REVOKED;
} else if (mIsKeyExpired) {
Log.d(Constants.TAG, "RESULT_INVALID_KEY_EXPIRED");
Timber.d("RESULT_INVALID_KEY_EXPIRED");
signatureStatus = OpenPgpSignatureResult.RESULT_INVALID_KEY_EXPIRED;
} else if (mInsecure) {
Log.d(Constants.TAG, "RESULT_INVALID_INSECURE");
Timber.d("RESULT_INVALID_INSECURE");
signatureStatus = OpenPgpSignatureResult.RESULT_INVALID_KEY_INSECURE;
} else if (mIsSignatureKeyCertified) {
Log.d(Constants.TAG, "RESULT_VALID_CONFIRMED");
Timber.d("RESULT_VALID_CONFIRMED");
signatureStatus = OpenPgpSignatureResult.RESULT_VALID_KEY_CONFIRMED;
} else {
Log.d(Constants.TAG, "RESULT_VALID_UNCONFIRMED");
Timber.d("RESULT_VALID_UNCONFIRMED");
signatureStatus = OpenPgpSignatureResult.RESULT_VALID_KEY_UNCONFIRMED;
}

View file

@ -32,14 +32,13 @@ import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
import org.bouncycastle.openpgp.PGPSignatureSubpacketVector;
import org.bouncycastle.openpgp.PGPUserAttributeSubpacketVector;
import org.bouncycastle.openpgp.operator.jcajce.NfcSyncPGPContentSignerBuilder.NfcInteractionNeeded;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel.SecurityTokenSignOperationsBuilder;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class PgpCertifyOperation {
@ -67,7 +66,7 @@ public class PgpCertifyOperation {
PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
if (creationTimestamp != null) {
spGen.setSignatureCreationTime(false, creationTimestamp);
Log.d(Constants.TAG, "For NFC: set sig creation time to " + creationTimestamp);
Timber.d("For NFC: set sig creation time to " + creationTimestamp);
}
PGPSignatureSubpacketVector packetVector = spGen.generate();
signatureGenerator.setHashedSubpackets(packetVector);
@ -115,7 +114,7 @@ public class PgpCertifyOperation {
}
} catch (PGPException e) {
Log.e(Constants.TAG, "signing error", e);
Timber.e(e, "signing error");
return new PgpCertifyResult();
}

View file

@ -83,9 +83,12 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.CharsetVerifier;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.ProgressScaler;
import timber.log.Timber;
import static java.lang.String.format;
public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInputParcel> {
@ -112,7 +115,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
long inputSize = FileHelper.getFileSize(mContext, input.getInputUri(), 0);
inputData = new InputData(inputStream, inputSize);
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "Input URI could not be opened: " + input.getInputUri(), e);
Timber.e(e, "Input URI could not be opened: " + input.getInputUri());
OperationLog log = new OperationLog();
log.add(LogType.MSG_DC_ERROR_INPUT, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
@ -125,7 +128,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
try {
outputStream = mContext.getContentResolver().openOutputStream(input.getOutputUri());
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "Output URI could not be opened: " + input.getOutputUri(), e);
Timber.e(e, "Output URI could not be opened: " + input.getOutputUri());
OperationLog log = new OperationLog();
log.add(LogType.MSG_DC_ERROR_IO, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
@ -139,7 +142,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
}
result.mOperationTime = System.currentTimeMillis() - startTime;
Log.d(Constants.TAG, "total time taken: " + String.format("%.2f", result.mOperationTime / 1000.0) + "s");
Timber.d("total time taken: " + format("%.2f", result.mOperationTime / 1000.0) + "s");
return result;
}
@ -155,7 +158,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
InputData inputData, OutputStream outputStream) {
try {
if (input.getDetachedSignature() != null) {
Log.d(Constants.TAG, "Detached signature present, verifying with this signature only");
Timber.d("Detached signature present, verifying with this signature only");
return verifyDetachedSignature(input, inputData, outputStream, 0);
} else {
@ -165,7 +168,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
if (inputStream instanceof ArmoredInputStream) {
ArmoredInputStream aIn = (ArmoredInputStream) inputStream;
// it is ascii armored
Log.d(Constants.TAG, "ASCII Armor Header Line: " + aIn.getArmorHeaderLine());
Timber.d("ASCII Armor Header Line: " + aIn.getArmorHeaderLine());
if (aIn.isClearText()) {
// a cleartext signature, verify it with the other method
@ -179,19 +182,19 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
}
}
} catch (PGPException e) {
Log.d(Constants.TAG, "PGPException", e);
Timber.d(e, "PGPException");
OperationLog log = new OperationLog();
log.add(LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} catch (DecoderException | ArrayIndexOutOfBoundsException e) {
// these can happen if assumptions in JcaPGPObjectFactory.nextObject() aren't
// fulfilled, so we need to catch them here to handle this gracefully
Log.d(Constants.TAG, "data error", e);
Timber.d(e, "data error");
OperationLog log = new OperationLog();
log.add(LogType.MSG_DC_ERROR_IO, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} catch (IOException e) {
Log.d(Constants.TAG, "IOException", e);
Timber.d(e, "IOException");
OperationLog log = new OperationLog();
log.add(LogType.MSG_DC_ERROR_IO, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
@ -504,7 +507,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
}
opTime = System.currentTimeMillis()-startTime;
Log.d(Constants.TAG, "decrypt time taken: " + String.format("%.2f", opTime / 1000.0) + "s, for "
Timber.d("decrypt time taken: " + format("%.2f", opTime / 1000.0) + "s, for "
+ alreadyWritten + " bytes");
// special treatment to detect pgp mime types
@ -522,7 +525,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
alreadyWritten, charsetVerifier.getCharset());
log.add(LogType.MSG_DC_CLEAR_META_MIME, indent + 1, mimeType);
Log.d(Constants.TAG, metadata.toString());
Timber.d(metadata.toString());
indent -= 1;
@ -613,9 +616,9 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
// allow only specific keys for decryption?
if (input.getAllowedKeyIds() != null) {
Log.d(Constants.TAG, "encData.getKeyID(): " + subKeyId);
Log.d(Constants.TAG, "mAllowedKeyIds: " + input.getAllowedKeyIds());
Log.d(Constants.TAG, "masterKeyId: " + masterKeyId);
Timber.d("encData.getKeyID(): " + subKeyId);
Timber.d("mAllowedKeyIds: " + input.getAllowedKeyIds());
Timber.d("masterKeyId: " + masterKeyId);
if (!input.getAllowedKeyIds().contains(masterKeyId)) {
// this key is in our db, but NOT allowed!
@ -913,7 +916,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
signatureChecker.verifySignature(log, indent);
} catch (SignatureException e) {
Log.d(Constants.TAG, "SignatureException", e);
Timber.d(e, "SignatureException");
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
}
}

View file

@ -27,8 +27,8 @@ import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class PgpHelper {
@ -84,14 +84,14 @@ public class PgpHelper {
}
public static String getPgpMessageContent(@NonNull CharSequence input) {
Log.dEscaped(Constants.TAG, "input: " + input);
Timber.d("input: %s");
Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(input);
if (matcher.matches()) {
String text = matcher.group(1);
text = fixPgpMessage(text);
Log.dEscaped(Constants.TAG, "input fixed: " + text);
Timber.d("input fixed: %s", text);
return text;
} else {
matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(input);
@ -99,7 +99,7 @@ public class PgpHelper {
String text = matcher.group(1);
text = fixPgpCleartextSignature(text);
Log.dEscaped(Constants.TAG, "input fixed: " + text);
Timber.d("input fixed: %s", text);
return text;
} else {
return null;
@ -108,7 +108,7 @@ public class PgpHelper {
}
public static String getPgpPublicKeyContent(@NonNull CharSequence input) {
Log.dEscaped(Constants.TAG, "input: " + input);
Timber.d("input: %s", input);
Matcher matcher = PgpHelper.PGP_PUBLIC_KEY.matcher(input);
if (!matcher.matches()) {
@ -165,7 +165,7 @@ public class PgpHelper {
Matcher matcher = KEYDATA_START_PATTERN.matcher(text);
if (!matcher.find()) {
Log.e(Constants.TAG, "Could not find start of key data!");
Timber.e("Could not find start of key data!");
break;
}
int indexOfPubkeyMaterial = matcher.start(1);

View file

@ -90,10 +90,11 @@ import org.sufficientlysecure.keychain.service.input.RequiredInputParcel.Securit
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel.SecurityTokenSignOperationsBuilder;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Primes;
import org.sufficientlysecure.keychain.util.ProgressScaler;
import timber.log.Timber;
/**
* This class is the single place where ALL operations that actually modify a PGP public or secret
@ -286,7 +287,7 @@ public class PgpKeyOperation {
log.add(LogType.MSG_CR_ERROR_UNKNOWN_ALGO, indent);
return null;
} catch(PGPException e) {
Log.e(Constants.TAG, "internal pgp error", e);
Timber.e(e, "internal pgp error");
log.add(LogType.MSG_CR_ERROR_INTERNAL_PGP, indent);
return null;
}
@ -364,10 +365,10 @@ public class PgpKeyOperation {
} catch (PGPException e) {
log.add(LogType.MSG_CR_ERROR_INTERNAL_PGP, indent);
Log.e(Constants.TAG, "pgp error encoding key", e);
Timber.e(e, "pgp error encoding key");
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
} catch (IOException e) {
Log.e(Constants.TAG, "io error encoding key", e);
Timber.e(e, "io error encoding key");
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
}
@ -1137,15 +1138,15 @@ public class PgpKeyOperation {
}
} catch (IOException e) {
Log.e(Constants.TAG, "encountered IOException while modifying key", e);
Timber.e(e, "encountered IOException while modifying key");
log.add(LogType.MSG_MF_ERROR_ENCODE, indent+1);
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
} catch (PGPException e) {
Log.e(Constants.TAG, "encountered pgp error while modifying key", e);
Timber.e(e, "encountered pgp error while modifying key");
log.add(LogType.MSG_MF_ERROR_PGP, indent+1);
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
} catch (SignatureException e) {
Log.e(Constants.TAG, "encountered SignatureException while modifying key", e);
Timber.e(e, "encountered SignatureException while modifying key");
log.add(LogType.MSG_MF_ERROR_SIG, indent+1);
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
}

View file

@ -72,9 +72,12 @@ import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.ProgressScaler;
import timber.log.Timber;
import static java.lang.String.format;
/**
* This class supports a single, low-level, sign/encrypt operation.
@ -98,7 +101,7 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
try {
NEW_LINE = "\r\n".getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
Timber.e(e, "UnsupportedEncodingException");
}
}
@ -186,7 +189,7 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
compressionAlgorithm = PgpSecurityConstants.DEFAULT_COMPRESSION_ALGORITHM;
}
Log.d(Constants.TAG, data.toString());
Timber.d(data.toString());
ArmoredOutputStream armorOut = null;
OutputStream out;
@ -576,7 +579,7 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
}
opTime = System.currentTimeMillis() - startTime;
Log.d(Constants.TAG, "sign/encrypt time taken: " + String.format("%.2f", opTime / 1000.0) + "s");
Timber.d("sign/encrypt time taken: " + format("%.2f", opTime / 1000.0) + "s");
// closing outputs
// NOTE: closing needs to be done in the correct order!
@ -635,7 +638,7 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
// construct micalg parameter according to https://tools.ietf.org/html/rfc3156#section-5
result.setMicAlgDigestName("pgp-" + digestName.toLowerCase());
} catch (PGPException e) {
Log.e(Constants.TAG, "error setting micalg parameter!", e);
Timber.e(e, "error setting micalg parameter!");
}
}
return result;

View file

@ -41,7 +41,7 @@ import org.sufficientlysecure.keychain.pgp.SecurityProblem.KeySecurityProblem;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/** This class is used to track the state of a single signature verification.
@ -172,7 +172,7 @@ class PgpSignatureChecker {
onePassSignature = sigList.get(i);
return;
} catch (KeyWritableRepository.NotFoundException e) {
Log.d(Constants.TAG, "key not found, trying next signature...");
Timber.d("key not found, trying next signature...");
}
}
}
@ -195,7 +195,7 @@ class PgpSignatureChecker {
signature = sigList.get(i);
return;
} catch (KeyWritableRepository.NotFoundException e) {
Log.d(Constants.TAG, "key not found, trying next signature...");
Timber.d("key not found, trying next signature...");
}
}
}

View file

@ -67,8 +67,9 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult.Operat
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Utf8Util;
import timber.log.Timber;
/** Wrapper around PGPKeyRing class, to be constructed from bytes.
*
@ -217,10 +218,9 @@ public class UncachedKeyRing {
// go through all objects in this block
Object obj;
while ((obj = mObjectFactory.nextObject()) != null) {
Log.d(Constants.TAG, "Found class: " + obj.getClass());
Timber.d("Found class: " + obj.getClass());
if (!(obj instanceof PGPKeyRing)) {
Log.i(Constants.TAG,
"Skipping object of bad type " + obj.getClass().getName() + " in stream");
Timber.i("Skipping object of bad type " + obj.getClass().getName() + " in stream");
// skip object
continue;
}

View file

@ -17,6 +17,14 @@
package org.sufficientlysecure.keychain.pgp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import org.bouncycastle.bcpg.ECPublicBCPGKey;
import org.bouncycastle.bcpg.SignatureSubpacketTags;
import org.bouncycastle.openpgp.PGPPublicKey;
@ -26,15 +34,8 @@ import org.bouncycastle.openpgp.PGPUserAttributeSubpacketVector;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Utf8Util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import timber.log.Timber;
public class UncachedPublicKey {
protected final PGPPublicKey mPublicKey;
@ -374,7 +375,7 @@ public class UncachedPublicKey {
long valid = mPublicKey.getValidSeconds();
if (valid > Integer.MAX_VALUE) {
Log.e(Constants.TAG, "error, expiry time too large");
Timber.e("error, expiry time too large");
return null;
}
if (valid == 0) {

View file

@ -33,7 +33,7 @@ import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
import java.util.ArrayList;
@ -103,7 +103,7 @@ public class WrappedSignature {
}
} catch (PGPException e) {
// no matter
Log.e(Constants.TAG, "exception reading embedded signatures", e);
Timber.e(e, "exception reading embedded signatures");
}
return sigs;
}
@ -229,11 +229,11 @@ public class WrappedSignature {
PGPSignatureList signatures = null;
try {
if ((signatures = (PGPSignatureList) factory.nextObject()) == null || signatures.isEmpty()) {
Log.e(Constants.TAG, "No signatures given!");
Timber.e("No signatures given!");
return null;
}
} catch (IOException e) {
Log.e(Constants.TAG, "Error while converting to PGPSignature!", e);
Timber.e(e, "Error while converting to PGPSignature!");
return null;
}

View file

@ -20,14 +20,14 @@ package org.sufficientlysecure.keychain.provider;
import android.net.Uri;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/** This implementation of KeyRing provides a cached view of PublicKeyRing
* objects based on database queries exclusively.
@ -77,7 +77,7 @@ public class CachedPublicKeyRing extends KeyRing {
return Long.parseLong(firstSegment);
} catch (NumberFormatException e) {
// didn't work? oh well.
Log.d(Constants.TAG, "Couldn't get masterKeyId from URI, querying...");
Timber.d("Couldn't get masterKeyId from URI, querying...");
}
return getMasterKeyId();
}

View file

@ -28,10 +28,8 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.util.Log;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
@ -43,6 +41,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRingData;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UpdatedKeys;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
import timber.log.Timber;
public class KeyRepository {
@ -339,7 +338,7 @@ public class KeyRepository {
try {
data = mLocalPublicKeyStorage.readPublicKey(masterKeyId);
} catch (IOException e) {
Log.e(Constants.TAG, "Error reading public key from storage!", e);
Timber.e(e, "Error reading public key from storage!");
throw new NotFoundException();
}
}

View file

@ -38,7 +38,6 @@ import android.support.annotation.VisibleForTesting;
import android.support.v4.util.LongSparseArray;
import org.openintents.openpgp.util.OpenPgpUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
@ -67,9 +66,10 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UpdatedKeys;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.Utf8Util;
import timber.log.Timber;
/**
* This class contains high level methods for database access. Despite its
@ -514,7 +514,7 @@ public class KeyWritableRepository extends KeyRepository {
} catch (IOException e) {
log(LogType.MSG_IP_ERROR_IO_EXC);
Log.e(Constants.TAG, "IOException during import", e);
Timber.e(e, "IOException during import");
return SaveKeyringResult.RESULT_ERROR;
} finally {
mIndent -= 1;
@ -544,11 +544,11 @@ public class KeyWritableRepository extends KeyRepository {
} catch (RemoteException e) {
log(LogType.MSG_IP_ERROR_REMOTE_EX);
Log.e(Constants.TAG, "RemoteException during import", e);
Timber.e(e, "RemoteException during import");
return SaveKeyringResult.RESULT_ERROR;
} catch (OperationApplicationException e) {
log(LogType.MSG_IP_ERROR_OP_EXC);
Log.e(Constants.TAG, "OperationApplicationException during import", e);
Timber.e(e, "OperationApplicationException during import");
return SaveKeyringResult.RESULT_ERROR;
}
@ -602,7 +602,7 @@ public class KeyWritableRepository extends KeyRepository {
try {
mLocalPublicKeyStorage.deletePublicKey(masterKeyId);
} catch (IOException e) {
android.util.Log.e(Constants.TAG, "Could not delete file!", e);
Timber.e(e, "Could not delete file!");
return false;
}
mContentResolver.delete(ApiAutocryptPeer.buildByMasterKeyId(masterKeyId),null, null);
@ -671,7 +671,7 @@ public class KeyWritableRepository extends KeyRepository {
return SaveKeyringResult.RESULT_ERROR;
}
} catch (IOException e) {
Log.e(Constants.TAG, "Failed to encode key!", e);
Timber.e(e, "Failed to encode key!");
log(LogType.MSG_IS_ERROR_IO_EXC);
return SaveKeyringResult.RESULT_ERROR;
}
@ -1068,7 +1068,7 @@ public class KeyWritableRepository extends KeyRepository {
log.add(result, 1);
progress.setProgress(processedKeys++, totalKeys);
} catch (NotFoundException | PgpGeneralException | IOException e) {
Log.e(Constants.TAG, "Error updating trust database", e);
Timber.e(e, "Error updating trust database");
return new UpdateTrustResult(UpdateTrustResult.RESULT_ERROR, log);
}
}

View file

@ -40,8 +40,8 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeysColumns;
import org.sufficientlysecure.keychain.provider.KeychainContract.OverriddenWarnings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UpdatedKeysColumns;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPacketsColumns;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
/**
@ -215,7 +215,7 @@ public class KeychainDatabase extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
Log.w(Constants.TAG, "Creating database...");
Timber.w("Creating database...");
db.execSQL(CREATE_KEYRINGS_PUBLIC);
db.execSQL(CREATE_KEYRINGS_SECRET);
@ -249,7 +249,7 @@ public class KeychainDatabase extends SQLiteOpenHelper {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.d(Constants.TAG, "Upgrading db from " + oldVersion + " to " + newVersion);
Timber.d("Upgrading db from " + oldVersion + " to " + newVersion);
switch (oldVersion) {
case 1:

View file

@ -50,7 +50,10 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UpdatedKeys;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPacketsColumns;
import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import static android.database.DatabaseUtils.dumpCursorToString;
public class KeychainProvider extends ContentProvider {
@ -296,7 +299,7 @@ public class KeychainProvider extends ContentProvider {
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
Log.v(Constants.TAG, "query(uri=" + uri + ", proj=" + Arrays.toString(projection) + ")");
Timber.v("query(uri=" + uri + ", proj=" + Arrays.toString(projection) + ")");
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
@ -457,7 +460,7 @@ public class KeychainProvider extends ContentProvider {
+ " AND tmp." + Keys.KEY_ID + " = " + subkey + ""
+ ")");
} catch(NumberFormatException e) {
Log.e(Constants.TAG, "Malformed find by subkey query!", e);
Timber.e(e, "Malformed find by subkey query!");
qb.appendWhere(" AND 0");
}
break;
@ -510,7 +513,7 @@ public class KeychainProvider extends ContentProvider {
+ ")");
} else {
// TODO better way to do this?
Log.e(Constants.TAG, "Malformed find by email query!");
Timber.e("Malformed find by email query!");
qb.appendWhere(" AND 0");
}
break;
@ -795,11 +798,10 @@ public class KeychainProvider extends ContentProvider {
cursor.setNotificationUri(getContext().getContentResolver(), uri);
}
Log.d(Constants.TAG,
"Query: " + qb.buildQuery(projection, selection, null, null, orderBy, null));
Timber.d("Query: " + qb.buildQuery(projection, selection, null, null, orderBy, null));
if (Constants.DEBUG && Constants.DEBUG_LOG_DB_QUERIES) {
Log.d(Constants.TAG, "Cursor: " + DatabaseUtils.dumpCursorToString(cursor));
Timber.d("Cursor: " + dumpCursorToString(cursor));
}
if (Constants.DEBUG && Constants.DEBUG_EXPLAIN_QUERIES) {
@ -813,14 +815,14 @@ public class KeychainProvider extends ContentProvider {
for (int i = 0; i < explainCursor.getColumnCount(); i++) {
line.append(explainCursor.getColumnName(i)).append(", ");
}
Log.d(Constants.TAG, line.toString());
Timber.d(line.toString());
while (!explainCursor.isAfterLast()) {
line = new StringBuilder();
for (int i = 0; i < explainCursor.getColumnCount(); i++) {
line.append(explainCursor.getString(i)).append(", ");
}
Log.d(Constants.TAG, line.toString());
Timber.d(line.toString());
explainCursor.moveToNext();
}
@ -835,7 +837,7 @@ public class KeychainProvider extends ContentProvider {
*/
@Override
public Uri insert(Uri uri, ContentValues values) {
Log.d(Constants.TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
Timber.d("insert(uri=" + uri + ", values=" + values.toString() + ")");
final SQLiteDatabase db = getDb().getWritableDatabase();
@ -925,7 +927,7 @@ public class KeychainProvider extends ContentProvider {
getContext().getContentResolver().notifyChange(uri, null);
} catch (SQLiteConstraintException e) {
Log.d(Constants.TAG, "Constraint exception on insert! Entry already existing?", e);
Timber.d(e, "Constraint exception on insert! Entry already existing?");
}
return rowUri;
@ -936,7 +938,7 @@ public class KeychainProvider extends ContentProvider {
*/
@Override
public int delete(Uri uri, String additionalSelection, String[] selectionArgs) {
Log.v(Constants.TAG, "delete(uri=" + uri + ")");
Timber.v("delete(uri=" + uri + ")");
final SQLiteDatabase db = getDb().getWritableDatabase();
@ -1028,7 +1030,7 @@ public class KeychainProvider extends ContentProvider {
*/
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
Log.v(Constants.TAG, "update(uri=" + uri + ", values=" + values.toString() + ")");
Timber.v("update(uri=" + uri + ", values=" + values.toString() + ")");
final SQLiteDatabase db = getDb().getWritableDatabase();
ContentResolver contentResolver = getContext().getContentResolver();
@ -1109,7 +1111,7 @@ public class KeychainProvider extends ContentProvider {
contentResolver.notifyChange(uri, null);
} catch (SQLiteConstraintException e) {
Log.d(Constants.TAG, "Constraint exception on update! Entry already existing?", e);
Timber.d(e, "Constraint exception on update! Entry already existing?");
}
return count;

View file

@ -32,7 +32,7 @@ import android.provider.MediaStore;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.DatabaseUtil;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.File;
import java.io.FileNotFoundException;
@ -136,7 +136,7 @@ public class TemporaryFileProvider extends ContentProvider {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.d(Constants.TAG, "Upgrading files db from " + oldVersion + " to " + newVersion);
Timber.d("Upgrading files db from %s to %s", oldVersion, newVersion);
switch (oldVersion) {
case 1:
@ -188,7 +188,7 @@ public class TemporaryFileProvider extends ContentProvider {
try {
file = getFile(uri);
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "file not found!");
Timber.e("file not found!");
return null;
}
@ -253,13 +253,13 @@ public class TemporaryFileProvider extends ContentProvider {
values.put(TemporaryFileColumns.COLUMN_UUID, uuid);
int insert = (int) db.getWritableDatabase().insert(TABLE_FILES, null, values);
if (insert == -1) {
Log.e(Constants.TAG, "Insert failed!");
Timber.e("Insert failed!");
return null;
}
try {
getFile(uuid).createNewFile();
} catch (IOException e) {
Log.e(Constants.TAG, "File creation failed!");
Timber.e("File creation failed!");
return null;
}
return Uri.withAppendedPath(CONTENT_URI, uuid);

View file

@ -34,10 +34,9 @@ import android.os.Binder;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
@ -86,13 +85,13 @@ public class ApiPermissionHelper {
return null;
} else {
String packageName = getCurrentCallingPackage();
Log.d(Constants.TAG, "isAllowed packageName: " + packageName);
Timber.d("isAllowed packageName: " + packageName);
byte[] packageCertificate;
try {
packageCertificate = getPackageCertificate(packageName);
} catch (NameNotFoundException e) {
Log.e(Constants.TAG, "Should not happen, returning!", e);
Timber.e(e, "Should not happen, returning!");
// return error
Intent result = new Intent();
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
@ -100,7 +99,7 @@ public class ApiPermissionHelper {
new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage()));
return result;
}
Log.e(Constants.TAG, "Not allowed to use service! return PendingIntent for registration!");
Timber.e("Not allowed to use service! return PendingIntent for registration!");
PendingIntent pi = piFactory.createRegisterPendingIntent(data, packageName, packageCertificate);
@ -112,7 +111,7 @@ public class ApiPermissionHelper {
return result;
}
} catch (WrongPackageCertificateException e) {
Log.e(Constants.TAG, "wrong signature!", e);
Timber.e(e, "wrong signature!");
PendingIntent pi = piFactory.createErrorPendingIntent(data, mContext.getString(R.string.api_error_wrong_signature));
@ -159,7 +158,7 @@ public class ApiPermissionHelper {
// No plans to support sharedUserIds due to many bugs connected to them:
// http://java-hamster.blogspot.de/2010/05/androids-shareduserid.html
String currentPkg = callingPackages[0];
Log.d(Constants.TAG, "currentPkg: " + currentPkg);
Timber.d("currentPkg: " + currentPkg);
return currentPkg;
}
@ -187,7 +186,7 @@ public class ApiPermissionHelper {
}
}
Log.e(Constants.TAG, "Uid is NOT allowed!");
Timber.e("Uid is NOT allowed!");
return false;
}
@ -197,16 +196,16 @@ public class ApiPermissionHelper {
* @throws WrongPackageCertificateException
*/
public boolean isPackageAllowed(String packageName) throws WrongPackageCertificateException {
Log.d(Constants.TAG, "isPackageAllowed packageName: " + packageName);
Timber.d("isPackageAllowed packageName: " + packageName);
byte[] storedPackageCert = mApiDao.getApiAppCertificate(packageName);
boolean isKnownPackage = storedPackageCert != null;
if (!isKnownPackage) {
Log.d(Constants.TAG, "Package is NOT allowed! packageName: " + packageName);
Timber.d("Package is NOT allowed! packageName: " + packageName);
return false;
}
Log.d(Constants.TAG, "Package is allowed! packageName: " + packageName);
Timber.d("Package is allowed! packageName: " + packageName);
byte[] currentPackageCert;
try {
@ -217,7 +216,7 @@ public class ApiPermissionHelper {
boolean packageCertMatchesStored = Arrays.equals(currentPackageCert, storedPackageCert);
if (packageCertMatchesStored) {
Log.d(Constants.TAG,"Package certificate matches expected.");
Timber.d("Package certificate matches expected.");
return true;
}

View file

@ -32,7 +32,7 @@ import android.os.RemoteException;
import org.openintents.openpgp.util.OpenPgpApi;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@ -158,7 +158,7 @@ public class CryptoInputParcelCacheService extends Service {
case MSG_GET_NOT_FOUND:
throw new InputParcelNotFound();
default:
Log.e(Constants.TAG, "timeout!");
Timber.e("timeout!");
throw new InputParcelNotFound("should not happen!");
}
}
@ -206,19 +206,19 @@ public class CryptoInputParcelCacheService extends Service {
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoInputParcelCacheService: Sending message failed", e);
Timber.e(e, "CryptoInputParcelCacheService: Sending message failed");
}
break;
}
default: {
Log.e(Constants.TAG, "CryptoInputParcelCacheService: Intent or Intent Action not supported!");
Timber.e("CryptoInputParcelCacheService: Intent or Intent Action not supported!");
break;
}
}
if (mCache.size() <= 0) {
// stop whole service if cache is empty
Log.d(Constants.TAG, "CryptoInputParcelCacheService: No passphrases remaining in memory, stopping service!");
Timber.d("CryptoInputParcelCacheService: No passphrases remaining in memory, stopping service!");
stopSelf();
}
@ -229,13 +229,13 @@ public class CryptoInputParcelCacheService extends Service {
public void onCreate() {
super.onCreate();
mContext = this;
Log.d(Constants.TAG, "CryptoInputParcelCacheService, onCreate()");
Timber.d("CryptoInputParcelCacheService, onCreate()");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(Constants.TAG, "CryptoInputParcelCacheService, onDestroy()");
Timber.d("CryptoInputParcelCacheService, onDestroy()");
}
@Override

View file

@ -54,7 +54,8 @@ import org.sufficientlysecure.keychain.provider.KeychainExternalContract.Autocry
import org.sufficientlysecure.keychain.provider.KeychainExternalContract.EmailStatus;
import org.sufficientlysecure.keychain.provider.SimpleContentResolverInterface;
import org.sufficientlysecure.keychain.util.CloseDatabaseCursorFactory;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class KeychainExternalProvider extends ContentProvider implements SimpleContentResolverInterface {
private static final int EMAIL_STATUS = 101;
@ -135,7 +136,7 @@ public class KeychainExternalProvider extends ContentProvider implements SimpleC
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
Log.v(Constants.TAG, "query(uri=" + uri + ", proj=" + Arrays.toString(projection) + ")");
Timber.v("query(uri=" + uri + ", proj=" + Arrays.toString(projection) + ")");
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
@ -349,8 +350,7 @@ public class KeychainExternalProvider extends ContentProvider implements SimpleC
}
}
Log.d(Constants.TAG,
"Query: " + qb.buildQuery(projection, selection, groupBy, null, orderBy, null));
Timber.d("Query: " + qb.buildQuery(projection, selection, groupBy, null, orderBy, null));
return cursor;
}

View file

@ -81,8 +81,9 @@ import org.sufficientlysecure.keychain.service.BackupKeyringParcel;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
public class OpenPgpService extends Service {
public static final int API_VERSION_WITH_KEY_INVALID_INSECURE = 8;
@ -193,7 +194,7 @@ public class OpenPgpService extends Service {
throw new Exception(getString(errorMsg.mType.getMsgId()));
}
} catch (Exception e) {
Log.d(Constants.TAG, "signImpl", e);
Timber.d(e, "signImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -296,7 +297,7 @@ public class OpenPgpService extends Service {
throw new Exception(getString(errorMsg.mType.getMsgId()));
}
} catch (Exception e) {
Log.d(Constants.TAG, "encryptAndSignImpl", e);
Timber.d(e, "encryptAndSignImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -446,7 +447,7 @@ public class OpenPgpService extends Service {
}
} catch (Exception e) {
Log.e(Constants.TAG, "decryptAndVerifyImpl", e);
Timber.e(e, "decryptAndVerifyImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -486,7 +487,7 @@ public class OpenPgpService extends Service {
if (autocryptPeerUpdate.hasKeyData()) {
UncachedKeyRing uncachedKeyRing = UncachedKeyRing.decodeFromData(autocryptPeerUpdate.getKeyData());
if (uncachedKeyRing.isSecret()) {
Log.e(Constants.TAG, "Found secret key in autocrypt id! - Ignoring");
Timber.e("Found secret key in autocrypt id! - Ignoring");
return null;
}
// this will merge if the key already exists - no worries!
@ -669,7 +670,7 @@ public class OpenPgpService extends Service {
try {
outputStream.close();
} catch (IOException e) {
Log.e(Constants.TAG, "IOException when closing OutputStream", e);
Timber.e(e, "IOException when closing OutputStream");
}
}
}
@ -689,7 +690,7 @@ public class OpenPgpService extends Service {
return result;
}
} catch (Exception e) {
Log.d(Constants.TAG, "getKeyImpl", e);
Timber.d(e, "getKeyImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -776,7 +777,7 @@ public class OpenPgpService extends Service {
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, errorMsg);
}
} catch (Exception e) {
Log.d(Constants.TAG, "backupImpl", e);
Timber.d(e, "backupImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -797,7 +798,7 @@ public class OpenPgpService extends Service {
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS);
return result;
} catch (Exception e) {
Log.d(Constants.TAG, "exception in updateAutocryptPeerImpl", e);
Timber.d(e, "exception in updateAutocryptPeerImpl");
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
}
}
@ -870,7 +871,8 @@ public class OpenPgpService extends Service {
private final IOpenPgpService.Stub mBinder = new IOpenPgpService.Stub() {
@Override
public Intent execute(Intent data, ParcelFileDescriptor input, ParcelFileDescriptor output) {
Log.w(Constants.TAG, "You are using a deprecated service which may lead to truncated data on return, please use IOpenPgpService2!");
Timber.w(
"You are using a deprecated service which may lead to truncated data on return, please use IOpenPgpService2!");
return executeInternal(data, input, output);
}
@ -900,14 +902,14 @@ public class OpenPgpService extends Service {
try {
inputStream.close();
} catch (IOException e) {
Log.e(Constants.TAG, "IOException when closing input ParcelFileDescriptor", e);
Timber.e(e, "IOException when closing input ParcelFileDescriptor");
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
Log.e(Constants.TAG, "IOException when closing output ParcelFileDescriptor", e);
Timber.e(e, "IOException when closing output ParcelFileDescriptor");
}
}
}
@ -943,7 +945,8 @@ public class OpenPgpService extends Service {
}
case OpenPgpApi.ACTION_SIGN: {
// DEPRECATED: same as ACTION_CLEARTEXT_SIGN
Log.w(Constants.TAG, "You are using a deprecated API call, please use ACTION_CLEARTEXT_SIGN instead of ACTION_SIGN!");
Timber.w(
"You are using a deprecated API call, please use ACTION_CLEARTEXT_SIGN instead of ACTION_SIGN!");
return signImpl(data, inputStream, outputStream, true);
}
case OpenPgpApi.ACTION_DETACHED_SIGN: {

View file

@ -23,8 +23,7 @@ import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import org.openintents.openpgp.IOpenPgpService2;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
import java.util.HashMap;
@ -48,7 +47,7 @@ public class OpenPgpService2 extends OpenPgpService {
mOutputPipeMap.put(createKey(outputPipeId), pipe[1]);
return pipe[0];
} catch (IOException e) {
Log.e(Constants.TAG, "IOException in OpenPgpService2", e);
Timber.e(e, "IOException in OpenPgpService2");
return null;
}

View file

@ -31,12 +31,11 @@ import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import org.openintents.openpgp.util.OpenPgpApi;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAutocryptPeer;
import org.sufficientlysecure.keychain.provider.KeychainExternalContract;
import org.sufficientlysecure.keychain.provider.KeychainExternalContract.AutocryptStatus;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
class OpenPgpServiceKeyIdExtractor {
@ -158,7 +157,7 @@ class OpenPgpServiceKeyIdExtractor {
}
if (userIdEntries.size() != encryptionAddresses.length) {
Log.e(Constants.TAG, "Number of rows doesn't match number of retrieved rows! Probably a bug?");
Timber.e("Number of rows doesn't match number of retrieved rows! Probably a bug?");
}
allKeysConfirmed = !anyKeyNotVerified;

View file

@ -48,6 +48,7 @@ import org.sufficientlysecure.keychain.ssh.AuthenticationOperation;
import org.sufficientlysecure.keychain.ssh.AuthenticationParcel;
import org.sufficientlysecure.keychain.ssh.AuthenticationResult;
import org.sufficientlysecure.keychain.ssh.signature.SshSignatureConverter;
import timber.log.Timber;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
@ -412,7 +413,7 @@ public class SshAuthenticationService extends Service {
}
private Intent createErrorResult(int errorCode, String errorMessage) {
Log.e(TAG, errorMessage);
Timber.e(errorMessage);
Intent result = new Intent();
result.putExtra(SshAuthenticationApi.EXTRA_ERROR, new SshAuthenticationApiError(errorCode, errorMessage));
result.putExtra(SshAuthenticationApi.EXTRA_RESULT_CODE, SshAuthenticationApi.RESULT_CODE_ERROR);

View file

@ -35,7 +35,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
@ -43,7 +42,8 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.remote.AppSettings;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.ui.dialog.AdvancedAppSettingsDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class AppSettingsActivity extends BaseActivity {
private Uri mAppUri;
@ -82,12 +82,12 @@ public class AppSettingsActivity extends BaseActivity {
Intent intent = getIntent();
mAppUri = intent.getData();
if (mAppUri == null) {
Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!");
Timber.e("Intent data missing. Should be Uri of app!");
finish();
return;
}
Log.d(Constants.TAG, "uri: " + mAppUri);
Timber.d("uri: %s", mAppUri);
loadData(savedInstanceState, mAppUri);
}
@ -142,7 +142,7 @@ public class AppSettingsActivity extends BaseActivity {
byte[] digest = md.digest();
certificate = new String(Hex.encode(digest));
} catch (NoSuchAlgorithmException e) {
Log.e(Constants.TAG, "Should not happen!", e);
Timber.e(e, "Should not happen!");
}
AdvancedAppSettingsDialogFragment dialogFragment =
@ -163,7 +163,7 @@ public class AppSettingsActivity extends BaseActivity {
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
} catch (PackageManager.NameNotFoundException e) {
Log.e(Constants.TAG, "startApp", e);
Timber.e(e, "startApp");
}
}
@ -187,7 +187,7 @@ public class AppSettingsActivity extends BaseActivity {
mAppIconView.setImageDrawable(appIcon);
Uri allowedKeysUri = appUri.buildUpon().appendPath(KeychainContract.PATH_ALLOWED_KEYS).build();
Log.d(Constants.TAG, "allowedKeysUri: " + allowedKeysUri);
Timber.d("allowedKeysUri: " + allowedKeysUri);
startListFragments(savedInstanceState, allowedKeysUri);
}

View file

@ -33,7 +33,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ListFragmentWorkaround;
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
@ -41,7 +40,8 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter;
import org.sufficientlysecure.keychain.ui.adapter.KeySelectableAdapter;
import org.sufficientlysecure.keychain.ui.widget.FixedListView;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class AppSettingsAllowedKeysListFragment extends ListFragmentWorkaround implements LoaderManager.LoaderCallbacks<Cursor> {
private static final String ARG_DATA_URI = "uri";
@ -143,7 +143,7 @@ public class AppSettingsAllowedKeysListFragment extends ListFragmentWorkaround i
try {
mApiDao.saveAllowedKeyIdsForApp(mDataUri, getSelectedMasterKeyIds());
} catch (RemoteException | OperationApplicationException e) {
Log.e(Constants.TAG, "Problem saving allowed key ids!", e);
Timber.e(e, "Problem saving allowed key ids!");
}
}

View file

@ -30,10 +30,9 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.remote.AppSettings;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -100,7 +99,7 @@ public class AppSettingsHeaderFragment extends Fragment {
mPackageCertificate.setText(signature);
} catch (NoSuchAlgorithmException e) {
Log.e(Constants.TAG, "Should not happen!", e);
Timber.e(e, "Should not happen!");
}
}

View file

@ -41,11 +41,11 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiApps;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class AppsListFragment extends ListFragment implements
LoaderManager.LoaderCallbacks<Cursor>, OnItemClickListener {
@ -106,7 +106,7 @@ public class AppsListFragment extends ListFragment implements
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
} catch (PackageManager.NameNotFoundException e) {
Log.e(Constants.TAG, "startApp", e);
Timber.e(e, "startApp");
}
}
} else {
@ -326,7 +326,7 @@ public class AppsListFragment extends ListFragment implements
ImageView installIcon = (ImageView) view.findViewById(R.id.api_apps_adapter_install_icon);
String packageName = cursor.getString(INDEX_PACKAGE_NAME);
Log.d(Constants.TAG, "packageName: " + packageName);
Timber.d("packageName: " + packageName);
int installed = cursor.getInt(INDEX_INSTALLED);
String name = cursor.getString(INDEX_NAME);
int iconResName = cursor.getInt(INDEX_ICON_RES_ID);

View file

@ -25,11 +25,10 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
import org.sufficientlysecure.keychain.remote.AppSettings;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
class RemoteRegisterPresenter {
@ -61,7 +60,7 @@ class RemoteRegisterPresenter {
try {
setPackageInfo(packageName);
} catch (NameNotFoundException e) {
Log.e(Constants.TAG, "Unable to find info of calling app!");
Timber.e("Unable to find info of calling app!");
view.finishAsCancelled();
return;
}

View file

@ -26,7 +26,6 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import org.openintents.openpgp.util.OpenPgpUtils.UserId;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
@ -37,7 +36,7 @@ import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper;
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper.WrongPackageCertificateException;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
class RequestKeyPermissionPresenter {
@ -83,7 +82,7 @@ class RequestKeyPermissionPresenter {
try {
setPackageInfo(packageName);
} catch (NameNotFoundException e) {
Log.e(Constants.TAG, "Unable to find info of calling app!");
Timber.e("Unable to find info of calling app!");
view.finishAsCancelled();
return;
}

View file

@ -25,14 +25,12 @@ import android.view.View;
import android.widget.TextView;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class SelectSignKeyIdActivity extends BaseActivity {
@ -74,10 +72,10 @@ public class SelectSignKeyIdActivity extends BaseActivity {
mPreferredUserId = intent.getStringExtra(EXTRA_USER_ID);
mData = intent.getParcelableExtra(EXTRA_DATA);
if (appUri == null) {
Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!");
Timber.e("Intent data missing. Should be Uri of app!");
finish();
} else {
Log.d(Constants.TAG, "uri: " + appUri);
Timber.d("uri: " + appUri);
startListFragments(savedInstanceState, appUri, mData, mPreferredUserId);
}
}
@ -123,7 +121,7 @@ public class SelectSignKeyIdActivity extends BaseActivity {
// EditKeyResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
// mSelectKeySpinner.setSelectedKeyId(result.mMasterKeyId);
} else {
Log.e(Constants.TAG, "missing result!");
Timber.e("missing result!");
}
}
break;

View file

@ -30,7 +30,6 @@ import android.support.v7.widget.LinearLayoutManager;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
@ -40,7 +39,8 @@ import org.sufficientlysecure.keychain.remote.ui.adapter.SelectSignKeyAdapter;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity;
import org.sufficientlysecure.keychain.ui.util.adapter.CursorAdapter;
import org.sufficientlysecure.keychain.ui.base.RecyclerFragment;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class SelectSignKeyIdListFragment extends RecyclerFragment<SelectSignKeyAdapter>
implements SelectSignKeyAdapter.SelectSignKeyListener, LoaderManager.LoaderCallbacks<Cursor> {
@ -182,8 +182,8 @@ public class SelectSignKeyIdListFragment extends RecyclerFragment<SelectSignKeyA
mApiDao.addAllowedKeyIdForApp(allowedKeysUri, masterKeyId);
mResult.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, masterKeyId);
Log.d(Constants.TAG, "allowedKeyId: " + masterKeyId);
Log.d(Constants.TAG, "allowedKeysUri: " + allowedKeysUri);
Timber.d("allowedKeyId: " + masterKeyId);
Timber.d("allowedKeysUri: " + allowedKeysUri);
getActivity().setResult(Activity.RESULT_OK, mResult);
getActivity().finish();

View file

@ -30,12 +30,11 @@ import android.support.v4.app.LoaderManager;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.provider.AutocryptPeerDataAccessObject;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.remote.ui.dialog.KeyLoader.KeyInfo;
import org.sufficientlysecure.keychain.remote.ui.dialog.KeyLoader.KeySelector;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
class RemoteDeduplicatePresenter implements LoaderCallbacks<List<KeyInfo>> {
@ -68,7 +67,7 @@ class RemoteDeduplicatePresenter implements LoaderCallbacks<List<KeyInfo>> {
try {
setPackageInfo(packageName);
} catch (NameNotFoundException e) {
Log.e(Constants.TAG, "Unable to find info of calling app!");
Timber.e("Unable to find info of calling app!");
view.finishAsCancelled();
return;
}
@ -113,11 +112,11 @@ class RemoteDeduplicatePresenter implements LoaderCallbacks<List<KeyInfo>> {
void onClickSelect() {
if (keyInfoData == null) {
Log.e(Constants.TAG, "got click on select with no data…?");
Timber.e("got click on select with no data…?");
return;
}
if (selectedItem == null) {
Log.e(Constants.TAG, "got click on select with no selection…?");
Timber.e("got click on select with no selection…?");
return;
}

View file

@ -28,11 +28,10 @@ import android.support.v4.app.LoaderManager;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.remote.ui.dialog.KeyLoader.KeyInfo;
import org.sufficientlysecure.keychain.remote.ui.dialog.KeyLoader.KeySelector;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.util.List;
@ -64,7 +63,7 @@ class RemoteSelectAuthenticationKeyPresenter implements LoaderCallbacks<List<Key
try {
setPackageInfo(packageName);
} catch (NameNotFoundException e) {
Log.e(Constants.TAG, "Unable to find info of calling app!");
Timber.e("Unable to find info of calling app!");
view.finishAsCancelled();
}
}
@ -103,11 +102,11 @@ class RemoteSelectAuthenticationKeyPresenter implements LoaderCallbacks<List<Key
void onClickSelect() {
if (keyInfoData == null) {
Log.e(Constants.TAG, "got click on select with no data…?");
Timber.e("got click on select with no data…?");
return;
}
if (selectedItem == null) {
Log.e(Constants.TAG, "got click on select with no selection…?");
Timber.e("got click on select with no selection…?");
return;
}

View file

@ -17,10 +17,7 @@
package org.sufficientlysecure.keychain.securitytoken;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransportException;
import org.sufficientlysecure.keychain.util.Log;
import java.nio.ByteBuffer;
import java.util.Arrays;

View file

@ -31,6 +31,10 @@ import java.io.IOException;
import nordpol.IsoCard;
import nordpol.android.AndroidCard;
import timber.log.Timber;
import static org.bouncycastle.util.encoders.Hex.toHexString;
public class NfcTransport implements Transport {
// timeout is set to 100 seconds to avoid cancellation during calculation
@ -60,12 +64,12 @@ public class NfcTransport implements Transport {
public ResponseApdu transceive(final CommandApdu data) throws IOException {
byte[] rawCommand = data.toBytes();
if (Constants.DEBUG) {
Log.d(Constants.TAG, "nfc out: " + Hex.toHexString(rawCommand));
Timber.d("nfc out: " + toHexString(rawCommand));
}
byte[] rawResponse = mIsoCard.transceive(rawCommand);
if (Constants.DEBUG) {
Log.d(Constants.TAG, "nfc in: " + Hex.toHexString(rawResponse));
Timber.d("nfc in: " + toHexString(rawResponse));
}
return ResponseApdu.fromBytes(rawResponse);

View file

@ -27,11 +27,10 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType;
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TransportType;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
/**
@ -256,7 +255,7 @@ public class SecurityTokenConnection {
secureMessaging = SCP11bSecureMessaging.establish(this, context, commandFactory);
} catch (SecureMessagingException e) {
secureMessaging = null;
Log.e(Constants.TAG, "failed to establish secure messaging", e);
Timber.e(e, "failed to establish secure messaging");
}
}
@ -427,7 +426,7 @@ public class SecurityTokenConnection {
// Note: This should not happen, but happens with
// https://github.com/FluffyKaon/OpenPGP-Card, thus return an empty string for now!
Log.e(Constants.TAG, "Couldn't get holder name, returning empty string!", e);
Timber.e(e, "Couldn't get holder name, returning empty string!");
return "";
}
}

View file

@ -25,10 +25,10 @@ import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransport;
import org.sufficientlysecure.keychain.ui.UsbEventReceiverActivity;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class UsbConnectionDispatcher {
private Activity mActivity;
@ -50,7 +50,7 @@ public class UsbConnectionDispatcher {
boolean permission = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,
false);
if (permission) {
Log.d(Constants.TAG, "Got permission for " + usbDevice.getDeviceName());
Timber.d("Got permission for " + usbDevice.getDeviceName());
sendUsbTransportDiscovered(usbDevice);
}
break;

View file

@ -28,16 +28,14 @@ import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.bcpg.HashAlgorithmTags;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.CardException;
import org.sufficientlysecure.keychain.securitytoken.CommandApdu;
import org.sufficientlysecure.keychain.securitytoken.KeyFormat;
import org.sufficientlysecure.keychain.securitytoken.KeyType;
import org.sufficientlysecure.keychain.securitytoken.OpenPgpCapabilities;
import org.sufficientlysecure.keychain.securitytoken.RSAKeyFormat;
import org.sufficientlysecure.keychain.securitytoken.ResponseApdu;
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenConnection;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class SecurityTokenPsoSignTokenOp {
@ -54,7 +52,7 @@ public class SecurityTokenPsoSignTokenOp {
private byte[] prepareDsi(byte[] hash, int hashAlgo) throws IOException {
byte[] dsi;
Log.i(Constants.TAG, "Hash: " + hashAlgo);
Timber.i("Hash: " + hashAlgo);
switch (hashAlgo) {
case HashAlgorithmTags.SHA1:
if (hash.length != 20) {

View file

@ -27,13 +27,13 @@ import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.util.Log;
import com.google.auto.value.AutoValue;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransportException.UsbCcidErrorException;
import timber.log.Timber;
import static org.bouncycastle.util.encoders.Hex.toHexString;
public class CcidTransceiver {
@ -87,14 +87,14 @@ public class CcidTransceiver {
CcidDataBlock response = null;
for (CcidDescription.Voltage v : usbCcidDescription.getVoltages()) {
Log.v(Constants.TAG, "CCID: attempting to power on with voltage " + v.toString());
Timber.v("CCID: attempting to power on with voltage " + v.toString());
try {
response = iccPowerOnVoltage(v.powerOnValue);
} catch (UsbCcidErrorException e) {
if (e.getErrorResponse().getError() == 7) { // Power select error
Log.v(Constants.TAG, "CCID: failed to power on with voltage " + v.toString());
Timber.v("CCID: failed to power on with voltage " + v.toString());
iccPowerOff();
Log.v(Constants.TAG, "CCID: powered off");
Timber.v("CCID: powered off");
continue;
}
@ -109,8 +109,8 @@ public class CcidTransceiver {
long elapsedTime = SystemClock.elapsedRealtime() - startTime;
Log.d(Constants.TAG, "Usb transport connected, took " + elapsedTime + "ms, ATR=" +
Hex.toHexString(response.getData()));
Timber.d("Usb transport connected, took " + elapsedTime + "ms, ATR=" +
toHexString(response.getData()));
return response;
}
@ -176,7 +176,7 @@ public class CcidTransceiver {
CcidDataBlock ccidDataBlock = receiveDataBlock(sequenceNumber);
long elapsedTime = SystemClock.elapsedRealtime() - startTime;
Log.d(Constants.TAG, "USB XferBlock call took " + elapsedTime + "ms");
Timber.d("USB XferBlock call took " + elapsedTime + "ms");
return ccidDataBlock;
}
@ -187,8 +187,7 @@ public class CcidTransceiver {
ignoredBytes = usbConnection.bulkTransfer(
usbBulkIn, inputBuffer, inputBuffer.length, DEVICE_SKIP_TIMEOUT_MILLIS);
if (ignoredBytes > 0) {
Log.e(Constants.TAG,
"Skipped " + ignoredBytes + " bytes: " + Hex.toHexString(inputBuffer, 0, ignoredBytes));
Timber.e("Skipped " + ignoredBytes + " bytes: " + toHexString(inputBuffer, 0, ignoredBytes));
}
} while (ignoredBytes > 0);
}

View file

@ -31,7 +31,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Pair;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.CommandApdu;
import org.sufficientlysecure.keychain.securitytoken.ResponseApdu;
@ -39,8 +38,10 @@ import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo;
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType;
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TransportType;
import org.sufficientlysecure.keychain.securitytoken.Transport;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import static org.bouncycastle.util.encoders.Hex.toHexString;
/**
@ -98,7 +99,7 @@ public class UsbTransport implements Transport {
usbConnection = null;
}
Log.d(Constants.TAG, "Usb transport disconnected");
Timber.d("Usb transport disconnected");
}
/**
@ -158,7 +159,7 @@ public class UsbTransport implements Transport {
}
CcidDescription ccidDescription = CcidDescription.fromRawDescriptors(usbConnection.getRawDescriptors());
Log.d(Constants.TAG, "CCID Description: " + ccidDescription);
Timber.d("CCID Description: " + ccidDescription);
CcidTransceiver transceiver = new CcidTransceiver(usbConnection, usbBulkIn, usbBulkOut, ccidDescription);
ccidTransportProtocol = ccidDescription.getSuitableTransportProtocol();
@ -175,12 +176,12 @@ public class UsbTransport implements Transport {
public ResponseApdu transceive(CommandApdu data) throws UsbTransportException {
byte[] rawCommand = data.toBytes();
if (Constants.DEBUG) {
Log.d(Constants.TAG, "USB >> " + Hex.toHexString(rawCommand));
Timber.d("USB >> " + toHexString(rawCommand));
}
byte[] rawResponse = ccidTransportProtocol.transceive(rawCommand);
if (Constants.DEBUG) {
Log.d(Constants.TAG, "USB << " + Hex.toHexString(rawResponse));
Timber.d("USB << " + toHexString(rawResponse));
}
return ResponseApdu.fromBytes(rawResponse);
@ -252,7 +253,7 @@ public class UsbTransport implements Transport {
}
}
Log.d(Constants.TAG, "Unknown USB token. Vendor ID: " + usbDevice.getVendorId() + ", Product ID: " +
Timber.d("Unknown USB token. Vendor ID: " + usbDevice.getVendorId() + ", Product ID: " +
usbDevice.getProductId());
return null;
}

View file

@ -21,12 +21,12 @@ package org.sufficientlysecure.keychain.securitytoken.usb.tpdu;
import android.support.annotation.NonNull;
import org.bouncycastle.util.Arrays;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver;
import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver.CcidDataBlock;
import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransportProtocol;
import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransportException;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/* T=1 Protocol, see http://www.icedev.se/proxmark3/docs/ISO-7816.pdf, Part 11 */
public class T1TpduProtocol implements CcidTransportProtocol {
@ -94,10 +94,10 @@ public class T1TpduProtocol implements CcidTransportProtocol {
sentLength += len;
if (responseBlock instanceof SBlock) {
Log.d(Constants.TAG, "S-Block received " + responseBlock);
Timber.d("S-Block received " + responseBlock);
// just ignore
} else if (responseBlock instanceof RBlock) {
Log.d(Constants.TAG, "R-Block received " + responseBlock);
Timber.d("R-Block received " + responseBlock);
if (((RBlock) responseBlock).getError() != RBlock.RError.NO_ERROR) {
throw new UsbTransportException("R-Block reports error " + ((RBlock) responseBlock).getError());
}
@ -123,7 +123,7 @@ public class T1TpduProtocol implements CcidTransportProtocol {
Block responseBlock = blockFactory.fromBytes(response.getData());
if (!(responseBlock instanceof IBlock)) {
Log.e(Constants.TAG, "Invalid response block received " + responseBlock);
Timber.e("Invalid response block received " + responseBlock);
throw new UsbTransportException("Response: invalid state - invalid block received");
}

View file

@ -41,7 +41,8 @@ import org.sufficientlysecure.keychain.KeychainApplication;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.SettingsActivity;
import org.sufficientlysecure.keychain.util.ContactHelper;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class ContactSyncAdapterService extends Service {
@ -58,7 +59,7 @@ public class ContactSyncAdapterService extends Service {
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
final SyncResult syncResult) {
Log.d(Constants.TAG, "Performing a contact sync!");
Timber.d("Performing a contact sync!");
new ContactHelper(ContactSyncAdapterService.this).writeKeysToContacts();

View file

@ -30,9 +30,9 @@ import android.os.IBinder;
import android.os.Message;
import android.widget.Toast;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
* This service actually does nothing, it's sole task is to show a Toast if the use tries to create an account.
@ -75,7 +75,7 @@ public class DummyAccountService extends Service {
@Override
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
Log.d(Constants.TAG, "DummyAccountService.editProperties");
Timber.d("DummyAccountService.editProperties");
return null;
}
@ -84,41 +84,41 @@ public class DummyAccountService extends Service {
String[] requiredFeatures, Bundle options) throws NetworkErrorException {
response.onResult(new Bundle());
toaster.toast(R.string.account_no_manual_account_creation);
Log.d(Constants.TAG, "DummyAccountService.addAccount");
Timber.d("DummyAccountService.addAccount");
return null;
}
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options)
throws NetworkErrorException {
Log.d(Constants.TAG, "DummyAccountService.confirmCredentials");
Timber.d("DummyAccountService.confirmCredentials");
return null;
}
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType,
Bundle options) throws NetworkErrorException {
Log.d(Constants.TAG, "DummyAccountService.getAuthToken");
Timber.d("DummyAccountService.getAuthToken");
return null;
}
@Override
public String getAuthTokenLabel(String authTokenType) {
Log.d(Constants.TAG, "DummyAccountService.getAuthTokenLabel");
Timber.d("DummyAccountService.getAuthTokenLabel");
return null;
}
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType,
Bundle options) throws NetworkErrorException {
Log.d(Constants.TAG, "DummyAccountService.updateCredentials");
Timber.d("DummyAccountService.updateCredentials");
return null;
}
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features)
throws NetworkErrorException {
Log.d(Constants.TAG, "DummyAccountService.hasFeatures");
Timber.d("DummyAccountService.hasFeatures");
return null;
}
}

View file

@ -29,7 +29,6 @@ import android.os.Messenger;
import android.os.Parcelable;
import android.os.RemoteException;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.operations.BackupOperation;
import org.sufficientlysecure.keychain.operations.BaseOperation;
import org.sufficientlysecure.keychain.operations.BenchmarkOperation;
@ -52,7 +51,8 @@ import org.sufficientlysecure.keychain.pgp.SignEncryptParcel;
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
/**
* This Service contains all important long lasting operations for OpenKeychain. It receives Intents with
@ -172,9 +172,9 @@ public class KeychainService extends Service implements Progressable {
try {
mMessenger.get().send(msg);
} catch (RemoteException e) {
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
Timber.w(e, "Exception sending message, Is handler present?");
} catch (NullPointerException e) {
Log.w(Constants.TAG, "Messenger is null!", e);
Timber.w(e, "Messenger is null!");
}
}
@ -193,7 +193,7 @@ public class KeychainService extends Service implements Progressable {
*/
@Override
public void setProgress(String message, int progress, int max) {
Log.d(Constants.TAG, "Send message by setProgress with progress=" + progress + ", max="
Timber.d("Send message by setProgress with progress=" + progress + ", max="
+ max);
Bundle data = new Bundle();

View file

@ -66,9 +66,10 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class KeyserverSyncAdapterService extends Service {
@ -215,7 +216,7 @@ public class KeyserverSyncAdapterService extends Service {
return;
}
}
Log.d(Constants.TAG, "Performing a keyserver sync!");
Timber.d("Performing a keyserver sync!");
PowerManager pm = (PowerManager) KeyserverSyncAdapterService.this
.getSystemService(Context.POWER_SERVICE);
@SuppressWarnings("deprecation") // our min is API 15, deprecated only in 20
@ -249,7 +250,7 @@ public class KeyserverSyncAdapterService extends Service {
*/
private void handleUpdateResult(ImportKeyResult result, final int startId) {
if (result.isPending()) {
Log.d(Constants.TAG, "Orbot required for sync but not running, attempting to start");
Timber.d("Orbot required for sync but not running, attempting to start");
// result is pending due to Orbot not being started
// try to start it silently, if disabled show notifications
new OrbotHelper.SilentStartManager() {
@ -275,13 +276,13 @@ public class KeyserverSyncAdapterService extends Service {
// if we're killed before we get a response from Orbot, we need the intent to be
// redelivered, so no stopSelf(int) here
} else if (isUpdateCancelled()) {
Log.d(Constants.TAG, "Keyserver sync cancelled, postponing by" + SYNC_POSTPONE_TIME
Timber.d("Keyserver sync cancelled, postponing by" + SYNC_POSTPONE_TIME
+ "ms");
postponeSync();
// postponeSync creates a new intent, so we don't need this to be redelivered
stopSelf(startId);
} else {
Log.d(Constants.TAG, "Keyserver sync completed: Updated: " + result.mUpdatedKeys
Timber.d("Keyserver sync completed: Updated: " + result.mUpdatedKeys
+ " Failed: " + result.mBadKeys);
// key sync completed successfully, we can stop
stopSelf(startId);
@ -337,7 +338,7 @@ public class KeyserverSyncAdapterService extends Service {
private ImportKeyResult directUpdate(Context context, ArrayList<ParcelableKeyRing> keyList,
CryptoInputParcel cryptoInputParcel) {
Log.d(Constants.TAG, "Starting normal update");
Timber.d("Starting normal update");
ImportOperation importOp = new ImportOperation(context,
KeyWritableRepository.create(context), null);
return importOp.execute(
@ -356,7 +357,7 @@ public class KeyserverSyncAdapterService extends Service {
*/
private ImportKeyResult staggeredUpdate(Context context, ArrayList<ParcelableKeyRing> keyList,
CryptoInputParcel cryptoInputParcel) {
Log.d(Constants.TAG, "Starting staggered update");
Timber.d("Starting staggered update");
// final int WEEK_IN_SECONDS = (int) TimeUnit.DAYS.toSeconds(7);
// we are limiting our randomness to ORBOT_CIRCUIT_TIMEOUT_SECONDS for now
final int WEEK_IN_SECONDS = 0;
@ -383,11 +384,11 @@ public class KeyserverSyncAdapterService extends Service {
first = false;
}
Log.d(Constants.TAG, "Updating key with a wait time of " + waitTime + "s");
Timber.d("Updating key with a wait time of " + waitTime + "s");
try {
Thread.sleep(waitTime * 1000);
} catch (InterruptedException e) {
Log.e(Constants.TAG, "Exception during sleep between key updates", e);
Timber.e(e, "Exception during sleep between key updates");
// skip this one
continue;
}
@ -445,7 +446,7 @@ public class KeyserverSyncAdapterService extends Service {
ArrayList<Long> ignoreMasterKeyIds = new ArrayList<>();
while (updatedKeysCursor != null && updatedKeysCursor.moveToNext()) {
long masterKeyId = updatedKeysCursor.getLong(INDEX_UPDATED_KEYS_MASTER_KEY_ID);
Log.d(Constants.TAG, "Keyserver sync: Ignoring {" + masterKeyId + "} last updated at {"
Timber.d("Keyserver sync: Ignoring {" + masterKeyId + "} last updated at {"
+ updatedKeysCursor.getLong(INDEX_LAST_UPDATED) + "}s");
ignoreMasterKeyIds.add(masterKeyId);
}
@ -477,7 +478,7 @@ public class KeyserverSyncAdapterService extends Service {
if (ignoreMasterKeyIds.contains(keyId)) {
continue;
}
Log.d(Constants.TAG, "Keyserver sync: Updating {" + keyId + "}");
Timber.d("Keyserver sync: Updating {" + keyId + "}");
byte[] fingerprint = keyCursor.getBlob(INDEX_FINGERPRINT);
String hexKeyId = KeyFormattingUtils.convertKeyIdToHex(keyId);
// we aren't updating from keybase as of now

View file

@ -42,9 +42,9 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.util.Date;
@ -122,7 +122,7 @@ public class PassphraseCacheService extends Service {
Passphrase passphrase,
String primaryUserId,
int timeToLiveSeconds) {
Log.d(Constants.TAG, "PassphraseCacheService.addCachedPassphrase() for " + masterKeyId);
Timber.d("PassphraseCacheService.addCachedPassphrase() for " + masterKeyId);
Intent intent = new Intent(context, PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
@ -137,7 +137,7 @@ public class PassphraseCacheService extends Service {
}
public static void clearCachedPassphrase(Context context, long masterKeyId, long subKeyId) {
Log.d(Constants.TAG, "PassphraseCacheService.clearCachedPassphrase() for " + masterKeyId);
Timber.d("PassphraseCacheService.clearCachedPassphrase() for " + masterKeyId);
Intent intent = new Intent(context, PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
@ -149,7 +149,7 @@ public class PassphraseCacheService extends Service {
}
public static void clearCachedPassphrases(Context context) {
Log.d(Constants.TAG, "PassphraseCacheService.clearCachedPassphrase()");
Timber.d("PassphraseCacheService.clearCachedPassphrase()");
Intent intent = new Intent(context, PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
@ -164,7 +164,7 @@ public class PassphraseCacheService extends Service {
* @return passphrase or null (if no passphrase is cached for this keyId)
*/
public static Passphrase getCachedPassphrase(Context context, long masterKeyId, long subKeyId) throws KeyNotFoundException {
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphrase() for masterKeyId "
Timber.d("PassphraseCacheService.getCachedPassphrase() for masterKeyId "
+ masterKeyId + ", subKeyId " + subKeyId);
Intent intent = new Intent(context, PassphraseCacheService.class);
@ -216,7 +216,7 @@ public class PassphraseCacheService extends Service {
case MSG_PASSPHRASE_CACHE_GET_KEY_NOT_FOUND:
throw new KeyNotFoundException();
default:
Log.e(Constants.TAG, "timeout case!");
Timber.e("timeout case!");
throw new KeyNotFoundException("should not happen!");
}
}
@ -232,7 +232,7 @@ public class PassphraseCacheService extends Service {
// passphrase for symmetric encryption?
if (masterKeyId == Constants.key.symmetric) {
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphraseImpl() for symmetric encryption");
Timber.d("PassphraseCacheService.getCachedPassphraseImpl() for symmetric encryption");
CachedPassphrase cachedPassphrase = mPassphraseCache.get(Constants.key.symmetric);
if (cachedPassphrase == null) {
return null;
@ -241,7 +241,7 @@ public class PassphraseCacheService extends Service {
}
// try to get master key id which is used as an identifier for cached passphrases
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphraseImpl() for masterKeyId "
Timber.d("PassphraseCacheService.getCachedPassphraseImpl() for masterKeyId "
+ masterKeyId + ", subKeyId " + subKeyId);
// get the type of key (from the database)
@ -263,13 +263,13 @@ public class PassphraseCacheService extends Service {
// If we cache strictly by subkey, exit early
if (Preferences.getPreferences(mContext).getPassphraseCacheSubs()) {
Log.d(Constants.TAG, "PassphraseCacheService: specific subkey passphrase not (yet) cached, returning null");
Timber.d("PassphraseCacheService: specific subkey passphrase not (yet) cached, returning null");
// not really an error, just means the passphrase is not cached but not empty either
return null;
}
if (subKeyId == masterKeyId) {
Log.d(Constants.TAG, "PassphraseCacheService: masterkey passphrase not (yet) cached, returning null");
Timber.d("PassphraseCacheService: masterkey passphrase not (yet) cached, returning null");
// not really an error, just means the passphrase is not cached but not empty either
return null;
}
@ -277,7 +277,7 @@ public class PassphraseCacheService extends Service {
cachedPassphrase = mPassphraseCache.get(masterKeyId);
// If we cache strictly by subkey, exit early
if (cachedPassphrase == null) {
Log.d(Constants.TAG, "PassphraseCacheService: keyring passphrase not (yet) cached, returning null");
Timber.d("PassphraseCacheService: keyring passphrase not (yet) cached, returning null");
// not really an error, just means the passphrase is not cached but not empty either
return null;
}
@ -299,7 +299,7 @@ public class PassphraseCacheService extends Service {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(Constants.TAG, "PassphraseCacheService: Received broadcast...");
Timber.d("PassphraseCacheService: Received broadcast...");
if (action.equals(BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE)) {
long keyId = intent.getLongExtra(EXTRA_KEY_ID, -1);
@ -335,7 +335,7 @@ public class PassphraseCacheService extends Service {
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(Constants.TAG, "PassphraseCacheService.onStartCommand()");
Timber.d("PassphraseCacheService.onStartCommand()");
if (intent == null || intent.getAction() == null) {
updateService();
@ -352,10 +352,10 @@ public class PassphraseCacheService extends Service {
Passphrase passphrase = intent.getParcelableExtra(EXTRA_PASSPHRASE);
String primaryUserID = intent.getStringExtra(EXTRA_USER_ID);
Log.d(Constants.TAG,
Timber.d(
"PassphraseCacheService: Received ACTION_PASSPHRASE_CACHE_ADD intent in onStartCommand() with masterkeyId: "
+ masterKeyId + ", subKeyId: " + subKeyId + ", ttl: " + timeoutTtl + ", usrId: " + primaryUserID
);
+ masterKeyId + ", subKeyId: " + subKeyId + ", ttl: " + timeoutTtl + ", usrId: " +
primaryUserID);
// if we don't cache by specific subkey id, or the requested subkey is the master key,
// just add master key id to the cache, otherwise, add this specific subkey to the cache
@ -389,7 +389,7 @@ public class PassphraseCacheService extends Service {
try {
// If only one of these is symmetric, error out!
if (masterKeyId == Constants.key.symmetric ^ subKeyId == Constants.key.symmetric) {
Log.e(Constants.TAG, "PassphraseCacheService: Bad request, missing masterKeyId or subKeyId!");
Timber.e("PassphraseCacheService: Bad request, missing masterKeyId or subKeyId!");
msg.what = MSG_PASSPHRASE_CACHE_GET_KEY_NOT_FOUND;
} else {
Passphrase passphrase = getCachedPassphraseImpl(masterKeyId, subKeyId);
@ -399,14 +399,14 @@ public class PassphraseCacheService extends Service {
msg.setData(bundle);
}
} catch (KeyRepository.NotFoundException e) {
Log.e(Constants.TAG, "PassphraseCacheService: Passphrase for unknown key was requested!");
Timber.e("PassphraseCacheService: Passphrase for unknown key was requested!");
msg.what = MSG_PASSPHRASE_CACHE_GET_KEY_NOT_FOUND;
}
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.e(Constants.TAG, "PassphraseCacheService: Sending message failed", e);
Timber.e(e, "PassphraseCacheService: Sending message failed");
}
break;
}
@ -440,7 +440,7 @@ public class PassphraseCacheService extends Service {
break;
}
default: {
Log.e(Constants.TAG, "PassphraseCacheService: Intent or Intent Action not supported!");
Timber.e("PassphraseCacheService: Intent or Intent Action not supported!");
break;
}
}
@ -463,7 +463,7 @@ public class PassphraseCacheService extends Service {
mPassphraseCache.remove(keyId);
}
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
Timber.d("PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
updateService();
}
@ -481,7 +481,7 @@ public class PassphraseCacheService extends Service {
i += 1;
}
Log.d(Constants.TAG, "PassphraseCacheService Removing all cached-until-lock passphrases from memory!");
Timber.d("PassphraseCacheService Removing all cached-until-lock passphrases from memory!");
updateService();
}
@ -491,7 +491,7 @@ public class PassphraseCacheService extends Service {
startForeground(Constants.Notification.PASSPHRASE_CACHE, getNotification());
} else {
// stop whole service if no cached passphrases remaining
Log.d(Constants.TAG, "PassphraseCacheService: No passphrases remaining in memory, stopping service!");
Timber.d("PassphraseCacheService: No passphrases remaining in memory, stopping service!");
stopForeground(true);
stopSelf();
}
@ -544,7 +544,7 @@ public class PassphraseCacheService extends Service {
public void onCreate() {
super.onCreate();
mContext = this;
Log.d(Constants.TAG, "PassphraseCacheService, onCreate()");
Timber.d("PassphraseCacheService, onCreate()");
registerReceiver();
}
@ -552,7 +552,7 @@ public class PassphraseCacheService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
Log.d(Constants.TAG, "PassphraseCacheService, onDestroy()");
Timber.d("PassphraseCacheService, onDestroy()");
unregisterReceiver(mIntentReceiver);
}

View file

@ -25,11 +25,11 @@ import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class ServiceProgressHandler extends Handler {
@ -144,7 +144,7 @@ public class ServiceProgressHandler extends Handler {
break;
default:
Log.e(Constants.TAG, "unknown handler message!");
Timber.e("unknown handler message!");
break;
}
}

View file

@ -33,11 +33,14 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
import java.util.Collection;
import static java.lang.String.format;
/**
* This class supports a single, low-level, authentication operation.
* <p/>
@ -83,7 +86,7 @@ public class AuthenticationOperation extends BaseOperation<AuthenticationParcel>
log.add(LogType.MSG_AUTH, indent);
indent += 1;
Log.d(TAG, data.toString());
Timber.d(data.toString());
long opTime;
long startTime = System.currentTimeMillis();
@ -231,7 +234,7 @@ public class AuthenticationOperation extends BaseOperation<AuthenticationParcel>
}
opTime = System.currentTimeMillis() - startTime;
Log.d(TAG, "Authentication operation duration : " + String.format("%.2f", opTime / 1000.0) + "s");
Timber.d("Authentication operation duration : " + format("%.2f", opTime / 1000.0) + "s");
log.add(LogType.MSG_AUTH_OK, indent);
AuthenticationResult result = new AuthenticationResult(AuthenticationResult.RESULT_OK, log);

View file

@ -21,10 +21,10 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class CertifyFingerprintActivity extends BaseActivity {
@ -36,7 +36,7 @@ public class CertifyFingerprintActivity extends BaseActivity {
mDataUri = getIntent().getData();
if (mDataUri == null) {
Log.e(Constants.TAG, "Data missing. Should be uri of key!");
Timber.e("Data missing. Should be uri of key!");
finish();
return;
}
@ -48,7 +48,7 @@ public class CertifyFingerprintActivity extends BaseActivity {
}
});
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
Timber.i("mDataUri: " + mDataUri.toString());
startFragment(savedInstanceState, mDataUri);
}

View file

@ -18,11 +18,8 @@
package org.sufficientlysecure.keychain.ui;
import java.io.IOException;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
@ -33,14 +30,13 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.ui.base.LoaderFragment;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class CertifyFingerprintFragment extends LoaderFragment implements
@ -106,7 +102,7 @@ public class CertifyFingerprintFragment extends LoaderFragment implements
Uri dataUri = getArguments().getParcelable(ARG_DATA_URI);
if (dataUri == null) {
Log.e(Constants.TAG, "Data missing. Should be Uri of key!");
Timber.e("Data missing. Should be Uri of key!");
getActivity().finish();
return;
}
@ -117,7 +113,7 @@ public class CertifyFingerprintFragment extends LoaderFragment implements
private void loadData(Uri dataUri) {
mDataUri = dataUri;
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
Timber.i("mDataUri: " + mDataUri.toString());
// Prepare the loaders. Either re-connect with an existing ones,
// or start new ones.
@ -187,7 +183,7 @@ public class CertifyFingerprintFragment extends LoaderFragment implements
.getCachedPublicKeyRing(dataUri)
.extractOrGetMasterKeyId();
} catch (PgpKeyNotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
Timber.e(e, "key not found!");
}
Intent certifyIntent = new Intent(getActivity(), CertifyKeyActivity.class);
certifyIntent.putExtras(getActivity().getIntent());

View file

@ -46,8 +46,9 @@ import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class CertifyKeyFragment
extends CachingCryptoOperationFragment<CertifyActionsParcel, CertifyResult> {
@ -75,7 +76,7 @@ public class CertifyKeyFragment
mCertifyKeySpinner.setPreSelectedKeyId(certifyKeyId);
}
} catch (PgpKeyNotFoundException e) {
Log.e(Constants.TAG, "certify certify check failed", e);
Timber.e(e, "certify certify check failed");
}
}
}

View file

@ -52,10 +52,10 @@ import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.util.Date;
import java.util.Iterator;
@ -435,7 +435,7 @@ public class CreateKeyFinalFragment extends Fragment {
try {
builder = SaveKeyringParcel.buildChangeKeyringParcel(key.getMasterKeyId(), key.getFingerprint());
} catch (PgpKeyNotFoundException e) {
Log.e(Constants.TAG, "Key that should be moved to Security Token not found in database!");
Timber.e("Key that should be moved to Security Token not found in database!");
return;
}

View file

@ -32,12 +32,12 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
import org.sufficientlysecure.keychain.ui.transfer.view.TransferFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class CreateKeyStartFragment extends Fragment {
public static final int REQUEST_CODE_IMPORT_KEY = 0x00007012;
@ -149,7 +149,7 @@ public class CreateKeyStartFragment extends Fragment {
}
}
} else {
Log.e(Constants.TAG, "No valid request code!");
Timber.e("No valid request code!");
}
}

View file

@ -60,6 +60,8 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public abstract class DecryptFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
@ -424,7 +426,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
int result = mSignatureResult.getResult();
if (result != OpenPgpSignatureResult.RESULT_KEY_MISSING
&& result != OpenPgpSignatureResult.RESULT_INVALID_SIGNATURE) {
Log.e(Constants.TAG, "got missing status for non-missing key, shouldn't happen!");
Timber.e("got missing status for non-missing key, shouldn't happen!");
}
String userId = mSignatureResult.getPrimaryUserId();

View file

@ -95,9 +95,9 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableHashMap;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
/**
@ -321,7 +321,7 @@ public class DecryptListFragment
FileHelper.copyUriData(activity, decryptedFileUri, saveUri);
Notify.create(activity, R.string.file_saved, Style.OK).show();
} catch (IOException e) {
Log.e(Constants.TAG, "error saving file", e);
Timber.e(e, "error saving file");
Notify.create(activity, R.string.error_saving_file, Style.ERROR).show();
}
}
@ -631,7 +631,7 @@ public class DecryptListFragment
mCurrentInputUri = mPendingInputUris.remove(0);
}
Log.d(Constants.TAG, "mCurrentInputUri=" + mCurrentInputUri);
Timber.d("mCurrentInputUri=" + mCurrentInputUri);
if (!checkAndRequestReadPermission(activity, mCurrentInputUri)) {
return null;
@ -825,7 +825,7 @@ public class DecryptListFragment
Notify.create(activity, R.string.file_delete_none, Style.WARN).show();
}
} catch (Exception e) {
Log.e(Constants.TAG, "exception deleting file", e);
Timber.e(e, "exception deleting file");
Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show();
}

View file

@ -33,7 +33,6 @@ import android.widget.AdapterView;
import android.widget.Spinner;
import android.widget.TextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
@ -47,7 +46,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.util.Date;
import java.util.HashMap;
@ -111,9 +110,8 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
showRevokeDeleteDialog(name);
}
} catch (KeyRepository.NotFoundException e) {
Log.e(Constants.TAG,
"Secret key to delete not found at DeleteKeyDialogActivity for "
+ mMasterKeyIds[0], e);
Timber.e(e, "Secret key to delete not found at DeleteKeyDialogActivity for "
+ mMasterKeyIds[0]);
finish();
}
} else {

View file

@ -20,10 +20,10 @@ package org.sufficientlysecure.keychain.ui;
import android.net.Uri;
import android.os.Bundle;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class EditIdentitiesActivity extends BaseActivity {
@ -33,7 +33,7 @@ public class EditIdentitiesActivity extends BaseActivity {
Uri dataUri = getIntent().getData();
if (dataUri == null) {
Log.e(Constants.TAG, "Either a key Uri or EXTRA_SAVE_KEYRING_PARCEL is required!");
Timber.e("Either a key Uri or EXTRA_SAVE_KEYRING_PARCEL is required!");
finish();
return;
}

View file

@ -62,8 +62,9 @@ import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class EditIdentitiesFragment extends Fragment
implements LoaderManager.LoaderCallbacks<Cursor> {
@ -140,7 +141,7 @@ public class EditIdentitiesFragment extends Fragment
Uri dataUri = getArguments().getParcelable(ARG_DATA_URI);
if (dataUri == null) {
Log.e(Constants.TAG, "Either a key Uri is required!");
Timber.e("Either a key Uri is required!");
getActivity().finish();
return;
}
@ -164,7 +165,7 @@ public class EditIdentitiesFragment extends Fragment
private void loadData(Uri dataUri) {
mDataUri = dataUri;
Log.i(Constants.TAG, "mDataUri: " + mDataUri);
Timber.i("mDataUri: " + mDataUri);
// load the secret key ring. we do verify here that the passphrase is correct, so cached won't do
try {

View file

@ -20,11 +20,11 @@ package org.sufficientlysecure.keychain.ui;
import android.net.Uri;
import android.os.Bundle;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class EditKeyActivity extends BaseActivity {
@ -39,7 +39,7 @@ public class EditKeyActivity extends BaseActivity {
Uri dataUri = getIntent().getData();
SaveKeyringParcel saveKeyringParcel = getIntent().getParcelableExtra(EXTRA_SAVE_KEYRING_PARCEL);
if (dataUri == null && saveKeyringParcel == null) {
Log.e(Constants.TAG, "Either a key Uri or EXTRA_SAVE_KEYRING_PARCEL is required!");
Timber.e("Either a key Uri or EXTRA_SAVE_KEYRING_PARCEL is required!");
finish();
return;
}

View file

@ -38,7 +38,6 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
@ -68,8 +67,9 @@ import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyExpiryDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyringParcel, OperationResult>
implements LoaderManager.LoaderCallbacks<Cursor> {
@ -168,7 +168,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
Uri dataUri = getArguments().getParcelable(ARG_DATA_URI);
SaveKeyringParcel saveKeyringParcel = getArguments().getParcelable(ARG_SAVE_KEYRING_PARCEL);
if (dataUri == null && saveKeyringParcel == null) {
Log.e(Constants.TAG, "Either a key Uri or ARG_SAVE_KEYRING_PARCEL is required!");
Timber.e("Either a key Uri or ARG_SAVE_KEYRING_PARCEL is required!");
getActivity().finish();
return;
}
@ -195,7 +195,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
private void loadData(Uri dataUri) {
mDataUri = dataUri;
Log.i(Constants.TAG, "mDataUri: " + mDataUri);
Timber.i("mDataUri: " + mDataUri);
// load the secret key ring. we do verify here that the passphrase is correct, so cached won't do
try {

View file

@ -76,9 +76,10 @@ import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class EncryptFilesFragment
extends CachingCryptoOperationFragment<SignEncryptParcel, SignEncryptResult> {
@ -901,7 +902,7 @@ public class EncryptFilesFragment
for (Uri inputUri : inputUris) {
ViewModel newModel = new ViewModel(mActivity, inputUri);
if (mDataset.contains(newModel)) {
Log.e(Constants.TAG, "Skipped duplicate " + inputUri);
Timber.e("Skipped duplicate " + inputUri);
} else {
mDataset.add(newModel);
}

View file

@ -44,8 +44,9 @@ import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
import org.sufficientlysecure.keychain.ui.widget.KeySpinner.OnKeyChangedListener;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import timber.log.Timber;
public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
@ -144,7 +145,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
mSignKeySpinner.setPreSelectedKeyId(signatureKeyId);
}
} catch (PgpKeyNotFoundException e) {
Log.e(Constants.TAG, "key not found for signing!", e);
Timber.e(e, "key not found for signing!");
Notify.create(getActivity(), getString(R.string.error_preselect_sign_key,
KeyFormattingUtils.beautifyKeyId(signatureKeyId)),
Style.ERROR).show();
@ -158,7 +159,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
mKeyRepository.getCanonicalizedPublicKeyRing(preselectedId);
mEncryptKeyView.addObject(new KeyItem(ring));
} catch (NotFoundException e) {
Log.e(Constants.TAG, "key not found for encryption!", e);
Timber.e(e, "key not found for encryption!");
Notify.create(getActivity(), getString(R.string.error_preselect_encrypt_key,
KeyFormattingUtils.beautifyKeyId(preselectedId)),
Style.ERROR).show();

View file

@ -25,6 +25,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.widget.Toast;
import org.apache.james.mime4j.util.MimeUtil;
@ -33,7 +34,8 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
public class EncryptTextActivity extends EncryptActivity {
@ -63,8 +65,6 @@ public class EncryptTextActivity extends EncryptActivity {
// When sending to OpenKeychain Encrypt via share menu
if (Intent.ACTION_SEND.equals(action) && type != null) {
Log.logDebugBundle(extras, "extras");
// When sending to OpenKeychain Encrypt via share menu
if ( ! MimeUtil.isSameMimeType("text/plain", type)) {
Toast.makeText(this, R.string.toast_wrong_mimetype, Toast.LENGTH_LONG).show();

View file

@ -30,9 +30,8 @@ import android.widget.TextView;
import org.markdown4j.Markdown4jProcessor;
import org.sufficientlysecure.htmltextview.HtmlResImageGetter;
import org.sufficientlysecure.htmltextview.HtmlTextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
@ -54,7 +53,7 @@ public class HelpAboutFragment extends Fragment {
getActivity().getResources().openRawResource(R.raw.help_about));
aboutTextView.setHtml(html, new HtmlResImageGetter(aboutTextView));
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
Timber.e(e, "IOException");
}
return view;
@ -73,7 +72,7 @@ public class HelpAboutFragment extends Fragment {
result = String.format("%s (%s)", info.versionName, info.versionCode);
} catch (NameNotFoundException e) {
Log.w(Constants.TAG, "Unable to get application version: " + e.getMessage());
Timber.w("Unable to get application version: " + e.getMessage());
result = "Unable to get application version.";
}

View file

@ -28,8 +28,7 @@ import android.widget.ScrollView;
import org.markdown4j.Markdown4jProcessor;
import org.sufficientlysecure.htmltextview.HtmlResImageGetter;
import org.sufficientlysecure.htmltextview.HtmlTextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
@ -71,7 +70,7 @@ public class HelpMarkdownFragment extends Fragment {
getActivity().getResources().openRawResource(mHtmlFile));
text.setHtml(html, new HtmlResImageGetter(text));
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
Timber.e(e, "IOException");
}
return scroller;

View file

@ -42,9 +42,9 @@ import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.io.IOException;
import java.util.ArrayList;
@ -176,7 +176,7 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
// action: search immediately
startListFragment(null, null, query, null);
} else {
Log.e(Constants.TAG, "Query is empty!");
Timber.e("Query is empty!");
return;
}
} else if (extras.containsKey(EXTRA_FINGERPRINT)) {
@ -193,10 +193,8 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
startListFragment(null, null, query, null);
}
} else {
Log.e(Constants.TAG,
"IMPORT_KEY_FROM_KEYSERVER action needs to contain the 'query', 'key_id', or " +
"'fingerprint' extra!"
);
Timber.e("IMPORT_KEY_FROM_KEYSERVER action needs to contain the 'query', 'key_id', or " +
"'fingerprint' extra!");
return;
}
break;
@ -216,7 +214,7 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
dataUri.getScheme() + "://" + dataUri.getAuthority());
Preferences.CloudSearchPrefs cloudSearchPrefs = new Preferences.CloudSearchPrefs(
true, false, false, keyserver);
Log.d(Constants.TAG, "Using keyserver: " + keyserver);
Timber.d("Using keyserver: " + keyserver);
// process URL to get operation and query
String operation = dataUri.getQueryParameter("op");
@ -352,7 +350,7 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
new ParcelableFileCache<>(this, ImportOperation.CACHE_FILE_NAME);
cache.writeCache(entries.size(), keyRings.iterator());
} catch (IOException e) {
Log.e(Constants.TAG, "Problem writing cache file", e);
Timber.e(e, "Problem writing cache file");
Notify.create(this, "Problem writing cache file!", Notify.Style.ERROR).show();
return;
}

View file

@ -32,7 +32,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
import org.sufficientlysecure.keychain.keyimport.processing.BytesLoaderState;
@ -42,7 +41,7 @@ import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.ui.util.PermissionsUtil;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.io.IOException;
@ -151,7 +150,7 @@ public class ImportKeysFileFragment extends Fragment {
try {
isEncrypted = FileHelper.isEncryptedFile(mActivity, mCurrentUri);
} catch (IOException e) {
Log.e(Constants.TAG, "Error opening file", e);
Timber.e(e, "Error opening file");
Notify.create(mActivity, R.string.error_bad_data, Style.ERROR).show();
return;

View file

@ -43,9 +43,9 @@ import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.transfer.view.TransferFragment;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
import java.util.ArrayList;
import java.util.Locale;
@ -94,11 +94,11 @@ public class ImportKeysProxyActivity extends FragmentActivity
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
handleActionNdefDiscovered(getIntent());
} else {
Log.e(Constants.TAG, "Android Beam not supported by Android < 4.1");
Timber.e("Android Beam not supported by Android < 4.1");
finish();
}
} else {
Log.e(Constants.TAG, "No valid scheme or action given!");
Timber.e("No valid scheme or action given!");
finish();
}
}
@ -123,7 +123,7 @@ public class ImportKeysProxyActivity extends FragmentActivity
resultCode, data);
if (scanResult == null || scanResult.getFormatName() == null) {
Log.e(Constants.TAG, "scanResult or formatName null! Should not happen!");
Timber.e("scanResult or formatName null! Should not happen!");
finish();
return;
}
@ -142,7 +142,7 @@ public class ImportKeysProxyActivity extends FragmentActivity
private void processScannedContent(Uri uri) {
String action = getIntent().getAction();
Log.d(Constants.TAG, "scanned: " + uri);
Timber.d("scanned: " + uri);
// example: pgp+transfer:
if (uri != null && uri.getScheme() != null && uri.getScheme().equalsIgnoreCase(Constants.SKT_SCHEME)) {

View file

@ -68,8 +68,9 @@ import org.sufficientlysecure.keychain.ui.base.RecyclerFragment;
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.FabContainer;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
implements SearchView.OnQueryTextListener,
@ -381,7 +382,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
Notify.create(getActivity(), "Restored debug_backup.db", Notify.Style.OK).show();
getActivity().getContentResolver().notifyChange(KeychainContract.KeyRings.CONTENT_URI, null);
} catch (IOException e) {
Log.e(Constants.TAG, "IO Error", e);
Timber.e(e, "IO Error");
Notify.create(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR).show();
}
return true;
@ -391,7 +392,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
KeychainDatabase.debugBackup(getActivity(), false);
Notify.create(getActivity(), "Backup to debug_backup.db completed", Notify.Style.OK).show();
} catch (IOException e) {
Log.e(Constants.TAG, "IO Error", e);
Timber.e(e, "IO Error");
Notify.create(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR).show();
}
return true;
@ -422,7 +423,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
@Override
public boolean onQueryTextChange(String s) {
Log.d(Constants.TAG, "onQueryTextChange s:" + s);
Timber.d("onQueryTextChange s: %s", s);
// Called when the action bar search text has changed. Update the
// search filter, and restart the loader to do a new query with this
// filter.

View file

@ -32,15 +32,12 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import org.openintents.openpgp.util.OpenPgpUtils;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel;
import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter;
import org.sufficientlysecure.keychain.util.Log;
import timber.log.Timber;
import java.util.ArrayList;
@ -90,7 +87,7 @@ public class MultiUserIdsFragment extends Fragment implements LoaderManager.Load
mPubMasterKeyIds = getActivity().getIntent().getLongArrayExtra(EXTRA_KEY_IDS);
if (mPubMasterKeyIds == null) {
Log.e(Constants.TAG, "List of key ids to certify missing!");
Timber.e("List of key ids to certify missing!");
getActivity().finish();
return;
}
@ -184,7 +181,7 @@ public class MultiUserIdsFragment extends Fragment implements LoaderManager.Load
// Remember for next loop
lastName = name;
Log.d(Constants.TAG, Long.toString(masterKeyId, 16) + (grouped ? "grouped" : "not grouped"));
Timber.d(Long.toString(masterKeyId, 16) + (grouped ? "grouped" : "not grouped"));
if (!subGrouped) {
// 1. This name should NOT be grouped with the previous, so we flush the buffer

Some files were not shown because too many files have changed in this diff Show more