aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
index 138e54f71..0315650eb 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
@@ -50,15 +50,28 @@ import android.os.Bundle;
import android.os.Environment;
public class PgpImportExport {
+
+ public interface KeychainServiceListener{
+ public boolean hasServiceStopped();
+ }
private Context mContext;
private ProgressDialogUpdater mProgress;
+ private KeychainServiceListener mKeychainServiceListener;
+
public PgpImportExport(Context context, ProgressDialogUpdater progress) {
super();
this.mContext = context;
this.mProgress = progress;
}
+ public PgpImportExport(Context context, ProgressDialogUpdater progress, KeychainServiceListener keychainListener){
+ super();
+ this.mContext = context;
+ this.mProgress = progress;
+ this.mKeychainServiceListener = keychainListener;
+ }
+
public void updateProgress(int message, int current, int total) {
if (mProgress != null) {
mProgress.setProgress(message, current, total);
@@ -188,8 +201,10 @@ public class PgpImportExport {
if (secretKeyRing != null) {
secretKeyRing.encode(arOutStream);
}
- // Else if it's a public key get the PGPPublicKeyRing
- // and encode that to the output
+ if(mKeychainServiceListener.hasServiceStopped()==true){
+ arOutStream.close();
+ return null;
+ }
} else {
updateProgress(i * 100 / rowIdsSize, 100);
PGPPublicKeyRing publicKeyRing =
@@ -198,6 +213,11 @@ public class PgpImportExport {
if (publicKeyRing != null) {
publicKeyRing.encode(arOutStream);
}
+
+ if(mKeychainServiceListener.hasServiceStopped() == true){
+ arOutStream.close();
+ return null;
+ }
}
arOutStream.close();