Document and @hide okhttp APIs

Bug: 154796679
Test: m droid
Merged-In: I051ec677d0d70de61b6d58a4f37ec1e341250452
Change-Id: I051ec677d0d70de61b6d58a4f37ec1e341250452
diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java b/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
index a7a5eba..bf7e9a9 100644
--- a/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
+++ b/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
@@ -44,6 +44,11 @@
     private final CacheHolder cacheHolder;
     private final Cache okHttpCache;
 
+    /**
+     * Creates an instance from {@link CacheHolder}
+     *
+     * @hide
+     */
     @libcore.api.CorePlatformApi
     public AndroidResponseCacheAdapter(CacheHolder cacheHolder) {
         this.cacheHolder = cacheHolder;
@@ -54,6 +59,8 @@
     /**
      * Returns the {@link CacheHolder} associated with this instance and can be used by OkHttp
      * internal code to obtain the underlying OkHttp Cache object.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheHolder getCacheHolder() {
@@ -63,6 +70,8 @@
     /**
      * Used to implement {@link java.net.ResponseCache#get(URI, String, Map)}. See that method for
      * details.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheResponse get(URI uri, String requestMethod,
@@ -78,6 +87,8 @@
     /**
      * Used to implement {@link java.net.ResponseCache#put(URI, URLConnection)}. See that method for
      * details.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException {
@@ -98,6 +109,8 @@
      * Returns the number of bytes currently being used to store the values in
      * this cache. This may be greater than the {@link #getMaxSize()} if a background
      * deletion is pending. IOException is thrown if the size cannot be determined.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public long getSize() throws IOException {
@@ -107,6 +120,8 @@
     /**
      * Returns the maximum number of bytes that this cache should use to store
      * its data.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public long getMaxSize() {
@@ -117,6 +132,8 @@
      * Force buffered operations to the filesystem. This ensures that responses
      * written to the cache will be available the next time the cache is opened,
      * even if this process is killed. IOException is thrown if the flush fails.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void flush() throws IOException {
@@ -126,6 +143,8 @@
     /**
      * Returns the number of HTTP requests that required the network to either
      * supply a response or validate a locally cached response.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getNetworkCount() {
@@ -136,6 +155,8 @@
      * Returns the number of HTTP requests whose response was provided by the
      * cache. This may include conditional {@code GET} requests that were
      * validated over the network.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getHitCount() {
@@ -146,13 +167,19 @@
      * Returns the total number of HTTP requests that were made. This includes
      * both client requests and requests that were made on the client's behalf
      * to handle a redirects and retries.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getRequestCount() {
         return okHttpCache.getRequestCount();
     }
 
-    /** Closes this cache. Stored values will remain on the filesystem. */
+    /**
+     * Closes this cache. Stored values will remain on the filesystem.
+     *
+     * @hide
+     */
     @libcore.api.CorePlatformApi
     public void close() throws IOException {
         okHttpCache.close();
@@ -162,6 +189,8 @@
      * Closes the cache and deletes all of its stored values. This will delete
      * all files in the cache directory including files that weren't created by
      * the cache.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void delete() throws IOException {
diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java b/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
index 6558dfe..20f84da 100644
--- a/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
+++ b/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
@@ -29,6 +29,8 @@
     /**
      * Returns the IP addresses of {@code hostname}, in the order they should
      * be attempted.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     List<InetAddress> lookup(String hostname) throws UnknownHostException;
diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java b/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
index e990af4..895b576 100644
--- a/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
+++ b/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
@@ -29,6 +29,8 @@
 
     /**
      * Returns the {@link CacheHolder} object.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     CacheHolder getCacheHolder();
@@ -68,6 +70,8 @@
          *
          * @param directory a writable directory
          * @param maxSizeBytes the maximum number of bytes this cache should use to store
+         *
+         * @hide
          */
         @libcore.api.CorePlatformApi
         public static CacheHolder create(File directory, long maxSizeBytes) {
@@ -78,6 +82,8 @@
         /**
          * Returns true if the arguments supplied would result in an equivalent cache to this one
          * being created if they were passed to {@link #create(File, long)}.
+         *
+         * @hide
          */
         @libcore.api.CorePlatformApi
         public boolean isEquivalent(File directory, long maxSizeBytes) {
diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java b/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
index a7d0bbf..d6a7402 100644
--- a/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
+++ b/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
@@ -57,6 +57,7 @@
     private ConnectionPool connectionPool;
     private com.squareup.okhttp.Dns dns;
 
+    /** @hide */
     @libcore.api.CorePlatformApi
     public HttpURLConnectionFactory() {
     }
@@ -64,6 +65,8 @@
     /**
      * Sets a new ConnectionPool, specific to this URLFactory and not shared with
      * any other connections, with the given configuration.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration,
@@ -71,6 +74,7 @@
         this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
     }
 
+    /** @hide */
     @libcore.api.CorePlatformApi
     public void setDns(Dns dns) {
         Objects.requireNonNull(dns);
@@ -79,6 +83,8 @@
 
     /**
      * Opens a connection that uses the system default proxy settings and SocketFactory.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url) throws IOException {
         return internalOpenConnection(url, null /* socketFactory */, null /* proxy */);
@@ -87,6 +93,8 @@
     /**
      * Opens a connection that uses the system default SocketFactory and the specified
      * proxy settings.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url, Proxy proxy) throws IOException {
         Objects.requireNonNull(proxy);
@@ -96,6 +104,8 @@
     /**
      * Opens a connection that uses the specified SocketFactory and the system default
      * proxy settings.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url, SocketFactory socketFactory) throws IOException {
         Objects.requireNonNull(socketFactory);
@@ -105,6 +115,8 @@
     /**
      * Opens a connection using the specified SocketFactory and the specified proxy
      * settings, overriding any system wide configuration.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public URLConnection openConnection(URL url, SocketFactory socketFactory, Proxy proxy)
@@ -148,6 +160,8 @@
 
     /**
      * Adapts a {@link Dns} as a {@link com.squareup.okhttp.Dns}.
+     *
+     * @hide
      */
     static final class DnsAdapter implements com.squareup.okhttp.Dns {
         private final Dns adaptee;
diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
index b7f5002..20f8359 100644
--- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
+++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java
@@ -46,6 +46,11 @@
     private final CacheHolder cacheHolder;
     private final Cache okHttpCache;
 
+    /**
+     * Creates an instance from {@link CacheHolder}
+     *
+     * @hide
+     */
     @libcore.api.CorePlatformApi
     public AndroidResponseCacheAdapter(CacheHolder cacheHolder) {
         this.cacheHolder = cacheHolder;
@@ -56,6 +61,8 @@
     /**
      * Returns the {@link CacheHolder} associated with this instance and can be used by OkHttp
      * internal code to obtain the underlying OkHttp Cache object.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheHolder getCacheHolder() {
@@ -65,6 +72,8 @@
     /**
      * Used to implement {@link java.net.ResponseCache#get(URI, String, Map)}. See that method for
      * details.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheResponse get(URI uri, String requestMethod,
@@ -80,6 +89,8 @@
     /**
      * Used to implement {@link java.net.ResponseCache#put(URI, URLConnection)}. See that method for
      * details.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException {
@@ -100,6 +111,8 @@
      * Returns the number of bytes currently being used to store the values in
      * this cache. This may be greater than the {@link #getMaxSize()} if a background
      * deletion is pending. IOException is thrown if the size cannot be determined.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public long getSize() throws IOException {
@@ -109,6 +122,8 @@
     /**
      * Returns the maximum number of bytes that this cache should use to store
      * its data.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public long getMaxSize() {
@@ -119,6 +134,8 @@
      * Force buffered operations to the filesystem. This ensures that responses
      * written to the cache will be available the next time the cache is opened,
      * even if this process is killed. IOException is thrown if the flush fails.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void flush() throws IOException {
@@ -128,6 +145,8 @@
     /**
      * Returns the number of HTTP requests that required the network to either
      * supply a response or validate a locally cached response.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getNetworkCount() {
@@ -138,6 +157,8 @@
      * Returns the number of HTTP requests whose response was provided by the
      * cache. This may include conditional {@code GET} requests that were
      * validated over the network.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getHitCount() {
@@ -148,13 +169,19 @@
      * Returns the total number of HTTP requests that were made. This includes
      * both client requests and requests that were made on the client's behalf
      * to handle a redirects and retries.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public int getRequestCount() {
         return okHttpCache.getRequestCount();
     }
 
-    /** Closes this cache. Stored values will remain on the filesystem. */
+    /**
+     * Closes this cache. Stored values will remain on the filesystem.
+     *
+     * @hide
+     */
     @libcore.api.CorePlatformApi
     public void close() throws IOException {
         okHttpCache.close();
@@ -164,6 +191,8 @@
      * Closes the cache and deletes all of its stored values. This will delete
      * all files in the cache directory including files that weren't created by
      * the cache.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void delete() throws IOException {
diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
index 859ea80..104f23f 100644
--- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
+++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java
@@ -31,6 +31,8 @@
     /**
      * Returns the IP addresses of {@code hostname}, in the order they should
      * be attempted.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     List<InetAddress> lookup(String hostname) throws UnknownHostException;
diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
index aa90bf3..757c006 100644
--- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
+++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java
@@ -31,6 +31,8 @@
 
     /**
      * Returns the {@link CacheHolder} object.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     CacheHolder getCacheHolder();
@@ -70,6 +72,8 @@
          *
          * @param directory a writable directory
          * @param maxSizeBytes the maximum number of bytes this cache should use to store
+         *
+         * @hide
          */
         @libcore.api.CorePlatformApi
         public static CacheHolder create(File directory, long maxSizeBytes) {
@@ -80,6 +84,8 @@
         /**
          * Returns true if the arguments supplied would result in an equivalent cache to this one
          * being created if they were passed to {@link #create(File, long)}.
+         *
+         * @hide
          */
         @libcore.api.CorePlatformApi
         public boolean isEquivalent(File directory, long maxSizeBytes) {
diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
index 7f83ee5..91266ab 100644
--- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
+++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java
@@ -59,6 +59,7 @@
     private ConnectionPool connectionPool;
     private com.android.okhttp.Dns dns;
 
+    /** @hide */
     @libcore.api.CorePlatformApi
     public HttpURLConnectionFactory() {
     }
@@ -66,6 +67,8 @@
     /**
      * Sets a new ConnectionPool, specific to this URLFactory and not shared with
      * any other connections, with the given configuration.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration,
@@ -73,6 +76,7 @@
         this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
     }
 
+    /** @hide */
     @libcore.api.CorePlatformApi
     public void setDns(Dns dns) {
         Objects.requireNonNull(dns);
@@ -81,6 +85,8 @@
 
     /**
      * Opens a connection that uses the system default proxy settings and SocketFactory.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url) throws IOException {
         return internalOpenConnection(url, null /* socketFactory */, null /* proxy */);
@@ -89,6 +95,8 @@
     /**
      * Opens a connection that uses the system default SocketFactory and the specified
      * proxy settings.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url, Proxy proxy) throws IOException {
         Objects.requireNonNull(proxy);
@@ -98,6 +106,8 @@
     /**
      * Opens a connection that uses the specified SocketFactory and the system default
      * proxy settings.
+     *
+     * @hide
      */
     public URLConnection openConnection(URL url, SocketFactory socketFactory) throws IOException {
         Objects.requireNonNull(socketFactory);
@@ -107,6 +117,8 @@
     /**
      * Opens a connection using the specified SocketFactory and the specified proxy
      * settings, overriding any system wide configuration.
+     *
+     * @hide
      */
     @libcore.api.CorePlatformApi
     public URLConnection openConnection(URL url, SocketFactory socketFactory, Proxy proxy)
@@ -150,6 +162,8 @@
 
     /**
      * Adapts a {@link Dns} as a {@link com.android.okhttp.Dns}.
+     *
+     * @hide
      */
     static final class DnsAdapter implements com.android.okhttp.Dns {
         private final Dns adaptee;