Fix "battery saver" notification keeping coming back.

We have a delete intent set on this notification and but apparently
in this case it wasn't delivered or delayed. So add an extra check to make sure
we don't post it more than needed.

Also set FLAG_RECEIVER_FOREGROUND to pending broadcasts to make sure it won't
delayed too much.

Fixes: 79313125
Test: Manual test with:
1. Clear all battery saver settings
adb shell settings delete global low_power
adb shell settings delete global low_power_sticky
adb shell settings delete global low_power_trigger_level
adb shell settings delete secure low_power_manual_activation_count
adb shell settings delete secure low_power_warning_acknowledged
adb shell settings delete secure suppress_auto_battery_saver_suggestion
2. ./development/scripts/battery_simulator.py and set level to 10

3. Dismiss battery saver notification

Change-Id: I659fdb8a4dc8136e6c159fb566f30642c8a53fb2
1 file changed