Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecdf20d4 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Fix NPE in DateFormat.is24HourFormat."

parents 82461951 8d8ef00c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -816,9 +816,10 @@ public class DateUtils
     */
    public static Formatter formatDateRange(Context context, Formatter formatter, long startMillis,
                                            long endMillis, int flags, String timeZone) {
        // icu4c will fall back to the locale's preferred 12/24 format,
        // If we're being asked to format a time without being explicitly told whether to use
        // the 12- or 24-hour clock, icu4c will fall back to the locale's preferred 12/24 format,
        // but we want to fall back to the user's preference.
        if ((flags & (FORMAT_12HOUR | FORMAT_24HOUR)) == 0) {
        if ((flags & (FORMAT_SHOW_TIME | FORMAT_12HOUR | FORMAT_24HOUR)) == FORMAT_SHOW_TIME) {
            flags |= DateFormat.is24HourFormat(context) ? FORMAT_24HOUR : FORMAT_12HOUR;
        }