summaryrefslogtreecommitdiff
path: root/src/android/net/ip/IpClient.java
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2019-06-11 04:07:33 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-06-11 04:07:33 -0700
commit02434dace7e651782043b4f6d6c87398fbfe352e (patch)
tree39fcf6a07610ff07a60b23932d76114661ffccd8 /src/android/net/ip/IpClient.java
parent8679e1ebd6558059f8e8348fd288321a00e55a47 (diff)
parent670a869a13a85fd38d85e206da622eefcaff8e00 (diff)
Merge "Add DHCP INIT-REBOOT state in DHCP client."
am: 670a869a13 Change-Id: I9f4eb3e0f67fe16ac64e3aff5b1af8b84aab0a73
Diffstat (limited to 'src/android/net/ip/IpClient.java')
-rw-r--r--src/android/net/ip/IpClient.java20
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