Loading packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java +5 −1 Original line number Diff line number Diff line package com.android.systemui.power; import com.android.settingslib.fuelgauge.Estimate; import com.android.settingslib.fuelgauge.EstimateKt; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -19,7 +20,10 @@ public class EnhancedEstimatesImpl implements EnhancedEstimates { @Override public Estimate getEstimate() { return null; // Returns an unknown estimate. return new Estimate(EstimateKt.ESTIMATE_MILLIS_UNKNOWN, false /* isBasedOnUsage */, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN); } @Override Loading packages/SystemUI/src/com/android/systemui/power/PowerUI.java +10 −5 Original line number Diff line number Diff line Loading @@ -374,8 +374,10 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { BatteryStateSnapshot lastSnapshot) { // if we are now over 45% battery & 6 hours remaining so we can trigger hybrid // notification again final long timeRemainingMillis = currentSnapshot.getTimeRemainingMillis(); if (currentSnapshot.getBatteryLevel() >= CHARGE_CYCLE_PERCENT_RESET && currentSnapshot.getTimeRemainingMillis() > SIX_HOURS_MILLIS) { && (timeRemainingMillis > SIX_HOURS_MILLIS || timeRemainingMillis == NO_ESTIMATE_AVAILABLE)) { mLowWarningShownThisChargeCycle = false; mSevereWarningShownThisChargeCycle = false; if (DEBUG) { Loading @@ -390,8 +392,8 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { mWarnings.showLowBatteryWarning(playSound); // 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.getSevereThresholdMillis() if ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis <= currentSnapshot.getSevereThresholdMillis()) || currentSnapshot.getBatteryLevel() <= currentSnapshot.getSevereLevelThreshold()) { mSevereWarningShownThisChargeCycle = true; Loading Loading @@ -426,15 +428,18 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { return false; } final long timeRemainingMillis = snapshot.getTimeRemainingMillis(); // Only show the low warning if enabled once per charge cycle & no battery saver final boolean canShowWarning = snapshot.isLowWarningEnabled() && !mLowWarningShownThisChargeCycle && !snapshot.isPowerSaver() && (snapshot.getTimeRemainingMillis() < snapshot.getLowThresholdMillis() && ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis < snapshot.getLowThresholdMillis()) || snapshot.getBatteryLevel() <= snapshot.getLowLevelThreshold()); // Only show the severe warning once per charge cycle final boolean canShowSevereWarning = !mSevereWarningShownThisChargeCycle && (snapshot.getTimeRemainingMillis() < snapshot.getSevereThresholdMillis() && ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis < snapshot.getSevereThresholdMillis()) || snapshot.getBatteryLevel() <= snapshot.getSevereLevelThreshold()); final boolean canShow = canShowWarning || canShowSevereWarning; Loading Loading
packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java +5 −1 Original line number Diff line number Diff line package com.android.systemui.power; import com.android.settingslib.fuelgauge.Estimate; import com.android.settingslib.fuelgauge.EstimateKt; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -19,7 +20,10 @@ public class EnhancedEstimatesImpl implements EnhancedEstimates { @Override public Estimate getEstimate() { return null; // Returns an unknown estimate. return new Estimate(EstimateKt.ESTIMATE_MILLIS_UNKNOWN, false /* isBasedOnUsage */, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN); } @Override Loading
packages/SystemUI/src/com/android/systemui/power/PowerUI.java +10 −5 Original line number Diff line number Diff line Loading @@ -374,8 +374,10 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { BatteryStateSnapshot lastSnapshot) { // if we are now over 45% battery & 6 hours remaining so we can trigger hybrid // notification again final long timeRemainingMillis = currentSnapshot.getTimeRemainingMillis(); if (currentSnapshot.getBatteryLevel() >= CHARGE_CYCLE_PERCENT_RESET && currentSnapshot.getTimeRemainingMillis() > SIX_HOURS_MILLIS) { && (timeRemainingMillis > SIX_HOURS_MILLIS || timeRemainingMillis == NO_ESTIMATE_AVAILABLE)) { mLowWarningShownThisChargeCycle = false; mSevereWarningShownThisChargeCycle = false; if (DEBUG) { Loading @@ -390,8 +392,8 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { mWarnings.showLowBatteryWarning(playSound); // 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.getSevereThresholdMillis() if ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis <= currentSnapshot.getSevereThresholdMillis()) || currentSnapshot.getBatteryLevel() <= currentSnapshot.getSevereLevelThreshold()) { mSevereWarningShownThisChargeCycle = true; Loading Loading @@ -426,15 +428,18 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks { return false; } final long timeRemainingMillis = snapshot.getTimeRemainingMillis(); // Only show the low warning if enabled once per charge cycle & no battery saver final boolean canShowWarning = snapshot.isLowWarningEnabled() && !mLowWarningShownThisChargeCycle && !snapshot.isPowerSaver() && (snapshot.getTimeRemainingMillis() < snapshot.getLowThresholdMillis() && ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis < snapshot.getLowThresholdMillis()) || snapshot.getBatteryLevel() <= snapshot.getLowLevelThreshold()); // Only show the severe warning once per charge cycle final boolean canShowSevereWarning = !mSevereWarningShownThisChargeCycle && (snapshot.getTimeRemainingMillis() < snapshot.getSevereThresholdMillis() && ((timeRemainingMillis != NO_ESTIMATE_AVAILABLE && timeRemainingMillis < snapshot.getSevereThresholdMillis()) || snapshot.getBatteryLevel() <= snapshot.getSevereLevelThreshold()); final boolean canShow = canShowWarning || canShowSevereWarning; Loading