Merge "Move MIN_USE_DATE_OF_TIMEZONE to TimeUtils." am: e3d4e39144 am: 90d5572fa5 am: f3a44236e3

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1658001

Change-Id: I3f3ce9f7dc0528e492473dcf1f8344f0518119e1
This commit is contained in:
Almaz Mingaleev
2021-04-07 19:28:22 +00:00
committed by Automerger Merge Worker

View File

@@ -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());