summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-04-26 12:29:14 -0700
committerRobert Greenwalt <robdroid@android.com>2010-04-26 12:29:14 -0700
commit27fba6797b07583ef6c280bc287bf327e47f5e66 (patch)
tree2f807c4c33eb2bed92f509577080c8e7fde2d88e /services
parent19681af44b7c7494ae8de28dab8aacc3e9d92390 (diff)
downloadframeworks_base-27fba6797b07583ef6c280bc287bf327e47f5e66.zip
frameworks_base-27fba6797b07583ef6c280bc287bf327e47f5e66.tar.gz
frameworks_base-27fba6797b07583ef6c280bc287bf327e47f5e66.tar.bz2
Fix Throttle reset.
The start and end times were precisely the same so, a ">" check needed to be ">=". Also removed useless code and removed the potential problem where continuous gradual advancement of your start and end times would prevent resets. bug:2629717 Change-Id: Ieced1965a5611a9b555e92bcf924ec350f2a80db
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/ThrottleService.java36
1 files changed, 16 insertions, 20 deletions
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index a1aa555..6a5bbd2 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -732,23 +732,25 @@ public class ThrottleService extends IThrottleManager.Stub {
checkForSubscriberId();
boolean startNewPeriod = true;
- // if we rolled back in time, toss out
- // if we rolled foward, advance to the next
- if (end.before(mPeriodStart)) {
+ if (start.equals(mPeriodStart) && end.equals(mPeriodEnd)) {
+ // same endpoints - keep collecting
if (DBG) {
- Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
- end.getTimeInMillis() + ") - old start was " +
- mPeriodStart.getTimeInMillis() + ", wiping");
+ Slog.d(TAG, "same period (" + start.getTimeInMillis() + "," +
+ end.getTimeInMillis() +") - ammending data");
}
- synchronized (mParent) {
- mPeriodRxData[mCurrentPeriod] = 0;
- mPeriodTxData[mCurrentPeriod] = 0;
- }
- } else if(start.after(mPeriodEnd)) {
+ startNewPeriod = false;
+ } else {
if (DBG) {
- Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
- end.getTimeInMillis() + ") - old end was " +
- mPeriodEnd.getTimeInMillis() + ", following");
+ if(start.equals(mPeriodEnd) || start.after(mPeriodEnd)) {
+ Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
+ end.getTimeInMillis() + ") - old end was " +
+ mPeriodEnd.getTimeInMillis() + ", following");
+ } else {
+ Slog.d(TAG, "new period (" + start.getTimeInMillis() + "," +
+ end.getTimeInMillis() + ") replacing old (" +
+ mPeriodStart.getTimeInMillis() + "," +
+ mPeriodEnd.getTimeInMillis() + ")");
+ }
}
synchronized (mParent) {
++mCurrentPeriod;
@@ -756,12 +758,6 @@ public class ThrottleService extends IThrottleManager.Stub {
mPeriodRxData[mCurrentPeriod] = 0;
mPeriodTxData[mCurrentPeriod] = 0;
}
- } else {
- startNewPeriod = false;
- if (DBG) {
- Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
- end.getTimeInMillis() + ") - we fit - ammending to last period");
- }
}
setPeriodStart(start);
setPeriodEnd(end);