diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-01-31 18:26:20 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-01-31 18:49:00 +0100 |
commit | 5466d1e9802815726d713bca2aeabaff2861519c (patch) | |
tree | bf1c78a542cdcac051e2ab13e19d1005a09ce553 /OpenKeychain | |
parent | 43930ed8f2d890585b5b85cd963d4f564cdb736f (diff) | |
download | open-keychain-5466d1e9802815726d713bca2aeabaff2861519c.tar.gz open-keychain-5466d1e9802815726d713bca2aeabaff2861519c.tar.bz2 open-keychain-5466d1e9802815726d713bca2aeabaff2861519c.zip |
prevent recursive consolidate
Diffstat (limited to 'OpenKeychain')
5 files changed, 11 insertions, 5 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 055028064..af4fcb071 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -520,6 +520,7 @@ public abstract class OperationResult implements Parcelable { MSG_CON_ERROR_PUBLIC (LogLevel.ERROR, R.string.msg_con_error_public), MSG_CON_ERROR_SECRET (LogLevel.ERROR, R.string.msg_con_error_secret), MSG_CON_RECOVER (LogLevel.DEBUG, R.string.msg_con_recover), + MSG_CON_RECURSIVE (LogLevel.OK, R.string.msg_con_recursive), MSG_CON_REIMPORT_PUBLIC (LogLevel.DEBUG, R.plurals.msg_con_reimport_public), MSG_CON_REIMPORT_PUBLIC_SKIP (LogLevel.DEBUG, R.string.msg_con_reimport_public_skip), MSG_CON_REIMPORT_SECRET (LogLevel.DEBUG, R.plurals.msg_con_reimport_secret), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index a229f454f..f23006a94 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -1053,6 +1053,11 @@ public class ProviderHelper { log.add(LogType.MSG_CON, indent); indent += 1; + if (mConsolidateCritical) { + log.add(LogType.MSG_CON_RECURSIVE, indent); + return new ConsolidateResult(ConsolidateResult.RESULT_OK, log); + } + progress.setProgress(R.string.progress_con_saving, 0, 100); // The consolidate operation can never be cancelled! @@ -1219,13 +1224,11 @@ public class ProviderHelper { log.add(LogType.MSG_CON_DB_CLEAR, indent); mContentResolver.delete(KeyRings.buildUnifiedKeyRingsUri(), null, null); - ParcelableFileCache<ParcelableKeyRing> cacheSecret = - new ParcelableFileCache<>(mContext, "consolidate_secret.pcl"); - ParcelableFileCache<ParcelableKeyRing> cachePublic = - new ParcelableFileCache<>(mContext, "consolidate_public.pcl"); + ParcelableFileCache<ParcelableKeyRing> cacheSecret, cachePublic; // Set flag that we have a cached consolidation here try { + cacheSecret = new ParcelableFileCache<>(mContext, "consolidate_secret.pcl"); IteratorWithSize<ParcelableKeyRing> itSecrets = cacheSecret.readCache(false); int numSecrets = itSecrets.getSize(); @@ -1253,6 +1256,7 @@ public class ProviderHelper { try { + cachePublic = new ParcelableFileCache<>(mContext, "consolidate_public.pcl"); IteratorWithSize<ParcelableKeyRing> itPublics = cachePublic.readCache(); int numPublics = itPublics.getSize(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java index 180020d0b..a6d5b02c9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java @@ -131,6 +131,7 @@ public class KeychainIntentServiceHandler extends Handler { case MESSAGE_PREVENT_CANCEL: mProgressDialogFragment.setPreventCancel(true); + break; default: Log.e(Constants.TAG, "unknown handler message!"); 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 5de682fe6..6f9cb277e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableFileCache.java @@ -104,7 +104,6 @@ public class ParcelableFileCache<E extends Parcelable> { throw new IOException(e); } - // yes this is sloppy data flow. WE WOULDN'T NEED THIS WITH TUPLE RETURN TYPES final int numEntries = ois.readInt(); return new IteratorWithSize<E>() { diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 1151644d8..794de34f0 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -886,6 +886,7 @@ <string name="msg_con_error_public">"Error reimporting public keys!"</string> <string name="msg_con_error_secret">"Error reimporting secret keys!"</string> <string name="msg_con_recover">"Resuming consolidation process"</string> + <string name="msg_con_recursive">"Skipping recursive consolidation"</string> <string name="msg_con_recover_unknown">"Resuming consolidation process from unknown state"</string> <plurals name="msg_con_reimport_public"> <item quantity="one">"Reimporting one public key"</item> |