Skip to content

Commit

Permalink
Battery: properly updating real-time charge status
Browse files Browse the repository at this point in the history
it will otherwise led to crashes while using profiles

Signed-off-by: sunilpaulmathew <[email protected]>
  • Loading branch information
sunilpaulmathew committed Apr 30, 2018
1 parent cef8991 commit c8cbb64
Showing 1 changed file with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,26 @@ protected void refresh() {
if (mVoltage != null) {
mVoltage.setStat(mBatteryVoltage + " mV");
}
float chargingrate = mBattery.getchargingstatus();
if (mBattery.isChargeStatus()){
mChargingStatus.setTitle("Disconnected");
mChargingStatus.setStat(0.0 + (" mA"));}
else {
if (mBattery.accharge()){
mChargingStatus.setTitle("AC Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));}
else if (mBattery.usbcharge()){
mChargingStatus.setTitle("USB Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));}
else if (mBattery.wlcharge()){
mChargingStatus.setTitle("Wireless Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));}
else {
mChargingStatus.setTitle("Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));}
if (mChargingStatus != null) {
float chargingrate = mBattery.getchargingstatus();
if (mBattery.isChargeStatus()){
mChargingStatus.setTitle("Disconnected");
mChargingStatus.setStat(0.0 + (" mA"));}
else {
if (mBattery.accharge()){
mChargingStatus.setTitle("AC Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));
} else if (mBattery.usbcharge()){
mChargingStatus.setTitle("USB Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));
} else if (mBattery.wlcharge()){
mChargingStatus.setTitle("Wireless Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));
} else {
mChargingStatus.setTitle("Charging");
mChargingStatus.setStat(String.valueOf(chargingrate) + (" mA"));
}
}
}
}

Expand Down

0 comments on commit c8cbb64

Please sign in to comment.