From 57224928a70db3d67b991c20106d52814a7d7260 Mon Sep 17 00:00:00 2001 From: Hugo Benichi Date: Fri, 23 Jun 2017 10:07:08 +0900 Subject: [PATCH] IpManager: define InitialConfiguration This patch adds a InitialConfiguration class to IpManager for specifying IP information in IpManager ProvisioningConfiguration at IpManager startup. At the moment this InitialConfiguration is not used, but is validated in startProvsiioning if ProvisioningConfiguration includes one. It will be integrated into IpManager IP provisioning logic in follow-up patches. This patch also includes an example of data driven unit tests using a table of test case. The highlights of this methodology are: 1) easy extensibility for new test case, 2) rich and informative error messages, Unfortunately Java support for inlined data structure literals is poor and some companion static methods for data generation are required for enabling this methodology. Bug: 62988545 Test: added new test in FrameworksNetTests, $ runtest frameworks-net $ runtest frameworks-wifi Merged-In: I060b02603af7d73a6407df89344bf0c000574af2 (cherry pick of commit c8a0b1b80c5fe90be22c8180e89d2ac4a4cbd176) Change-Id: I48dbf89232d7758f1b07ed4d76ce93281e5c6b53 --- core/java/android/net/LinkAddress.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/java/android/net/LinkAddress.java b/core/java/android/net/LinkAddress.java index 6e74f14bd1..62de9911bc 100644 --- a/core/java/android/net/LinkAddress.java +++ b/core/java/android/net/LinkAddress.java @@ -16,6 +16,15 @@ package android.net; +import static android.system.OsConstants.IFA_F_DADFAILED; +import static android.system.OsConstants.IFA_F_DEPRECATED; +import static android.system.OsConstants.IFA_F_OPTIMISTIC; +import static android.system.OsConstants.IFA_F_TENTATIVE; +import static android.system.OsConstants.RT_SCOPE_HOST; +import static android.system.OsConstants.RT_SCOPE_LINK; +import static android.system.OsConstants.RT_SCOPE_SITE; +import static android.system.OsConstants.RT_SCOPE_UNIVERSE; + import android.os.Parcel; import android.os.Parcelable; import android.util.Pair; @@ -26,15 +35,6 @@ import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.UnknownHostException; -import static android.system.OsConstants.IFA_F_DADFAILED; -import static android.system.OsConstants.IFA_F_DEPRECATED; -import static android.system.OsConstants.IFA_F_OPTIMISTIC; -import static android.system.OsConstants.IFA_F_TENTATIVE; -import static android.system.OsConstants.RT_SCOPE_HOST; -import static android.system.OsConstants.RT_SCOPE_LINK; -import static android.system.OsConstants.RT_SCOPE_SITE; -import static android.system.OsConstants.RT_SCOPE_UNIVERSE; - /** * Identifies an IP address on a network link. * @@ -101,7 +101,7 @@ public class LinkAddress implements Parcelable { * Per RFC 4193 section 8, fc00::/7 identifies these addresses. */ private boolean isIPv6ULA() { - if (address != null && address instanceof Inet6Address) { + if (address instanceof Inet6Address) { byte[] bytes = address.getAddress(); return ((bytes[0] & (byte)0xfe) == (byte)0xfc); }