aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-08-28 17:03:15 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2015-08-28 17:03:15 +0200
commit820e183ca76d0f7feb5d7584d5eddcd49a4e7d57 (patch)
tree3b86322e52d2f6589a3cb0e33559f2b862ac79f9
parent3433d1297dc095eaf2a004c761af89aef6ce5dd7 (diff)
downloadopenpgp-api-820e183ca76d0f7feb5d7584d5eddcd49a4e7d57.tar.gz
openpgp-api-820e183ca76d0f7feb5d7584d5eddcd49a4e7d57.tar.bz2
openpgp-api-820e183ca76d0f7feb5d7584d5eddcd49a4e7d57.zip
Fix and improve OpenPgpService2 code
-rw-r--r--example/src/main/java/org/openintents/openpgp/example/OpenPgpApiActivity.java4
-rw-r--r--openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl8
-rw-r--r--openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService2.aidl9
-rw-r--r--openpgp-api/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java9
4 files changed, 19 insertions, 11 deletions
diff --git a/example/src/main/java/org/openintents/openpgp/example/OpenPgpApiActivity.java b/example/src/main/java/org/openintents/openpgp/example/OpenPgpApiActivity.java
index 1c3ab1e..823c202 100644
--- a/example/src/main/java/org/openintents/openpgp/example/OpenPgpApiActivity.java
+++ b/example/src/main/java/org/openintents/openpgp/example/OpenPgpApiActivity.java
@@ -30,7 +30,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
-import org.openintents.openpgp.IOpenPgpService;
+import org.openintents.openpgp.IOpenPgpService2;
import org.openintents.openpgp.OpenPgpDecryptionResult;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult;
@@ -148,7 +148,7 @@ public class OpenPgpApiActivity extends Activity {
providerPackageName,
new OpenPgpServiceConnection.OnBound() {
@Override
- public void onBound(IOpenPgpService service) {
+ public void onBound(IOpenPgpService2 service) {
Log.d(OpenPgpApi.TAG, "onBound!");
}
diff --git a/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl b/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl
index 8fa619b..3689d17 100644
--- a/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl
+++ b/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl
@@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.openintents.openpgp;
interface IOpenPgpService {
- // see OpenPgpApi for documentation
- //DEPRECATED, do NOT use this, data returned from the service through "output" may be truncated
+ /**
+ * do NOT use this, data returned from the service through "output" may be truncated
+ * @deprecated
+ */
Intent execute(in Intent data, in ParcelFileDescriptor input, in ParcelFileDescriptor output);
} \ No newline at end of file
diff --git a/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService2.aidl b/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService2.aidl
index 39c24e5..8aa4dd2 100644
--- a/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService2.aidl
+++ b/openpgp-api/src/main/aidl/org/openintents/openpgp/IOpenPgpService2.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2015 Dominik Schürmann <dominik@dominikschuermann.de>
+ * Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,13 @@ package org.openintents.openpgp;
interface IOpenPgpService2 {
+ /**
+ * see org.openintents.openpgp.util.OpenPgpApi for documentation
+ */
ParcelFileDescriptor createOutputPipe(in int pipeId);
+
+ /**
+ * see org.openintents.openpgp.util.OpenPgpApi for documentation
+ */
Intent execute(in Intent data, in ParcelFileDescriptor input, int pipeId);
}
diff --git a/openpgp-api/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java b/openpgp-api/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
index 461a5ba..931ed84 100644
--- a/openpgp-api/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
+++ b/openpgp-api/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
@@ -18,6 +18,7 @@
package org.openintents.openpgp.util;
import android.os.ParcelFileDescriptor;
+import android.util.Log;
import java.io.IOException;
import java.io.InputStream;
@@ -69,17 +70,15 @@ public class ParcelFileDescriptorUtil {
mOut.write(buf, 0, len);
}
} catch (IOException e) {
- e.printStackTrace();
+ Log.e(OpenPgpApi.TAG, "IOException when writing to out", e);
} finally {
try {
mIn.close();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (IOException ignored) {
}
try {
mOut.close();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (IOException ignored) {
}
}
}