diff options
author | Xiao Ma <xiaom@google.com> | 2019-07-05 07:46:34 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-07-05 07:46:34 -0700 |
commit | f093022d6c8186c9bb3e02cba10f76ca3f848d1e (patch) | |
tree | 6da997056111b477a3a564d93a6d8862acdfbbd0 /src/android/net/util/NetworkStackUtils.java | |
parent | fff7b07d00fbe0cacaf61dec80f5e28cec982c81 (diff) | |
parent | d53f5498850e2371843dfbba2bcaad7dd5cd74a3 (diff) |
Merge "Add DHCP Rapid Commit option(RFC4039) support in client side."
am: d53f549885
Change-Id: I4a868d673f6263a5ad2d5acb475e99aac80b750c
Diffstat (limited to 'src/android/net/util/NetworkStackUtils.java')
-rw-r--r-- | src/android/net/util/NetworkStackUtils.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java index 9bf1b96..4e340ce 100644 --- a/src/android/net/util/NetworkStackUtils.java +++ b/src/android/net/util/NetworkStackUtils.java @@ -108,6 +108,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"); } @@ -182,8 +192,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, @@ -197,6 +206,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; |