Update battery summary
When it is charging, show "5% - charging"(not only "5%") Bug: 112013485 Test: RunSettingsRoboTests Change-Id: If2299cc4929d8fc40d63669b74590fafe39122dc
This commit is contained in:
@@ -80,7 +80,9 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle
|
|||||||
}
|
}
|
||||||
CharSequence label;
|
CharSequence label;
|
||||||
final BidiFormatter formatter = BidiFormatter.getInstance();
|
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;
|
label = info.batteryPercentString;
|
||||||
} else {
|
} else {
|
||||||
label = context.getString(R.string.power_remaining_settings_home_page,
|
label = context.getString(R.string.power_remaining_settings_home_page,
|
||||||
|
@@ -61,5 +61,9 @@ public class TopLevelBatteryPreferenceControllerTest {
|
|||||||
|
|
||||||
info.remainingLabel = "Phone will shut down soon";
|
info.remainingLabel = "Phone will shut down soon";
|
||||||
assertThat(getDashboardLabel(mContext, info)).isEqualTo("3% - 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user