aconfig: add fixed read only flag

Add a new field in the declaration to indicate whether
the permission can be overridden.

When the field “is_fixed_read_only” is set to true,
the flag permission will be set as fixed “READ_ONLY”,
and the permission should not be changed by Gantry.

Bug: 292521627
Test: atest aconfig.test
Change-Id: Ic9bcd7823bccb8b947cf05568c7ced3763490a23
This commit is contained in:
Zhi Dou
2023-08-21 22:49:46 +00:00
parent 07c4b5c0f2
commit 71f1b35fb4
10 changed files with 236 additions and 4 deletions

View File

@@ -121,6 +121,7 @@ mod tests {
public interface FeatureFlags {
boolean disabledRo();
boolean disabledRw();
boolean enabledFixedRo();
boolean enabledRo();
boolean enabledRw();
"#;
@@ -130,6 +131,7 @@ mod tests {
public final class Flags {
public static final String FLAG_DISABLED_RO = "com.android.aconfig.test.disabled_ro";
public static final String FLAG_DISABLED_RW = "com.android.aconfig.test.disabled_rw";
public static final String FLAG_ENABLED_FIXED_RO = "com.android.aconfig.test.enabled_fixed_ro";
public static final String FLAG_ENABLED_RO = "com.android.aconfig.test.enabled_ro";
public static final String FLAG_ENABLED_RW = "com.android.aconfig.test.enabled_rw";
@@ -139,6 +141,9 @@ mod tests {
public static boolean disabledRw() {
return FEATURE_FLAGS.disabledRw();
}
public static boolean enabledFixedRo() {
return FEATURE_FLAGS.enabledFixedRo();
}
public static boolean enabledRo() {
return FEATURE_FLAGS.enabledRo();
}
@@ -159,6 +164,11 @@ mod tests {
"Method is not implemented.");
}
@Override
public boolean enabledFixedRo() {
throw new UnsupportedOperationException(
"Method is not implemented.");
}
@Override
public boolean enabledRo() {
throw new UnsupportedOperationException(
"Method is not implemented.");
@@ -211,6 +221,10 @@ mod tests {
);
}
@Override
public boolean enabledFixedRo() {
return true;
}
@Override
public boolean enabledRo() {
return true;
}
@@ -311,6 +325,10 @@ mod tests {
return getFlag(Flags.FLAG_DISABLED_RW);
}
@Override
public boolean enabledFixedRo() {
return getFlag(Flags.FLAG_ENABLED_FIXED_RO);
}
@Override
public boolean enabledRo() {
return getFlag(Flags.FLAG_ENABLED_RO);
}
@@ -341,6 +359,7 @@ mod tests {
private HashMap<String, Boolean> mFlagMap = Stream.of(
Flags.FLAG_DISABLED_RO,
Flags.FLAG_DISABLED_RW,
Flags.FLAG_ENABLED_FIXED_RO,
Flags.FLAG_ENABLED_RO,
Flags.FLAG_ENABLED_RW
)