summaryrefslogtreecommitdiff
path: root/src/android/net/util/NetworkStackUtils.java
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2019-06-11 18:51:24 +0900
committerXiao Ma <xiaom@google.com>2019-07-02 18:57:04 +0900
commitf963e366ec80924fd17e4631f2243fb6b1a3670d (patch)
tree014a2690fa5883cdeb9db393ce1a75c2e8b13b2a /src/android/net/util/NetworkStackUtils.java
parent74c651f8f3fde9ebb4bd43b433759aaa40bf8f40 (diff)
Add DHCP Rapid Commit option(RFC4039) support in client side.
Bug: 122710829 Bug: 136216415 Test: atest FrameworksNetTests NetworkStackTests Test: manual test Change-Id: I384282b7efd0df0c4a6de7bdc1957048303ad88b
Diffstat (limited to 'src/android/net/util/NetworkStackUtils.java')
-rw-r--r--src/android/net/util/NetworkStackUtils.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java
index 541f9d8..4afc34b 100644
--- a/src/android/net/util/NetworkStackUtils.java
+++ b/src/android/net/util/NetworkStackUtils.java
@@ -107,6 +107,16 @@ public class NetworkStackUtils {
*/
public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
+ /**
+ * Experiment flag to enable DHCP INIT-REBOOT state, default value is false.
+ */
+ public static final String DHCP_INIT_REBOOT_ENABLED = "dhcp_init_reboot_enabled";
+
+ /**
+ * Experiment flag to enable DHCP Rapid Commit option, default value is false.
+ */
+ public static final String DHCP_RAPID_COMMIT_ENABLED = "dhcp_rapid_commit_enabled";
+
static {
System.loadLibrary("networkstackutilsjni");
}
@@ -181,8 +191,7 @@ public class NetworkStackUtils {
* Look up the value of a property for a particular namespace from {@link DeviceConfig}.
* @param namespace The namespace containing the property to look up.
* @param name The name of the property to look up.
- * @param defaultValue The value to return if the property does not exist or has no non-null
- * value.
+ * @param defaultValue The value to return if the property does not exist or its value is null.
* @return the corresponding value, or defaultValue if none exists.
*/
public static int getDeviceConfigPropertyInt(@NonNull String namespace, @NonNull String name,
@@ -196,6 +205,19 @@ public class NetworkStackUtils {
}
/**
+ * Look up the value of a property for a particular namespace from {@link DeviceConfig}.
+ * @param namespace The namespace containing the property to look up.
+ * @param name The name of the property to look up.
+ * @param defaultValue The value to return if the property does not exist or its value is null.
+ * @return the corresponding value, or defaultValue if none exists.
+ */
+ public static boolean getDeviceConfigPropertyBoolean(@NonNull String namespace,
+ @NonNull String name, boolean defaultValue) {
+ String value = getDeviceConfigProperty(namespace, name, null /* defaultValue */);
+ return (value != null) ? Boolean.parseBoolean(value) : defaultValue;
+ }
+
+ /**
* Attaches a socket filter that accepts DHCP packets to the given socket.
*/
public static native void attachDhcpFilter(FileDescriptor fd) throws SocketException;