Replace interal okhttp APIs
Connectivity is becoming a mainline module in S but mainline modules are not allowed to use non-formal APIs. Thus, replace internal okhttp APIs to stable libcore APIs which are created for using HttpURLConnectionFactory. Bug: 182238821 Test: atest FrameworksNetTests Change-Id: I56ba1b9e6e94f9c6519c3f1c8f0c5993fccbe185
This commit is contained in:
@@ -30,10 +30,10 @@ import android.system.OsConstants;
|
|||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.okhttp.internalandroidapi.Dns;
|
|
||||||
import com.android.okhttp.internalandroidapi.HttpURLConnectionFactory;
|
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
|
import libcore.net.http.Dns;
|
||||||
|
import libcore.net.http.HttpURLConnectionFactory;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -299,7 +299,7 @@ public class Network implements Parcelable {
|
|||||||
// Set configuration on the HttpURLConnectionFactory that will be good for all
|
// Set configuration on the HttpURLConnectionFactory that will be good for all
|
||||||
// connections created by this Network. Configuration that might vary is left
|
// connections created by this Network. Configuration that might vary is left
|
||||||
// until openConnection() and passed as arguments.
|
// until openConnection() and passed as arguments.
|
||||||
HttpURLConnectionFactory urlConnectionFactory = new HttpURLConnectionFactory();
|
HttpURLConnectionFactory urlConnectionFactory = HttpURLConnectionFactory.createInstance();
|
||||||
urlConnectionFactory.setDns(dnsLookup); // Let traffic go via dnsLookup
|
urlConnectionFactory.setDns(dnsLookup); // Let traffic go via dnsLookup
|
||||||
// A private connection pool just for this Network.
|
// A private connection pool just for this Network.
|
||||||
urlConnectionFactory.setNewConnectionPool(httpMaxConnections,
|
urlConnectionFactory.setNewConnectionPool(httpMaxConnections,
|
||||||
|
|||||||
Reference in New Issue
Block a user