NetworkTimeUpdateService: Schedule NTP on ethernet connect as well as wifi

Change-Id: I936fd9a8119ee361ec0afde60f7931c58ffdd524
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2011-11-09 10:49:29 -08:00
parent 1e2c0d231e
commit 0342a420a4

View File

@@ -55,7 +55,7 @@ public class NetworkTimeUpdateService {
private static final int EVENT_AUTO_TIME_CHANGED = 1;
private static final int EVENT_POLL_NETWORK_TIME = 2;
private static final int EVENT_WIFI_CONNECTED = 3;
private static final int EVENT_NETWORK_CONNECTED = 3;
/** Normal polling frequency */
private static final long POLLING_INTERVAL_MS = 24L * 60 * 60 * 1000; // 24 hrs
@@ -239,8 +239,9 @@ public class NetworkTimeUpdateService {
if (netInfo != null) {
// Verify that it's a WIFI connection
if (netInfo.getState() == NetworkInfo.State.CONNECTED &&
netInfo.getType() == ConnectivityManager.TYPE_WIFI ) {
mHandler.obtainMessage(EVENT_WIFI_CONNECTED).sendToTarget();
(netInfo.getType() == ConnectivityManager.TYPE_WIFI ||
netInfo.getType() == ConnectivityManager.TYPE_ETHERNET) ) {
mHandler.obtainMessage(EVENT_NETWORK_CONNECTED).sendToTarget();
}
}
}
@@ -259,7 +260,7 @@ public class NetworkTimeUpdateService {
switch (msg.what) {
case EVENT_AUTO_TIME_CHANGED:
case EVENT_POLL_NETWORK_TIME:
case EVENT_WIFI_CONNECTED:
case EVENT_NETWORK_CONNECTED:
onPollNetworkTime(msg.what);
break;
}