Loading src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java +1 −1 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ public class LinkBandwidthEstimator extends Handler { int filterInKbps = mBwSampleValid ? mBwSampleKbps : avgKbps; long currTimeMs = mTelephonyFacade.getElapsedSinceBootMillis(); int timeDeltaSec = (int) (currTimeMs - mBwSampleValidTimeMs) / 1000; int timeDeltaSec = (int) ((currTimeMs - mBwSampleValidTimeMs) / 1000); // If the operation condition changes significantly since the last update // or the sample has higher BW, use a faster filter. Otherwise, use a slow filter Loading tests/telephonytests/src/com/android/internal/telephony/data/LinkBandwidthEstimatorTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,32 @@ public class LinkBandwidthEstimatorTest extends TelephonyTest { verifyUpdateBandwidth(-1, 19_597); } @Test public void testNoOverflowAfterLargeTimeGap() throws Exception { mLBE.obtainMessage(MSG_SCREEN_STATE_CHANGED, true).sendToTarget(); processAllMessages(); for (int i = 0; i < BW_STATS_COUNT_THRESHOLD + 2; i++) { addTxBytes(10_000L); addRxBytes(500_000L); if (i == BW_STATS_COUNT_THRESHOLD) { addElapsedTime(26 * 24 * 3_600_000L); moveTimeForward(26 * 24 * 3_600_000L); } else { addElapsedTime(5_100); moveTimeForward(5_100); } processAllMessages(); mLBE.obtainMessage(MSG_MODEM_ACTIVITY_RETURNED, new ModemActivityInfo( i * 5_100L, 0, 0, TX_TIME_2_MS, i * RX_TIME_2_MS)).sendToTarget(); processAllMessages(); } verify(mTelephonyManager, times(BW_STATS_COUNT_THRESHOLD + 2)) .requestModemActivityInfo(any(), any()); verifyUpdateBandwidth(-1, 19_531); } @Test public void testAbnormalTrafficCountTriggerLessBwUpdate() throws Exception { mLBE.obtainMessage(MSG_SCREEN_STATE_CHANGED, true).sendToTarget(); Loading Loading
src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java +1 −1 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ public class LinkBandwidthEstimator extends Handler { int filterInKbps = mBwSampleValid ? mBwSampleKbps : avgKbps; long currTimeMs = mTelephonyFacade.getElapsedSinceBootMillis(); int timeDeltaSec = (int) (currTimeMs - mBwSampleValidTimeMs) / 1000; int timeDeltaSec = (int) ((currTimeMs - mBwSampleValidTimeMs) / 1000); // If the operation condition changes significantly since the last update // or the sample has higher BW, use a faster filter. Otherwise, use a slow filter Loading
tests/telephonytests/src/com/android/internal/telephony/data/LinkBandwidthEstimatorTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,32 @@ public class LinkBandwidthEstimatorTest extends TelephonyTest { verifyUpdateBandwidth(-1, 19_597); } @Test public void testNoOverflowAfterLargeTimeGap() throws Exception { mLBE.obtainMessage(MSG_SCREEN_STATE_CHANGED, true).sendToTarget(); processAllMessages(); for (int i = 0; i < BW_STATS_COUNT_THRESHOLD + 2; i++) { addTxBytes(10_000L); addRxBytes(500_000L); if (i == BW_STATS_COUNT_THRESHOLD) { addElapsedTime(26 * 24 * 3_600_000L); moveTimeForward(26 * 24 * 3_600_000L); } else { addElapsedTime(5_100); moveTimeForward(5_100); } processAllMessages(); mLBE.obtainMessage(MSG_MODEM_ACTIVITY_RETURNED, new ModemActivityInfo( i * 5_100L, 0, 0, TX_TIME_2_MS, i * RX_TIME_2_MS)).sendToTarget(); processAllMessages(); } verify(mTelephonyManager, times(BW_STATS_COUNT_THRESHOLD + 2)) .requestModemActivityInfo(any(), any()); verifyUpdateBandwidth(-1, 19_531); } @Test public void testAbnormalTrafficCountTriggerLessBwUpdate() throws Exception { mLBE.obtainMessage(MSG_SCREEN_STATE_CHANGED, true).sendToTarget(); Loading