[BugFix] Fix the incorrect state for dockdefend on battery settings page

Bug: 348563863
Change-Id: Ie5f0f3e380b9355f96898eeddc755a18a71917a0
Test: Manual Test
Test: http://ab/I16200010297673244
Flag: EXEMPT bug fix
This commit is contained in:
Pajace Chen
2024-07-22 08:22:32 +00:00
parent 5c466c5ba3
commit c0c3b65c5c
2 changed files with 26 additions and 1 deletions

View File

@@ -389,6 +389,28 @@ public class BatteryHeaderPreferenceControllerTest {
verify(mBatteryUsageProgressBarPref).setBottomSummary(expectedChargingString);
}
@Test
public void updateBatteryStatus_dockDefend_chargingOnHold() {
var expected = "Charging on hold";
mBatteryInfo.isBatteryDefender = false;
when(mFactory.powerUsageFeatureProvider.isExtraDefend()).thenReturn(true);
mController.updateBatteryStatus(/* label= */ null, mBatteryInfo);
verify(mBatteryUsageProgressBarPref).setBottomSummary(expected);
}
@Test
public void updateBatteryStatus_batteryDefender_chargingOnHold() {
var expected = "Charging on hold";
mBatteryInfo.isBatteryDefender = true;
when(mFactory.powerUsageFeatureProvider.isExtraDefend()).thenReturn(false);
mController.updateBatteryStatus(/* label= */ null, mBatteryInfo);
verify(mBatteryUsageProgressBarPref).setBottomSummary(expected);
}
private BatteryInfo arrangeUpdateBatteryStatusTestWithRemainingLabel(
String remainingLabel,
String statusLabel,