Migrate to the librustutils system property bindings.

Bug: 182498247
Test: Build
Change-Id: Ic16033d7f5e302a3cb7e591a0fa2ae403755fc2e
This commit is contained in:
Joel Galenson 2021-07-29 15:27:34 -07:00
parent 8125bace85
commit 7ead3a249f
3 changed files with 6 additions and 5 deletions

View file

@ -54,7 +54,7 @@ rust_defaults {
"liblog_rust",
"librand",
"librusqlite",
"libsystem_properties-rust",
"librustutils",
"libthiserror",
],
shared_libs: [

View file

@ -46,10 +46,10 @@ use android_security_metrics::aidl::android::security::metrics::{
};
use anyhow::{Context, Result};
use lazy_static::lazy_static;
use rustutils::system_properties::PropertyWatcherError;
use std::collections::HashMap;
use std::sync::Mutex;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use system_properties::PropertyWatcherError;
// Note: Crash events are recorded at keystore restarts, based on the assumption that keystore only
// gets restarted after a crash, during a boot cycle.
@ -626,7 +626,8 @@ pub fn update_keystore_crash_sysprop() {
}
};
if let Err(e) = system_properties::write(KEYSTORE_CRASH_COUNT_PROPERTY, &new_count.to_string())
if let Err(e) =
rustutils::system_properties::write(KEYSTORE_CRASH_COUNT_PROPERTY, &new_count.to_string())
{
log::error!(
concat!(
@ -640,7 +641,7 @@ pub fn update_keystore_crash_sysprop() {
/// Read the system property: keystore.crash_count.
pub fn read_keystore_crash_count() -> Result<i32> {
system_properties::read("keystore.crash_count")
rustutils::system_properties::read("keystore.crash_count")
.context("In read_keystore_crash_count: Failed read property.")?
.parse::<i32>()
.map_err(std::convert::Into::into)

View file

@ -46,13 +46,13 @@ use keystore2_crypto::{
aes_gcm_decrypt, aes_gcm_encrypt, generate_aes256_key, generate_salt, Password, ZVec,
AES_256_KEY_LENGTH,
};
use rustutils::system_properties::PropertyWatcher;
use std::{
collections::HashMap,
sync::Arc,
sync::{Mutex, Weak},
};
use std::{convert::TryFrom, ops::Deref};
use system_properties::PropertyWatcher;
const MAX_MAX_BOOT_LEVEL: usize = 1_000_000_000;
/// Allow up to 15 seconds between the user unlocking using a biometric, and the auth