summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-01-26 22:23:45 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-26 22:23:45 +0000
commit8dbcd434979886fddee341eeb1e188f0a7e66fdb (patch)
tree86c5816085634552978fe46efe5eeb406bd0d027 /services
parent6d4cc5c816fba1f1706db79c3ae356a6d1b52189 (diff)
parent09dff843b8ed402564c4c89d7e1cabceb715e458 (diff)
downloadframeworks_base-8dbcd434979886fddee341eeb1e188f0a7e66fdb.zip
frameworks_base-8dbcd434979886fddee341eeb1e188f0a7e66fdb.tar.gz
frameworks_base-8dbcd434979886fddee341eeb1e188f0a7e66fdb.tar.bz2
am 09dff843: Merge "Only try to fetch time from NTP if there is a network connection." into lmp-mr1-dev
* commit '09dff843b8ed402564c4c89d7e1cabceb715e458': Only try to fetch time from NTP if there is a network connection.
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/NetworkTimeUpdateService.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/NetworkTimeUpdateService.java b/services/core/java/com/android/server/NetworkTimeUpdateService.java
index fddb54e..d6abce9 100644
--- a/services/core/java/com/android/server/NetworkTimeUpdateService.java
+++ b/services/core/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_NETWORK_CONNECTED = 3;
+ private static final int EVENT_NETWORK_CHANGED = 3;
private static final String ACTION_POLL =
"com.android.server.NetworkTimeUpdateService.action.POLL";
@@ -248,18 +248,8 @@ public class NetworkTimeUpdateService {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
- // There is connectivity
- final ConnectivityManager connManager = (ConnectivityManager) context
- .getSystemService(Context.CONNECTIVITY_SERVICE);
- final NetworkInfo netInfo = connManager.getActiveNetworkInfo();
- if (netInfo != null) {
- // Verify that it's a WIFI connection
- if (netInfo.getState() == NetworkInfo.State.CONNECTED &&
- (netInfo.getType() == ConnectivityManager.TYPE_WIFI ||
- netInfo.getType() == ConnectivityManager.TYPE_ETHERNET) ) {
- mHandler.obtainMessage(EVENT_NETWORK_CONNECTED).sendToTarget();
- }
- }
+ // Don't bother checking if we have connectivity, NtpTrustedTime does that for us.
+ mHandler.obtainMessage(EVENT_NETWORK_CHANGED).sendToTarget();
}
}
};
@@ -276,7 +266,7 @@ public class NetworkTimeUpdateService {
switch (msg.what) {
case EVENT_AUTO_TIME_CHANGED:
case EVENT_POLL_NETWORK_TIME:
- case EVENT_NETWORK_CONNECTED:
+ case EVENT_NETWORK_CHANGED:
onPollNetworkTime(msg.what);
break;
}