make recreation of views atomic operation

This commit is contained in:
Vincent Breitmoser 2018-07-12 17:38:10 +02:00
parent 00caf28ee2
commit 4f4be8ed47

View file

@ -363,9 +363,15 @@ public class KeychainDatabase {
}
private void recreateUnifiedKeyView(SupportSQLiteDatabase db) {
// noinspection deprecation
db.execSQL("DROP VIEW IF EXISTS " + KeysModel.UNIFIEDKEYVIEW_VIEW_NAME);
db.execSQL(KeysModel.UNIFIEDKEYVIEW);
try {
db.beginTransaction();
// noinspection deprecation
db.execSQL("DROP VIEW IF EXISTS " + KeysModel.UNIFIEDKEYVIEW_VIEW_NAME);
db.execSQL(KeysModel.UNIFIEDKEYVIEW);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
private void migrateSecretKeysFromDbToLocalStorage(SupportSQLiteDatabase db, Context context) throws IOException {