Loading src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceController.java +3 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,9 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle } CharSequence label; final BidiFormatter formatter = BidiFormatter.getInstance(); if (info.remainingLabel == null) { if (!info.discharging && info.chargeLabel != null) { label = info.chargeLabel; } else if (info.remainingLabel == null) { label = info.batteryPercentString; } else { label = context.getString(R.string.power_remaining_settings_home_page, Loading tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -61,5 +61,9 @@ public class TopLevelBatteryPreferenceControllerTest { info.remainingLabel = "Phone will shut down soon"; assertThat(getDashboardLabel(mContext, info)).isEqualTo("3% - Phone will shut down soon"); info.discharging = false; info.chargeLabel = "5% - charging"; assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging"); } } Loading
src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceController.java +3 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,9 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle } CharSequence label; final BidiFormatter formatter = BidiFormatter.getInstance(); if (info.remainingLabel == null) { if (!info.discharging && info.chargeLabel != null) { label = info.chargeLabel; } else if (info.remainingLabel == null) { label = info.batteryPercentString; } else { label = context.getString(R.string.power_remaining_settings_home_page, Loading
tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -61,5 +61,9 @@ public class TopLevelBatteryPreferenceControllerTest { info.remainingLabel = "Phone will shut down soon"; assertThat(getDashboardLabel(mContext, info)).isEqualTo("3% - Phone will shut down soon"); info.discharging = false; info.chargeLabel = "5% - charging"; assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging"); } }