diff options
author | Xiao Ma <xiaom@google.com> | 2019-06-03 10:54:39 +0900 |
---|---|---|
committer | Xiao Ma <xiaom@google.com> | 2019-06-11 11:49:50 +0900 |
commit | d2d6e6bbe518e8600a77d40e1f084127c0cd3b54 (patch) | |
tree | 9c20e49928dd2644ca4e7f3981cd7fca1eb5b7e5 /src/android/net/ip/IpClient.java | |
parent | 67be1d71aa5d45763746ebb46881ce29ae4c4b7d (diff) |
Add DHCP INIT-REBOOT state in DHCP client.
Bug: 122710829
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I4d7f2f5e7303f34b6364109a545f60fc25b88058
Diffstat (limited to 'src/android/net/ip/IpClient.java')
-rw-r--r-- | src/android/net/ip/IpClient.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java index 266b1b0..ea19c7b 100644 --- a/src/android/net/ip/IpClient.java +++ b/src/android/net/ip/IpClient.java @@ -78,7 +78,6 @@ import java.util.concurrent.CountDownLatch; import java.util.function.Predicate; import java.util.stream.Collectors; - /** * IpClient * @@ -394,6 +393,14 @@ public class IpClient extends StateMachine { public INetd getNetd(Context context) { return INetd.Stub.asInterface((IBinder) context.getSystemService(Context.NETD_SERVICE)); } + + /** + * Get a IpMemoryStore instance. + */ + public NetworkStackIpMemoryStore getIpMemoryStore(Context context, + NetworkStackServiceManager nssManager) { + return new NetworkStackIpMemoryStore(context, nssManager.getIpMemoryStoreService()); + } } public IpClient(Context context, String ifName, IIpClientCallbacks callback, @@ -418,8 +425,7 @@ public class IpClient extends StateMachine { mShutdownLatch = new CountDownLatch(1); mCm = mContext.getSystemService(ConnectivityManager.class); mObserverRegistry = observerRegistry; - mIpMemoryStore = - new NetworkStackIpMemoryStore(context, nssManager.getIpMemoryStoreService()); + mIpMemoryStore = deps.getIpMemoryStore(context, nssManager); sSmLogs.putIfAbsent(mInterfaceName, new SharedLog(MAX_LOG_RECORDS, mTag)); mLog = sSmLogs.get(mInterfaceName); @@ -1124,6 +1130,7 @@ public class IpClient extends StateMachine { } mCallback.onNewDhcpResults(dhcpResults); maybeSaveNetworkToIpMemoryStore(); + dispatchCallback(delta, newLp); } @@ -1182,9 +1189,10 @@ public class IpClient extends StateMachine { } } else { // Start DHCPv4. - mDhcpClient = DhcpClient.makeDhcpClient(mContext, IpClient.this, mInterfaceParams); + mDhcpClient = DhcpClient.makeDhcpClient(mContext, IpClient.this, mInterfaceParams, + mIpMemoryStore); mDhcpClient.registerForPreDhcpNotification(); - mDhcpClient.sendMessage(DhcpClient.CMD_START_DHCP); + mDhcpClient.sendMessage(DhcpClient.CMD_START_DHCP, mL2Key); } return true; @@ -1369,7 +1377,6 @@ public class IpClient extends StateMachine { @Override public void enter() { mStartTimeMillis = SystemClock.elapsedRealtime(); - if (mConfiguration.mProvisioningTimeoutMs > 0) { final long alarmTime = SystemClock.elapsedRealtime() + mConfiguration.mProvisioningTimeoutMs; @@ -1426,7 +1433,6 @@ public class IpClient extends StateMachine { case EVENT_PROVISIONING_TIMEOUT: handleProvisioningFailure(); break; - default: // It's safe to process messages out of order because the // only message that can both |