Major changes in files fix_battery.sh, MonitorService.java, BatteryInfo.java.
I sent modified source code to you. Compare it.
BatteryInfo.java -run fix if battVoltage >= 4200
MonitorService.java
fix_battery.sh - your code have problem with command delete files from data/battd for my CM10.1
I sent modified source code to you. Compare it.
BatteryInfo.java -run fix if battVoltage >= 4200
Code:
...
if (!seemsFull && isOnPower && battVoltage != null) {
if ( Math.round(Float.valueOf(battVoltage) / 1000) >= 4200) {
//if (lastVoltage == null || lastTime <= 0 || !lastVoltage.equals(String.valueOf(Math.round(Float.valueOf(battVoltage) / 1000)))) {
//lastVoltage = String.valueOf(Math.round(Float.valueOf(battVoltage) / 1000));
//lastTime = System.currentTimeMillis();
//utils.log("got new voltage %s", (Object)lastVoltage);
seemsFull = true;
} else {
//long time = System.currentTimeMillis();
//seemsFull = (time - lastTime >= MAX_TIME) ? true : false;
//utils.log("voltage stayed at %s for %d ms", (Object)lastVoltage, time - lastTime);
}
} else {
lastVoltage = null;
lastTime = -1;
}
...
MonitorService.java
Code:
...
utils.log("performing auto-action");
if (settings.prefAutoFix()) {
if (settings.prefNon100() && Integer.valueOf(info.battShown) >= 100) {
return;
}
try {
fix.fixBattery();
}
catch (Exception ex) { }
switch (settings.prefAutoAction()) {
case REBOOT: {
fix.reboot();
}
break;
case RESTART: {
fix.restartBattd();
}
break;
case NONE:
default:
break;
}
}
...
fix_battery.sh - your code have problem with command delete files from data/battd for my CM10.1
Code:
#! /system/bin/sh
set -e > /dev/null 2>&1 || :
if (test -d /data/battd)
then
:
else
echo "/data/battd does not exist" >&2
exit 1
fi
for i in cc_data cc_data_old powerup
do
rm /data/battd/${i}* > /dev/null 2>&1 || :
done
exit "${?}"