summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapi/system-current.txt6
-rw-r--r--core/java/android/webkit/PacProcessor.java36
-rw-r--r--core/java/android/webkit/WebViewFactoryProvider.java9
-rw-r--r--non-updatable-api/system-current.txt6
4 files changed, 36 insertions, 21 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index d46bf4acbd25..b4869e3bf0ce 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -12745,8 +12745,8 @@ package android.webkit {
public interface PacProcessor {
method @Nullable public String findProxyForUrl(@NonNull String);
method @NonNull public static android.webkit.PacProcessor getInstance();
- method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(long);
- method public default long getNetworkHandle();
+ method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(@Nullable android.net.Network);
+ method @Nullable public default android.net.Network getNetwork();
method public default void releasePacProcessor();
method public boolean setProxyScript(@NonNull String);
}
@@ -12887,7 +12887,7 @@ package android.webkit {
method public android.webkit.CookieManager getCookieManager();
method public android.webkit.GeolocationPermissions getGeolocationPermissions();
method @NonNull public default android.webkit.PacProcessor getPacProcessor();
- method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(long);
+ method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(@Nullable android.net.Network);
method public android.webkit.ServiceWorkerController getServiceWorkerController();
method public android.webkit.WebViewFactoryProvider.Statics getStatics();
method @Deprecated public android.webkit.TokenBindingService getTokenBindingService();
diff --git a/core/java/android/webkit/PacProcessor.java b/core/java/android/webkit/PacProcessor.java
index 7e7b987f72f3..b04105ab1e75 100644
--- a/core/java/android/webkit/PacProcessor.java
+++ b/core/java/android/webkit/PacProcessor.java
@@ -32,6 +32,10 @@ public interface PacProcessor {
/**
* Returns the default PacProcessor instance.
*
+ * <p> There can only be one default {@link PacProcessor} instance.
+ * This method will create a new instance if one did not already exist, or
+ * if the previous instance was released with {@link #releasePacProcessor}.
+ *
* @return the default PacProcessor instance.
*/
@NonNull
@@ -43,14 +47,21 @@ public interface PacProcessor {
* Returns PacProcessor instance associated with the {@link Network}.
* The host resolution is done on this {@link Network}.
*
- * @param networkHandle a handle representing {@link Network} handle.
- * @return PacProcessor instance for the specified network.
- * @see Network#getNetworkHandle
- * @see Network#fromNetworkHandle
+ * <p> There can only be one {@link PacProcessor} instance at a time for each {@link Network}.
+ * This method will create a new instance if one did not already exist, or
+ * if the previous instance was released with {@link #releasePacProcessor}.
+ *
+ * <p> The {@link PacProcessor} instance needs to be released manually with
+ * {@link #releasePacProcessor} when the associated {@link Network} goes away.
+ *
+ * @param network a {@link Network} which this {@link PacProcessor}
+ * will use for host/address resolution.
+ * If {@code null} this method is equivalent to {@link #getInstance}.
+ * @return {@link PacProcessor} instance for the specified network.
*/
@NonNull
- static PacProcessor getInstanceForNetwork(long networkHandle) {
- return WebViewFactory.getProvider().getPacProcessorForNetwork(networkHandle);
+ static PacProcessor getInstanceForNetwork(@Nullable Network network) {
+ return WebViewFactory.getProvider().getPacProcessorForNetwork(network);
}
/**
@@ -73,19 +84,22 @@ public interface PacProcessor {
/**
* Stops support for this {@link PacProcessor} and release its resources.
* No methods of this class must be called after calling this method.
+ *
+ * <p> Released instances will not be reused; a subsequent call to
+ * {@link #getInstance} and {@link #getInstanceForNetwork}
+ * for the same network will create a new instance.
*/
default void releasePacProcessor() {
throw new UnsupportedOperationException("Not implemented");
}
/**
- * Returns a network handle associated with this {@link PacProcessor}.
+ * Returns a {@link Network} associated with this {@link PacProcessor}.
*
- * @return a network handle or 0 if a network is unspecified.
- * @see Network#getNetworkHandle
- * @see Network#fromNetworkHandle
+ * @return an associated {@link Network} or {@code null} if a network is unspecified.
*/
- default long getNetworkHandle() {
+ @Nullable
+ default Network getNetwork() {
throw new UnsupportedOperationException("Not implemented");
}
}
diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java
index f1863e319689..ce999cd5e235 100644
--- a/core/java/android/webkit/WebViewFactoryProvider.java
+++ b/core/java/android/webkit/WebViewFactoryProvider.java
@@ -17,6 +17,7 @@
package android.webkit;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.Intent;
@@ -188,13 +189,13 @@ public interface WebViewFactoryProvider {
* Returns PacProcessor instance associated with the {@link Network}.
* The host resolution is done on this {@link Network}.
*
- * @param networkHandle a network handle representing the {@link Network}.
+ * @param network a {@link Network} which needs to be associated
+ * with the returned {@link PacProcessor}.
+ * If {@code null} the method returns default {@link PacProcessor}.
* @return the {@link PacProcessor} instance associated with {@link Network}.
- * @see Network#getNetworkHandle
- * @see Network#fromNetworkHandle
*/
@NonNull
- default PacProcessor getPacProcessorForNetwork(long networkHandle) {
+ default PacProcessor getPacProcessorForNetwork(@Nullable Network network) {
throw new UnsupportedOperationException("Not implemented");
}
diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt
index a51f584b8dc3..bc8517d6180a 100644
--- a/non-updatable-api/system-current.txt
+++ b/non-updatable-api/system-current.txt
@@ -11586,8 +11586,8 @@ package android.webkit {
public interface PacProcessor {
method @Nullable public String findProxyForUrl(@NonNull String);
method @NonNull public static android.webkit.PacProcessor getInstance();
- method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(long);
- method public default long getNetworkHandle();
+ method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(@Nullable android.net.Network);
+ method @Nullable public default android.net.Network getNetwork();
method public default void releasePacProcessor();
method public boolean setProxyScript(@NonNull String);
}
@@ -11728,7 +11728,7 @@ package android.webkit {
method public android.webkit.CookieManager getCookieManager();
method public android.webkit.GeolocationPermissions getGeolocationPermissions();
method @NonNull public default android.webkit.PacProcessor getPacProcessor();
- method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(long);
+ method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(@Nullable android.net.Network);
method public android.webkit.ServiceWorkerController getServiceWorkerController();
method public android.webkit.WebViewFactoryProvider.Statics getStatics();
method @Deprecated public android.webkit.TokenBindingService getTokenBindingService();