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

Commit e3d4e391 authored by Almaz Mingaleev's avatar Almaz Mingaleev Committed by Gerrit Code Review
Browse files

Merge "Move MIN_USE_DATE_OF_TIMEZONE to TimeUtils."

parents 15ecc361 3be24f4a
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@
package com.android.settings.datetime.timezone.model;

import android.util.ArraySet;
import android.util.TimeUtils;

import com.android.i18n.timezone.CountryTimeZones;

import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -31,21 +31,6 @@ import java.util.Set;
 */
public class FilteredCountryTimeZones {

    /**
     * The timestamp used to determine which time zones to show to users by using the notUsedAfter
     * metadata Android holds for each time zone.
     *
     * notUsedAfter exists because some time zones effectively "merge" with other time zones after
     * a given point in time (i.e. they have identical transitions, offsets, etc.). After that
     * point we only need to show one of the functionally identical ones.
     *
     * Rather than using System.currentTimeMillis(), UX folks asked for consistent behavior and so
     * a timestamp known to be in the recent past is used. This should be updated occasionally but
     * it doesn't have to be very often.
     */
    private static final Instant MIN_USE_DATE_OF_TIMEZONE =
            Instant.ofEpochMilli(1546300800000L); // 1/1/2019 00:00 UTC

    private final CountryTimeZones mCountryTimeZones;
    private final List<String> mPreferredTimeZoneIds;
    private final Set<String> mAlternativeTimeZoneIds;
@@ -56,7 +41,7 @@ public class FilteredCountryTimeZones {
        Set<String> alternativeTimeZoneIds = new ArraySet<>();
        for (CountryTimeZones.TimeZoneMapping timeZoneMapping :
                countryTimeZones.getTimeZoneMappings()) {
            if (timeZoneMapping.isShownInPickerAt(MIN_USE_DATE_OF_TIMEZONE)) {
            if (timeZoneMapping.isShownInPickerAt(TimeUtils.MIN_USE_DATE_OF_TIMEZONE)) {
                String timeZoneId = timeZoneMapping.getTimeZoneId();
                timeZoneIds.add(timeZoneId);
                alternativeTimeZoneIds.addAll(timeZoneMapping.getAlternativeIds());