--- a/frameworks/base/core/java/android/util/NtpTrustedTime.java
+++ b/frameworks/base/core/java/android/util/NtpTrustedTime.java
@@ -57,6 +57,9 @@ public class NtpTrustedTime implements TrustedTime {
private static int mNtpRetries = 0;
private static int mNtpRetriesMax = 0;
private static final String BACKUP_SERVER = "persist.backup.ntpServer";
+ private String[] mNtpServers = { "cn.ntp.org.cn", "edu.ntp.org.cn", "ntp1.aliyun.com", "ntp2.aliyun.com", "cn.pool.ntp.org" };
private NtpTrustedTime(String server, long timeout) {
if (LOGD) Log.d(TAG, "creating NtpTrustedTime using " + server);
@@ -160,6 +163,17 @@ public class NtpTrustedTime implements TrustedTime {
mCachedNtpCertainty = client.getRoundTripTime() / 2;
return true;
} else {
+ for (String ntpServer : mNtpServers) {
+ if (client.requestTime(ntpServer, (int) mTimeout, network)) {
+ mHasCache = true;
+ mCachedNtpTime = client.getNtpTime();
+ mCachedNtpElapsedRealtime = client.getNtpTimeReference();
+ mCachedNtpCertainty = client.getRoundTripTime() / 2;
+ return true;
+ }
+ }
countInBackupmode();
return false;
}
修改时区
--- a/device/qcom/msm8953_64/msm8953_64.mk
+++ b/device/qcom/msm8953_64/msm8953_64.mk
@@ -585,3 +585,6 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_PROPERTY_OVERRIDES += \
ro.vendor.sensors.gravity=false \
ro.vendor.sensors.laccel=false
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ persist.sys.timezone=Asia/Shanghai
|