Merge "Move getOffset(int, int, int, int, int, int) to ZoneInfo" am: 964e0e09ef

Original change: https://android-review.googlesource.com/c/platform/external/icu/+/1489036

Change-Id: I39c47e67b27765ae880f9d3eb0eb798d49bb4869
diff --git a/android_icu4j/api/intra/current.txt b/android_icu4j/api/intra/current.txt
index eecf4f0..1c30c17 100644
--- a/android_icu4j/api/intra/current.txt
+++ b/android_icu4j/api/intra/current.txt
@@ -101,13 +101,12 @@
 
 package com.android.i18n.timezone {
 
-  public final class ZoneInfoData implements java.lang.Cloneable {
+  public final class ZoneInfoData {
     ctor public ZoneInfoData(com.android.i18n.timezone.ZoneInfoData);
     method public static com.android.i18n.timezone.ZoneInfoData createFromSerializationFields(String, java.io.ObjectInputStream.GetField) throws java.io.IOException;
     method public static com.android.i18n.timezone.ZoneInfoData createZoneInfo(String, long, java.nio.ByteBuffer) throws java.io.IOException;
     method public int getDSTSavings();
     method public String getID();
-    method public int getOffset(int, int, int, int, int, int);
     method public int getOffset(long);
     method public int getOffsetsByUtcTime(long, int[]);
     method public int getRawOffset();
diff --git a/android_icu4j/api/legacy_platform/current.txt b/android_icu4j/api/legacy_platform/current.txt
index 392b02d..3754020 100644
--- a/android_icu4j/api/legacy_platform/current.txt
+++ b/android_icu4j/api/legacy_platform/current.txt
@@ -156,7 +156,7 @@
     ctor public TzDataSetVersion.TzDataSetException(String, Throwable);
   }
 
-  public final class ZoneInfoData implements java.lang.Cloneable {
+  public final class ZoneInfoData {
     method public String getID();
   }
 
diff --git a/android_icu4j/libcore_bridge/src/java/com/android/i18n/timezone/ZoneInfoData.java b/android_icu4j/libcore_bridge/src/java/com/android/i18n/timezone/ZoneInfoData.java
index 1e306ab..6cb54b5 100644
--- a/android_icu4j/libcore_bridge/src/java/com/android/i18n/timezone/ZoneInfoData.java
+++ b/android_icu4j/libcore_bridge/src/java/com/android/i18n/timezone/ZoneInfoData.java
@@ -59,21 +59,7 @@
  */
 @libcore.api.IntraCoreApi
 @libcore.api.CorePlatformApi
-public final class ZoneInfoData implements Cloneable {
-    private static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
-    private static final long MILLISECONDS_PER_400_YEARS =
-            MILLISECONDS_PER_DAY * (400 * 365 + 100 - 3);
-
-    private static final long UNIX_OFFSET = 62167219200000L;
-
-    private static final int[] NORMAL = new int[] {
-        0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
-    };
-
-    private static final int[] LEAP = new int[] {
-        0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335,
-    };
-
+public final class ZoneInfoData {
     /**
      * The serialized fields in {@link libcore.util.ZoneInfo} kept for backward app compatibility.
      */
@@ -544,35 +530,6 @@
         putField.put("mIsDsts", mIsDsts);
     }
 
-    @libcore.api.IntraCoreApi
-    public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
-        // XXX This assumes Gregorian always; Calendar switches from
-        // Julian to Gregorian in 1582.  What calendar system are the
-        // arguments supposed to come from?
-
-        long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
-        year %= 400;
-
-        calc += year * (365 * MILLISECONDS_PER_DAY);
-        calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
-
-        if (year > 0) {
-            calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
-        }
-
-        boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
-        int[] mlen = isLeap ? LEAP : NORMAL;
-
-        calc += mlen[month] * MILLISECONDS_PER_DAY;
-        calc += (day - 1) * MILLISECONDS_PER_DAY;
-        calc += millis;
-
-        calc -= mRawOffset;
-        calc -= UNIX_OFFSET;
-
-        return getOffset(calc);
-    }
-
     /**
      * Find the transition in the {@code timezone} in effect at {@code seconds}.
      *