Loading tools/aconfig/aconfig/src/codegen/rust.rs +16 −4 Original line number Diff line number Diff line Loading @@ -295,7 +295,10 @@ static CACHED_disabled_rw: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 1) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -339,7 +342,10 @@ static CACHED_disabled_rw_exported: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 2) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -383,7 +389,10 @@ static CACHED_disabled_rw_in_other_namespace: LazyLock<bool> = LazyLock::new(|| get_boolean_flag_value(&flag_val_map, offset + 3) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -428,7 +437,10 @@ static CACHED_enabled_rw: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 8) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(true) } } }) }); Loading tools/aconfig/aconfig/templates/cpp_source_file.template +13 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,8 @@ namespace {cpp_namespace} \{ : boolean_start_index_() {{ -endif }} , flag_value_file_(nullptr) , read_from_new_storage_(false) \{ , read_from_new_storage_(false) , package_exists_in_storage_(true) \{ if (access("/metadata/aconfig/boot/enable_only_new_storage", F_OK) == 0) \{ read_from_new_storage_ = true; Loading @@ -99,6 +100,11 @@ namespace {cpp_namespace} \{ ALOGE("error: failed to get package read context: %s", context.error().c_str()); } if (!(context->package_exists)) \{ package_exists_in_storage_ = false; return; } // cache package boolean flag start index boolean_start_index_ = context->boolean_start_index; Loading Loading @@ -126,6 +132,10 @@ namespace {cpp_namespace} \{ if (cache_[{item.readwrite_idx}] == -1) \{ {{ if allow_instrumentation- }} if (read_from_new_storage_) \{ if (!package_exists_in_storage_) \{ return {item.default_value}; } auto value = aconfig_storage::get_boolean_flag_value( *flag_value_file_, boolean_start_index_ + {item.flag_offset}); Loading Loading @@ -168,6 +178,8 @@ namespace {cpp_namespace} \{ std::unique_ptr<aconfig_storage::MappedStorageFile> flag_value_file_; bool read_from_new_storage_; bool package_exists_in_storage_; {{ -endif }} {{ -endif }} Loading tools/aconfig/aconfig/templates/rust.template +4 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,10 @@ static CACHED_{flag.name}: LazyLock<bool> = LazyLock::new(|| \{ get_boolean_flag_value(&flag_val_map, offset + {flag.flag_offset}) .map_err(|err| format!("failed to get flag: \{err}")) }, None => Err("no context found for package '{package}'".to_string()) None => \{ log!(Level::Error, "no context found for package {package}"); Ok({flag.default_value}) } } }) }); Loading tools/aconfig/aflags/Cargo.toml +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ paste = "1.0.11" protobuf = "3.2.0" regex = "1.10.3" aconfig_protos = { path = "../aconfig_protos" } aconfigd_protos = { version = "0.1.0", path = "../../../../../system/server_configurable_flags/aconfigd"} aconfigd_protos = { version = "0.1.0", path = "../../../../../packages/modules/ConfigInfrastructure/aconfigd/proto"} nix = { version = "0.28.0", features = ["user"] } aconfig_storage_file = { version = "0.1.0", path = "../aconfig_storage_file" } aconfig_storage_read_api = { version = "0.1.0", path = "../aconfig_storage_read_api" } Loading Loading
tools/aconfig/aconfig/src/codegen/rust.rs +16 −4 Original line number Diff line number Diff line Loading @@ -295,7 +295,10 @@ static CACHED_disabled_rw: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 1) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -339,7 +342,10 @@ static CACHED_disabled_rw_exported: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 2) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -383,7 +389,10 @@ static CACHED_disabled_rw_in_other_namespace: LazyLock<bool> = LazyLock::new(|| get_boolean_flag_value(&flag_val_map, offset + 3) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(false) } } }) }); Loading Loading @@ -428,7 +437,10 @@ static CACHED_enabled_rw: LazyLock<bool> = LazyLock::new(|| { get_boolean_flag_value(&flag_val_map, offset + 8) .map_err(|err| format!("failed to get flag: {err}")) }, None => Err("no context found for package 'com.android.aconfig.test'".to_string()) None => { log!(Level::Error, "no context found for package com.android.aconfig.test"); Ok(true) } } }) }); Loading
tools/aconfig/aconfig/templates/cpp_source_file.template +13 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,8 @@ namespace {cpp_namespace} \{ : boolean_start_index_() {{ -endif }} , flag_value_file_(nullptr) , read_from_new_storage_(false) \{ , read_from_new_storage_(false) , package_exists_in_storage_(true) \{ if (access("/metadata/aconfig/boot/enable_only_new_storage", F_OK) == 0) \{ read_from_new_storage_ = true; Loading @@ -99,6 +100,11 @@ namespace {cpp_namespace} \{ ALOGE("error: failed to get package read context: %s", context.error().c_str()); } if (!(context->package_exists)) \{ package_exists_in_storage_ = false; return; } // cache package boolean flag start index boolean_start_index_ = context->boolean_start_index; Loading Loading @@ -126,6 +132,10 @@ namespace {cpp_namespace} \{ if (cache_[{item.readwrite_idx}] == -1) \{ {{ if allow_instrumentation- }} if (read_from_new_storage_) \{ if (!package_exists_in_storage_) \{ return {item.default_value}; } auto value = aconfig_storage::get_boolean_flag_value( *flag_value_file_, boolean_start_index_ + {item.flag_offset}); Loading Loading @@ -168,6 +178,8 @@ namespace {cpp_namespace} \{ std::unique_ptr<aconfig_storage::MappedStorageFile> flag_value_file_; bool read_from_new_storage_; bool package_exists_in_storage_; {{ -endif }} {{ -endif }} Loading
tools/aconfig/aconfig/templates/rust.template +4 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,10 @@ static CACHED_{flag.name}: LazyLock<bool> = LazyLock::new(|| \{ get_boolean_flag_value(&flag_val_map, offset + {flag.flag_offset}) .map_err(|err| format!("failed to get flag: \{err}")) }, None => Err("no context found for package '{package}'".to_string()) None => \{ log!(Level::Error, "no context found for package {package}"); Ok({flag.default_value}) } } }) }); Loading
tools/aconfig/aflags/Cargo.toml +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ paste = "1.0.11" protobuf = "3.2.0" regex = "1.10.3" aconfig_protos = { path = "../aconfig_protos" } aconfigd_protos = { version = "0.1.0", path = "../../../../../system/server_configurable_flags/aconfigd"} aconfigd_protos = { version = "0.1.0", path = "../../../../../packages/modules/ConfigInfrastructure/aconfigd/proto"} nix = { version = "0.28.0", features = ["user"] } aconfig_storage_file = { version = "0.1.0", path = "../aconfig_storage_file" } aconfig_storage_read_api = { version = "0.1.0", path = "../aconfig_storage_read_api" } Loading