From 136397667a1c740578081a990882a18149a6b686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 29 Jun 2015 14:01:12 +0200 Subject: Force db upgrade on app start --- .../org/sufficientlysecure/keychain/KeychainApplication.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java') 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 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; } } -- cgit v1.2.3