Tag assorted CorePlatformApi APIs (2)

These were found while investigating targets besides
"framework" needed by targets that are
closely tied to framework. e.g.
framework/core/services, framework/opt/telephony.

Bug: 113148576
Test: build
Change-Id: Ic45624d1404e8ee31ddf6c975b4bd6a8d1f8710a
diff --git a/dalvik/src/main/java/dalvik/system/CloseGuard.java b/dalvik/src/main/java/dalvik/system/CloseGuard.java
index 6b05be0..31549fc 100644
--- a/dalvik/src/main/java/dalvik/system/CloseGuard.java
+++ b/dalvik/src/main/java/dalvik/system/CloseGuard.java
@@ -108,6 +108,7 @@
  *
  * @hide
  */
+@libcore.api.CorePlatformApi
 @libcore.api.IntraCoreApi
 public final class CloseGuard {
 
@@ -135,6 +136,7 @@
      * Returns a CloseGuard instance. {@code #open(String)} can be used to set
      * up the instance to warn on failure to close.
      */
+    @libcore.api.CorePlatformApi
     @libcore.api.IntraCoreApi
     public static CloseGuard get() {
         return new CloseGuard();
@@ -209,6 +211,7 @@
      * @param closer non-null name of explicit termination method. Printed by warnIfOpen.
      * @throws NullPointerException if closer is null.
      */
+    @libcore.api.CorePlatformApi
     @libcore.api.IntraCoreApi
     public void open(String closer) {
         // always perform the check for valid API usage...
@@ -238,6 +241,7 @@
      * Marks this CloseGuard instance as closed to avoid warnings on
      * finalization.
      */
+    @libcore.api.CorePlatformApi
     @libcore.api.IntraCoreApi
     public void close() {
         Tracker tracker = currentTracker;
@@ -255,6 +259,7 @@
      * the allocation to the current reporter. If it was not enabled, it just
      * directly logs a brief message.
      */
+    @libcore.api.CorePlatformApi
     @libcore.api.IntraCoreApi
     public void warnIfOpen() {
         if (closerNameOrAllocationInfo != null) {
@@ -284,9 +289,11 @@
 
     /**
      * Interface to allow customization of reporting behavior.
+     * @hide
      */
+    @libcore.api.CorePlatformApi
     public interface Reporter {
-        void report (String message, Throwable allocationSite);
+        void report(String message, Throwable allocationSite);
     }
 
     /**
diff --git a/luni/src/main/java/android/system/ErrnoException.java b/luni/src/main/java/android/system/ErrnoException.java
index 472acbd..19889d7 100644
--- a/luni/src/main/java/android/system/ErrnoException.java
+++ b/luni/src/main/java/android/system/ErrnoException.java
@@ -67,6 +67,7 @@
     /**
      * @hide - internal use only.
      */
+    @libcore.api.CorePlatformApi
     public IOException rethrowAsIOException() throws IOException {
         IOException newException = new IOException(getMessage());
         newException.initCause(this);
diff --git a/luni/src/main/java/android/system/OsConstants.java b/luni/src/main/java/android/system/OsConstants.java
index 2a9b0ea..802c52e 100644
--- a/luni/src/main/java/android/system/OsConstants.java
+++ b/luni/src/main/java/android/system/OsConstants.java
@@ -123,6 +123,7 @@
     public static final int AI_PASSIVE = placeholder();
     public static final int AI_V4MAPPED = placeholder();
     /** @hide */
+    @libcore.api.CorePlatformApi
     public static final int ARPHRD_ETHER = placeholder();
     /** @hide */
     public static final int ARPHRD_LOOPBACK = placeholder();
@@ -256,8 +257,10 @@
     /** @hide */
     public static final int ETH_P_ARP = placeholder();
     /** @hide */
+    @libcore.api.CorePlatformApi
     public static final int ETH_P_IP = placeholder();
     /** @hide */
+    @libcore.api.CorePlatformApi
     public static final int ETH_P_IPV6 = placeholder();
     public static final int ETIME = placeholder();
     public static final int ETIMEDOUT = placeholder();
diff --git a/luni/src/main/java/libcore/icu/LocaleData.java b/luni/src/main/java/libcore/icu/LocaleData.java
index 45f4b29..4e7bd7f 100644
--- a/luni/src/main/java/libcore/icu/LocaleData.java
+++ b/luni/src/main/java/libcore/icu/LocaleData.java
@@ -32,7 +32,9 @@
  * Note that you share these; you must not alter any of the fields, nor their array elements
  * in the case of arrays. If you ever expose any of these things to user code, you must give
  * them a clone rather than the original.
+ * @hide
  */
+@libcore.api.CorePlatformApi
 public final class LocaleData {
     // A cache for the locale-specific data.
     private static final HashMap<String, LocaleData> localeDataCache = new HashMap<String, LocaleData>();
@@ -88,10 +90,14 @@
     public String narrowPm; // "p".
 
     // Used by DateFormat to implement 12- and 24-hour SHORT and MEDIUM.
-    // The first two are also used directly by frameworks code.
+    // They are also used directly by frameworks code.
+    @libcore.api.CorePlatformApi
     public String timeFormat_hm;
+    @libcore.api.CorePlatformApi
     public String timeFormat_Hm;
+    @libcore.api.CorePlatformApi
     public String timeFormat_hms;
+    @libcore.api.CorePlatformApi
     public String timeFormat_Hms;
 
     // Used by DecimalFormatSymbols.
@@ -134,6 +140,7 @@
     /**
      * Returns a shared LocaleData for the given locale.
      */
+    @libcore.api.CorePlatformApi
     public static LocaleData get(Locale locale) {
         if (locale == null) {
             throw new NullPointerException("locale == null");
@@ -161,6 +168,7 @@
         return Objects.toString(this);
     }
 
+    @libcore.api.CorePlatformApi
     public String getDateFormat(int style) {
         switch (style) {
         case DateFormat.SHORT:
diff --git a/luni/src/main/java/libcore/io/IoUtils.java b/luni/src/main/java/libcore/io/IoUtils.java
index f235e1a..6818bce 100644
--- a/luni/src/main/java/libcore/io/IoUtils.java
+++ b/luni/src/main/java/libcore/io/IoUtils.java
@@ -147,6 +147,7 @@
      * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
      * or invalid.
      */
+    @libcore.api.CorePlatformApi
     public static void close(FileDescriptor fd) throws IOException {
         IoBridge.closeAndSignalBlockedThreads(fd);
     }
@@ -210,6 +211,7 @@
     /**
      * Returns the contents of 'path' as a byte array.
      */
+    @libcore.api.CorePlatformApi
     public static byte[] readFileAsByteArray(String absolutePath) throws IOException {
         return new FileReader(absolutePath).readFully().toByteArray();
     }
diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java
index bd7c874..d20eae23 100644
--- a/luni/src/main/java/libcore/net/MimeUtils.java
+++ b/luni/src/main/java/libcore/net/MimeUtils.java
@@ -27,7 +27,9 @@
 /**
  * Utilities for dealing with MIME types.
  * Used to implement java.net.URLConnection and android.webkit.MimeTypeMap.
+ * @hide
  */
+@libcore.api.CorePlatformApi
 public final class MimeUtils {
     private static final Pattern splitPattern = Pattern.compile("\\s+");
 
@@ -127,6 +129,7 @@
      * @return The extension has been registered for
      * the given case insensitive MIME type or null if there is none.
      */
+    @libcore.api.CorePlatformApi
     public static String guessExtensionFromMimeType(String mimeType) {
         if (mimeType == null || mimeType.isEmpty()) {
             return null;
diff --git a/luni/src/main/java/libcore/util/CountryTimeZones.java b/luni/src/main/java/libcore/util/CountryTimeZones.java
index 4bf4023..b9de8ab 100644
--- a/luni/src/main/java/libcore/util/CountryTimeZones.java
+++ b/luni/src/main/java/libcore/util/CountryTimeZones.java
@@ -183,6 +183,7 @@
     /**
      * Returns the ISO code for the country.
      */
+    @libcore.api.CorePlatformApi
     public String getCountryIso() {
         return countryIso;
     }
@@ -228,6 +229,7 @@
      * "priority" order. The list can be empty if there were no zones configured or the configured
      * zone IDs were not recognized.
      */
+    @libcore.api.CorePlatformApi
     public List<TimeZoneMapping> getTimeZoneMappings() {
         return timeZoneMappings;
     }
diff --git a/luni/src/main/java/libcore/util/CountryZonesFinder.java b/luni/src/main/java/libcore/util/CountryZonesFinder.java
index cbc8a1b..f6a6300 100644
--- a/luni/src/main/java/libcore/util/CountryZonesFinder.java
+++ b/luni/src/main/java/libcore/util/CountryZonesFinder.java
@@ -23,7 +23,9 @@
 
 /**
  * An in-memory representation of country &lt;-&gt; time zone mapping data.
+ * @hide
  */
+@libcore.api.CorePlatformApi
 public final class CountryZonesFinder {
 
     private final List<CountryTimeZones> countryTimeZonesList;
@@ -41,6 +43,7 @@
      * Returns an immutable list of country ISO codes with time zones. The codes can be passed to
      * {@link #lookupCountryTimeZones(String)} and similar methods.
      */
+    @libcore.api.CorePlatformApi
     public List<String> lookupAllCountryIsoCodes() {
         List<String> isoCodes = new ArrayList<>(countryTimeZonesList.size());
         for (CountryTimeZones countryTimeZones : countryTimeZonesList) {
@@ -54,6 +57,7 @@
      * time zone. An exact, case-sensitive match is performed on the zone ID. This method never
      * returns null.
      */
+    @libcore.api.CorePlatformApi
     public List<CountryTimeZones> lookupCountryTimeZonesForZoneId(String zoneId) {
         List<CountryTimeZones> matches = new ArrayList<>(2);
         for (CountryTimeZones countryTimeZones : countryTimeZonesList) {
@@ -70,6 +74,7 @@
      * Returns a {@link CountryTimeZones} object associated with the specified country code. If one
      * cannot be found this method returns {@code null}.
      */
+    @libcore.api.CorePlatformApi
     public CountryTimeZones lookupCountryTimeZones(String countryIso) {
         String normalizedCountryIso = TimeZoneFinder.normalizeCountryIso(countryIso);
         for (CountryTimeZones countryTimeZones : countryTimeZonesList) {
diff --git a/luni/src/main/java/libcore/util/HexEncoding.java b/luni/src/main/java/libcore/util/HexEncoding.java
index aa9c7f0..6ba61ab 100644
--- a/luni/src/main/java/libcore/util/HexEncoding.java
+++ b/luni/src/main/java/libcore/util/HexEncoding.java
@@ -39,6 +39,7 @@
     /**
      * Encodes the provided data as a sequence of hexadecimal characters.
      */
+    @libcore.api.CorePlatformApi
     public static char[] encode(byte[] data, int offset, int len) {
         char[] result = new char[len * 2];
         for (int i = 0; i < len; i++) {
@@ -98,6 +99,7 @@
      *
      * Throws an {@code IllegalArgumentException} if the input is malformed.
      */
+    @libcore.api.CorePlatformApi
     public static byte[] decode(char[] encoded, boolean allowSingleChar) throws IllegalArgumentException {
         int resultLengthBytes = (encoded.length + 1) / 2;
         byte[] result = new byte[resultLengthBytes];
diff --git a/luni/src/main/java/libcore/util/TimeZoneFinder.java b/luni/src/main/java/libcore/util/TimeZoneFinder.java
index bed0f24..4874459 100644
--- a/luni/src/main/java/libcore/util/TimeZoneFinder.java
+++ b/luni/src/main/java/libcore/util/TimeZoneFinder.java
@@ -175,6 +175,7 @@
      * Loads all the country &lt;-&gt; time zone mapping data into memory. This method can return
      * {@code null} in the event of an error while reading the underlying data files.
      */
+    @libcore.api.CorePlatformApi
     public CountryZonesFinder getCountryZonesFinder() {
         CountryZonesLookupExtractor extractor = new CountryZonesLookupExtractor();
         try {
@@ -244,6 +245,7 @@
      * {@link android.icu.util.TimeZone#getTimeZone(String)}. This method can return an empty list
      * in a case when the underlying data files reference only unknown zone IDs.
      */
+    @libcore.api.CorePlatformApi
     public List<String> lookupTimeZoneIdsByCountry(String countryIso) {
         CountryTimeZones countryTimeZones = lookupCountryTimeZones(countryIso);
         return countryTimeZones == null
diff --git a/non_openjdk_java_files.bp b/non_openjdk_java_files.bp
index e4b0742..2ab257d 100644
--- a/non_openjdk_java_files.bp
+++ b/non_openjdk_java_files.bp
@@ -160,13 +160,16 @@
         "luni/src/main/java/libcore/api/Hide.java",
         "luni/src/main/java/libcore/api/IntraCoreApi.java",
         "luni/src/main/java/libcore/icu/ICU.java",
+        "luni/src/main/java/libcore/icu/LocaleData.java",
         "luni/src/main/java/libcore/io/IoUtils.java",
         "luni/src/main/java/libcore/io/Libcore.java",
         "luni/src/main/java/libcore/io/Os.java",
         "luni/src/main/java/libcore/io/Streams.java",
         "luni/src/main/java/libcore/mmodule/libart/DemoLibartClass.java",
+        "luni/src/main/java/libcore/net/MimeUtils.java",
         "luni/src/main/java/libcore/net/NetworkSecurityPolicy.java",
         "luni/src/main/java/libcore/util/CountryTimeZones.java",
+        "luni/src/main/java/libcore/util/CountryZonesFinder.java",
         "luni/src/main/java/libcore/util/EmptyArray.java",
         "luni/src/main/java/libcore/util/HexEncoding.java",
         "luni/src/main/java/libcore/util/NativeAllocationRegistry.java",
@@ -271,7 +274,6 @@
         "luni/src/main/java/libcore/icu/DateIntervalFormat.java",
         "luni/src/main/java/libcore/icu/DateTimeFormat.java",
         "luni/src/main/java/libcore/icu/DateUtilsBridge.java",
-        "luni/src/main/java/libcore/icu/LocaleData.java",
         "luni/src/main/java/libcore/icu/NativeConverter.java",
         "luni/src/main/java/libcore/icu/RelativeDateTimeFormatter.java",
         "luni/src/main/java/libcore/icu/TimeZoneNames.java",
@@ -291,7 +293,6 @@
         "luni/src/main/java/libcore/io/NioBufferIterator.java",
         "luni/src/main/java/libcore/io/SizeOf.java",
         "luni/src/main/java/libcore/math/MathUtils.java",
-        "luni/src/main/java/libcore/net/MimeUtils.java",
         "luni/src/main/java/libcore/net/event/NetworkEventDispatcher.java",
         "luni/src/main/java/libcore/net/event/NetworkEventListener.java",
         "luni/src/main/java/libcore/net/http/HttpDate.java",
@@ -312,7 +313,6 @@
         "luni/src/main/java/libcore/util/CharsetUtils.java",
         "luni/src/main/java/libcore/util/BasicLruCache.java",
         "luni/src/main/java/libcore/util/CollectionUtils.java",
-        "luni/src/main/java/libcore/util/CountryZonesFinder.java",
         "luni/src/main/java/libcore/util/NonNull.java",
         "luni/src/main/java/libcore/util/Nullable.java",
         "luni/src/main/java/libcore/util/NullFromTypeParam.java",
diff --git a/ojluni/annotations/mmodule/java/sun/security/util/ObjectIdentifier.annotated.java b/ojluni/annotations/mmodule/java/sun/security/util/ObjectIdentifier.annotated.java
new file mode 100644
index 0000000..d1d5eac
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/sun/security/util/ObjectIdentifier.annotated.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package sun.security.util;
+
+import java.io.*;
+import java.math.BigInteger;
+
+@libcore.api.CorePlatformApi
+@libcore.api.Hide
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class ObjectIdentifier implements java.io.Serializable {
+
+@libcore.api.CorePlatformApi
+public ObjectIdentifier(java.lang.String oid) throws java.io.IOException { throw new RuntimeException("Stub!"); }
+
+public ObjectIdentifier(int[] values) throws java.io.IOException { throw new RuntimeException("Stub!"); }
+
+public ObjectIdentifier(sun.security.util.DerInputStream in) throws java.io.IOException { throw new RuntimeException("Stub!"); }
+
+public static sun.security.util.ObjectIdentifier newInternal(int[] values) { throw new RuntimeException("Stub!"); }
+
+@Deprecated
+public boolean equals(sun.security.util.ObjectIdentifier other) { throw new RuntimeException("Stub!"); }
+
+public boolean equals(java.lang.Object obj) { throw new RuntimeException("Stub!"); }
+
+public int hashCode() { throw new RuntimeException("Stub!"); }
+
+public int[] toIntArray() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String toString() { throw new RuntimeException("Stub!"); }
+}
+
diff --git a/ojluni/annotations/mmodule/java/sun/security/x509/AlgorithmId.annotated.java b/ojluni/annotations/mmodule/java/sun/security/x509/AlgorithmId.annotated.java
index cc62a74..9e4ce60 100644
--- a/ojluni/annotations/mmodule/java/sun/security/x509/AlgorithmId.annotated.java
+++ b/ojluni/annotations/mmodule/java/sun/security/x509/AlgorithmId.annotated.java
@@ -25,16 +25,23 @@
  */
 
 package sun.security.x509;
-
 import java.io.Serializable;
 import java.security.NoSuchAlgorithmException;
 
 import sun.security.util.DerEncoder;
+import sun.security.util.ObjectIdentifier
 
+@libcore.api.CorePlatformApi
 @libcore.api.Hide
 @libcore.api.IntraCoreApi
 public class AlgorithmId implements Serializable, DerEncoder {
 
+    @libcore.api.CorePlatformApi
+    public AlgorithmId(ObjectIdentifier oid) {
+        throw new RuntimeException("Stub!");
+    }
+
+    @libcore.api.CorePlatformApi
     @libcore.api.IntraCoreApi
     public String getName() {
         throw new RuntimeException("Stub!");
diff --git a/ojluni/src/main/java/java/io/FileDescriptor.java b/ojluni/src/main/java/java/io/FileDescriptor.java
index a2c833d..cd3a567 100644
--- a/ojluni/src/main/java/java/io/FileDescriptor.java
+++ b/ojluni/src/main/java/java/io/FileDescriptor.java
@@ -165,6 +165,7 @@
      * your needs with a libcore maintainer before using this method.
      * @hide internal use only
      */
+    @libcore.api.CorePlatformApi
     public final void setInt$(int fd) {
         this.descriptor = fd;
     }
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index 28b50a8..792f694 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -2105,11 +2105,13 @@
      * @hide used when configuring the runtime for exception logging; see
      *     {@link dalvik.system.RuntimeHooks} b/29624607
      */
+    @libcore.api.CorePlatformApi
     public static void setUncaughtExceptionPreHandler(UncaughtExceptionHandler eh) {
         uncaughtExceptionPreHandler = eh;
     }
 
     /** @hide */
+    @libcore.api.CorePlatformApi
     public static UncaughtExceptionHandler getUncaughtExceptionPreHandler() {
         return uncaughtExceptionPreHandler;
     }
diff --git a/ojluni/src/main/java/java/net/Inet4Address.java b/ojluni/src/main/java/java/net/Inet4Address.java
index 1fb7b92..cdb02e8 100644
--- a/ojluni/src/main/java/java/net/Inet4Address.java
+++ b/ojluni/src/main/java/java/net/Inet4Address.java
@@ -95,6 +95,7 @@
 
     // BEGIN Android-added: Define special-purpose IPv4 address
     /** @hide */
+    @libcore.api.CorePlatformApi
     public static final InetAddress ANY = new Inet4Address(null, new byte[] { 0, 0, 0, 0 });
 
     /** @hide */
diff --git a/ojluni/src/main/java/java/util/LinkedHashMap.java b/ojluni/src/main/java/java/util/LinkedHashMap.java
index 7c8cad0..fac50c2 100644
--- a/ojluni/src/main/java/java/util/LinkedHashMap.java
+++ b/ojluni/src/main/java/java/util/LinkedHashMap.java
@@ -493,6 +493,7 @@
      * Returns the eldest entry in the map, or {@code null} if the map is empty.
      * @hide
      */
+    @libcore.api.CorePlatformApi
     public Map.Entry<K, V> eldest() {
         return head;
     }
diff --git a/openjdk_java_files.bp b/openjdk_java_files.bp
index 103fb04..ccb348a 100644
--- a/openjdk_java_files.bp
+++ b/openjdk_java_files.bp
@@ -1390,6 +1390,7 @@
     name: "openjdk_mmodule_extra_files",
     srcs: [
         "ojluni/src/main/java/sun/security/util/DerEncoder.java",
+        "ojluni/src/main/java/sun/security/util/ObjectIdentifier.java",
         "ojluni/src/main/java/sun/security/x509/AlgorithmId.java",
     ],
 }
@@ -1678,7 +1679,6 @@
         "ojluni/src/main/java/sun/security/util/Length.java",
         "ojluni/src/main/java/sun/security/util/ManifestDigester.java",
         "ojluni/src/main/java/sun/security/util/ManifestEntryVerifier.java",
-        "ojluni/src/main/java/sun/security/util/ObjectIdentifier.java",
         "ojluni/src/main/java/sun/security/util/PropertyExpander.java",
         "ojluni/src/main/java/sun/security/util/Resources.java",
         "ojluni/src/main/java/sun/security/util/ResourcesMgr.java",