Compare both id and tag in ImeTrackerService
There are a few instances where statsToken values are stored, to be
re-used and cleared shortly after. In a few of these, if the tokes is
not cleared and re-used later, it could intefere with newer requests, if
the ids match. This is a low chance, as it implies storing a token from
a process that was killed, and a new process is re-using the same pid.
This helps handling this case by comparing both the id and the token's
tag, which contains the process name and a randomly generated hex
number. While comparing on additional randomness is not a perfect
solution, it should decrease the collision chance by enough such that
this scenario is extremely unlikely to occur.
The only downside is this requires also passing in, and thus parcelling,
the tag of the token, for every onProgress call, which occur vastly more
often than onStart or onFinish.
Flag: EXEMPT refactor
Bug: 342111149
Test: atest ImeTrackerServiceTest#testStartOnReusedId
ImeTrackerServiceTest#testProgressOnReusedId
ImeTrackerServiceTest#testFinishOnReusedId
Change-Id: I6f8e85461578fd6692982c95c23b1287adeb5183
5 files changed