Merge "aconfig Rust: Support huge list of flags" into main am: d713353ab8
am: 0a79e2158c
Original change: https://android-review.googlesource.com/c/platform/build/+/3247857 Change-Id: I2ad9121ab5b8495cd9c4aec7182548b06140bf06 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -122,31 +122,36 @@ static MIGRATION_LOG_TAG: &str = "AconfigTestMission1";
|
|||||||
/// flag provider
|
/// flag provider
|
||||||
pub struct FlagProvider;
|
pub struct FlagProvider;
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
|
||||||
/// flag value cache for disabled_rw
|
/// flag value cache for disabled_rw
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_disabled_rw: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.disabled_rw",
|
"com.android.aconfig.test.disabled_rw",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for disabled_rw_exported
|
/// flag value cache for disabled_rw_exported
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw_exported: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_disabled_rw_exported: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.disabled_rw_exported",
|
"com.android.aconfig.test.disabled_rw_exported",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for disabled_rw_in_other_namespace
|
/// flag value cache for disabled_rw_in_other_namespace
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw_in_other_namespace: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_disabled_rw_in_other_namespace: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.other_namespace",
|
"aconfig_flags.other_namespace",
|
||||||
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for enabled_rw
|
/// flag value cache for enabled_rw
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_enabled_rw: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_enabled_rw: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.enabled_rw",
|
"com.android.aconfig.test.enabled_rw",
|
||||||
"true") == "true";
|
"true") == "true";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlagProvider {
|
impl FlagProvider {
|
||||||
@@ -269,7 +274,6 @@ static MIGRATION_LOG_TAG: &str = "AconfigTestMission1";
|
|||||||
pub struct FlagProvider;
|
pub struct FlagProvider;
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
|
|
||||||
static ref PACKAGE_OFFSET: Result<Option<u32>, AconfigStorageError> = unsafe {
|
static ref PACKAGE_OFFSET: Result<Option<u32>, AconfigStorageError> = unsafe {
|
||||||
get_mapped_storage_file("system", StorageFileType::PackageMap)
|
get_mapped_storage_file("system", StorageFileType::PackageMap)
|
||||||
.and_then(|package_map| get_package_read_context(&package_map, "com.android.aconfig.test"))
|
.and_then(|package_map| get_package_read_context(&package_map, "com.android.aconfig.test"))
|
||||||
@@ -279,8 +283,10 @@ lazy_static::lazy_static! {
|
|||||||
static ref FLAG_VAL_MAP: Result<Mmap, AconfigStorageError> = unsafe {
|
static ref FLAG_VAL_MAP: Result<Mmap, AconfigStorageError> = unsafe {
|
||||||
get_mapped_storage_file("system", StorageFileType::FlagVal)
|
get_mapped_storage_file("system", StorageFileType::FlagVal)
|
||||||
};
|
};
|
||||||
/// flag value cache for disabled_rw
|
}
|
||||||
|
|
||||||
|
/// flag value cache for disabled_rw
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw: bool = {
|
static ref CACHED_disabled_rw: bool = {
|
||||||
let result = flags_rust::GetServerConfigurableFlag(
|
let result = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
@@ -344,9 +350,10 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
result
|
result
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for disabled_rw_exported
|
/// flag value cache for disabled_rw_exported
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw_exported: bool = {
|
static ref CACHED_disabled_rw_exported: bool = {
|
||||||
let result = flags_rust::GetServerConfigurableFlag(
|
let result = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
@@ -410,9 +417,10 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
result
|
result
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for disabled_rw_in_other_namespace
|
/// flag value cache for disabled_rw_in_other_namespace
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw_in_other_namespace: bool = {
|
static ref CACHED_disabled_rw_in_other_namespace: bool = {
|
||||||
let result = flags_rust::GetServerConfigurableFlag(
|
let result = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.other_namespace",
|
"aconfig_flags.other_namespace",
|
||||||
@@ -476,9 +484,10 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
result
|
result
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for enabled_rw
|
/// flag value cache for enabled_rw
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_enabled_rw: bool = {
|
static ref CACHED_enabled_rw: bool = {
|
||||||
let result = flags_rust::GetServerConfigurableFlag(
|
let result = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
@@ -542,7 +551,6 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
result
|
result
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlagProvider {
|
impl FlagProvider {
|
||||||
@@ -1216,25 +1224,28 @@ static MIGRATION_LOG_TAG: &str = "AconfigTestMission1";
|
|||||||
/// flag provider
|
/// flag provider
|
||||||
pub struct FlagProvider;
|
pub struct FlagProvider;
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
|
||||||
/// flag value cache for disabled_rw_exported
|
/// flag value cache for disabled_rw_exported
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_disabled_rw_exported: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_disabled_rw_exported: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.disabled_rw_exported",
|
"com.android.aconfig.test.disabled_rw_exported",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for enabled_fixed_ro_exported
|
/// flag value cache for enabled_fixed_ro_exported
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_enabled_fixed_ro_exported: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_enabled_fixed_ro_exported: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
}
|
||||||
|
|
||||||
/// flag value cache for enabled_ro_exported
|
/// flag value cache for enabled_ro_exported
|
||||||
|
lazy_static::lazy_static! {
|
||||||
static ref CACHED_enabled_ro_exported: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_enabled_ro_exported: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlagProvider {
|
impl FlagProvider {
|
||||||
|
@@ -12,8 +12,8 @@ static MIGRATION_LOG_TAG: &str = "AconfigTestMission1";
|
|||||||
pub struct FlagProvider;
|
pub struct FlagProvider;
|
||||||
|
|
||||||
{{ if has_readwrite- }}
|
{{ if has_readwrite- }}
|
||||||
|
{{ if allow_instrumentation }}
|
||||||
lazy_static::lazy_static! \{
|
lazy_static::lazy_static! \{
|
||||||
{{ if allow_instrumentation }}
|
|
||||||
static ref PACKAGE_OFFSET: Result<Option<u32>, AconfigStorageError> = unsafe \{
|
static ref PACKAGE_OFFSET: Result<Option<u32>, AconfigStorageError> = unsafe \{
|
||||||
get_mapped_storage_file("{container}", StorageFileType::PackageMap)
|
get_mapped_storage_file("{container}", StorageFileType::PackageMap)
|
||||||
.and_then(|package_map| get_package_read_context(&package_map, "{package}"))
|
.and_then(|package_map| get_package_read_context(&package_map, "{package}"))
|
||||||
@@ -23,12 +23,14 @@ lazy_static::lazy_static! \{
|
|||||||
static ref FLAG_VAL_MAP: Result<Mmap, AconfigStorageError> = unsafe \{
|
static ref FLAG_VAL_MAP: Result<Mmap, AconfigStorageError> = unsafe \{
|
||||||
get_mapped_storage_file("{container}", StorageFileType::FlagVal)
|
get_mapped_storage_file("{container}", StorageFileType::FlagVal)
|
||||||
};
|
};
|
||||||
{{ -endif }}
|
}
|
||||||
|
{{ -endif }}
|
||||||
{{ -for flag in template_flags }}
|
{{ -for flag in template_flags }}
|
||||||
{{ -if flag.readwrite }}
|
|
||||||
/// flag value cache for {flag.name}
|
{{ -if flag.readwrite }}
|
||||||
{{ if allow_instrumentation }}
|
/// flag value cache for {flag.name}
|
||||||
|
{{ if allow_instrumentation }}
|
||||||
|
lazy_static::lazy_static! \{
|
||||||
static ref CACHED_{flag.name}: bool = \{
|
static ref CACHED_{flag.name}: bool = \{
|
||||||
let result = flags_rust::GetServerConfigurableFlag(
|
let result = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.{flag.device_config_namespace}",
|
"aconfig_flags.{flag.device_config_namespace}",
|
||||||
@@ -92,15 +94,17 @@ lazy_static::lazy_static! \{
|
|||||||
|
|
||||||
result
|
result
|
||||||
};
|
};
|
||||||
{{ else }}
|
}
|
||||||
|
{{ else }}
|
||||||
|
lazy_static::lazy_static! \{
|
||||||
static ref CACHED_{flag.name}: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_{flag.name}: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.{flag.device_config_namespace}",
|
"aconfig_flags.{flag.device_config_namespace}",
|
||||||
"{flag.device_config_flag}",
|
"{flag.device_config_flag}",
|
||||||
"{flag.default_value}") == "true";
|
"{flag.default_value}") == "true";
|
||||||
{{ endif }}
|
|
||||||
{{ -endif }}
|
|
||||||
{{ -endfor }}
|
|
||||||
}
|
}
|
||||||
|
{{ endif }}
|
||||||
|
{{ -endif }}
|
||||||
|
{{ -endfor }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
|
||||||
impl FlagProvider \{
|
impl FlagProvider \{
|
||||||
|
Reference in New Issue
Block a user