From 2bd03503ee9f03971d9e3def2bb319511c5feb02 Mon Sep 17 00:00:00 2001 From: Aurimas Liutikas Date: Tue, 23 Jun 2020 16:53:15 -0700 Subject: Fix ReferencesHidden issues in apache http We had RequestQueue had several public APIs that used hidden Connection and Request classes. This made these impossible to call for developers and in fact stubs would not even compile without a metalava workaround for this. This CL remove the disabling of ReferencesHidden as ignoring ReferencesHidden leads to pulling in hidden classes into API surfaces which is always a bug. Removing hiding here so this option to suppress can be removed completely. Test: make -j -> passes Change-Id: I8e02af533be5cd0eccad0d9eed0a85c9b1b9b3e8 --- Android.bp | 1 - android/src/android/net/http/Connection.java | 8 ++++---- android/src/android/net/http/Request.java | 4 ++-- api/current.txt | 8 +++++++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Android.bp b/Android.bp index 04d4aa9..3d2a908 100644 --- a/Android.bp +++ b/Android.bp @@ -83,7 +83,6 @@ java_sdk_library { // Add dependencies on files used by droiddoc_options. droiddoc_option_files: [":frameworks-base-api-current.txt"], droiddoc_options: [ - "--hide ReferencesHidden", // Subtract classes from the API .txt / stubs that are in the public SDK API. Without this // the org.apache.http.legacy.jar would contain duplicates of classes in android.jar. // See http://b/119021844 for more details. diff --git a/android/src/android/net/http/Connection.java b/android/src/android/net/http/Connection.java index 4a49d22..53f8d5b 100644 --- a/android/src/android/net/http/Connection.java +++ b/android/src/android/net/http/Connection.java @@ -36,7 +36,7 @@ import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.BasicHttpContext; -abstract class Connection { +public abstract class Connection { /** * Allow a TCP connection 60 idle seconds before erroring out @@ -52,7 +52,7 @@ abstract class Connection { Context mContext; /** The low level connection */ - protected AndroidHttpClientConnection mHttpClientConnection = null; + AndroidHttpClientConnection mHttpClientConnection = null; /** * The server SSL certificate associated with this connection @@ -60,7 +60,7 @@ abstract class Connection { * It would be nice to store the whole certificate chain, but * we want to keep things as light-weight as possible */ - protected SslCertificate mCertificate = null; + SslCertificate mCertificate = null; /** * The host this connection is connected to. If using proxy, @@ -98,7 +98,7 @@ abstract class Connection { */ private byte[] mBuf; - protected Connection(Context context, HttpHost host, + Connection(Context context, HttpHost host, RequestFeeder requestFeeder) { mContext = context; mHost = host; diff --git a/android/src/android/net/http/Request.java b/android/src/android/net/http/Request.java index d8eba11..2ed5d4c 100644 --- a/android/src/android/net/http/Request.java +++ b/android/src/android/net/http/Request.java @@ -44,7 +44,7 @@ import org.apache.http.protocol.RequestContent; * Represents an HTTP request for a given host. */ -class Request { +public class Request { /** The eventhandler to call as the request progresses */ EventHandler mEventHandler; @@ -503,7 +503,7 @@ class Request { * Handles SSL error(s) on the way down from the user (the user * has already provided their feedback). */ - public void handleSslErrorResponse(boolean proceed) { + void handleSslErrorResponse(boolean proceed) { HttpsConnection connection = (HttpsConnection)(mConnection); if (connection != null) { connection.restartConnection(proceed); diff --git a/api/current.txt b/api/current.txt index a04d0cd..9f1b879 100644 --- a/api/current.txt +++ b/api/current.txt @@ -72,6 +72,9 @@ package android.net.http { method public static android.net.http.SslError verifyServerCertificates(byte[][], String, String) throws java.io.IOException; } + public abstract class Connection { + } + public class DelegatingSSLSession implements javax.net.ssl.SSLSession { ctor protected DelegatingSSLSession(); method public int getApplicationBufferSize(); @@ -217,7 +220,7 @@ package android.net.http { field public static final int UNKNOWN = 0; // 0x0 } - public class HttpsConnection { + public class HttpsConnection extends android.net.http.Connection { method public static void initializeEngine(java.io.File); } @@ -234,6 +237,9 @@ package android.net.http { method public void status(int, int, int, String); } + public class Request { + } + public class RequestHandle { ctor public RequestHandle(android.net.http.RequestQueue, String, android.net.compatibility.WebAddress, String, java.util.Map, java.io.InputStream, int, android.net.http.Request); ctor public RequestHandle(android.net.http.RequestQueue, String, android.net.compatibility.WebAddress, String, java.util.Map, java.io.InputStream, int, android.net.http.Request, android.net.http.Connection); -- cgit v1.2.3