OSDN Git Service

Fix "battery saver" notification keeping coming back.
authorMakoto Onuki <omakoto@google.com>
Mon, 7 May 2018 20:56:40 +0000 (13:56 -0700)
committerMakoto Onuki <omakoto@google.com>
Mon, 7 May 2018 21:05:56 +0000 (14:05 -0700)
commit60b8f18abe13622d3199a956f5a56b7ba3969cca
treebb32346e0cb1cf768f560c20e727996da8f6db00
parent7bfb942e2d240dc1c52bfd0926517a7dbd3942fb
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
packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java