Remove references to BaseDhcpStateMachine and DhcpStateMachine
am: 29a215268d
* commit '29a215268dfa18f5023dc3c06b33db68e91ae316':
Remove references to BaseDhcpStateMachine and DhcpStateMachine
diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java
index ceabfce..38551b6 100644
--- a/services/net/java/android/net/dhcp/DhcpClient.java
+++ b/services/net/java/android/net/dhcp/DhcpClient.java
@@ -25,8 +25,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.net.DhcpResults;
import android.net.BaseDhcpStateMachine;
+import android.net.DhcpResults;
import android.net.InterfaceConfiguration;
import android.net.LinkAddress;
import android.net.NetworkUtils;
@@ -247,6 +247,11 @@
public static BaseDhcpStateMachine makeDhcpStateMachine(
Context context, StateMachine controller, String intf) {
+ return makeDhcpClient(context, controller, intf);
+ }
+
+ public static DhcpClient makeDhcpClient(
+ Context context, StateMachine controller, String intf) {
DhcpClient client = new DhcpClient(context, controller, intf);
client.start();
return client;
@@ -822,7 +827,7 @@
super.enter();
mOneshotTimeoutAlarm.cancel();
notifySuccess();
- // TODO: DhcpStateMachine only supports renewing at 50% of the lease time, and does not
+ // TODO: DhcpStateMachine only supported renewing at 50% of the lease time, and did not
// support rebinding. Once the legacy DHCP client is gone, fix this.
scheduleRenew();
}
@@ -890,7 +895,7 @@
}
}
- // Not implemented. DhcpStateMachine does not implement it either.
+ // Not implemented. DhcpStateMachine did not implement it either.
class DhcpRebindingState extends LoggingState {
}
diff --git a/services/net/java/android/net/ip/IpManager.java b/services/net/java/android/net/ip/IpManager.java
index d9d9829..d0d87b1 100644
--- a/services/net/java/android/net/ip/IpManager.java
+++ b/services/net/java/android/net/ip/IpManager.java
@@ -17,9 +17,7 @@
package android.net.ip;
import android.content.Context;
-import android.net.BaseDhcpStateMachine;
import android.net.DhcpResults;
-import android.net.DhcpStateMachine;
import android.net.InterfaceConfiguration;
import android.net.LinkAddress;
import android.net.LinkProperties;
@@ -31,7 +29,6 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.provider.Settings;
import android.util.Log;
import com.android.internal.annotations.GuardedBy;
@@ -185,7 +182,7 @@
* Non-final member variables accessed only from within our StateMachine.
*/
private IpReachabilityMonitor mIpReachabilityMonitor;
- private BaseDhcpStateMachine mDhcpStateMachine;
+ private DhcpClient mDhcpClient;
private DhcpResults mDhcpResults;
private ProvisioningConfiguration mConfiguration;
@@ -619,7 +616,7 @@
class StoppingState extends State {
@Override
public void enter() {
- if (mDhcpStateMachine == null) {
+ if (mDhcpClient == null) {
// There's no DHCPv4 for which to wait; proceed to stopped.
transitionTo(mStoppedState);
}
@@ -629,7 +626,7 @@
public boolean processMessage(Message msg) {
switch (msg.what) {
case DhcpClient.CMD_ON_QUIT:
- mDhcpStateMachine = null;
+ mDhcpClient = null;
transitionTo(mStoppedState);
break;
@@ -678,9 +675,12 @@
}
} else {
// Start DHCPv4.
- makeDhcpStateMachine();
- mDhcpStateMachine.registerForPreDhcpNotification();
- mDhcpStateMachine.sendMessage(DhcpClient.CMD_START_DHCP);
+ mDhcpClient = DhcpClient.makeDhcpClient(
+ mContext,
+ IpManager.this,
+ mInterfaceName);
+ mDhcpClient.registerForPreDhcpNotification();
+ mDhcpClient.sendMessage(DhcpClient.CMD_START_DHCP);
}
}
@@ -691,9 +691,9 @@
mIpReachabilityMonitor = null;
}
- if (mDhcpStateMachine != null) {
- mDhcpStateMachine.sendMessage(DhcpClient.CMD_STOP_DHCP);
- mDhcpStateMachine.doQuit();
+ if (mDhcpClient != null) {
+ mDhcpClient.sendMessage(DhcpClient.CMD_STOP_DHCP);
+ mDhcpClient.doQuit();
}
resetLinkProperties();
@@ -724,8 +724,8 @@
// It's possible to reach here if, for example, someone
// calls completedPreDhcpAction() after provisioning with
// a static IP configuration.
- if (mDhcpStateMachine != null) {
- mDhcpStateMachine.sendMessage(DhcpClient.CMD_PRE_DHCP_ACTION_COMPLETE);
+ if (mDhcpClient != null) {
+ mDhcpClient.sendMessage(DhcpClient.CMD_PRE_DHCP_ACTION_COMPLETE);
}
break;
@@ -775,7 +775,7 @@
case DhcpClient.CMD_ON_QUIT:
// DHCPv4 quit early for some reason.
Log.e(mTag, "Unexpected CMD_ON_QUIT.");
- mDhcpStateMachine = null;
+ mDhcpClient = null;
break;
default:
@@ -798,23 +798,5 @@
return true;
}
-
- private void makeDhcpStateMachine() {
- final boolean usingLegacyDhcp = (Settings.Global.getInt(
- mContext.getContentResolver(),
- Settings.Global.LEGACY_DHCP_CLIENT, 0) == 1);
-
- if (usingLegacyDhcp) {
- mDhcpStateMachine = DhcpStateMachine.makeDhcpStateMachine(
- mContext,
- IpManager.this,
- mInterfaceName);
- } else {
- mDhcpStateMachine = DhcpClient.makeDhcpStateMachine(
- mContext,
- IpManager.this,
- mInterfaceName);
- }
- }
}
}