Defer sending of ACTION_CHARGING
ACTION_CHARGING is sent when the device is in a good enough charging
state for power-heavy work to be done. It was sent immediately when this
determination was done:
1. plugged in and level >= 90
2. plugged in and level is increasing
However this lead to many jobs being ungated when this happen, and
defeats the purpose of plugging in your device to get a quick boost.
In the case of 2. we defer the sending of ACTION_CHARGING by a
configurable time, defaulting to 15minutes, after said determination.
The adb command to play with this is:
adb shell settings put global battery_stats_constants battery_charged_delay_ms=90000
Bug: 111360323
Test: Set the delay to 15s, then cmd battery unplug and reset,
verify that broadcast is sent in dumpsys activity broadcasts
Change-Id: I71f8d06604041efeba12fbdfd0374aaff2f04807
2 files changed