Loading services/net/java/android/net/dhcp/DhcpClient.java +8 −3 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import com.android.internal.util.WakeupMessage; 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; Loading Loading @@ -247,6 +247,11 @@ public class DhcpClient extends BaseDhcpStateMachine { 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; Loading Loading @@ -822,7 +827,7 @@ public class DhcpClient extends BaseDhcpStateMachine { 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(); } Loading Loading @@ -890,7 +895,7 @@ public class DhcpClient extends BaseDhcpStateMachine { } } // Not implemented. DhcpStateMachine does not implement it either. // Not implemented. DhcpStateMachine did not implement it either. class DhcpRebindingState extends LoggingState { } Loading services/net/java/android/net/ip/IpManager.java +15 −33 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -31,7 +29,6 @@ import android.os.INetworkManagementService; 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; Loading Loading @@ -185,7 +182,7 @@ public class IpManager extends StateMachine { * 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; Loading Loading @@ -619,7 +616,7 @@ public class IpManager extends StateMachine { 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); } Loading @@ -629,7 +626,7 @@ public class IpManager extends StateMachine { public boolean processMessage(Message msg) { switch (msg.what) { case DhcpClient.CMD_ON_QUIT: mDhcpStateMachine = null; mDhcpClient = null; transitionTo(mStoppedState); break; Loading Loading @@ -678,9 +675,12 @@ public class IpManager extends StateMachine { } } 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); } } Loading @@ -691,9 +691,9 @@ public class IpManager extends StateMachine { 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(); Loading Loading @@ -724,8 +724,8 @@ public class IpManager extends StateMachine { // 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; Loading Loading @@ -775,7 +775,7 @@ public class IpManager extends StateMachine { case DhcpClient.CMD_ON_QUIT: // DHCPv4 quit early for some reason. Log.e(mTag, "Unexpected CMD_ON_QUIT."); mDhcpStateMachine = null; mDhcpClient = null; break; default: Loading @@ -798,23 +798,5 @@ public class IpManager extends StateMachine { 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); } } } } Loading
services/net/java/android/net/dhcp/DhcpClient.java +8 −3 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import com.android.internal.util.WakeupMessage; 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; Loading Loading @@ -247,6 +247,11 @@ public class DhcpClient extends BaseDhcpStateMachine { 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; Loading Loading @@ -822,7 +827,7 @@ public class DhcpClient extends BaseDhcpStateMachine { 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(); } Loading Loading @@ -890,7 +895,7 @@ public class DhcpClient extends BaseDhcpStateMachine { } } // Not implemented. DhcpStateMachine does not implement it either. // Not implemented. DhcpStateMachine did not implement it either. class DhcpRebindingState extends LoggingState { } Loading
services/net/java/android/net/ip/IpManager.java +15 −33 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -31,7 +29,6 @@ import android.os.INetworkManagementService; 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; Loading Loading @@ -185,7 +182,7 @@ public class IpManager extends StateMachine { * 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; Loading Loading @@ -619,7 +616,7 @@ public class IpManager extends StateMachine { 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); } Loading @@ -629,7 +626,7 @@ public class IpManager extends StateMachine { public boolean processMessage(Message msg) { switch (msg.what) { case DhcpClient.CMD_ON_QUIT: mDhcpStateMachine = null; mDhcpClient = null; transitionTo(mStoppedState); break; Loading Loading @@ -678,9 +675,12 @@ public class IpManager extends StateMachine { } } 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); } } Loading @@ -691,9 +691,9 @@ public class IpManager extends StateMachine { 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(); Loading Loading @@ -724,8 +724,8 @@ public class IpManager extends StateMachine { // 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; Loading Loading @@ -775,7 +775,7 @@ public class IpManager extends StateMachine { case DhcpClient.CMD_ON_QUIT: // DHCPv4 quit early for some reason. Log.e(mTag, "Unexpected CMD_ON_QUIT."); mDhcpStateMachine = null; mDhcpClient = null; break; default: Loading @@ -798,23 +798,5 @@ public class IpManager extends StateMachine { 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); } } } }