Rename ExtendedTimeZoneNames.matchName method

The return type can't be changed, because ART branch is building
aganist the prebuilt SDK provided by ICU.

Temporaily name the method "matchNameToBeRenamed" until the prebuilt
SDK is updataed

Bug: 183477238
Test: m droid
Change-Id: I109a0f444959a894282149ad7d7f40cffd6d5902
diff --git a/android_icu4j/api/intra/current.txt b/android_icu4j/api/intra/current.txt
index d3cc4cc..317a843 100644
--- a/android_icu4j/api/intra/current.txt
+++ b/android_icu4j/api/intra/current.txt
@@ -74,6 +74,13 @@
     method @NonNull public static com.android.icu.text.ExtendedTimeZoneNames getInstance(@NonNull android.icu.util.ULocale);
     method @NonNull public android.icu.text.TimeZoneNames getTimeZoneNames();
     method @Nullable public com.android.icu.text.ExtendedTimeZoneNames.MatchedTimeZone matchName(@NonNull CharSequence, int, @NonNull String);
+    method @Nullable public com.android.icu.text.ExtendedTimeZoneNames.Match matchNameToBeRenamed(@NonNull CharSequence, int, @NonNull String);
+  }
+
+  public static final class ExtendedTimeZoneNames.Match {
+    method public int getMatchLength();
+    method @NonNull public String getTzId();
+    method public boolean isDst();
   }
 
   public static class ExtendedTimeZoneNames.MatchedTimeZone {
diff --git a/android_icu4j/libcore_bridge/src/java/com/android/icu/text/ExtendedTimeZoneNames.java b/android_icu4j/libcore_bridge/src/java/com/android/icu/text/ExtendedTimeZoneNames.java
index 57c7367..37c6063 100644
--- a/android_icu4j/libcore_bridge/src/java/com/android/icu/text/ExtendedTimeZoneNames.java
+++ b/android_icu4j/libcore_bridge/src/java/com/android/icu/text/ExtendedTimeZoneNames.java
@@ -54,7 +54,55 @@
 
     private final ULocale locale;
     private final TimeZoneNames timeZoneNames;
+/**
+     * A class representing the return result of {@link #matchName(CharSequence, int, String)}
+     *
+     * @hide
+     */
+    @IntraCoreApi
+    public static final class Match {
 
+        private final int matchLength;
+        private final @NonNull String tzId;
+        private final boolean isDst;
+
+        private Match(int matchLength, @NonNull String tzId, boolean isDst) {
+            this.matchLength = matchLength;
+            this.tzId = tzId;
+            this.isDst = isDst;
+        }
+
+        /**
+         * Returns the number of chars in the matched name.
+         *
+         * @hide
+         */
+        @IntraCoreApi
+        public int getMatchLength() {
+            return matchLength;
+        }
+
+        /**
+         * Returns the time zone id associated with the matched name.
+         *
+         * @hide
+         */
+        @IntraCoreApi
+        public @NonNull String getTzId() {
+            return tzId;
+        }
+
+        /**
+         * Returns true if the matched name is a display name for daylight saving time. For example,
+         * returns true for "Pacific Daylight Time", but false for "Pacific Standard Time".
+         *
+         * @hide
+         */
+        @IntraCoreApi
+        public boolean isDst() {
+            return isDst;
+        }
+    }
     /**
      * A class representing the return result of {@link #matchName(CharSequence, int, String)}
      *
@@ -131,6 +179,38 @@
     }
 
     /**
+     * Returns {@link Match} if a time zone name in ICU can be matched against the input
+     * CharSequence {@code s}.
+     * The best match is found by the following principles:
+     * <ul>
+     * <li>Length of the matched name. Longest name matched to the given {@code s} has the
+     * highest priority.</li>
+     * <li>The current time zone and meta zones possible in the current country have higher
+     * priority than other zones.</li>
+     * <li>If only meta zones are matched, the country/region in the locale is used to select
+     * a reference time zone. For example, if the name is "Pacific Standard Time" and the country
+     * is US, America/Los_Angeles is returned.</li>
+     * </ul>
+     *
+     * @param text input string to be matched against time zone names in ICU
+     * @param start the begin index in the CharSequence {@code s}
+     * @param currentTzId the time zone ID prioritized to be matched if multiple time zone IDs can
+     *                    be matched and this is one of the matched IDs.
+     * @return null if no match is found
+     *
+     * @hide
+     */
+    @IntraCoreApi
+    public @Nullable Match matchNameToBeRenamed(@NonNull CharSequence text, int start,
+            @NonNull String currentTzId) {
+        MatchedTimeZone matchedTimeZone  = matchName(text, start, currentTzId);
+        if (matchedTimeZone == null) {
+            return null;
+        }
+        return new Match(matchedTimeZone.matchLength, matchedTimeZone.tzId, matchedTimeZone.isDst);
+    }
+
+    /**
      * Returns {@link MatchedTimeZone} if a time zone name in ICU can be matched against the input
      * CharSequence {@code s}.
      * The best match is found by the following principles: