Send battery low intent when battery warning boundary changed
If the battery warning boundary is changed and the new boundary is higher than the current battery level, send the battery low intent too. Test: manual: inspection (with different boundary level changes) Change-Id: Ic8b7ebd4052bb757e35ed4e904ea6bddcb23a7ac
This commit is contained in:
@@ -165,6 +165,7 @@ public final class BatteryService extends SystemService {
|
||||
private int mLastInvalidCharger;
|
||||
|
||||
private int mLowBatteryWarningLevel;
|
||||
private int mLastLowBatteryWarningLevel;
|
||||
private int mLowBatteryCloseWarningLevel;
|
||||
private int mShutdownBatteryTemperature;
|
||||
|
||||
@@ -313,6 +314,7 @@ public final class BatteryService extends SystemService {
|
||||
final ContentResolver resolver = mContext.getContentResolver();
|
||||
int defWarnLevel = mContext.getResources().getInteger(
|
||||
com.android.internal.R.integer.config_lowBatteryWarningLevel);
|
||||
mLastLowBatteryWarningLevel = mLowBatteryWarningLevel;
|
||||
mLowBatteryWarningLevel = Settings.Global.getInt(resolver,
|
||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);
|
||||
if (mLowBatteryWarningLevel == 0) {
|
||||
@@ -357,7 +359,8 @@ public final class BatteryService extends SystemService {
|
||||
return !plugged
|
||||
&& mHealthInfo.batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
|
||||
&& mHealthInfo.batteryLevel <= mLowBatteryWarningLevel
|
||||
&& (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel);
|
||||
&& (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel
|
||||
|| mHealthInfo.batteryLevel > mLastLowBatteryWarningLevel);
|
||||
}
|
||||
|
||||
private boolean shouldShutdownLocked() {
|
||||
|
||||
Reference in New Issue
Block a user