Historical app ops.
This change is the main check in for the historical app op feature. The idea is to store a historical data about past app op rejections, accesses, and durations per op for any UID state indefinitely. Keeping all operations on record is not practical as app ops are very frequently performed. To address this we are storing aggregated data as snapshots where we store for every UID and its packages how many times each op was accessed, rejected, lasted as an aggregate. To allow history scaling indefinitely we are taking a logarithmic approach with only the most recent state stored in memory and all preceding state stored on disk. State on disk is stored in separate files where each preceding file, i.e. for an older period, would cover X times longer period with X number of snapshots covering X times longer period. Initially X is ten but can be tweaked. For example, the first file could contain data for ten days with daily snapshots, while the file for older period would have data for a hundred days with snapshots every ten days, etc. The implementation is optimized for fast history update and no impact on system runtime performance and minimizing memory footprint. We are lazily persisting state to disk on a dedicated thread as this is slow. We are also reading the relevant historical files on a query as this is very rare as opposed to state updates. The base snapshot interval, i.e. snapshot time span, in the initial iteration and the logarithmic step are configurable. These can be changed dynamically and the history would be rewriten to take this into account. Test: atest CtsAppOpsTestCases bug:111061782 Change-Id: I55c32c79911ba12b2ace58d2a782b8df1e6bff60
Loading
Please register or sign in to comment