Loading packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java +2 −1 Original line number Diff line number Diff line Loading @@ -144,7 +144,8 @@ public class PowerUtil { FIFTEEN_MINUTES_MILLIS); // convert the time to a properly formatted string. DateFormat fmt = DateFormat.getTimeInstance(DateFormat.SHORT); String skeleton = android.text.format.DateFormat.getTimeFormatString(context); DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton); Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs)); CharSequence timeString = fmt.format(date); Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ public class PowerUtilTest { public static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis(); public static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about"; public static final String ENHANCED_SUFFIX = " based on your usage"; // matches a time (ex: '1:15 PM', '2 AM') public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* (AM)|(PM)"; // matches a time (ex: '1:15 PM', '2 AM', '23:00') public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)"; // matches a percentage with parenthesis (ex: '(10%)') public static final String PERCENTAGE_REGEX = " \\(\\d?\\d%\\)"; Loading Loading
packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java +2 −1 Original line number Diff line number Diff line Loading @@ -144,7 +144,8 @@ public class PowerUtil { FIFTEEN_MINUTES_MILLIS); // convert the time to a properly formatted string. DateFormat fmt = DateFormat.getTimeInstance(DateFormat.SHORT); String skeleton = android.text.format.DateFormat.getTimeFormatString(context); DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton); Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs)); CharSequence timeString = fmt.format(date); Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ public class PowerUtilTest { public static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis(); public static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about"; public static final String ENHANCED_SUFFIX = " based on your usage"; // matches a time (ex: '1:15 PM', '2 AM') public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* (AM)|(PM)"; // matches a time (ex: '1:15 PM', '2 AM', '23:00') public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)"; // matches a percentage with parenthesis (ex: '(10%)') public static final String PERCENTAGE_REGEX = " \\(\\d?\\d%\\)"; Loading