From b352b9d33fcb96db7eda70011a76d341870f5209 Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Wed, 16 Aug 2023 17:33:33 +0000 Subject: [PATCH] Update codegen to use single channel in sys prop Update sys prop name from persist.device_config.. to persist.aconfig_flags.aconfig_flags.. Bug: b/295379636 Change-Id: I78f00daa574dc016902dce4b9b4ec961f973693c --- tools/aconfig/src/codegen_cpp.rs | 8 ++++---- tools/aconfig/src/codegen_rust.rs | 8 ++++---- tools/aconfig/templates/cpp_source_file.template | 4 ++-- tools/aconfig/templates/rust_prod.template | 2 +- tools/aconfig/templates/rust_test.template | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/aconfig/src/codegen_cpp.rs b/tools/aconfig/src/codegen_cpp.rs index 530af49866..30e564a5a1 100644 --- a/tools/aconfig/src/codegen_cpp.rs +++ b/tools/aconfig/src/codegen_cpp.rs @@ -289,7 +289,7 @@ namespace com::android::aconfig::test { virtual bool disabled_rw() override { return server_configurable_flags::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.disabled_rw", "false") == "true"; } @@ -300,7 +300,7 @@ namespace com::android::aconfig::test { virtual bool enabled_rw() override { return server_configurable_flags::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.enabled_rw", "true") == "true"; } @@ -363,7 +363,7 @@ namespace com::android::aconfig::test { return it->second; } else { return server_configurable_flags::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.disabled_rw", "false") == "true"; } @@ -392,7 +392,7 @@ namespace com::android::aconfig::test { return it->second; } else { return server_configurable_flags::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.enabled_rw", "true") == "true"; } diff --git a/tools/aconfig/src/codegen_rust.rs b/tools/aconfig/src/codegen_rust.rs index 053cebc66f..0234eb25d5 100644 --- a/tools/aconfig/src/codegen_rust.rs +++ b/tools/aconfig/src/codegen_rust.rs @@ -103,7 +103,7 @@ impl FlagProvider { /// query flag disabled_rw pub fn disabled_rw(&self) -> bool { flags_rust::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.disabled_rw", "false") == "true" } @@ -116,7 +116,7 @@ impl FlagProvider { /// query flag enabled_rw pub fn enabled_rw(&self) -> bool { flags_rust::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.enabled_rw", "true") == "true" } @@ -178,7 +178,7 @@ impl FlagProvider { pub fn disabled_rw(&self) -> bool { self.overrides.get("disabled_rw").copied().unwrap_or( flags_rust::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.disabled_rw", "false") == "true" ) @@ -205,7 +205,7 @@ impl FlagProvider { pub fn enabled_rw(&self) -> bool { self.overrides.get("enabled_rw").copied().unwrap_or( flags_rust::GetServerConfigurableFlag( - "aconfig_test", + "aconfig_flags.aconfig_test", "com.android.aconfig.test.enabled_rw", "true") == "true" ) diff --git a/tools/aconfig/templates/cpp_source_file.template b/tools/aconfig/templates/cpp_source_file.template index 289e299096..f373bc6152 100644 --- a/tools/aconfig/templates/cpp_source_file.template +++ b/tools/aconfig/templates/cpp_source_file.template @@ -23,7 +23,7 @@ namespace {cpp_namespace} \{ } else \{ {{ if item.readwrite- }} return server_configurable_flags::GetServerConfigurableFlag( - "{item.device_config_namespace}", + "aconfig_flags.{item.device_config_namespace}", "{item.device_config_flag}", "{item.default_value}") == "true"; {{ -else- }} @@ -50,7 +50,7 @@ namespace {cpp_namespace} \{ virtual bool {item.flag_name}() override \{ {{ if item.readwrite- }} return server_configurable_flags::GetServerConfigurableFlag( - "{item.device_config_namespace}", + "aconfig_flags.{item.device_config_namespace}", "{item.device_config_flag}", "{item.default_value}") == "true"; {{ -else- }} diff --git a/tools/aconfig/templates/rust_prod.template b/tools/aconfig/templates/rust_prod.template index d518694142..e22ad6faa4 100644 --- a/tools/aconfig/templates/rust_prod.template +++ b/tools/aconfig/templates/rust_prod.template @@ -10,7 +10,7 @@ impl FlagProvider \{ pub fn {flag.name}(&self) -> bool \{ {{ if flag.readwrite -}} flags_rust::GetServerConfigurableFlag( - "{flag.device_config_namespace}", + "aconfig_flags.{flag.device_config_namespace}", "{flag.device_config_flag}", "{flag.default_value}") == "true" {{ -else- }} diff --git a/tools/aconfig/templates/rust_test.template b/tools/aconfig/templates/rust_test.template index 1e2c28a112..fd1229bf86 100644 --- a/tools/aconfig/templates/rust_test.template +++ b/tools/aconfig/templates/rust_test.template @@ -15,7 +15,7 @@ impl FlagProvider \{ self.overrides.get("{flag.name}").copied().unwrap_or( {{ if flag.readwrite -}} flags_rust::GetServerConfigurableFlag( - "{flag.device_config_namespace}", + "aconfig_flags.{flag.device_config_namespace}", "{flag.device_config_flag}", "{flag.default_value}") == "true" {{ -else- }}