diff options
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 93238349d..23f489d35 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -56,6 +56,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import org.sufficientlysecure.keychain.util.HkpKeyServer; import org.sufficientlysecure.keychain.util.InputData; +import org.sufficientlysecure.keychain.util.KeychainServiceListener; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; @@ -73,7 +74,7 @@ import android.os.RemoteException; * data from the activities or other apps, queues these intents, executes them, and stops itself * after doing them. */ -public class KeychainIntentService extends IntentService implements ProgressDialogUpdater { +public class KeychainIntentService extends IntentService implements ProgressDialogUpdater, KeychainServiceListener { /* extras that can be given by intent */ public static final String EXTRA_MESSENGER = "messenger"; @@ -712,10 +713,15 @@ public class KeychainIntentService extends IntentService implements ProgressDial Bundle resultData; - PgpImportExport pgpImportExport = new PgpImportExport(this, this); + PgpImportExport pgpImportExport = new PgpImportExport(this, this, this); + resultData = pgpImportExport .exportKeyRings(keyRingRowIds, keyType, outStream); + if(mIsCanceled){ + boolean isDeleted = new File(outputFile).delete(); + } + sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData); } catch (Exception e) { sendErrorToHandler(e); @@ -903,4 +909,9 @@ public class KeychainIntentService extends IntentService implements ProgressDial public void setProgress(int progress, int max) { setProgress(null, progress, max); } + + @Override + public boolean hasServiceStopped() { + return mIsCanceled; + } } |