am 885c3c11: am bc4ddef4: Merge "DO NOT MERGE Revert "Fix lease duration handling"" into honeycomb-mr2
* commit '885c3c11cf1e20c456ddf681a06a4a878426a632': DO NOT MERGE Revert "Fix lease duration handling"
This commit is contained in:
@@ -66,9 +66,6 @@ public class DhcpStateMachine extends StateMachine {
|
|||||||
private static final int DHCP_RENEW = 0;
|
private static final int DHCP_RENEW = 0;
|
||||||
private static final String ACTION_DHCP_RENEW = "android.net.wifi.DHCP_RENEW";
|
private static final String ACTION_DHCP_RENEW = "android.net.wifi.DHCP_RENEW";
|
||||||
|
|
||||||
//Used for sanity check on setting up renewal
|
|
||||||
private static final int MIN_RENEWAL_TIME_SECS = 5 * 60; // 5 minutes
|
|
||||||
|
|
||||||
private enum DhcpAction {
|
private enum DhcpAction {
|
||||||
START,
|
START,
|
||||||
RENEW
|
RENEW
|
||||||
@@ -334,21 +331,13 @@ public class DhcpStateMachine extends StateMachine {
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
Log.d(TAG, "DHCP succeeded on " + mInterfaceName);
|
Log.d(TAG, "DHCP succeeded on " + mInterfaceName);
|
||||||
long leaseDuration = dhcpInfoInternal.leaseDuration; //int to long conversion
|
//Do it a bit earlier than half the lease duration time
|
||||||
|
//to beat the native DHCP client and avoid extra packets
|
||||||
//Sanity check for renewal
|
//48% for one hour lease time = 29 minutes
|
||||||
//TODO: would be good to notify the user that his network configuration is
|
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
||||||
//bad and that the device cannot renew below MIN_RENEWAL_TIME_SECS
|
SystemClock.elapsedRealtime() +
|
||||||
if (leaseDuration < MIN_RENEWAL_TIME_SECS) {
|
dhcpInfoInternal.leaseDuration * 480, //in milliseconds
|
||||||
leaseDuration = MIN_RENEWAL_TIME_SECS;
|
mDhcpRenewalIntent);
|
||||||
}
|
|
||||||
//Do it a bit earlier than half the lease duration time
|
|
||||||
//to beat the native DHCP client and avoid extra packets
|
|
||||||
//48% for one hour lease time = 29 minutes
|
|
||||||
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
|
||||||
SystemClock.elapsedRealtime() +
|
|
||||||
leaseDuration * 480, //in milliseconds
|
|
||||||
mDhcpRenewalIntent);
|
|
||||||
|
|
||||||
mController.obtainMessage(CMD_POST_DHCP_ACTION, DHCP_SUCCESS, 0, dhcpInfoInternal)
|
mController.obtainMessage(CMD_POST_DHCP_ACTION, DHCP_SUCCESS, 0, dhcpInfoInternal)
|
||||||
.sendToTarget();
|
.sendToTarget();
|
||||||
|
|||||||
Reference in New Issue
Block a user