From 0342a420a4a87f8d03d86e85f2f5aa85f28d75fd Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Wed, 9 Nov 2011 10:49:29 -0800 Subject: [PATCH] NetworkTimeUpdateService: Schedule NTP on ethernet connect as well as wifi Change-Id: I936fd9a8119ee361ec0afde60f7931c58ffdd524 Signed-off-by: Mike Lockwood --- .../com/android/server/NetworkTimeUpdateService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java index f7fe39ecfd680..02a0872be9322 100644 --- a/services/java/com/android/server/NetworkTimeUpdateService.java +++ b/services/java/com/android/server/NetworkTimeUpdateService.java @@ -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; }