Update strings in battery settings.

1. Message in high usage dialog
2. Title in app usage list

Change-Id: Iac610483e10e8d2a93a18ca664aec17d9561aaf8
Fixes: 78638843
Test: RunSettingsRoboTests
This commit is contained in:
Lei Yu
2018-05-10 11:31:29 -07:00
parent cda8a44cee
commit bc54cedabd
4 changed files with 7 additions and 19 deletions

View File

@@ -4924,9 +4924,7 @@
<string name="device_cellular_network">Mobile network scanning</string> <string name="device_cellular_network">Mobile network scanning</string>
<!-- Label for list of apps using battery in power use UI. Note: ^1 should be used in all translations[CHAR_LIMIT=120] --> <!-- Label for list of apps using battery in power use UI. Note: ^1 should be used in all translations[CHAR_LIMIT=120] -->
<string name="power_usage_list_summary">App usage since full charge (<xliff:g id="relative_time">^1</xliff:g>)</string> <string name="power_usage_list_summary">Battery usage since full charge</string>
<!-- Label for device components using battery in power use UI. Note: ^1 should be used in all translations[CHAR_LIMIT=120] -->
<string name="power_usage_list_summary_device">Device usage since full charge (<xliff:g id="relative_time">^1</xliff:g>)</string>
<!-- Temp string used to debug new battery estimates [DO NOT TRANSLATE] --> <!-- Temp string used to debug new battery estimates [DO NOT TRANSLATE] -->
<string name="power_usage_enhanced_debug" translatable="false"><xliff:g id="time">%1$s</xliff:g> left (New ML est)</string> <string name="power_usage_enhanced_debug" translatable="false"><xliff:g id="time">%1$s</xliff:g> left (New ML est)</string>
<!-- Temp string used to debug old battery estimates [DO NOT TRANSLATE] --> <!-- Temp string used to debug old battery estimates [DO NOT TRANSLATE] -->
@@ -5031,11 +5029,11 @@
<!-- Summary for the battery high usage tip, which presents battery may run out soon [CHAR LIMIT=NONE] --> <!-- Summary for the battery high usage tip, which presents battery may run out soon [CHAR LIMIT=NONE] -->
<string name="battery_tip_high_usage_summary">Battery may run out soon</string> <string name="battery_tip_high_usage_summary">Battery may run out soon</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] --> <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
<string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string> <string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps you used since full charge:</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] --> <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
<string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string> <string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps you used since full charge:</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] --> <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
<string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string> <string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps you used since full charge:</string>
<!-- Title for restricted app preference, showing how many app need to be restricted [CHAR LIMIT=NONE] --> <!-- Title for restricted app preference, showing how many app need to be restricted [CHAR LIMIT=NONE] -->
<plurals name="battery_tip_restrict_title"> <plurals name="battery_tip_restrict_title">
<item quantity="one">Restrict %1$d app</item> <item quantity="one">Restrict %1$d app</item>

View File

@@ -193,14 +193,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
} }
mBatteryStatsHelper = statsHelper; mBatteryStatsHelper = statsHelper;
final long lastFullChargeTime = mBatteryUtils.calculateLastFullChargeTime( mAppListGroup.setTitle(R.string.power_usage_list_summary);
mBatteryStatsHelper, System.currentTimeMillis());
final CharSequence timeSequence = StringUtil.formatRelativeTime(mContext,
lastFullChargeTime,
false);
final int resId = showAllApps ? R.string.power_usage_list_summary_device
: R.string.power_usage_list_summary;
mAppListGroup.setTitle(TextUtils.expandTemplate(mContext.getText(resId), timeSequence));
final PowerProfile powerProfile = statsHelper.getPowerProfile(); final PowerProfile powerProfile = statsHelper.getPowerProfile();
final BatteryStats stats = statsHelper.getStats(); final BatteryStats stats = statsHelper.getStats();

View File

@@ -94,10 +94,7 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
return new AlertDialog.Builder(context) return new AlertDialog.Builder(context)
.setMessage(getString(R.string.battery_tip_dialog_message, .setMessage(getString(R.string.battery_tip_dialog_message,
highUsageTip.getHighUsageAppList().size(), highUsageTip.getHighUsageAppList().size()))
StringUtil.formatRelativeTime(context,
highUsageTip.getLastFullChargeTimeMs(),
false /* withSeconds */)))
.setView(view) .setView(view)
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.create(); .create();

View File

@@ -113,7 +113,7 @@ public class BatteryTipDialogFragmentTest {
ShadowAlertDialog shadowDialog = shadowOf(dialog); ShadowAlertDialog shadowDialog = shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo( assertThat(shadowDialog.getMessage()).isEqualTo(
mContext.getString(R.string.battery_tip_dialog_message, 1, "60 minutes ago")); mContext.getString(R.string.battery_tip_dialog_message, 1));
} }
@Test @Test