diff options
author | Robert Greenwalt <robdroid@android.com> | 2010-05-25 16:15:37 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-05-25 16:15:37 -0700 |
commit | ac53a8a135b3e04692a553147eabf3cbafd321c1 (patch) | |
tree | b88515672b6d5e731605efd899e302ae558bf9be /services/java/com/android/server | |
parent | f7617d3601519464400e8f6e9cf7030944b94d0c (diff) | |
parent | 88ccecf573a52648052bc9c7858f345776f76e0e (diff) | |
download | frameworks_base-ac53a8a135b3e04692a553147eabf3cbafd321c1.zip frameworks_base-ac53a8a135b3e04692a553147eabf3cbafd321c1.tar.gz frameworks_base-ac53a8a135b3e04692a553147eabf3cbafd321c1.tar.bz2 |
am 88ccecf5: am d1055a25: Make the NTP Cache max-age gservices-settable
Merge commit '88ccecf573a52648052bc9c7858f345776f76e0e' into kraken
* commit '88ccecf573a52648052bc9c7858f345776f76e0e':
Make the NTP Cache max-age gservices-settable
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r-- | services/java/com/android/server/ThrottleService.java | 13 |
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 23c1adc..f0b2210 100644 --- a/services/java/com/android/server/ThrottleService.java +++ b/services/java/com/android/server/ThrottleService.java @@ -197,6 +197,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 @@ -432,10 +434,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 + ", value=" + mPolicyThrottleValue + ", resetDay=" + mPolicyResetDay + ", noteType=" + - mPolicyNotificationsAllowedMask); + mPolicyNotificationsAllowedMask + ", maxNtpCacheAge=" + mMaxNtpCacheAgeSec); // force updates mThrottleIndex = THROTTLE_INDEX_UNINITIALIZED; @@ -715,8 +720,9 @@ public class ThrottleService extends IThrottleManager.Stub { getBestTime(); } - private static final int MAX_NTP_CACHE_AGE = 30 * 1000; + private static final int MAX_NTP_CACHE_AGE_SEC = 60 * 60 * 24; // 1 day private static final int MAX_NTP_FETCH_WAIT = 10 * 1000; + private int mMaxNtpCacheAgeSec = MAX_NTP_CACHE_AGE_SEC; private long cachedNtp; private long cachedNtpTimestamp; @@ -724,7 +730,7 @@ public class ThrottleService extends IThrottleManager.Stub { if (mNtpServer != null) { if (mNtpActive) { long ntpAge = SystemClock.elapsedRealtime() - cachedNtpTimestamp; - if (ntpAge < MAX_NTP_CACHE_AGE) { + if (ntpAge < mMaxNtpCacheAgeSec * 1000) { if (VDBG) Slog.v(TAG, "using cached time"); return cachedNtp + ntpAge; } @@ -1091,6 +1097,7 @@ public class ThrottleService extends IThrottleManager.Stub { " seconds."); pw.println("Polling every " + mPolicyPollPeriodSec + " seconds"); pw.println("Current Throttle Index is " + mThrottleIndex); + 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:" + |