CachedAppOptimizer: kill apps that spam binder transactions
Spamming binder transactions prevents the freeze binder ioctl from
succeeding, which allows apps that spam binder calls for whatever
reason to stay out of the freezer. This can have a negative effect on
battery life.
To address this issue, the following approach is introduced:
1. Wait for default freeze timeout
2. If the process failed the binder freeze ioctl, adjust the timeout
to be ((timeout / divisor) + rand(-offset, +offset))
3. If the new timeout is above the kill threshold, wait for the new
timeout and either freeze or goto 2
4. If the new timeout is below the kill threshold, assume the app is
broken and kill the app with REASON_EXCESSIVE_RESOURCE_USAGE
The retry approach is configurable with flags to enable the new
approach and set the divisor, offset, and kill threshold.
Test: myfreezertest is killed correctly
Bug: 286750917
Change-Id: I389200237c3b412f80f630bb4fd12961f52a849e
2 files changed