libtimeinstate: tolerate multiple calls to startTrackingUidTimes

system_server instantiates 2 of each type of KernelCpuUidTimeReader,
but the logic in startTrackingUidTimes() must run exactly once. Revise
startTrackingUidTimes() to return immediately if tracking is already
active. This makes it safe to call from the KernelCpuUidTimeReader
constructor, ensuring that tracking will start as early as possible.

Bug: 138317993
Test: boot & check that time_in_state programs have been attached
exactly once
Change-Id: Ic64438a3270874b398a8db07531521fe1d02a3de
Signed-off-by: Connor O'Brien <connoro@google.com>
1 file changed