diff options
author | Remi NGUYEN VAN <reminv@google.com> | 2020-06-26 16:39:48 +0900 |
---|---|---|
committer | Remi NGUYEN VAN <reminv@google.com> | 2020-07-03 18:30:51 +0900 |
commit | 7b6435fd3b3aac33c6b239040bdeac1573a444a5 (patch) | |
tree | 3d26b568874e7e788a18d9e0dde07b1bdb1516b3 /src/android/net/util/NetworkStackUtils.java | |
parent | e04f8b7dfb9d7efa7f87de3859014d3e7eb524f2 (diff) |
Refine validation metrics
Rename members for a clearer API, and add try/catch blocks to each
NetworkMonitor call to guarantee there will not be any crash.
Add a flag allowing to disable all the metrics collection code.
Bug: 151796056
Test: atest NetworkStackTests (see also test-only change)
Change-Id: I06d6dccc57146b955b15cf36a2109c68a5355494
Diffstat (limited to 'src/android/net/util/NetworkStackUtils.java')
-rwxr-xr-x | src/android/net/util/NetworkStackUtils.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java index 19ca4b5..94de7c3 100755 --- a/src/android/net/util/NetworkStackUtils.java +++ b/src/android/net/util/NetworkStackUtils.java @@ -226,6 +226,15 @@ public class NetworkStackUtils { public static final String DNS_PROBE_PRIVATE_IP_NO_INTERNET_VERSION = "dns_probe_private_ip_no_internet"; + /** + * Experiment flag to enable validation metrics sent by NetworkMonitor. + * + * Metrics are sent by default. They can be disabled by setting the flag to a number greater + * than the APK version (for example 999999999). + * @see #isFeatureEnabled(Context, String, String, boolean) + */ + public static final String VALIDATION_METRICS_VERSION = "validation_metrics_version"; + static { System.loadLibrary("networkstackutilsjni"); } @@ -348,6 +357,9 @@ public class NetworkStackUtils { * {@link DeviceConfig} is enabled by comparing NetworkStack module version {@link NetworkStack} * with current version of property. If this property version is valid, the corresponding * experimental feature would be enabled, otherwise disabled. + * + * This is useful to ensure that if a module install is rolled back, flags are not left fully + * rolled out on a version where they have not been well tested. * @param context The global context information about an app environment. * @param namespace The namespace containing the property to look up. * @param name The name of the property to look up. @@ -363,6 +375,9 @@ public class NetworkStackUtils { * {@link DeviceConfig} is enabled by comparing NetworkStack module version {@link NetworkStack} * with current version of property. If this property version is valid, the corresponding * experimental feature would be enabled, otherwise disabled. + * + * This is useful to ensure that if a module install is rolled back, flags are not left fully + * rolled out on a version where they have not been well tested. * @param context The global context information about an app environment. * @param namespace The namespace containing the property to look up. * @param name The name of the property to look up. |