[Ravenwood] Update core property access check

Flag: EXEMPT host test change only
Bug: 377765941
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Change-Id: Ie8d1099c63b638927f22d8229a9244b6bb011e31
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 c545baa..99b38ed 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 @@
     }
 
     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 @@
         if (root.startsWith("soc.")) return true;
         if (root.startsWith("system.")) return true;
 
-        // For PropertyInvalidatedCache
-        if (root.startsWith("cache_key.")) return true;
+        // All core values should be readable
+        if (sDefaultValues.containsKey(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;
+        // 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) {