aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
index 8d43c0155..627623f47 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
@@ -33,6 +33,7 @@ import android.provider.ContactsContract;
import android.widget.Toast;
import org.spongycastle.jce.provider.BouncyCastleProvider;
+import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.ConsolidateDialogActivity;
@@ -101,7 +102,10 @@ public class KeychainApplication extends Application {
TemporaryStorageProvider.cleanUp(this);
- checkConsolidateRecovery();
+ if (!checkConsolidateRecovery()) {
+ // force DB upgrade, https://github.com/open-keychain/open-keychain/issues/1334
+ new KeychainDatabase(this).getReadableDatabase().close();
+ }
}
public static HashMap<String,Bitmap> qrCodeCache = new HashMap<>();
@@ -118,12 +122,15 @@ public class KeychainApplication extends Application {
/**
* Restart consolidate process if it has been interruped before
*/
- public void checkConsolidateRecovery() {
+ public boolean checkConsolidateRecovery() {
if (Preferences.getPreferences(this).getCachedConsolidate()) {
Intent consolidateIntent = new Intent(this, ConsolidateDialogActivity.class);
consolidateIntent.putExtra(ConsolidateDialogActivity.EXTRA_CONSOLIDATE_RECOVERY, true);
consolidateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(consolidateIntent);
+ return true;
+ } else {
+ return false;
}
}