summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Forrest Dunlap <fdunlap@google.com> 2021-03-31 20:04:43 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-03-31 20:04:43 +0000
commit527b38c7a26d3c6e24abdd8ffa04cbb237b125fb (patch)
tree1f8ab80d156fbef58c0205815bb7ecc3caaf18d4
parent090ceb3af9845ace914a3e1eb91507d83c9678e5 (diff)
parentf9063fb1ff10bef7f77dcf7fe5b32421d925d3da (diff)
Merge "Clarify resetToDefaults documentation." into sc-dev
-rw-r--r--core/java/android/provider/DeviceConfig.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 03b5a2e2568a..d7d1902b9b9f 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -800,10 +800,24 @@ public final class DeviceConfig {
}
/**
- * Reset properties to their default values.
+ * Reset properties to their default values by removing the underlying values.
* <p>
* The method accepts an optional namespace parameter. If provided, only properties set within
* that namespace will be reset. Otherwise, all properties will be reset.
+ * <p>
+ * Note: This method should only be used by {@link com.android.server.RescueParty}. It was
+ * designed to be used in the event of boot or crash loops caused by flag changes. It does not
+ * revert flag values to defaults - instead it removes the property entirely which causes the
+ * consumer of the flag to use hardcoded defaults upon retrieval.
+ * <p>
+ * To clear values for a namespace without removing the underlying properties, construct a
+ * {@link Properties} object with the caller's namespace and either an empty flag map, or some
+ * snapshot of flag values. Then use {@link #setProperties(Properties)} to remove all flags
+ * under the namespace, or set them to the values in the snapshot.
+ * <p>
+ * To revert values for testing, one should mock DeviceConfig using
+ * {@link com.android.server.testables.TestableDeviceConfig} where possible. Otherwise, fallback
+ * to using {@link #setProperties(Properties)} as outlined above.
*
* @param resetMode The reset mode to use.
* @param namespace Optionally, the specific namespace which resets will be limited to.