aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain-API
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-02-21 16:04:05 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2014-02-21 16:04:05 +0100
commit1ed532b6e2cfe10725aa3ad7fdfb8a6da8c9a235 (patch)
treef7995cfbd447847f01c59ef4604d859751ecbd18 /OpenPGP-Keychain-API
parent5d8867260946937498cf9e8d64fea3a9f53d9dd3 (diff)
downloadopen-keychain-1ed532b6e2cfe10725aa3ad7fdfb8a6da8c9a235.tar.gz
open-keychain-1ed532b6e2cfe10725aa3ad7fdfb8a6da8c9a235.tar.bz2
open-keychain-1ed532b6e2cfe10725aa3ad7fdfb8a6da8c9a235.zip
remove logging from library
Diffstat (limited to 'OpenPGP-Keychain-API')
-rw-r--r--OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java11
-rw-r--r--OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpConstants.java1
-rw-r--r--OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java28
-rw-r--r--OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java9
4 files changed, 17 insertions, 32 deletions
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java
index 41cbfec59..f121c345d 100644
--- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java
@@ -18,7 +18,6 @@ package org.openintents.openpgp.util;
import android.content.Context;
import android.os.AsyncTask;
-import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -128,15 +127,7 @@ public class OpenPgpApi {
}
private void executeApiAsync(int operationId, Bundle params, InputStream is, OutputStream os, IOpenPgpCallback callback) {
- OpenPgpAsyncTask task = new OpenPgpAsyncTask(operationId, params, is, os, callback);
-
- // don't serialize async tasks!
- // http://commonsware.com/blog/2012/04/20/asynctask-threading-regression-confirmed.html
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
- } else {
- task.execute((Void[]) null);
- }
+ new OpenPgpAsyncTask(operationId, params, is, os, callback).execute((Void[]) null);
}
private Bundle executeApi(int operationId, Bundle params, InputStream is, OutputStream os) {
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpConstants.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpConstants.java
index 9a2d3c054..263b42aaa 100644
--- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpConstants.java
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpConstants.java
@@ -23,6 +23,7 @@ public class OpenPgpConstants {
public static final int API_VERSION = 1;
public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService";
+
/* Bundle params */
public static final String PARAMS_API_VERSION = "api_version";
// request ASCII Armor for output
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java
index 8e8812faa..c80656c52 100644
--- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java
@@ -23,18 +23,17 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
-import android.util.Log;
public class OpenPgpServiceConnection {
private Context mApplicationContext;
- private IOpenPgpService mService;
private boolean mBound;
- private String mCryptoProviderPackageName;
+ private IOpenPgpService mService;
+ private String mProviderPackageName;
- public OpenPgpServiceConnection(Context context, String cryptoProviderPackageName) {
+ public OpenPgpServiceConnection(Context context, String providerPackageName) {
this.mApplicationContext = context.getApplicationContext();
- this.mCryptoProviderPackageName = cryptoProviderPackageName;
+ this.mProviderPackageName = providerPackageName;
}
public IOpenPgpService getService() {
@@ -45,50 +44,45 @@ public class OpenPgpServiceConnection {
return mBound;
}
- private ServiceConnection mCryptoServiceConnection = new ServiceConnection() {
+ private ServiceConnection mServiceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
mService = IOpenPgpService.Stub.asInterface(service);
- Log.d(OpenPgpConstants.TAG, "connected to service");
mBound = true;
}
public void onServiceDisconnected(ComponentName name) {
mService = null;
- Log.d(OpenPgpConstants.TAG, "disconnected from service");
mBound = false;
}
};
/**
- * If not already bound, bind!
+ * If not already bound, bind to service!
*
* @return
*/
public boolean bindToService() {
- // if not already connected
+ // if not already bound...
if (mService == null && !mBound) {
try {
- Log.d(OpenPgpConstants.TAG, "not bound yet");
-
Intent serviceIntent = new Intent();
serviceIntent.setAction(IOpenPgpService.class.getName());
- serviceIntent.setPackage(mCryptoProviderPackageName);
- mApplicationContext.bindService(serviceIntent, mCryptoServiceConnection,
+ // NOTE: setPackage is very important to restrict the intent to this provider only!
+ serviceIntent.setPackage(mProviderPackageName);
+ mApplicationContext.bindService(serviceIntent, mServiceConnection,
Context.BIND_AUTO_CREATE);
return true;
} catch (Exception e) {
- Log.d(OpenPgpConstants.TAG, "Exception on binding", e);
return false;
}
} else {
- Log.d(OpenPgpConstants.TAG, "already bound");
return true;
}
}
public void unbindFromService() {
- mApplicationContext.unbindService(mCryptoServiceConnection);
+ mApplicationContext.unbindService(mServiceConnection);
}
}
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
index 75d4b8c18..3569caf5b 100644
--- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
@@ -18,7 +18,6 @@
package org.openintents.openpgp.util;
import android.os.ParcelFileDescriptor;
-import android.util.Log;
import java.io.IOException;
import java.io.InputStream;
@@ -82,21 +81,21 @@ public class ParcelFileDescriptorUtil {
}
mOut.flush(); // just to be safe
} catch (IOException e) {
- Log.e(OpenPgpConstants.TAG, "TransferThread" + getId() + ": writing failed", e);
+ //Log.e(OpenPgpConstants.TAG, "TransferThread" + getId() + ": writing failed", e);
} finally {
try {
mIn.close();
} catch (IOException e) {
- Log.e(OpenPgpConstants.TAG, "TransferThread" + getId(), e);
+ //Log.e(OpenPgpConstants.TAG, "TransferThread" + getId(), e);
}
try {
mOut.close();
} catch (IOException e) {
- Log.e(OpenPgpConstants.TAG, "TransferThread" + getId(), e);
+ //Log.e(OpenPgpConstants.TAG, "TransferThread" + getId(), e);
}
}
if (mListener != null) {
- Log.d(OpenPgpConstants.TAG, "TransferThread " + getId() + " finished!");
+ //Log.d(OpenPgpConstants.TAG, "TransferThread " + getId() + " finished!");
mListener.onThreadFinished(this);
}
}