Merge "Avoid showing "0 minute" in the charge time label" into udc-dev am: 86f145d22a am: 921b1f6a6f am: 52e2ee66ac

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23157339

Change-Id: If6c5231df1d4e4c8c9b2511d0b612180a6c4f733
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-11 14:20:38 +00:00
committed by Automerger Merge Worker

View File

@@ -299,9 +299,10 @@ public class BatteryInfo {
(double) PowerUtil.convertUsToMs(info.remainingTimeUs), false /* withSeconds */,
true /* collapseTimeUnit */);
int resId = R.string.power_charging_duration;
info.remainingLabel = context.getString(R.string.power_remaining_charging_duration_only,
timeString);
info.chargeLabel = context.getString(resId, info.batteryPercentString, timeString);
info.remainingLabel = chargeTimeMs <= 0 ? null : context.getString(
R.string.power_remaining_charging_duration_only, timeString);
info.chargeLabel = chargeTimeMs <= 0 ? info.batteryPercentString
: context.getString(resId, info.batteryPercentString, timeString);
} else if (dockDefenderMode == BatteryUtils.DockDefenderMode.FUTURE_BYPASS) {
// Dock defender will be triggered in the future, charging will be optimized.
info.chargeLabel = context.getString(R.string.power_charging_future_paused,