Merge "aconfig: rename test flag disabled_rw_2 -> disabled_rw_in_other_namespace" into main

This commit is contained in:
Treehugger Robot
2023-11-17 14:20:25 +00:00
committed by Gerrit Code Review
7 changed files with 67 additions and 67 deletions

View File

@@ -165,7 +165,7 @@ public:
virtual bool disabled_rw() = 0; 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; virtual bool enabled_fixed_ro() = 0;
@@ -184,8 +184,8 @@ inline bool disabled_rw() {
return provider_->disabled_rw(); return provider_->disabled_rw();
} }
inline bool disabled_rw_2() { inline bool disabled_rw_in_other_namespace() {
return provider_->disabled_rw_2(); return provider_->disabled_rw_in_other_namespace();
} }
inline bool enabled_fixed_ro() { inline bool enabled_fixed_ro() {
@@ -209,7 +209,7 @@ bool com_android_aconfig_test_disabled_ro();
bool com_android_aconfig_test_disabled_rw(); 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(); bool com_android_aconfig_test_enabled_fixed_ro();
@@ -244,9 +244,9 @@ public:
virtual void disabled_rw(bool val) = 0; 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; virtual bool enabled_fixed_ro() = 0;
@@ -281,12 +281,12 @@ inline void disabled_rw(bool val) {
provider_->disabled_rw(val); provider_->disabled_rw(val);
} }
inline bool disabled_rw_2() { inline bool disabled_rw_in_other_namespace() {
return provider_->disabled_rw_2(); return provider_->disabled_rw_in_other_namespace();
} }
inline void disabled_rw_2(bool val) { inline void disabled_rw_in_other_namespace(bool val) {
provider_->disabled_rw_2(val); provider_->disabled_rw_in_other_namespace(val);
} }
inline bool enabled_fixed_ro() { inline bool enabled_fixed_ro() {
@@ -330,9 +330,9 @@ bool com_android_aconfig_test_disabled_rw();
void set_com_android_aconfig_test_disabled_rw(bool val); 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(); bool com_android_aconfig_test_enabled_fixed_ro();
@@ -379,11 +379,11 @@ namespace com::android::aconfig::test {
return cache_[0]; return cache_[0];
} }
virtual bool disabled_rw_2() override { virtual bool disabled_rw_in_other_namespace() override {
if (cache_[1] == -1) { if (cache_[1] == -1) {
cache_[1] = server_configurable_flags::GetServerConfigurableFlag( cache_[1] = server_configurable_flags::GetServerConfigurableFlag(
"aconfig_flags.other_namespace", "aconfig_flags.other_namespace",
"com.android.aconfig.test.disabled_rw_2", "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true"; "false") == "true";
} }
return cache_[1]; return cache_[1];
@@ -423,8 +423,8 @@ bool com_android_aconfig_test_disabled_rw() {
return com::android::aconfig::test::disabled_rw(); return com::android::aconfig::test::disabled_rw();
} }
bool com_android_aconfig_test_disabled_rw_2() { bool com_android_aconfig_test_disabled_rw_in_other_namespace() {
return com::android::aconfig::test::disabled_rw_2(); return com::android::aconfig::test::disabled_rw_in_other_namespace();
} }
bool com_android_aconfig_test_enabled_fixed_ro() { bool com_android_aconfig_test_enabled_fixed_ro() {
@@ -487,20 +487,20 @@ namespace com::android::aconfig::test {
overrides_["disabled_rw"] = val; overrides_["disabled_rw"] = val;
} }
virtual bool disabled_rw_2() override { virtual bool disabled_rw_in_other_namespace() override {
auto it = overrides_.find("disabled_rw_2"); auto it = overrides_.find("disabled_rw_in_other_namespace");
if (it != overrides_.end()) { if (it != overrides_.end()) {
return it->second; return it->second;
} else { } else {
return server_configurable_flags::GetServerConfigurableFlag( return server_configurable_flags::GetServerConfigurableFlag(
"aconfig_flags.other_namespace", "aconfig_flags.other_namespace",
"com.android.aconfig.test.disabled_rw_2", "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true"; "false") == "true";
} }
} }
virtual void disabled_rw_2(bool val) override { virtual void disabled_rw_in_other_namespace(bool val) override {
overrides_["disabled_rw_2"] = val; overrides_["disabled_rw_in_other_namespace"] = val;
} }
virtual bool enabled_fixed_ro() override { virtual bool enabled_fixed_ro() override {
@@ -572,13 +572,13 @@ void set_com_android_aconfig_test_disabled_rw(bool val) {
com::android::aconfig::test::disabled_rw(val); com::android::aconfig::test::disabled_rw(val);
} }
bool com_android_aconfig_test_disabled_rw_2() { bool com_android_aconfig_test_disabled_rw_in_other_namespace() {
return com::android::aconfig::test::disabled_rw_2(); return 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) {
com::android::aconfig::test::disabled_rw_2(val); com::android::aconfig::test::disabled_rw_in_other_namespace(val);
} }

View File

@@ -179,7 +179,7 @@ mod tests {
@UnsupportedAppUsage @UnsupportedAppUsage
boolean disabledRw(); boolean disabledRw();
@UnsupportedAppUsage @UnsupportedAppUsage
boolean disabledRw2(); boolean disabledRwInOtherNamespace();
@com.android.aconfig.annotations.AssumeTrueForR8 @com.android.aconfig.annotations.AssumeTrueForR8
@UnsupportedAppUsage @UnsupportedAppUsage
boolean enabledFixedRo(); boolean enabledFixedRo();
@@ -202,7 +202,7 @@ mod tests {
/** @hide */ /** @hide */
public static final String FLAG_DISABLED_RW = "com.android.aconfig.test.disabled_rw"; public static final String FLAG_DISABLED_RW = "com.android.aconfig.test.disabled_rw";
/** @hide */ /** @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 */ /** @hide */
public static final String FLAG_ENABLED_FIXED_RO = "com.android.aconfig.test.enabled_fixed_ro"; public static final String FLAG_ENABLED_FIXED_RO = "com.android.aconfig.test.enabled_fixed_ro";
/** @hide */ /** @hide */
@@ -220,8 +220,8 @@ mod tests {
return FEATURE_FLAGS.disabledRw(); return FEATURE_FLAGS.disabledRw();
} }
@UnsupportedAppUsage @UnsupportedAppUsage
public static boolean disabledRw2() { public static boolean disabledRwInOtherNamespace() {
return FEATURE_FLAGS.disabledRw2(); return FEATURE_FLAGS.disabledRwInOtherNamespace();
} }
@com.android.aconfig.annotations.AssumeTrueForR8 @com.android.aconfig.annotations.AssumeTrueForR8
@UnsupportedAppUsage @UnsupportedAppUsage
@@ -262,8 +262,8 @@ mod tests {
} }
@Override @Override
@UnsupportedAppUsage @UnsupportedAppUsage
public boolean disabledRw2() { public boolean disabledRwInOtherNamespace() {
return getValue(Flags.FLAG_DISABLED_RW_2); return getValue(Flags.FLAG_DISABLED_RW_IN_OTHER_NAMESPACE);
} }
@Override @Override
@UnsupportedAppUsage @UnsupportedAppUsage
@@ -302,7 +302,7 @@ mod tests {
Map.ofEntries( Map.ofEntries(
Map.entry(Flags.FLAG_DISABLED_RO, false), Map.entry(Flags.FLAG_DISABLED_RO, false),
Map.entry(Flags.FLAG_DISABLED_RW, 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_FIXED_RO, false),
Map.entry(Flags.FLAG_ENABLED_RO, false), Map.entry(Flags.FLAG_ENABLED_RO, false),
Map.entry(Flags.FLAG_ENABLED_RW, false) Map.entry(Flags.FLAG_ENABLED_RW, false)
@@ -336,7 +336,7 @@ mod tests {
private static boolean aconfig_test_is_cached = false; private static boolean aconfig_test_is_cached = false;
private static boolean other_namespace_is_cached = false; private static boolean other_namespace_is_cached = false;
private static boolean disabledRw = false; private static boolean disabledRw = false;
private static boolean disabledRw2 = false; private static boolean disabledRwInOtherNamespace = false;
private static boolean enabledRw = true; private static boolean enabledRw = true;
@@ -363,8 +363,8 @@ mod tests {
private void load_overrides_other_namespace() { private void load_overrides_other_namespace() {
try { try {
Properties properties = DeviceConfig.getProperties("other_namespace"); Properties properties = DeviceConfig.getProperties("other_namespace");
disabledRw2 = disabledRwInOtherNamespace =
properties.getBoolean("com.android.aconfig.test.disabled_rw_2", false); properties.getBoolean("com.android.aconfig.test.disabled_rw_in_other_namespace", false);
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new RuntimeException( throw new RuntimeException(
"Cannot read value from namespace other_namespace " "Cannot read value from namespace other_namespace "
@@ -394,11 +394,11 @@ mod tests {
} }
@Override @Override
@UnsupportedAppUsage @UnsupportedAppUsage
public boolean disabledRw2() { public boolean disabledRwInOtherNamespace() {
if (!other_namespace_is_cached) { if (!other_namespace_is_cached) {
load_overrides_other_namespace(); load_overrides_other_namespace();
} }
return disabledRw2; return disabledRwInOtherNamespace;
} }
@Override @Override
@UnsupportedAppUsage @UnsupportedAppUsage
@@ -489,7 +489,7 @@ mod tests {
} }
@Override @Override
@UnsupportedAppUsage @UnsupportedAppUsage
public boolean disabledRw2() { public boolean disabledRwInOtherNamespace() {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Method is not implemented."); "Method is not implemented.");
} }

View File

@@ -104,10 +104,10 @@ lazy_static::lazy_static! {
"com.android.aconfig.test.disabled_rw", "com.android.aconfig.test.disabled_rw",
"false") == "true"; "false") == "true";
/// flag value cache for disabled_rw_2 /// flag value cache for disabled_rw_in_other_namespace
static ref CACHED_disabled_rw_2: 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_2", "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
@@ -128,9 +128,9 @@ impl FlagProvider {
*CACHED_disabled_rw *CACHED_disabled_rw
} }
/// query flag disabled_rw_2 /// query flag disabled_rw_in_other_namespace
pub fn disabled_rw_2(&self) -> bool { pub fn disabled_rw_in_other_namespace(&self) -> bool {
*CACHED_disabled_rw_2 *CACHED_disabled_rw_in_other_namespace
} }
/// query flag enabled_fixed_ro /// query flag enabled_fixed_ro
@@ -164,10 +164,10 @@ pub fn disabled_rw() -> bool {
PROVIDER.disabled_rw() PROVIDER.disabled_rw()
} }
/// query flag disabled_rw_2 /// query flag disabled_rw_in_other_namespace
#[inline(always)] #[inline(always)]
pub fn disabled_rw_2() -> bool { pub fn disabled_rw_in_other_namespace() -> bool {
PROVIDER.disabled_rw_2() PROVIDER.disabled_rw_in_other_namespace()
} }
/// query flag enabled_fixed_ro /// query flag enabled_fixed_ro
@@ -228,19 +228,19 @@ impl FlagProvider {
self.overrides.insert("disabled_rw", val); self.overrides.insert("disabled_rw", val);
} }
/// query flag disabled_rw_2 /// query flag disabled_rw_in_other_namespace
pub fn disabled_rw_2(&self) -> bool { pub fn disabled_rw_in_other_namespace(&self) -> bool {
self.overrides.get("disabled_rw_2").copied().unwrap_or( self.overrides.get("disabled_rw_in_other_namespace").copied().unwrap_or(
flags_rust::GetServerConfigurableFlag( flags_rust::GetServerConfigurableFlag(
"aconfig_flags.other_namespace", "aconfig_flags.other_namespace",
"com.android.aconfig.test.disabled_rw_2", "com.android.aconfig.test.disabled_rw_in_other_namespace",
"false") == "true" "false") == "true"
) )
} }
/// set flag disabled_rw_2 /// set flag disabled_rw_in_other_namespace
pub fn set_disabled_rw_2(&mut self, val: bool) { pub fn set_disabled_rw_in_other_namespace(&mut self, val: bool) {
self.overrides.insert("disabled_rw_2", val); self.overrides.insert("disabled_rw_in_other_namespace", val);
} }
/// query flag enabled_fixed_ro /// query flag enabled_fixed_ro
@@ -317,16 +317,16 @@ pub fn set_disabled_rw(val: bool) {
PROVIDER.lock().unwrap().set_disabled_rw(val); PROVIDER.lock().unwrap().set_disabled_rw(val);
} }
/// query flag disabled_rw_2 /// query flag disabled_rw_in_other_namespace
#[inline(always)] #[inline(always)]
pub fn disabled_rw_2() -> bool { pub fn disabled_rw_in_other_namespace() -> bool {
PROVIDER.lock().unwrap().disabled_rw_2() PROVIDER.lock().unwrap().disabled_rw_in_other_namespace()
} }
/// set flag disabled_rw_2 /// set flag disabled_rw_in_other_namespace
#[inline(always)] #[inline(always)]
pub fn set_disabled_rw_2(val: bool) { pub fn set_disabled_rw_in_other_namespace(val: bool) {
PROVIDER.lock().unwrap().set_disabled_rw_2(val); PROVIDER.lock().unwrap().set_disabled_rw_in_other_namespace(val);
} }
/// query flag enabled_fixed_ro /// query flag enabled_fixed_ro

View File

@@ -433,7 +433,7 @@ mod tests {
let input = parse_test_flags_as_input(); let input = parse_test_flags_as_input();
let bytes = create_device_config_defaults(input).unwrap(); let bytes = create_device_config_defaults(input).unwrap();
let text = std::str::from_utf8(&bytes).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] #[test]
@@ -441,7 +441,7 @@ mod tests {
let input = parse_test_flags_as_input(); let input = parse_test_flags_as_input();
let bytes = create_device_config_sysprops(input).unwrap(); let bytes = create_device_config_sysprops(input).unwrap();
let text = std::str::from_utf8(&bytes).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] #[test]

View File

@@ -60,9 +60,9 @@ parsed_flag {
} }
parsed_flag { parsed_flag {
package: "com.android.aconfig.test" package: "com.android.aconfig.test"
name: "disabled_rw_2" name: "disabled_rw_in_other_namespace"
namespace: "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" bug: "999"
state: DISABLED state: DISABLED
permission: READ_WRITE permission: READ_WRITE

View File

@@ -18,7 +18,7 @@ flag_value {
} }
flag_value { flag_value {
package: "com.android.aconfig.test" package: "com.android.aconfig.test"
name: "disabled_rw_2" name: "disabled_rw_in_other_namespace"
state: DISABLED state: DISABLED
permission: READ_WRITE permission: READ_WRITE
} }

View File

@@ -53,8 +53,8 @@ flag {
} }
flag { flag {
name: "disabled_rw_2" name: "disabled_rw_in_other_namespace"
namespace: "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" bug: "999"
} }