Update StringUtil#formatElapsedTime method (2/3)

- Update the usage and the test case
 - Update discharging string to follow new string doc

Bug: 183689347
Test: make RunSettingsRoboTests
Change-Id: I1e14e7da8cb02755d8cf6e12626a0d94fad87121
This commit is contained in:
Wesley.CW Wang
2021-04-01 18:56:57 +08:00
committed by Wesley Wang
parent acacad4cdf
commit 50f314e45d
9 changed files with 37 additions and 15 deletions

View File

@@ -229,10 +229,18 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME);
mForegroundPreference.setSummary(
TextUtils.expandTemplate(getText(R.string.battery_used_for),
StringUtil.formatElapsedTime(context, foregroundTimeMs, false)));
StringUtil.formatElapsedTime(
context,
foregroundTimeMs,
/* withSeconds */ false,
/* collapseTimeUnit */ false)));
mBackgroundPreference.setSummary(
TextUtils.expandTemplate(getText(R.string.battery_active_for),
StringUtil.formatElapsedTime(context, backgroundTimeMs, false)));
StringUtil.formatElapsedTime(
context,
backgroundTimeMs,
/* withSeconds */ false,
/* collapseTimeUnit */ false)));
}
@Override