diff options
author | Robert Greenwalt <robdroid@android.com> | 2010-04-14 17:31:20 -0700 |
---|---|---|
committer | Robert Greenwalt <robdroid@android.com> | 2010-04-14 17:31:20 -0700 |
commit | 8c7e609b530d5dcb34e02788958a84a99501c332 (patch) | |
tree | e2c625e7001d72df1c830afe773c3b6c2a30610a /services | |
parent | d3d445b1dca98728a37b5163e018ba890fd9cc50 (diff) | |
download | frameworks_base-8c7e609b530d5dcb34e02788958a84a99501c332.zip frameworks_base-8c7e609b530d5dcb34e02788958a84a99501c332.tar.gz frameworks_base-8c7e609b530d5dcb34e02788958a84a99501c332.tar.bz2 |
Sholes mobile iface comes/goes - handle the reset
The byte counter for the iface goes to zero when it comes back. Catch that and
do the complex math to correct.
Also add a log entry telling us our desired throttle index.
Lastly, reset the sec/msec part of our reset time so that one calc will == another and not
be off by little bits.
bug:25494925
Change-Id: I99525b72a76316a8e601ceb457ca202fae040bae
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/ThrottleService.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java index 9333dd8..6ba96ae 100644 --- a/services/java/com/android/server/ThrottleService.java +++ b/services/java/com/android/server/ThrottleService.java @@ -372,6 +372,14 @@ public class ThrottleService extends IThrottleManager.Stub { try { incRead = mNMService.getInterfaceRxCounter(mIface) - mLastRead; incWrite = mNMService.getInterfaceTxCounter(mIface) - mLastWrite; + // handle iface resets - on some device the 3g iface comes and goes and gets + // totals reset to 0. Deal with it + if ((incRead < 0) || (incWrite < 0)) { + incRead += mLastRead; + incWrite += mLastWrite; + mLastRead = 0; + mLastWrite = 0; + } } catch (RemoteException e) { Slog.e(TAG, "got remoteException in onPollAlarm:" + e); } @@ -529,6 +537,8 @@ public class ThrottleService extends IThrottleManager.Stub { end.set(Calendar.DAY_OF_MONTH, mPolicyResetDay); end.set(Calendar.HOUR_OF_DAY, 0); end.set(Calendar.MINUTE, 0); + end.set(Calendar.SECOND, 0); + end.set(Calendar.MILLISECOND, 0); if (day >= mPolicyResetDay) { int month = end.get(Calendar.MONTH); if (month == Calendar.DECEMBER) { @@ -845,6 +855,8 @@ public class ThrottleService extends IThrottleManager.Stub { "and ends in " + (mRecorder.getPeriodEnd() - System.currentTimeMillis()) / 1000 + " seconds."); pw.println("Polling every " + mPolicyPollPeriodSec + " seconds"); + pw.println("Current Throttle Index is " + mThrottleIndex); + for (int i = 0; i < mRecorder.getPeriodCount(); i++) { pw.println(" Period[" + i + "] - read:" + mRecorder.getPeriodRx(i) + ", written:" + mRecorder.getPeriodTx(i)); |