Track process with visible activities
- A quick lookup without locking WM to provide whether a process
or uid has visible or resumed activity.
- Move cpu usage collection from the path of resume/pause in WM
lock to background thread.
- Do not get cpu time if the next activity is still in the same
process, to reduce unnecessary accesses of proc file. E.g.
if there are 3 foreground activity switches in the same process,
it can save 6 accesses.
- Change hasForegroundActivities to use source state. It was set
by OomAdjuster when ComputeOomAdjCallback#onVisibleActivity or
onPausedActivity or onStoppingActivity is called, which may
not be the latest state.
Bug: 171989664
Test: WindowProcessControllerTests#testComputeProcessActivityState
Change-Id: I3fb42e455232c8718549af5b7bb1ca638558d827
8 files changed