DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
Also add logging to measure success/failure details. Test: builds, boots, and NTP fix obtained Bug: 32969463 (cherry picked from commitd3f689bf14) (cherry picked from commitdda938a698) Change-Id: I67e4f54f8f2ec69b6522fbbe06ef196b1084f44a
This commit is contained in:
committed by
Lorenzo Colitti
parent
1fee3a64b7
commit
389b853bc8
@@ -45,6 +45,7 @@ LOCAL_SRC_FILES += \
|
||||
core/java/android/app/admin/SecurityLogTags.logtags \
|
||||
core/java/android/content/EventLogTags.logtags \
|
||||
core/java/android/speech/tts/EventLogTags.logtags \
|
||||
core/java/android/net/EventLogTags.logtags \
|
||||
core/java/android/webkit/EventLogTags.logtags \
|
||||
core/java/com/android/internal/logging/EventLogTags.logtags \
|
||||
|
||||
|
||||
6
core/java/android/net/EventLogTags.logtags
Normal file
6
core/java/android/net/EventLogTags.logtags
Normal file
@@ -0,0 +1,6 @@
|
||||
# See system/core/logcat/event.logtags for a description of the format of this file.
|
||||
|
||||
option java_package android.net
|
||||
|
||||
50080 ntp_success (server|3),(rtt|2),(offset|2)
|
||||
50081 ntp_failure (server|3),(msg|3)
|
||||
@@ -36,8 +36,7 @@ import java.util.Arrays;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class SntpClient
|
||||
{
|
||||
public class SntpClient {
|
||||
private static final String TAG = "SntpClient";
|
||||
private static final boolean DBG = true;
|
||||
|
||||
@@ -88,6 +87,7 @@ public class SntpClient
|
||||
try {
|
||||
address = InetAddress.getByName(host);
|
||||
} catch (Exception e) {
|
||||
EventLogTags.writeNtpFailure(host, e.toString());
|
||||
if (DBG) Log.d(TAG, "request time failed: " + e);
|
||||
return false;
|
||||
}
|
||||
@@ -142,6 +142,7 @@ public class SntpClient
|
||||
// = (transit + skew - transit + skew)/2
|
||||
// = (2 * skew)/2 = skew
|
||||
long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2;
|
||||
EventLogTags.writeNtpSuccess(address.toString(), roundTripTime, clockOffset);
|
||||
if (DBG) {
|
||||
Log.d(TAG, "round trip: " + roundTripTime + "ms, " +
|
||||
"clock offset: " + clockOffset + "ms");
|
||||
@@ -153,6 +154,7 @@ public class SntpClient
|
||||
mNtpTimeReference = responseTicks;
|
||||
mRoundTripTime = roundTripTime;
|
||||
} catch (Exception e) {
|
||||
EventLogTags.writeNtpFailure(address.toString(), e.toString());
|
||||
if (DBG) Log.d(TAG, "request time failed: " + e);
|
||||
return false;
|
||||
} finally {
|
||||
|
||||
@@ -1706,7 +1706,7 @@
|
||||
<bool name="config_actionMenuItemAllCaps">true</bool>
|
||||
|
||||
<!-- Remote server that can provide NTP responses. -->
|
||||
<string translatable="false" name="config_ntpServer">2.android.pool.ntp.org</string>
|
||||
<string translatable="false" name="config_ntpServer">time.android.com</string>
|
||||
<!-- Normal polling frequency in milliseconds -->
|
||||
<integer name="config_ntpPollingInterval">86400000</integer>
|
||||
<!-- Try-again polling interval in milliseconds, in case the network request failed -->
|
||||
|
||||
Reference in New Issue
Block a user