Merge "Rename flag wal_db_journalmode" into main am: 9c7503368f

Original change: https://android-review.googlesource.com/c/platform/system/security/+/2843638

Change-Id: I116ca8e1e994b082fbcd25d88cff1db92a19aa2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shaquille Johnson 2023-11-27 16:42:48 +00:00 committed by Automerger Merge Worker
commit e22afc71d6
4 changed files with 10 additions and 2 deletions

View file

@ -1,7 +1,7 @@
package: "android.security.keystore2"
flag {
name: "wal_db_journalmode"
name: "wal_db_journalmode_v2"
namespace: "hardware_backed_security"
description: "This flag controls changing journalmode to wal"
bug: "191777960"

View file

@ -32,6 +32,7 @@ rust_defaults {
"libanyhow",
"libbinder_rs",
"liblog_rust",
"libkeystore2_flags_rust",
"librusqlite",
"librustutils",
"libthiserror",
@ -58,6 +59,7 @@ rust_test {
"libanyhow",
"libbinder_rs",
"libkeystore2",
"libkeystore2_flags_rust",
"libkeystore2_test_utils",
"liblog_rust",
"librusqlite",

View file

@ -46,6 +46,12 @@ impl DB {
conn: Connection::open(db_file).context("Failed to initialize SQLite connection.")?,
};
if keystore2_flags::wal_db_journalmode_v2() {
// Update journal mode to WAL
db.conn
.pragma_update(None, "journal_mode", "WAL")
.context("Failed to connect in WAL mode for persistent db")?;
}
db.init_tables().context("Trying to initialize legacy keystore db.")?;
Ok(db)
}

View file

@ -1036,7 +1036,7 @@ impl KeystoreDB {
break;
}
if keystore2_flags::wal_db_journalmode() {
if keystore2_flags::wal_db_journalmode_v2() {
// Update journal mode to WAL
conn.pragma_update(None, "journal_mode", "WAL")
.context("Failed to connect in WAL mode for persistent db")?;