Fix content capture session id collision bug
* The content capture session id should be globally unique
* Before this change, the id is genrated from a static random
number generator created with new Random(). It appears that
it all has the same seed value, so the sequence it generates
is identical across processes
* Ideally the session id should be generated from a center
place to ensure uniqueness (e.g. system server), or be a UUID
which is more unlikely to conflict. We will explore that as
a longer term solution in S
* For now the less invasive solution is to use SecureRandom,
which produces non-deterministic output
* Other approaches tried:
1) new Random(android.os.Process.myPid()). This doesn't work
as the pid value is all the same at static loading time
2) offset the generated number by pid. This will work but the
ids are not so random
3) make Random a non-static variable. This will work but it
creates a new object for every class
Test: manual
Bug: 158714891
Change-Id: I158f45680a961b32f3b01dc4eabb45e7215cdeec
1 file changed