Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -3332,6 +3332,14 @@ public final class Settings { */ public static final String THROTTLE_HELP_URI = "throttle_help_uri"; /** * The length of time in Sec that we allow our notion of NTP time * to be cached before we refresh it * @hide */ public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC = "throttle_max_ntp_cache_age_sec"; /** * @hide Loading services/java/com/android/server/ThrottleService.java +10 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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:" + Loading Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -3332,6 +3332,14 @@ public final class Settings { */ public static final String THROTTLE_HELP_URI = "throttle_help_uri"; /** * The length of time in Sec that we allow our notion of NTP time * to be cached before we refresh it * @hide */ public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC = "throttle_max_ntp_cache_age_sec"; /** * @hide Loading
services/java/com/android/server/ThrottleService.java +10 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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:" + Loading