Loading packages/SettingsLib/res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -1066,8 +1066,8 @@ <string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=20] Label for estimated time that phone will run out of battery --> <string name="power_discharge_by_only_short">Until <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=100] Extend the battery life past a certain time --> <string name="power_suggestion_extend_battery">Extend battery life past <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery --> <string name="power_suggestion_battery_run_out">Battery may run out by <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount --> <string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string> Loading packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class PowerUtil { return null; } if (drainTimeMs <= ONE_DAY_MILLIS) { return context.getString(R.string.power_suggestion_extend_battery, return context.getString(R.string.power_suggestion_battery_run_out, getDateTimeStringFromMs(context, drainTimeMs)); } else { return getMoreThanOneDayShortString(context, drainTimeMs, Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class PowerUtilTest { private static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis(); private static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about"; private static final String ENHANCED_SUFFIX = " based on your usage"; private static final String EXTEND_PREFIX = "Extend battery life past"; private static final String BATTERY_RUN_OUT_PREFIX = "Battery may run out by"; // matches a time (ex: '1:15 PM', '2 AM', '23:00') private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)"; // matches a percentage with parenthesis (ex: '(10%)') Loading Loading @@ -189,9 +189,9 @@ public class PowerUtilTest { String info = PowerUtil.getBatteryTipStringFormatted(mContext, SEVENTEEN_MIN_MILLIS); // ex: Extend battery life past 1:15 PM // ex: Battery may run out by 1:15 PM assertThat(info).containsMatch(Pattern.compile( EXTEND_PREFIX + TIME_OF_DAY_REGEX)); BATTERY_RUN_OUT_PREFIX + TIME_OF_DAY_REGEX)); } @Test Loading Loading
packages/SettingsLib/res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -1066,8 +1066,8 @@ <string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=20] Label for estimated time that phone will run out of battery --> <string name="power_discharge_by_only_short">Until <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=100] Extend the battery life past a certain time --> <string name="power_suggestion_extend_battery">Extend battery life past <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery --> <string name="power_suggestion_battery_run_out">Battery may run out by <xliff:g id="time" example="12 PM">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount --> <string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string> Loading
packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class PowerUtil { return null; } if (drainTimeMs <= ONE_DAY_MILLIS) { return context.getString(R.string.power_suggestion_extend_battery, return context.getString(R.string.power_suggestion_battery_run_out, getDateTimeStringFromMs(context, drainTimeMs)); } else { return getMoreThanOneDayShortString(context, drainTimeMs, Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class PowerUtilTest { private static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis(); private static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about"; private static final String ENHANCED_SUFFIX = " based on your usage"; private static final String EXTEND_PREFIX = "Extend battery life past"; private static final String BATTERY_RUN_OUT_PREFIX = "Battery may run out by"; // matches a time (ex: '1:15 PM', '2 AM', '23:00') private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)"; // matches a percentage with parenthesis (ex: '(10%)') Loading Loading @@ -189,9 +189,9 @@ public class PowerUtilTest { String info = PowerUtil.getBatteryTipStringFormatted(mContext, SEVENTEEN_MIN_MILLIS); // ex: Extend battery life past 1:15 PM // ex: Battery may run out by 1:15 PM assertThat(info).containsMatch(Pattern.compile( EXTEND_PREFIX + TIME_OF_DAY_REGEX)); BATTERY_RUN_OUT_PREFIX + TIME_OF_DAY_REGEX)); } @Test Loading