Skip to content
Snippets Groups Projects
Commit 04277955 authored by mmanjuna's avatar mmanjuna Committed by Meghana Manjunatha
Browse files

Response stats:counts are not updated sometimes

This problem occurs only when the timestamp of broadcast and the
notification event is exactly the same.
Though ideally they need to occur one after the other,
it is quite possible that they can occur immediately with the same
timestamp. Hence, we see flaky behaviour.
Fix is to process the events even if broadcast event's
timestamp is equal to the notification event.

Bug: 330844354

Test: atest tests/tests/app.usage/src/android/app/usage/cts/BroadcastResponse
StatsTest.java
Change-Id: I69398c1d15ed7a4ae39c31a2b56f19ef0b858614
parent 31753ee5
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,7 @@ class BroadcastResponseStatsTracker {
// We only need to look at the broadcast events that occurred before
// this notification related event.
while (dispatchTimestampsMs.size() > 0
&& dispatchTimestampsMs.peekFirst() < timestampMs) {
&& dispatchTimestampsMs.peekFirst() <= timestampMs) {
final long dispatchTimestampMs = dispatchTimestampsMs.peekFirst();
final long elapsedDurationMs = timestampMs - dispatchTimestampMs;
// Only increment the counts if the broadcast was sent not too long ago, as
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment