aconfig: add new testing flag enabled_fixed_ro_exported
This commit adds a new testing flag enabled_fixed_ro_exported to test the case of a exported and fixed_read_only flag. Test: atest aconfig.test aconfig.test.java AconfigJavaHostTest aconfig.test.cpp aconfig.test.cpp.test_mode aconfig.prod_mode.test.rust Bug: 316357680 Change-Id: Iaedb8a6875166c6a6d24c7c3deee701a496b4964
This commit is contained in:
@@ -153,6 +153,10 @@ mod tests {
|
|||||||
#define COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO true
|
#define COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO_EXPORTED
|
||||||
|
#define COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO_EXPORTED true
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -173,6 +177,8 @@ public:
|
|||||||
|
|
||||||
virtual bool enabled_fixed_ro() = 0;
|
virtual bool enabled_fixed_ro() = 0;
|
||||||
|
|
||||||
|
virtual bool enabled_fixed_ro_exported() = 0;
|
||||||
|
|
||||||
virtual bool enabled_ro() = 0;
|
virtual bool enabled_ro() = 0;
|
||||||
|
|
||||||
virtual bool enabled_ro_exported() = 0;
|
virtual bool enabled_ro_exported() = 0;
|
||||||
@@ -202,6 +208,10 @@ inline bool enabled_fixed_ro() {
|
|||||||
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool enabled_fixed_ro_exported() {
|
||||||
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO_EXPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool enabled_ro() {
|
inline bool enabled_ro() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -229,6 +239,8 @@ 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();
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported();
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro();
|
bool com_android_aconfig_test_enabled_ro();
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro_exported();
|
bool com_android_aconfig_test_enabled_ro_exported();
|
||||||
@@ -274,6 +286,10 @@ public:
|
|||||||
|
|
||||||
virtual void enabled_fixed_ro(bool val) = 0;
|
virtual void enabled_fixed_ro(bool val) = 0;
|
||||||
|
|
||||||
|
virtual bool enabled_fixed_ro_exported() = 0;
|
||||||
|
|
||||||
|
virtual void enabled_fixed_ro_exported(bool val) = 0;
|
||||||
|
|
||||||
virtual bool enabled_ro() = 0;
|
virtual bool enabled_ro() = 0;
|
||||||
|
|
||||||
virtual void enabled_ro(bool val) = 0;
|
virtual void enabled_ro(bool val) = 0;
|
||||||
@@ -331,6 +347,14 @@ inline void enabled_fixed_ro(bool val) {
|
|||||||
provider_->enabled_fixed_ro(val);
|
provider_->enabled_fixed_ro(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool enabled_fixed_ro_exported() {
|
||||||
|
return provider_->enabled_fixed_ro_exported();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void enabled_fixed_ro_exported(bool val) {
|
||||||
|
provider_->enabled_fixed_ro_exported(val);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool enabled_ro() {
|
inline bool enabled_ro() {
|
||||||
return provider_->enabled_ro();
|
return provider_->enabled_ro();
|
||||||
}
|
}
|
||||||
@@ -384,6 +408,10 @@ bool com_android_aconfig_test_enabled_fixed_ro();
|
|||||||
|
|
||||||
void set_com_android_aconfig_test_enabled_fixed_ro(bool val);
|
void set_com_android_aconfig_test_enabled_fixed_ro(bool val);
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported();
|
||||||
|
|
||||||
|
void set_com_android_aconfig_test_enabled_fixed_ro_exported(bool val);
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro();
|
bool com_android_aconfig_test_enabled_ro();
|
||||||
|
|
||||||
void set_com_android_aconfig_test_enabled_ro(bool val);
|
void set_com_android_aconfig_test_enabled_ro(bool val);
|
||||||
@@ -421,6 +449,8 @@ public:
|
|||||||
|
|
||||||
virtual bool disabled_rw_exported() = 0;
|
virtual bool disabled_rw_exported() = 0;
|
||||||
|
|
||||||
|
virtual bool enabled_fixed_ro_exported() = 0;
|
||||||
|
|
||||||
virtual bool enabled_ro_exported() = 0;
|
virtual bool enabled_ro_exported() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -430,6 +460,10 @@ inline bool disabled_rw_exported() {
|
|||||||
return provider_->disabled_rw_exported();
|
return provider_->disabled_rw_exported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool enabled_fixed_ro_exported() {
|
||||||
|
return provider_->enabled_fixed_ro_exported();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool enabled_ro_exported() {
|
inline bool enabled_ro_exported() {
|
||||||
return provider_->enabled_ro_exported();
|
return provider_->enabled_ro_exported();
|
||||||
}
|
}
|
||||||
@@ -441,6 +475,8 @@ extern "C" {
|
|||||||
|
|
||||||
bool com_android_aconfig_test_disabled_rw_exported();
|
bool com_android_aconfig_test_disabled_rw_exported();
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported();
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro_exported();
|
bool com_android_aconfig_test_enabled_ro_exported();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -496,6 +532,10 @@ namespace com::android::aconfig::test {
|
|||||||
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool enabled_fixed_ro_exported() override {
|
||||||
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO_EXPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool enabled_ro() override {
|
virtual bool enabled_ro() override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -542,6 +582,10 @@ bool com_android_aconfig_test_enabled_fixed_ro() {
|
|||||||
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported() {
|
||||||
|
return COM_ANDROID_ACONFIG_TEST_ENABLED_FIXED_RO_EXPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro() {
|
bool com_android_aconfig_test_enabled_ro() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -647,6 +691,19 @@ namespace com::android::aconfig::test {
|
|||||||
overrides_["enabled_fixed_ro"] = val;
|
overrides_["enabled_fixed_ro"] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool enabled_fixed_ro_exported() override {
|
||||||
|
auto it = overrides_.find("enabled_fixed_ro_exported");
|
||||||
|
if (it != overrides_.end()) {
|
||||||
|
return it->second;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void enabled_fixed_ro_exported(bool val) override {
|
||||||
|
overrides_["enabled_fixed_ro_exported"] = val;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool enabled_ro() override {
|
virtual bool enabled_ro() override {
|
||||||
auto it = overrides_.find("enabled_ro");
|
auto it = overrides_.find("enabled_ro");
|
||||||
if (it != overrides_.end()) {
|
if (it != overrides_.end()) {
|
||||||
@@ -743,6 +800,13 @@ void set_com_android_aconfig_test_enabled_fixed_ro(bool val) {
|
|||||||
com::android::aconfig::test::enabled_fixed_ro(val);
|
com::android::aconfig::test::enabled_fixed_ro(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported() {
|
||||||
|
return com::android::aconfig::test::enabled_fixed_ro_exported();
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_com_android_aconfig_test_enabled_fixed_ro_exported(bool val) {
|
||||||
|
com::android::aconfig::test::enabled_fixed_ro_exported(val);
|
||||||
|
}
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro() {
|
bool com_android_aconfig_test_enabled_ro() {
|
||||||
return com::android::aconfig::test::enabled_ro();
|
return com::android::aconfig::test::enabled_ro();
|
||||||
@@ -798,19 +862,28 @@ namespace com::android::aconfig::test {
|
|||||||
return cache_[0];
|
return cache_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool enabled_ro_exported() override {
|
virtual bool enabled_fixed_ro_exported() override {
|
||||||
if (cache_[1] == -1) {
|
if (cache_[1] == -1) {
|
||||||
cache_[1] = server_configurable_flags::GetServerConfigurableFlag(
|
cache_[1] = server_configurable_flags::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.aconfig_test",
|
"aconfig_flags.aconfig_test",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
}
|
}
|
||||||
return cache_[1];
|
return cache_[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool enabled_ro_exported() override {
|
||||||
|
if (cache_[2] == -1) {
|
||||||
|
cache_[2] = server_configurable_flags::GetServerConfigurableFlag(
|
||||||
|
"aconfig_flags.aconfig_test",
|
||||||
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
|
"false") == "true";
|
||||||
|
}
|
||||||
|
return cache_[2];
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int8_t> cache_ = std::vector<int8_t>(2, -1);
|
std::vector<int8_t> cache_ = std::vector<int8_t>(3, -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<flag_provider_interface> provider_ =
|
std::unique_ptr<flag_provider_interface> provider_ =
|
||||||
@@ -821,6 +894,10 @@ bool com_android_aconfig_test_disabled_rw_exported() {
|
|||||||
return com::android::aconfig::test::disabled_rw_exported();
|
return com::android::aconfig::test::disabled_rw_exported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool com_android_aconfig_test_enabled_fixed_ro_exported() {
|
||||||
|
return com::android::aconfig::test::enabled_fixed_ro_exported();
|
||||||
|
}
|
||||||
|
|
||||||
bool com_android_aconfig_test_enabled_ro_exported() {
|
bool com_android_aconfig_test_enabled_ro_exported() {
|
||||||
return com::android::aconfig::test::enabled_ro_exported();
|
return com::android::aconfig::test::enabled_ro_exported();
|
||||||
}
|
}
|
||||||
|
@@ -202,6 +202,9 @@ mod tests {
|
|||||||
boolean enabledFixedRo();
|
boolean enabledFixedRo();
|
||||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
boolean enabledFixedRoExported();
|
||||||
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
|
@UnsupportedAppUsage
|
||||||
boolean enabledRo();
|
boolean enabledRo();
|
||||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
@@ -228,6 +231,8 @@ mod tests {
|
|||||||
/** @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 */
|
||||||
|
public static final String FLAG_ENABLED_FIXED_RO_EXPORTED = "com.android.aconfig.test.enabled_fixed_ro_exported";
|
||||||
|
/** @hide */
|
||||||
public static final String FLAG_ENABLED_RO = "com.android.aconfig.test.enabled_ro";
|
public static final String FLAG_ENABLED_RO = "com.android.aconfig.test.enabled_ro";
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String FLAG_ENABLED_RO_EXPORTED = "com.android.aconfig.test.enabled_ro_exported";
|
public static final String FLAG_ENABLED_RO_EXPORTED = "com.android.aconfig.test.enabled_ro_exported";
|
||||||
@@ -258,6 +263,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public static boolean enabledFixedRoExported() {
|
||||||
|
return FEATURE_FLAGS.enabledFixedRoExported();
|
||||||
|
}
|
||||||
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static boolean enabledRo() {
|
public static boolean enabledRo() {
|
||||||
return FEATURE_FLAGS.enabledRo();
|
return FEATURE_FLAGS.enabledRo();
|
||||||
}
|
}
|
||||||
@@ -310,6 +320,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public boolean enabledFixedRoExported() {
|
||||||
|
return getValue(Flags.FLAG_ENABLED_FIXED_RO_EXPORTED);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean enabledRo() {
|
public boolean enabledRo() {
|
||||||
return getValue(Flags.FLAG_ENABLED_RO);
|
return getValue(Flags.FLAG_ENABLED_RO);
|
||||||
}
|
}
|
||||||
@@ -348,6 +363,7 @@ mod tests {
|
|||||||
Map.entry(Flags.FLAG_DISABLED_RW_EXPORTED, false),
|
Map.entry(Flags.FLAG_DISABLED_RW_EXPORTED, false),
|
||||||
Map.entry(Flags.FLAG_DISABLED_RW_IN_OTHER_NAMESPACE, 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_FIXED_RO_EXPORTED, false),
|
||||||
Map.entry(Flags.FLAG_ENABLED_RO, false),
|
Map.entry(Flags.FLAG_ENABLED_RO, false),
|
||||||
Map.entry(Flags.FLAG_ENABLED_RO_EXPORTED, false),
|
Map.entry(Flags.FLAG_ENABLED_RO_EXPORTED, false),
|
||||||
Map.entry(Flags.FLAG_ENABLED_RW, false)
|
Map.entry(Flags.FLAG_ENABLED_RW, false)
|
||||||
@@ -463,6 +479,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public boolean enabledFixedRoExported() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean enabledRo() {
|
public boolean enabledRo() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -528,6 +549,8 @@ mod tests {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String FLAG_DISABLED_RW_EXPORTED = "com.android.aconfig.test.disabled_rw_exported";
|
public static final String FLAG_DISABLED_RW_EXPORTED = "com.android.aconfig.test.disabled_rw_exported";
|
||||||
/** @hide */
|
/** @hide */
|
||||||
|
public static final String FLAG_ENABLED_FIXED_RO_EXPORTED = "com.android.aconfig.test.enabled_fixed_ro_exported";
|
||||||
|
/** @hide */
|
||||||
public static final String FLAG_ENABLED_RO_EXPORTED = "com.android.aconfig.test.enabled_ro_exported";
|
public static final String FLAG_ENABLED_RO_EXPORTED = "com.android.aconfig.test.enabled_ro_exported";
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
@@ -535,6 +558,10 @@ mod tests {
|
|||||||
return FEATURE_FLAGS.disabledRwExported();
|
return FEATURE_FLAGS.disabledRwExported();
|
||||||
}
|
}
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public static boolean enabledFixedRoExported() {
|
||||||
|
return FEATURE_FLAGS.enabledFixedRoExported();
|
||||||
|
}
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static boolean enabledRoExported() {
|
public static boolean enabledRoExported() {
|
||||||
return FEATURE_FLAGS.enabledRoExported();
|
return FEATURE_FLAGS.enabledRoExported();
|
||||||
}
|
}
|
||||||
@@ -551,6 +578,8 @@ mod tests {
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
boolean disabledRwExported();
|
boolean disabledRwExported();
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
boolean enabledFixedRoExported();
|
||||||
|
@UnsupportedAppUsage
|
||||||
boolean enabledRoExported();
|
boolean enabledRoExported();
|
||||||
}
|
}
|
||||||
"#;
|
"#;
|
||||||
@@ -566,6 +595,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 disabledRwExported = false;
|
private static boolean disabledRwExported = false;
|
||||||
|
private static boolean enabledFixedRoExported = false;
|
||||||
private static boolean enabledRoExported = false;
|
private static boolean enabledRoExported = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -574,6 +604,8 @@ mod tests {
|
|||||||
Properties properties = DeviceConfig.getProperties("aconfig_test");
|
Properties properties = DeviceConfig.getProperties("aconfig_test");
|
||||||
disabledRwExported =
|
disabledRwExported =
|
||||||
properties.getBoolean("com.android.aconfig.test.disabled_rw_exported", false);
|
properties.getBoolean("com.android.aconfig.test.disabled_rw_exported", false);
|
||||||
|
enabledFixedRoExported =
|
||||||
|
properties.getBoolean("com.android.aconfig.test.enabled_fixed_ro_exported", false);
|
||||||
enabledRoExported =
|
enabledRoExported =
|
||||||
properties.getBoolean("com.android.aconfig.test.enabled_ro_exported", false);
|
properties.getBoolean("com.android.aconfig.test.enabled_ro_exported", false);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
@@ -614,6 +646,15 @@ mod tests {
|
|||||||
return disabledRwExported;
|
return disabledRwExported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@UnsupportedAppUsage
|
||||||
|
public boolean enabledFixedRoExported() {
|
||||||
|
if (!aconfig_test_is_cached) {
|
||||||
|
load_overrides_aconfig_test();
|
||||||
|
}
|
||||||
|
return enabledFixedRoExported;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public boolean enabledRoExported() {
|
public boolean enabledRoExported() {
|
||||||
@@ -642,6 +683,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public boolean enabledFixedRoExported() {
|
||||||
|
return getValue(Flags.FLAG_ENABLED_FIXED_RO_EXPORTED);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean enabledRoExported() {
|
public boolean enabledRoExported() {
|
||||||
return getValue(Flags.FLAG_ENABLED_RO_EXPORTED);
|
return getValue(Flags.FLAG_ENABLED_RO_EXPORTED);
|
||||||
}
|
}
|
||||||
@@ -666,6 +712,7 @@ mod tests {
|
|||||||
private Map<String, Boolean> mFlagMap = new HashMap<>(
|
private Map<String, Boolean> mFlagMap = new HashMap<>(
|
||||||
Map.ofEntries(
|
Map.ofEntries(
|
||||||
Map.entry(Flags.FLAG_DISABLED_RW_EXPORTED, false),
|
Map.entry(Flags.FLAG_DISABLED_RW_EXPORTED, false),
|
||||||
|
Map.entry(Flags.FLAG_ENABLED_FIXED_RO_EXPORTED, false),
|
||||||
Map.entry(Flags.FLAG_ENABLED_RO_EXPORTED, false)
|
Map.entry(Flags.FLAG_ENABLED_RO_EXPORTED, false)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -759,6 +806,12 @@ mod tests {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
public boolean enabledFixedRoExported() {
|
||||||
|
throw new UnsupportedOperationException(
|
||||||
|
"Method is not implemented.");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean enabledRo() {
|
public boolean enabledRo() {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"Method is not implemented.");
|
"Method is not implemented.");
|
||||||
|
@@ -153,6 +153,11 @@ impl FlagProvider {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// query flag enabled_fixed_ro_exported
|
||||||
|
pub fn enabled_fixed_ro_exported(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
/// query flag enabled_ro
|
/// query flag enabled_ro
|
||||||
pub fn enabled_ro(&self) -> bool {
|
pub fn enabled_ro(&self) -> bool {
|
||||||
true
|
true
|
||||||
@@ -202,6 +207,12 @@ pub fn enabled_fixed_ro() -> bool {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// query flag enabled_fixed_ro_exported
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn enabled_fixed_ro_exported() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
/// query flag enabled_ro
|
/// query flag enabled_ro
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn enabled_ro() -> bool {
|
pub fn enabled_ro() -> bool {
|
||||||
@@ -302,6 +313,18 @@ impl FlagProvider {
|
|||||||
self.overrides.insert("enabled_fixed_ro", val);
|
self.overrides.insert("enabled_fixed_ro", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// query flag enabled_fixed_ro_exported
|
||||||
|
pub fn enabled_fixed_ro_exported(&self) -> bool {
|
||||||
|
self.overrides.get("enabled_fixed_ro_exported").copied().unwrap_or(
|
||||||
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// set flag enabled_fixed_ro_exported
|
||||||
|
pub fn set_enabled_fixed_ro_exported(&mut self, val: bool) {
|
||||||
|
self.overrides.insert("enabled_fixed_ro_exported", val);
|
||||||
|
}
|
||||||
|
|
||||||
/// query flag enabled_ro
|
/// query flag enabled_ro
|
||||||
pub fn enabled_ro(&self) -> bool {
|
pub fn enabled_ro(&self) -> bool {
|
||||||
self.overrides.get("enabled_ro").copied().unwrap_or(
|
self.overrides.get("enabled_ro").copied().unwrap_or(
|
||||||
@@ -412,6 +435,18 @@ pub fn set_enabled_fixed_ro(val: bool) {
|
|||||||
PROVIDER.lock().unwrap().set_enabled_fixed_ro(val);
|
PROVIDER.lock().unwrap().set_enabled_fixed_ro(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// query flag enabled_fixed_ro_exported
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn enabled_fixed_ro_exported() -> bool {
|
||||||
|
PROVIDER.lock().unwrap().enabled_fixed_ro_exported()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// set flag enabled_fixed_ro_exported
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn set_enabled_fixed_ro_exported(val: bool) {
|
||||||
|
PROVIDER.lock().unwrap().set_enabled_fixed_ro_exported(val);
|
||||||
|
}
|
||||||
|
|
||||||
/// query flag enabled_ro
|
/// query flag enabled_ro
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn enabled_ro() -> bool {
|
pub fn enabled_ro() -> bool {
|
||||||
|
@@ -390,9 +390,9 @@ mod tests {
|
|||||||
assert_eq!(ProtoFlagState::ENABLED, enabled_ro.trace[2].state());
|
assert_eq!(ProtoFlagState::ENABLED, enabled_ro.trace[2].state());
|
||||||
assert_eq!(ProtoFlagPermission::READ_ONLY, enabled_ro.trace[2].permission());
|
assert_eq!(ProtoFlagPermission::READ_ONLY, enabled_ro.trace[2].permission());
|
||||||
|
|
||||||
assert_eq!(8, parsed_flags.parsed_flag.len());
|
assert_eq!(9, parsed_flags.parsed_flag.len());
|
||||||
for pf in parsed_flags.parsed_flag.iter() {
|
for pf in parsed_flags.parsed_flag.iter() {
|
||||||
if pf.name() == "enabled_fixed_ro" {
|
if pf.name().starts_with("enabled_fixed_ro") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let first = pf.trace.first().unwrap();
|
let first = pf.trace.first().unwrap();
|
||||||
@@ -621,7 +621,13 @@ mod tests {
|
|||||||
let bytes =
|
let bytes =
|
||||||
dump_parsed_flags(vec![input, input2], DumpFormat::Textproto, &[], true).unwrap();
|
dump_parsed_flags(vec![input, input2], DumpFormat::Textproto, &[], true).unwrap();
|
||||||
let text = std::str::from_utf8(&bytes).unwrap();
|
let text = std::str::from_utf8(&bytes).unwrap();
|
||||||
assert_eq!(crate::test::TEST_FLAGS_TEXTPROTO.trim(), text.trim());
|
assert_eq!(
|
||||||
|
None,
|
||||||
|
crate::test::first_significant_code_diff(
|
||||||
|
crate::test::TEST_FLAGS_TEXTPROTO.trim(),
|
||||||
|
text.trim()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -631,14 +637,14 @@ mod tests {
|
|||||||
|
|
||||||
let filtered_parsed_flags =
|
let filtered_parsed_flags =
|
||||||
filter_parsed_flags(parsed_flags.clone(), CodegenMode::Exported);
|
filter_parsed_flags(parsed_flags.clone(), CodegenMode::Exported);
|
||||||
assert_eq!(2, filtered_parsed_flags.len());
|
assert_eq!(3, filtered_parsed_flags.len());
|
||||||
|
|
||||||
let filtered_parsed_flags =
|
let filtered_parsed_flags =
|
||||||
filter_parsed_flags(parsed_flags.clone(), CodegenMode::Production);
|
filter_parsed_flags(parsed_flags.clone(), CodegenMode::Production);
|
||||||
assert_eq!(8, filtered_parsed_flags.len());
|
assert_eq!(9, filtered_parsed_flags.len());
|
||||||
|
|
||||||
let filtered_parsed_flags = filter_parsed_flags(parsed_flags.clone(), CodegenMode::Test);
|
let filtered_parsed_flags = filter_parsed_flags(parsed_flags.clone(), CodegenMode::Test);
|
||||||
assert_eq!(8, filtered_parsed_flags.len());
|
assert_eq!(9, filtered_parsed_flags.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_test_flags_as_input() -> Input {
|
fn parse_test_flags_as_input() -> Input {
|
||||||
@@ -664,7 +670,7 @@ mod tests {
|
|||||||
fn test_modify_parsed_flags_based_on_mode_exported() {
|
fn test_modify_parsed_flags_based_on_mode_exported() {
|
||||||
let parsed_flags = crate::test::parse_test_flags();
|
let parsed_flags = crate::test::parse_test_flags();
|
||||||
let p_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, CodegenMode::Exported);
|
let p_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, CodegenMode::Exported);
|
||||||
assert_eq!(2, p_parsed_flags.len());
|
assert_eq!(3, p_parsed_flags.len());
|
||||||
for flag in p_parsed_flags.iter() {
|
for flag in p_parsed_flags.iter() {
|
||||||
assert_eq!(ProtoFlagState::DISABLED, flag.state());
|
assert_eq!(ProtoFlagState::DISABLED, flag.state());
|
||||||
assert_eq!(ProtoFlagPermission::READ_WRITE, flag.permission());
|
assert_eq!(ProtoFlagPermission::READ_WRITE, flag.permission());
|
||||||
|
@@ -341,6 +341,7 @@ mod tests {
|
|||||||
"com.android.aconfig.test.disabled_rw_exported",
|
"com.android.aconfig.test.disabled_rw_exported",
|
||||||
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
||||||
"com.android.aconfig.test.enabled_fixed_ro",
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro",
|
"com.android.aconfig.test.enabled_ro",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_rw",
|
"com.android.aconfig.test.enabled_rw",
|
||||||
@@ -360,6 +361,7 @@ mod tests {
|
|||||||
"state:ENABLED",
|
"state:ENABLED",
|
||||||
&[
|
&[
|
||||||
"com.android.aconfig.test.enabled_fixed_ro",
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro",
|
"com.android.aconfig.test.enabled_ro",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_rw",
|
"com.android.aconfig.test.enabled_rw",
|
||||||
@@ -370,6 +372,7 @@ mod tests {
|
|||||||
&[
|
&[
|
||||||
"com.android.aconfig.test.disabled_ro",
|
"com.android.aconfig.test.disabled_ro",
|
||||||
"com.android.aconfig.test.enabled_fixed_ro",
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro",
|
"com.android.aconfig.test.enabled_ro",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
]
|
]
|
||||||
@@ -377,12 +380,16 @@ mod tests {
|
|||||||
// trace: not supported yet
|
// trace: not supported yet
|
||||||
assert_create_filter_predicate!(
|
assert_create_filter_predicate!(
|
||||||
"is_fixed_read_only:true",
|
"is_fixed_read_only:true",
|
||||||
&["com.android.aconfig.test.enabled_fixed_ro"]
|
&[
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
|
]
|
||||||
);
|
);
|
||||||
assert_create_filter_predicate!(
|
assert_create_filter_predicate!(
|
||||||
"is_exported:true",
|
"is_exported:true",
|
||||||
&[
|
&[
|
||||||
"com.android.aconfig.test.disabled_rw_exported",
|
"com.android.aconfig.test.disabled_rw_exported",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -394,6 +401,7 @@ mod tests {
|
|||||||
"com.android.aconfig.test.disabled_rw_exported",
|
"com.android.aconfig.test.disabled_rw_exported",
|
||||||
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
"com.android.aconfig.test.disabled_rw_in_other_namespace",
|
||||||
"com.android.aconfig.test.enabled_fixed_ro",
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro",
|
"com.android.aconfig.test.enabled_ro",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_rw",
|
"com.android.aconfig.test.enabled_rw",
|
||||||
@@ -406,6 +414,7 @@ mod tests {
|
|||||||
"permission:READ_ONLY+state:ENABLED",
|
"permission:READ_ONLY+state:ENABLED",
|
||||||
&[
|
&[
|
||||||
"com.android.aconfig.test.enabled_fixed_ro",
|
"com.android.aconfig.test.enabled_fixed_ro",
|
||||||
|
"com.android.aconfig.test.enabled_fixed_ro_exported",
|
||||||
"com.android.aconfig.test.enabled_ro",
|
"com.android.aconfig.test.enabled_ro",
|
||||||
"com.android.aconfig.test.enabled_ro_exported",
|
"com.android.aconfig.test.enabled_ro_exported",
|
||||||
]
|
]
|
||||||
|
@@ -143,6 +143,31 @@ parsed_flag {
|
|||||||
purpose: PURPOSE_UNSPECIFIED
|
purpose: PURPOSE_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
parsed_flag {
|
||||||
|
package: "com.android.aconfig.test"
|
||||||
|
name: "enabled_fixed_ro_exported"
|
||||||
|
namespace: "aconfig_test"
|
||||||
|
description: "This flag is fixed ENABLED + READ_ONLY and exported"
|
||||||
|
bug: "111"
|
||||||
|
state: ENABLED
|
||||||
|
permission: READ_ONLY
|
||||||
|
trace {
|
||||||
|
source: "tests/test.aconfig"
|
||||||
|
state: DISABLED
|
||||||
|
permission: READ_ONLY
|
||||||
|
}
|
||||||
|
trace {
|
||||||
|
source: "tests/first.values"
|
||||||
|
state: ENABLED
|
||||||
|
permission: READ_ONLY
|
||||||
|
}
|
||||||
|
is_fixed_read_only: true
|
||||||
|
is_exported: true
|
||||||
|
container: "system"
|
||||||
|
metadata {
|
||||||
|
purpose: PURPOSE_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
parsed_flag {
|
parsed_flag {
|
||||||
package: "com.android.aconfig.test"
|
package: "com.android.aconfig.test"
|
||||||
name: "enabled_ro"
|
name: "enabled_ro"
|
||||||
|
@@ -40,3 +40,9 @@ flag_value {
|
|||||||
state: DISABLED
|
state: DISABLED
|
||||||
permission: READ_WRITE
|
permission: READ_WRITE
|
||||||
}
|
}
|
||||||
|
flag_value {
|
||||||
|
package: "com.android.aconfig.test"
|
||||||
|
name: "enabled_fixed_ro_exported"
|
||||||
|
state: ENABLED
|
||||||
|
permission: READ_ONLY
|
||||||
|
}
|
||||||
|
@@ -78,3 +78,12 @@ flag {
|
|||||||
bug: "111"
|
bug: "111"
|
||||||
is_exported: true
|
is_exported: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "enabled_fixed_ro_exported"
|
||||||
|
namespace: "aconfig_test"
|
||||||
|
description: "This flag is fixed ENABLED + READ_ONLY and exported"
|
||||||
|
bug: "111"
|
||||||
|
is_fixed_read_only: true
|
||||||
|
is_exported: true
|
||||||
|
}
|
Reference in New Issue
Block a user