Add adaptive charging to the top level settings menu

Bug: 172009945
Test: Trigger adaptive charging and verify string in menu
Change-Id: I8f600287c38e3992bb884faeb4df3d91570851a0
This commit is contained in:
Stephane Lee
2020-11-04 15:21:05 -08:00
parent f63874f2b0
commit 8fee0917f8
6 changed files with 89 additions and 25 deletions

View File

@@ -18,7 +18,6 @@ package com.android.settings.fuelgauge;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.android.settings.fuelgauge.TopLevelBatteryPreferenceController.getDashboardLabel;
import static com.google.common.truth.Truth.assertThat;
@@ -69,14 +68,16 @@ public class TopLevelBatteryPreferenceControllerTest {
public void getDashboardLabel_returnsCorrectLabel() {
BatteryInfo info = new BatteryInfo();
info.batteryPercentString = "3%";
assertThat(getDashboardLabel(mContext, info)).isEqualTo(info.batteryPercentString);
assertThat(mController.getDashboardLabel(mContext, info))
.isEqualTo(info.batteryPercentString);
info.remainingLabel = "Phone will shut down soon";
assertThat(getDashboardLabel(mContext, info)).isEqualTo("3% - Phone will shut down soon");
assertThat(mController.getDashboardLabel(mContext, info))
.isEqualTo("3% - Phone will shut down soon");
info.discharging = false;
info.chargeLabel = "5% - charging";
assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging");
assertThat(mController.getDashboardLabel(mContext, info)).isEqualTo("5% - charging");
}
@Test