aconfig: rename test flag `disabled_rw_2` -> `disabled_rw_in_other_namespace`
The flag `disabled_rw_2` is used to verify that aconfig can
auto-generate code for flags in different namespaces. Rename the flag to
`disabled_rw_in_other_namespace` to highlight that it belongs to a
different namespace than the other flags.
This CL is a semantic change only.
Bug: None
Test: atest aconfig.test
Change-Id: Ib82fdce0ca3f7cd56b9b3f80e44fe424a03a2ae4
diff --git a/tools/aconfig/src/codegen_cpp.rs b/tools/aconfig/src/codegen_cpp.rs
index 33e54a1..42d900b 100644
--- a/tools/aconfig/src/codegen_cpp.rs
+++ b/tools/aconfig/src/codegen_cpp.rs
@@ -165,7 +165,7 @@
virtual bool disabled_rw() = 0;
- virtual bool disabled_rw_2() = 0;
+ virtual bool disabled_rw_in_other_namespace() = 0;
virtual bool enabled_fixed_ro() = 0;
@@ -184,8 +184,8 @@
return provider_->disabled_rw();
}
-inline bool disabled_rw_2() {
- return provider_->disabled_rw_2();
+inline bool disabled_rw_in_other_namespace() {
+ return provider_->disabled_rw_in_other_namespace();
}
inline bool enabled_fixed_ro() {
@@ -209,7 +209,7 @@
bool com_android_aconfig_test_disabled_rw();
-bool com_android_aconfig_test_disabled_rw_2();
+bool com_android_aconfig_test_disabled_rw_in_other_namespace();
bool com_android_aconfig_test_enabled_fixed_ro();
@@ -244,9 +244,9 @@
virtual void disabled_rw(bool val) = 0;
- virtual bool disabled_rw_2() = 0;
+ virtual bool disabled_rw_in_other_namespace() = 0;
- virtual void disabled_rw_2(bool val) = 0;
+ virtual void disabled_rw_in_other_namespace(bool val) = 0;
virtual bool enabled_fixed_ro() = 0;
@@ -281,12 +281,12 @@
provider_->disabled_rw(val);
}
-inline bool disabled_rw_2() {
- return provider_->disabled_rw_2();
+inline bool disabled_rw_in_other_namespace() {
+ return provider_->disabled_rw_in_other_namespace();
}
-inline void disabled_rw_2(bool val) {
- provider_->disabled_rw_2(val);
+inline void disabled_rw_in_other_namespace(bool val) {
+ provider_->disabled_rw_in_other_namespace(val);
}
inline bool enabled_fixed_ro() {
@@ -330,9 +330,9 @@
void set_com_android_aconfig_test_disabled_rw(bool val);
-bool com_android_aconfig_test_disabled_rw_2();
+bool com_android_aconfig_test_disabled_rw_in_other_namespace();
-void set_com_android_aconfig_test_disabled_rw_2(bool val);
+void set_com_android_aconfig_test_disabled_rw_in_other_namespace(bool val);
bool com_android_aconfig_test_enabled_fixed_ro();
@@ -379,11 +379,11 @@
return cache_[0];
}
- virtual bool disabled_rw_2() override {
+ virtual bool disabled_rw_in_other_namespace() override {
if (cache_[1] == -1) {
cache_[1] = server_configurable_flags::GetServerConfigurableFlag(
"aconfig_flags.other_namespace",
- "com.android.aconfig.test.disabled_rw_2",
+ "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true";
}
return cache_[1];
@@ -423,8 +423,8 @@
return com::android::aconfig::test::disabled_rw();
}
-bool com_android_aconfig_test_disabled_rw_2() {
- return com::android::aconfig::test::disabled_rw_2();
+bool com_android_aconfig_test_disabled_rw_in_other_namespace() {
+ return com::android::aconfig::test::disabled_rw_in_other_namespace();
}
bool com_android_aconfig_test_enabled_fixed_ro() {
@@ -487,20 +487,20 @@
overrides_["disabled_rw"] = val;
}
- virtual bool disabled_rw_2() override {
- auto it = overrides_.find("disabled_rw_2");
+ virtual bool disabled_rw_in_other_namespace() override {
+ auto it = overrides_.find("disabled_rw_in_other_namespace");
if (it != overrides_.end()) {
return it->second;
} else {
return server_configurable_flags::GetServerConfigurableFlag(
"aconfig_flags.other_namespace",
- "com.android.aconfig.test.disabled_rw_2",
+ "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true";
}
}
- virtual void disabled_rw_2(bool val) override {
- overrides_["disabled_rw_2"] = val;
+ virtual void disabled_rw_in_other_namespace(bool val) override {
+ overrides_["disabled_rw_in_other_namespace"] = val;
}
virtual bool enabled_fixed_ro() override {
@@ -572,13 +572,13 @@
com::android::aconfig::test::disabled_rw(val);
}
-bool com_android_aconfig_test_disabled_rw_2() {
- return com::android::aconfig::test::disabled_rw_2();
+bool com_android_aconfig_test_disabled_rw_in_other_namespace() {
+ return com::android::aconfig::test::disabled_rw_in_other_namespace();
}
-void set_com_android_aconfig_test_disabled_rw_2(bool val) {
- com::android::aconfig::test::disabled_rw_2(val);
+void set_com_android_aconfig_test_disabled_rw_in_other_namespace(bool val) {
+ com::android::aconfig::test::disabled_rw_in_other_namespace(val);
}
diff --git a/tools/aconfig/src/codegen_java.rs b/tools/aconfig/src/codegen_java.rs
index 5470cb3..a822cd5 100644
--- a/tools/aconfig/src/codegen_java.rs
+++ b/tools/aconfig/src/codegen_java.rs
@@ -179,7 +179,7 @@
@UnsupportedAppUsage
boolean disabledRw();
@UnsupportedAppUsage
- boolean disabledRw2();
+ boolean disabledRwInOtherNamespace();
@com.android.aconfig.annotations.AssumeTrueForR8
@UnsupportedAppUsage
boolean enabledFixedRo();
@@ -202,7 +202,7 @@
/** @hide */
public static final String FLAG_DISABLED_RW = "com.android.aconfig.test.disabled_rw";
/** @hide */
- public static final String FLAG_DISABLED_RW_2 = "com.android.aconfig.test.disabled_rw_2";
+ public static final String FLAG_DISABLED_RW_IN_OTHER_NAMESPACE = "com.android.aconfig.test.disabled_rw_in_other_namespace";
/** @hide */
public static final String FLAG_ENABLED_FIXED_RO = "com.android.aconfig.test.enabled_fixed_ro";
/** @hide */
@@ -220,8 +220,8 @@
return FEATURE_FLAGS.disabledRw();
}
@UnsupportedAppUsage
- public static boolean disabledRw2() {
- return FEATURE_FLAGS.disabledRw2();
+ public static boolean disabledRwInOtherNamespace() {
+ return FEATURE_FLAGS.disabledRwInOtherNamespace();
}
@com.android.aconfig.annotations.AssumeTrueForR8
@UnsupportedAppUsage
@@ -262,8 +262,8 @@
}
@Override
@UnsupportedAppUsage
- public boolean disabledRw2() {
- return getValue(Flags.FLAG_DISABLED_RW_2);
+ public boolean disabledRwInOtherNamespace() {
+ return getValue(Flags.FLAG_DISABLED_RW_IN_OTHER_NAMESPACE);
}
@Override
@UnsupportedAppUsage
@@ -302,7 +302,7 @@
Map.ofEntries(
Map.entry(Flags.FLAG_DISABLED_RO, false),
Map.entry(Flags.FLAG_DISABLED_RW, false),
- Map.entry(Flags.FLAG_DISABLED_RW_2, false),
+ Map.entry(Flags.FLAG_DISABLED_RW_IN_OTHER_NAMESPACE, false),
Map.entry(Flags.FLAG_ENABLED_FIXED_RO, false),
Map.entry(Flags.FLAG_ENABLED_RO, false),
Map.entry(Flags.FLAG_ENABLED_RW, false)
@@ -336,7 +336,7 @@
private static boolean aconfig_test_is_cached = false;
private static boolean other_namespace_is_cached = false;
private static boolean disabledRw = false;
- private static boolean disabledRw2 = false;
+ private static boolean disabledRwInOtherNamespace = false;
private static boolean enabledRw = true;
@@ -363,8 +363,8 @@
private void load_overrides_other_namespace() {
try {
Properties properties = DeviceConfig.getProperties("other_namespace");
- disabledRw2 =
- properties.getBoolean("com.android.aconfig.test.disabled_rw_2", false);
+ disabledRwInOtherNamespace =
+ properties.getBoolean("com.android.aconfig.test.disabled_rw_in_other_namespace", false);
} catch (NullPointerException e) {
throw new RuntimeException(
"Cannot read value from namespace other_namespace "
@@ -394,11 +394,11 @@
}
@Override
@UnsupportedAppUsage
- public boolean disabledRw2() {
+ public boolean disabledRwInOtherNamespace() {
if (!other_namespace_is_cached) {
load_overrides_other_namespace();
}
- return disabledRw2;
+ return disabledRwInOtherNamespace;
}
@Override
@UnsupportedAppUsage
@@ -489,7 +489,7 @@
}
@Override
@UnsupportedAppUsage
- public boolean disabledRw2() {
+ public boolean disabledRwInOtherNamespace() {
throw new UnsupportedOperationException(
"Method is not implemented.");
}
diff --git a/tools/aconfig/src/codegen_rust.rs b/tools/aconfig/src/codegen_rust.rs
index fb4f981..d8675e7 100644
--- a/tools/aconfig/src/codegen_rust.rs
+++ b/tools/aconfig/src/codegen_rust.rs
@@ -104,10 +104,10 @@
"com.android.aconfig.test.disabled_rw",
"false") == "true";
- /// flag value cache for disabled_rw_2
- static ref CACHED_disabled_rw_2: bool = flags_rust::GetServerConfigurableFlag(
+ /// flag value cache for disabled_rw_in_other_namespace
+ static ref CACHED_disabled_rw_in_other_namespace: bool = flags_rust::GetServerConfigurableFlag(
"aconfig_flags.other_namespace",
- "com.android.aconfig.test.disabled_rw_2",
+ "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true";
/// flag value cache for enabled_rw
@@ -128,9 +128,9 @@
*CACHED_disabled_rw
}
- /// query flag disabled_rw_2
- pub fn disabled_rw_2(&self) -> bool {
- *CACHED_disabled_rw_2
+ /// query flag disabled_rw_in_other_namespace
+ pub fn disabled_rw_in_other_namespace(&self) -> bool {
+ *CACHED_disabled_rw_in_other_namespace
}
/// query flag enabled_fixed_ro
@@ -164,10 +164,10 @@
PROVIDER.disabled_rw()
}
-/// query flag disabled_rw_2
+/// query flag disabled_rw_in_other_namespace
#[inline(always)]
-pub fn disabled_rw_2() -> bool {
- PROVIDER.disabled_rw_2()
+pub fn disabled_rw_in_other_namespace() -> bool {
+ PROVIDER.disabled_rw_in_other_namespace()
}
/// query flag enabled_fixed_ro
@@ -228,19 +228,19 @@
self.overrides.insert("disabled_rw", val);
}
- /// query flag disabled_rw_2
- pub fn disabled_rw_2(&self) -> bool {
- self.overrides.get("disabled_rw_2").copied().unwrap_or(
+ /// query flag disabled_rw_in_other_namespace
+ pub fn disabled_rw_in_other_namespace(&self) -> bool {
+ self.overrides.get("disabled_rw_in_other_namespace").copied().unwrap_or(
flags_rust::GetServerConfigurableFlag(
"aconfig_flags.other_namespace",
- "com.android.aconfig.test.disabled_rw_2",
+ "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true"
)
}
- /// set flag disabled_rw_2
- pub fn set_disabled_rw_2(&mut self, val: bool) {
- self.overrides.insert("disabled_rw_2", val);
+ /// set flag disabled_rw_in_other_namespace
+ pub fn set_disabled_rw_in_other_namespace(&mut self, val: bool) {
+ self.overrides.insert("disabled_rw_in_other_namespace", val);
}
/// query flag enabled_fixed_ro
@@ -317,16 +317,16 @@
PROVIDER.lock().unwrap().set_disabled_rw(val);
}
-/// query flag disabled_rw_2
+/// query flag disabled_rw_in_other_namespace
#[inline(always)]
-pub fn disabled_rw_2() -> bool {
- PROVIDER.lock().unwrap().disabled_rw_2()
+pub fn disabled_rw_in_other_namespace() -> bool {
+ PROVIDER.lock().unwrap().disabled_rw_in_other_namespace()
}
-/// set flag disabled_rw_2
+/// set flag disabled_rw_in_other_namespace
#[inline(always)]
-pub fn set_disabled_rw_2(val: bool) {
- PROVIDER.lock().unwrap().set_disabled_rw_2(val);
+pub fn set_disabled_rw_in_other_namespace(val: bool) {
+ PROVIDER.lock().unwrap().set_disabled_rw_in_other_namespace(val);
}
/// query flag enabled_fixed_ro
diff --git a/tools/aconfig/src/commands.rs b/tools/aconfig/src/commands.rs
index 63aef29..c8c7975 100644
--- a/tools/aconfig/src/commands.rs
+++ b/tools/aconfig/src/commands.rs
@@ -433,7 +433,7 @@
let input = parse_test_flags_as_input();
let bytes = create_device_config_defaults(input).unwrap();
let text = std::str::from_utf8(&bytes).unwrap();
- assert_eq!("aconfig_test:com.android.aconfig.test.disabled_rw=disabled\nother_namespace:com.android.aconfig.test.disabled_rw_2=disabled\naconfig_test:com.android.aconfig.test.enabled_rw=enabled\n", text);
+ assert_eq!("aconfig_test:com.android.aconfig.test.disabled_rw=disabled\nother_namespace:com.android.aconfig.test.disabled_rw_in_other_namespace=disabled\naconfig_test:com.android.aconfig.test.enabled_rw=enabled\n", text);
}
#[test]
@@ -441,7 +441,7 @@
let input = parse_test_flags_as_input();
let bytes = create_device_config_sysprops(input).unwrap();
let text = std::str::from_utf8(&bytes).unwrap();
- assert_eq!("persist.device_config.com.android.aconfig.test.disabled_rw=false\npersist.device_config.com.android.aconfig.test.disabled_rw_2=false\npersist.device_config.com.android.aconfig.test.enabled_rw=true\n", text);
+ assert_eq!("persist.device_config.com.android.aconfig.test.disabled_rw=false\npersist.device_config.com.android.aconfig.test.disabled_rw_in_other_namespace=false\npersist.device_config.com.android.aconfig.test.enabled_rw=true\n", text);
}
#[test]
diff --git a/tools/aconfig/src/test.rs b/tools/aconfig/src/test.rs
index 922d4c6..bb3d1f0 100644
--- a/tools/aconfig/src/test.rs
+++ b/tools/aconfig/src/test.rs
@@ -60,9 +60,9 @@
}
parsed_flag {
package: "com.android.aconfig.test"
- name: "disabled_rw_2"
+ name: "disabled_rw_in_other_namespace"
namespace: "other_namespace"
- description: "This flag is DISABLED + READ_WRITE"
+ description: "This flag is DISABLED + READ_WRITE, and is defined in another namespace"
bug: "999"
state: DISABLED
permission: READ_WRITE
diff --git a/tools/aconfig/tests/first.values b/tools/aconfig/tests/first.values
index 448fb3a..07d8d1d 100644
--- a/tools/aconfig/tests/first.values
+++ b/tools/aconfig/tests/first.values
@@ -18,7 +18,7 @@
}
flag_value {
package: "com.android.aconfig.test"
- name: "disabled_rw_2"
+ name: "disabled_rw_in_other_namespace"
state: DISABLED
permission: READ_WRITE
}
diff --git a/tools/aconfig/tests/test.aconfig b/tools/aconfig/tests/test.aconfig
index 3076f5e..8527e93 100644
--- a/tools/aconfig/tests/test.aconfig
+++ b/tools/aconfig/tests/test.aconfig
@@ -53,8 +53,8 @@
}
flag {
- name: "disabled_rw_2"
+ name: "disabled_rw_in_other_namespace"
namespace: "other_namespace"
- description: "This flag is DISABLED + READ_WRITE"
+ description: "This flag is DISABLED + READ_WRITE, and is defined in another namespace"
bug: "999"
}