Merge "Keystore 2.0: Reduce sqlite cache to 0.5M" am: 0df926098f

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

Change-Id: I065c85116a4926d89eaaee999c3d0c331702f3c7
diff --git a/keystore2/src/database.rs b/keystore2/src/database.rs
index e1185f3..28ff02d 100644
--- a/keystore2/src/database.rs
+++ b/keystore2/src/database.rs
@@ -1045,6 +1045,12 @@
             break;
         }
 
+        // Drop the cache size from default (2M) to 0.5M
+        conn.execute("PRAGMA persistent.cache_size = -500;", params![])
+            .context("Failed to decrease cache size for persistent db")?;
+        conn.execute("PRAGMA perboot.cache_size = -500;", params![])
+            .context("Failed to decrease cache size for perboot db")?;
+
         Ok(conn)
     }