From 19775c399b106149e8906a7482a4b5a4af2ac8fa Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Thu, 19 Mar 2015 20:31:34 +0530 Subject: introduced multi-threading refactored oldKeys to updatedKeys added update all keys, ThreadPoolExecutor used modified CachedThreadPoolExecutor --- .../keychain/util/ParcelableFileCache.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java index 6f9cb277e..5a314ad0b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java @@ -83,10 +83,22 @@ public class ParcelableFileCache { } + /** + * Reads from cache file and deletes it afterward. Convenience function for readCache(boolean). + * @return an IteratorWithSize object containing entries read from the cache file + * @throws IOException + */ public IteratorWithSize readCache() throws IOException { return readCache(true); } + /** + * Reads entries from a cache file and returns an IteratorWithSize object containing the entries + * @param deleteAfterRead if true, the cache file will be deleted after being read + * @return an IteratorWithSize object containing entries read from the cache file + * @throws IOException if cache directory/parcel import file does not exist, or a read error + * occurs + */ public IteratorWithSize readCache(final boolean deleteAfterRead) throws IOException { File cacheDir = mContext.getCacheDir(); -- cgit v1.2.3 From 9f5581463f1b2d07217f59fa32346c786069dbf5 Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Sun, 22 Mar 2015 03:31:13 +0530 Subject: shifted multi-threading to own service added multi-threaded cloud import, restored KeychainIntentService eliminated code duplication in multi-threaded import --- .../org/sufficientlysecure/keychain/util/ExportHelper.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java index 7b164f2b2..7efb7c5af 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java @@ -19,9 +19,7 @@ package org.sufficientlysecure.keychain.util; import android.app.ProgressDialog; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.os.Message; import android.os.Messenger; import android.support.v4.app.FragmentActivity; @@ -29,11 +27,9 @@ import android.support.v4.app.FragmentActivity; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.ExportResult; -import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException; -import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; -import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; -import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment; +import org.sufficientlysecure.keychain.service.ServiceProgressHandler; +import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment; import java.io.File; @@ -102,9 +98,10 @@ public class ExportHelper { intent.putExtra(KeychainIntentService.EXTRA_DATA, data); // Message is received after exporting is done in KeychainIntentService - KeychainIntentServiceHandler exportHandler = new KeychainIntentServiceHandler(mActivity, + ServiceProgressHandler exportHandler = new ServiceProgressHandler(mActivity, mActivity.getString(R.string.progress_exporting), - ProgressDialog.STYLE_HORIZONTAL) { + ProgressDialog.STYLE_HORIZONTAL, + ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) { public void handleMessage(Message message) { // handle messages by standard KeychainIntentServiceHandler first super.handleMessage(message); -- cgit v1.2.3