Add cpu user mode run time rate limiter per UID
To address security review feedback, we will only allow apps to
poll new CPU headroom if the CPU time executing in user mode has
elapsed for longer than the min interval. The check will only
happen if there is a cache miss, so any frequent polling calls
within the interval with same params and default calculation
window size will still be served from cache and require no proc
stat file reads. Also a DEVICE_POWER permission check is used
to skip the cpu time check for test and trusted apps.
Bug: 346604998
Bug: 373697764
Flag: android.os.cpu_gpu_headrooms
Test: atest HeadroomTest NativeSystemHealthTest
Change-Id: I752aa673a26feffdce0e8828a8ee34b6219fda10
2 files changed