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

Commit 11be3acf authored by Neil Fuller's avatar Neil Fuller
Browse files

Use ICU APIs not impl types

It's possible to use BasicTimeZone in place of OlsonTimeZone.
Although neither are currently public SDK APIs the BasicTimeZone
is preferable.

Bug: 113148576
Test: build
Change-Id: I745b17feee678ecd053fadc6c447107fa80918e8
parent ec65174f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@
package com.android.settings.datetime.timezone;

import android.content.Context;
import android.icu.impl.OlsonTimeZone;
import android.icu.text.DateFormat;
import android.icu.text.DisplayContext;
import android.icu.text.SimpleDateFormat;
import android.icu.util.BasicTimeZone;
import android.icu.util.Calendar;
import android.icu.util.TimeZone;
import android.icu.util.TimeZoneTransition;
@@ -115,17 +115,17 @@ public class TimeZoneInfoPreferenceController extends BaseTimeZonePreferenceCont
    }

    private TimeZoneTransition findNextDstTransition(TimeZone timeZone) {
        if (!(timeZone instanceof OlsonTimeZone)) {
        if (!(timeZone instanceof BasicTimeZone)) {
            return null;
        }
        final OlsonTimeZone olsonTimeZone = (OlsonTimeZone) timeZone;
        TimeZoneTransition transition = olsonTimeZone.getNextTransition(
        final BasicTimeZone basicTimeZone = (BasicTimeZone) timeZone;
        TimeZoneTransition transition = basicTimeZone.getNextTransition(
                mDate.getTime(), /* inclusive */ false);
        do {
            if (transition.getTo().getDSTSavings() != transition.getFrom().getDSTSavings()) {
                break;
            }
            transition = olsonTimeZone.getNextTransition(
            transition = basicTimeZone.getNextTransition(
                    transition.getTime(), /*inclusive */ false);
        } while (transition != null);
        return transition;