Fix the charging string while charging wirelessly

Move the null check of the charging remaining time after the wireless charging check, so when the time to full is not available, there's still a chance to show the customized wireless charging state.

Fixes: 342046505
Test: atest SettingsRoboTests
Flag: EXEMPT bugfix
Change-Id: I8a6104c46222e9f27d488035a218856f51e30430
This commit is contained in:
Yiling Chuang
2024-08-06 10:56:07 +00:00
parent cadfc0187d
commit 9e2bda0c87

View File

@@ -92,8 +92,7 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
&& mBatterySettingsFeatureProvider.isChargingOptimizationMode(mContext)) {
return info.remainingLabel;
}
if (info.remainingLabel == null
|| info.batteryStatus == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {
if (info.batteryStatus == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {
return info.statusLabel;
}
if (info.pluggedStatus == BatteryManager.BATTERY_PLUGGED_WIRELESS) {
@@ -106,6 +105,9 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
return wirelessChargingLabel;
}
}
if (info.remainingLabel == null) {
return info.statusLabel;
}
if (info.statusLabel != null && !info.discharging) {
// Charging state
if (com.android.settingslib.fuelgauge.BatteryUtils.isChargingStringV2Enabled()) {