Avoid caching properties into known namespace
Those namespace have moving tracking which makes
caching inconvenient
Test: presubmit
Bug: 289963949
Change-Id: Ic8b16744f7fc377159c89456215ebc7e9d64bf24
diff --git a/src/com/android/tradefed/device/NativeDevice.java b/src/com/android/tradefed/device/NativeDevice.java
index 40a35d5..4904cd5 100644
--- a/src/com/android/tradefed/device/NativeDevice.java
+++ b/src/com/android/tradefed/device/NativeDevice.java
@@ -268,6 +268,8 @@
// If we increase the number of props, then increase the cache size of mPropertiesCache.
private final Set<String> propsToPrefetch =
ImmutableSet.of("ro.build.version.sdk", "ro.build.version.codename", "ro.build.id");
+ // Avoid caching any properties in those namespace
+ private final Set<String> NEVER_CACHE_PROPERTIES = ImmutableSet.of("vendor.debug", "ro.boot");
/** Interface for a generic device communication attempt. */
abstract interface DeviceAction {
@@ -655,8 +657,10 @@
}
property = result.getStdout().trim();
if (property != null) {
- // Manage the cache manually to maintain exception handling
- mPropertiesCache.put(name, property);
+ if (!NEVER_CACHE_PROPERTIES.stream().anyMatch(p -> name.startsWith(p))) {
+ // Manage the cache manually to maintain exception handling
+ mPropertiesCache.put(name, property);
+ }
}
return property;
}