summaryrefslogtreecommitdiff
path: root/ravenwood/junit-impl-src
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-26 01:37:06 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-11-26 01:37:06 +0000
commit07e440452f4fc8b525cbc6ae93dc58c96bdbd922 (patch)
tree96488e9238590c15eec355c8c35b0b12c95fa3b5 /ravenwood/junit-impl-src
parentde6bd0574e1ce67f2893416fd4edfc1827b8414a (diff)
parenteeeed8689b58dc5c5ff90d243132ce70fb2ed9ef (diff)
Merge "[Ravenwood] Update core property access check" into main
Diffstat (limited to 'ravenwood/junit-impl-src')
-rw-r--r--ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
index c545baacdf3e..99b38ed4c92c 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
@@ -132,9 +132,10 @@ public class RavenwoodSystemProperties {
}
private static boolean isKeyReadable(String key) {
- final String root = getKeyRoot(key);
+ // All writable keys are also readable
+ if (isKeyWritable(key)) return true;
- if (root.startsWith("debug.")) return true;
+ final String root = getKeyRoot(key);
// This set is carefully curated to help identify situations where a test may
// accidentally depend on a default value of an obscure property whose owner hasn't
@@ -145,26 +146,24 @@ public class RavenwoodSystemProperties {
if (root.startsWith("soc.")) return true;
if (root.startsWith("system.")) return true;
- // For PropertyInvalidatedCache
- if (root.startsWith("cache_key.")) return true;
-
- switch (key) {
- case "gsm.version.baseband":
- case "no.such.thing":
- case "qemu.sf.lcd_density":
- case "ro.bootloader":
- case "ro.debuggable":
- case "ro.hardware":
- case "ro.hw_timeout_multiplier":
- case "ro.odm.build.media_performance_class":
- case "ro.sf.lcd_density":
- case "ro.treble.enabled":
- case "ro.vndk.version":
- case "ro.icu.data.path":
- return true;
- }
-
- return false;
+ // All core values should be readable
+ if (sDefaultValues.containsKey(key)) return true;
+
+ // Hardcoded allowlist
+ return switch (key) {
+ case "gsm.version.baseband",
+ "no.such.thing",
+ "qemu.sf.lcd_density",
+ "ro.bootloader",
+ "ro.hardware",
+ "ro.hw_timeout_multiplier",
+ "ro.odm.build.media_performance_class",
+ "ro.sf.lcd_density",
+ "ro.treble.enabled",
+ "ro.vndk.version",
+ "ro.icu.data.path" -> true;
+ default -> false;
+ };
}
private static boolean isKeyWritable(String key) {