diff options
| author | 2020-08-06 17:51:02 +0000 | |
|---|---|---|
| committer | 2020-08-06 17:51:02 +0000 | |
| commit | f1a408f2080c78a9258f59faeedd18fcb483985f (patch) | |
| tree | bf9dc6dfafc7b617f378f5845a40e84c56e28607 | |
| parent | d40ac08a3fd3a47627b5248a47b000bb5cf780eb (diff) | |
| parent | 1d0dede72da719832247d06969e5abe5428fdab2 (diff) | |
Merge "Add new methods to PacProcessor to"
| -rwxr-xr-x | api/system-current.txt | 4 | ||||
| -rw-r--r-- | core/java/android/webkit/PacProcessor.java | 35 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewFactoryProvider.java | 17 | ||||
| -rw-r--r-- | non-updatable-api/system-current.txt | 4 |
4 files changed, 58 insertions, 2 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 56059dd9d864..88fe40a93010 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -12732,6 +12732,9 @@ 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 public default void releasePacProcessor(); method public boolean setProxyScript(@NonNull String); } @@ -12871,6 +12874,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 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 5ef450fa65dd..7e7b987f72f3 100644 --- a/core/java/android/webkit/PacProcessor.java +++ b/core/java/android/webkit/PacProcessor.java @@ -19,7 +19,7 @@ package android.webkit; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; - +import android.net.Network; /** * Class to evaluate PAC scripts. @@ -40,6 +40,20 @@ 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 + */ + @NonNull + static PacProcessor getInstanceForNetwork(long networkHandle) { + return WebViewFactory.getProvider().getPacProcessorForNetwork(networkHandle); + } + + /** * Set PAC script to use. * * @param script PAC script. @@ -55,4 +69,23 @@ public interface PacProcessor { */ @Nullable String findProxyForUrl(@NonNull String url); + + /** + * Stops support for this {@link PacProcessor} and release its resources. + * No methods of this class must be called after calling this method. + */ + default void releasePacProcessor() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** + * Returns a network handle associated with this {@link PacProcessor}. + * + * @return a network handle or 0 if a network is unspecified. + * @see Network#getNetworkHandle + * @see Network#fromNetworkHandle + */ + default long getNetworkHandle() { + throw new UnsupportedOperationException("Not implemented"); + } } diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java index f7c3ec09dd67..f1863e319689 100644 --- a/core/java/android/webkit/WebViewFactoryProvider.java +++ b/core/java/android/webkit/WebViewFactoryProvider.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; +import android.net.Network; import android.net.Uri; import java.util.List; @@ -175,7 +176,7 @@ public interface WebViewFactoryProvider { WebViewDatabase getWebViewDatabase(Context context); /** - * Gets the singleton PacProcessor instance. + * Gets the default PacProcessor instance. * @return the PacProcessor instance */ @NonNull @@ -184,6 +185,20 @@ 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}. + * @return the {@link PacProcessor} instance associated with {@link Network}. + * @see Network#getNetworkHandle + * @see Network#fromNetworkHandle + */ + @NonNull + default PacProcessor getPacProcessorForNetwork(long networkHandle) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** * Gets the classloader used to load internal WebView implementation classes. This interface * should only be used by the WebView Support Library. */ diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index 844e929774a1..10887fabb5c7 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -11575,6 +11575,9 @@ 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 public default void releasePacProcessor(); method public boolean setProxyScript(@NonNull String); } @@ -11714,6 +11717,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 public android.webkit.ServiceWorkerController getServiceWorkerController(); method public android.webkit.WebViewFactoryProvider.Statics getStatics(); method @Deprecated public android.webkit.TokenBindingService getTokenBindingService(); |