From 290496e94e35d1bc804aad4ef7f7d04ee5c86eea Mon Sep 17 00:00:00 2001 From: Salvador Martinez Date: Thu, 4 Apr 2019 10:30:19 -0700 Subject: [PATCH] Fix mixed up variable in triggering logic When this code got refactored the check for severe warnings accidentally had the time remaining being compared against the percentage value of the severe warning threshold. Unfortunately this meant that it was impossible to mark the severe level warning as shown and could result in multiple triggerings. This change makes it so everything is compared with the appropriate type of value again. Test: PowerUI Tests pass Bug: 129730217 Change-Id: Ic8bdabf1c70e49d117210bb80f1ca0a0d7684617 --- .../SystemUI/src/com/android/systemui/power/PowerUI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java index 4e41108f64964..25d6d940d92e7 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java @@ -341,8 +341,9 @@ public class PowerUI extends SystemUI { // mark if we've already shown a warning this cycle. This will prevent the notification // trigger from spamming users by only showing low/critical warnings once per cycle if (currentSnapshot.getTimeRemainingMillis() - <= currentSnapshot.getSevereLevelThreshold() - || currentSnapshot.getBatteryLevel() <= mLowBatteryReminderLevels[1]) { + <= currentSnapshot.getSevereThresholdMillis() + || currentSnapshot.getBatteryLevel() + <= currentSnapshot.getSevereLevelThreshold()) { mSevereWarningShownThisChargeCycle = true; mLowWarningShownThisChargeCycle = true; if (DEBUG) {