summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/ThrottleService.java
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-05-26 10:37:48 -0700
committerRobert Greenwalt <robdroid@android.com>2010-05-26 10:37:48 -0700
commitd1c3ea6a2116156629a1a3eaee64d0181e4f52c8 (patch)
tree5ff7caadfd878c26e1a657531b96b63d49308980 /services/java/com/android/server/ThrottleService.java
parenta14aded514540578b7024918c82c81810622a91a (diff)
parent3cd6a3e35322d293848cf9f998ffa301b60b9b2d (diff)
resolved conflicts for merge of 3cd6a3e3 to master
Change-Id: If3e45cc3494b2c52a1f1dcc19deff763a50498d7
Diffstat (limited to 'services/java/com/android/server/ThrottleService.java')
-rw-r--r--services/java/com/android/server/ThrottleService.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index 5e328a7ab26e..1974f0e63bb3 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -203,6 +203,8 @@ public class ThrottleService extends IThrottleManager.Stub {
Settings.Secure.THROTTLE_NOTIFICATION_TYPE), false, this);
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.THROTTLE_HELP_URI), false, this);
+ resolver.registerContentObserver(Settings.Secure.getUriFor(
+ Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
}
@Override
@@ -438,10 +440,13 @@ public class ThrottleService extends IThrottleManager.Stub {
mPolicyNotificationsAllowedMask = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
+ mMaxNtpCacheAgeSec = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC, MAX_NTP_CACHE_AGE_SEC);
+
Slog.d(TAG, "onPolicyChanged testing=" + testing +", period=" + mPolicyPollPeriodSec +
", threshold=" + mPolicyThreshold.get() + ", value=" +
mPolicyThrottleValue.get() + ", resetDay=" + mPolicyResetDay + ", noteType=" +
- mPolicyNotificationsAllowedMask);
+ mPolicyNotificationsAllowedMask + ", maxNtpCacheAge=" + mMaxNtpCacheAgeSec);
// force updates
mThrottleIndex.set(THROTTLE_INDEX_UNINITIALIZED);
@@ -719,8 +724,9 @@ public class ThrottleService extends IThrottleManager.Stub {
getBestTime(false);
}
- private static final int MAX_NTP_CACHE_AGE = 60 * 1000;
+ private static final int MAX_NTP_CACHE_AGE_SEC = 60 * 60 * 24; // 1 day
private static final int MAX_NTP_FETCH_WAIT = 20 * 1000;
+ private int mMaxNtpCacheAgeSec = MAX_NTP_CACHE_AGE_SEC;
private long cachedNtp;
private long cachedNtpTimestamp;
@@ -731,7 +737,7 @@ public class ThrottleService extends IThrottleManager.Stub {
if (mNtpServer != null) {
if (mNtpActive) {
long ntpAge = SystemClock.elapsedRealtime() - cachedNtpTimestamp;
- if (ntpAge < MAX_NTP_CACHE_AGE || fast) {
+ if (ntpAge < mMaxNtpCacheAgeSec * 1000 || fast) {
if (VDBG) Slog.v(TAG, "using cached time");
return cachedNtp + ntpAge;
}
@@ -1117,6 +1123,7 @@ public class ThrottleService extends IThrottleManager.Stub {
" seconds.");
pw.println("Polling every " + mPolicyPollPeriodSec + " seconds");
pw.println("Current Throttle Index is " + mThrottleIndex.get());
+ pw.println("Max NTP Cache Age is " + mMaxNtpCacheAgeSec);
for (int i = 0; i < mRecorder.getPeriodCount(); i++) {
pw.println(" Period[" + i + "] - read:" + mRecorder.getPeriodRx(i) + ", written:" +