mtk android smartphone方案 低电量报警

低电量警报发起的条件是: BatteryService.java :

 
BatteryService::update()
{
.......
            final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE;
            final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE;
 
            /* The ACTION_BATTERY_LOW broadcast is sent in these situations:
             * - is just un-plugged (previously was plugged) and battery level is
             *   less than or equal to WARNING, or
             * - is not plugged and battery level falls to WARNING boundary
             *   (becomes <= mLowBatteryWarningLevel).
             */
            final boolean sendBatteryLow = !plugged
                && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
                && mBatteryLevel <= mLowBatteryWarningLevel
                && (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel);
 
            sendIntent();
......
}
 发送低电量信息会有两个条件,

1)当前不在充电状态,上次update时处于充电状态,并且电池电量小于等于mLowBatteryWarningLevel(低电量警告值)

2)当前不在充电状态,电池电量小于等于mLowBatteryWarningLevel(低电量警告值),并且上次update时,电量大于mLowBatteryWarningLevel(低电量警告值)

根据 frameworks\base\core\res\res\values\config.xml:

 
<integer name="config_lowBatteryWarningLevel">15</integer>
 和

mediatek\custom\ckt73_gb\battery\battery\cus_battery.h

 
VBAT_TO_PERCENT Batt_VoltToPercent_Table[] = {
 /*BattVolt,BattPercent*/
 {3400,0},
 {3641,10},
 {3708,20},
 {3741,30},
 {3765,40},
 {3793,50},
 {3836,60},
 {3891,70},
 {3960,80},
 {4044,90},
 {4183,100},
};
 可以看出mLowBatteryWarningLevel大约为{3641,10},{3708,20}之间,即大约3.67V 正常情况当电压连续下载时,低于3.67V时,会启动低电压报警,如果系统一开机就电压就小于3.67V,低电量不会发送报警.

你可能感兴趣的:(mtk android smartphone方案 低电量报警)