Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afdca0e6 authored by Ling Ma's avatar Ling Ma Committed by Automerger Merge Worker
Browse files

Merge "Allow simultaneous timestamp not considered as inWindow" into tm-dev...

Merge "Allow simultaneous timestamp not considered as inWindow" into tm-dev am: 9c8f6e98 am: d2ac9bbc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/17748603



Change-Id: I83f233d22ecafa1356069ac3ca350b5f98e29cee
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5009d622 d2ac9bbc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class SlidingWindowEventCounter {
    public synchronized boolean isInWindow() {
        return (mTimestampQueueMillis.size() == mNumOccurrences)
                && mTimestampQueueMillis.peekFirst()
                + mWindowSizeMillis >= mTimestampQueueMillis.peekLast();
                + mWindowSizeMillis > mTimestampQueueMillis.peekLast();
    }

    @VisibleForTesting
+3 −2
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ public class SlidingWindowEventCounterTest {
        counter = new SlidingWindowEventCounter(0, 2);
        counter.addOccurrence(mInitialTime);
        counter.addOccurrence(mInitialTime);
        assertTrue(counter.isInWindow());
        assertFalse(counter.addOccurrence(mInitialTime + 1));
        assertFalse(counter.isInWindow());
        assertFalse(counter.addOccurrence(mInitialTime));
        assertFalse(counter.addOccurrence(mInitialTime));
    }
}