Guarding collisions in TimeSparseArray

TimeSparseArray - used to store UsageEvents - can keep at most one event
per millisecond, which can result in an event being replaced by another
event that occurred close enough that the system records it at the same
millisecond.

Test: atest android.app.usage.TimeSparseArrayTest

Fixes: 73832306
Change-Id: I860a101ab098f65d5c5832758832f43572865690
2 files changed