OSDN Git Service

Check for NTP time as soon as WIFI is connected.
authorAmith Yamasani <yamasani@google.com>
Tue, 1 Mar 2011 20:41:04 +0000 (12:41 -0800)
committerAmith Yamasani <yamasani@google.com>
Tue, 1 Mar 2011 20:41:04 +0000 (12:41 -0800)
commit8d394fa8993f7143dee6f894a41be888bdd16bc0
tree61fd6fce4eb1a46f78b81049ddc563cca672edda
parent9967ce04572e916a5f68ae0f9345f13b35ec20b0
Check for NTP time as soon as WIFI is connected.

Listen for connectivity changes. If WIFI is connected, check if
we have recently checked for NTP time. If we haven't yet checked the
time or it has been long enough (a day), then connect to the NTP server
and get the latest time. Update the time if it is significantly out of sync.

This doesn't poll the NTP server every time there is connectivity, only
if it hasn't been checked since boot or has been a day.

This fixes the problem that during SetupWizard, we try to contact the NTP
server before there is connectivity and fail. Now, as soon as the user
chooses a WiFi network to connect to, it will update the time before
getting to the Date/Time step. Then as soon as the user corrects the TZ,
the date/time should be correct.

Bug: 3491920
Change-Id: I62664156616510b67ecd6a1c24dd838b98d5204f
services/java/com/android/server/NetworkTimeUpdateService.java