aconfig: Respect flag naming convention on test flags

Test: atest aconfig.test
Bug: 311152507
Change-Id: I960867d32415007db5dacab57e97b813cbbee650
This commit is contained in:
Oriol Prieto Gasco
2023-12-11 12:10:36 +00:00
committed by Oriol Prieto Gascó
parent 7c607a0e32
commit bbeda85949
8 changed files with 188 additions and 35 deletions

View File

@@ -170,6 +170,8 @@ public:
virtual bool enabled_ro() = 0;
virtual bool enabled_ro_exported() = 0;
virtual bool enabled_rw() = 0;
};
@@ -199,6 +201,10 @@ inline bool enabled_ro() {
return true;
}
inline bool enabled_ro_exported() {
return true;
}
inline bool enabled_rw() {
return provider_->enabled_rw();
}
@@ -220,6 +226,8 @@ bool com_android_aconfig_test_enabled_fixed_ro();
bool com_android_aconfig_test_enabled_ro();
bool com_android_aconfig_test_enabled_ro_exported();
bool com_android_aconfig_test_enabled_rw();
#ifdef __cplusplus
@@ -265,6 +273,10 @@ public:
virtual void enabled_ro(bool val) = 0;
virtual bool enabled_ro_exported() = 0;
virtual void enabled_ro_exported(bool val) = 0;
virtual bool enabled_rw() = 0;
virtual void enabled_rw(bool val) = 0;
@@ -322,6 +334,14 @@ inline void enabled_ro(bool val) {
provider_->enabled_ro(val);
}
inline bool enabled_ro_exported() {
return provider_->enabled_ro_exported();
}
inline void enabled_ro_exported(bool val) {
provider_->enabled_ro_exported(val);
}
inline bool enabled_rw() {
return provider_->enabled_rw();
}
@@ -363,6 +383,10 @@ bool com_android_aconfig_test_enabled_ro();
void set_com_android_aconfig_test_enabled_ro(bool val);
bool com_android_aconfig_test_enabled_ro_exported();
void set_com_android_aconfig_test_enabled_ro_exported(bool val);
bool com_android_aconfig_test_enabled_rw();
void set_com_android_aconfig_test_enabled_rw(bool val);
@@ -429,6 +453,10 @@ namespace com::android::aconfig::test {
return true;
}
virtual bool enabled_ro_exported() override {
return true;
}
virtual bool enabled_rw() override {
if (cache_[3] == -1) {
cache_[3] = server_configurable_flags::GetServerConfigurableFlag(
@@ -471,6 +499,10 @@ bool com_android_aconfig_test_enabled_ro() {
return true;
}
bool com_android_aconfig_test_enabled_ro_exported() {
return true;
}
bool com_android_aconfig_test_enabled_rw() {
return com::android::aconfig::test::enabled_rw();
}
@@ -581,6 +613,19 @@ namespace com::android::aconfig::test {
overrides_["enabled_ro"] = val;
}
virtual bool enabled_ro_exported() override {
auto it = overrides_.find("enabled_ro_exported");
if (it != overrides_.end()) {
return it->second;
} else {
return true;
}
}
virtual void enabled_ro_exported(bool val) override {
overrides_["enabled_ro_exported"] = val;
}
virtual bool enabled_rw() override {
auto it = overrides_.find("enabled_rw");
if (it != overrides_.end()) {
@@ -661,6 +706,17 @@ void set_com_android_aconfig_test_enabled_ro(bool val) {
com::android::aconfig::test::enabled_ro(val);
}
bool com_android_aconfig_test_enabled_ro_exported() {
return com::android::aconfig::test::enabled_ro_exported();
}
void set_com_android_aconfig_test_enabled_ro_exported(bool val) {
com::android::aconfig::test::enabled_ro_exported(val);
}
bool com_android_aconfig_test_enabled_rw() {
return com::android::aconfig::test::enabled_rw();
}