Fix canceling renew alarms.
1. Entering DhcpBoundState cancels the renew alarm, but at that
point the renew alarm is guaranteed not to have been scheduled.
This is harmless, but results in an "unknown listener" message
in the AlarmManager logs.
2. We don't cancel the renew alarm when exiting DhcpBoundState.
This is also harmless, because that alarm does nothing except
in DhcpBoundState, and we cancel it whenever we enter
DhcpBoundState. But canceling it on exit is more correct.
Change-Id: I60dfcf00f243253b81b8906540e0a6218a7a489c
diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java
index 812d9b6..2329b42 100644
--- a/services/net/java/android/net/dhcp/DhcpClient.java
+++ b/services/net/java/android/net/dhcp/DhcpClient.java
@@ -389,7 +389,6 @@
}
private void scheduleRenew() {
- mRenewAlarm.cancel();
if (mDhcpLeaseExpiry != 0) {
long now = SystemClock.elapsedRealtime();
long alarmTime = (now + mDhcpLeaseExpiry) / 2;
@@ -822,6 +821,11 @@
return NOT_HANDLED;
}
}
+
+ @Override
+ public void exit() {
+ mRenewAlarm.cancel();
+ }
}
class DhcpRenewingState extends PacketRetransmittingState {