Correctly offset app op history on reboot
The offset was computed based off the offset represented by
the most recent historical file while we have to use the time
this file was written.
Also now we persist the history on reboot and shutdown,
significantly minimizing the possibility of data loss.
Added test API to emulate reboot of the history to allow for
precise and tightly controlled test to prevent flakes due to
boot time deviations.
Test: atest android.app.appops.cts.HistoricalAppopsTest#testRebootHistory
Fixes:156853195
Change-Id: I4142371f8bc2b1d710cc8c300e7e79cb03764c04
5 files changed