diff options
| -rw-r--r-- | api/system-current.txt | 5 | ||||
| -rw-r--r-- | core/java/android/webkit/PacProcessor.java | 33 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewFactoryProvider.java | 6 | ||||
| -rw-r--r-- | non-updatable-api/system-current.txt | 5 |
4 files changed, 27 insertions, 22 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 949a54a781db..b820ae08f906 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -12960,11 +12960,12 @@ package android.webkit { } public interface PacProcessor { + method @NonNull public static android.webkit.PacProcessor createInstance(); method @Nullable public String findProxyForUrl(@NonNull String); method @NonNull public static android.webkit.PacProcessor getInstance(); - 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 default void setNetwork(@Nullable android.net.Network); method public boolean setProxyScript(@NonNull String); } @@ -13100,11 +13101,11 @@ package android.webkit { } public interface WebViewFactoryProvider { + method @NonNull public default android.webkit.PacProcessor createPacProcessor(); method public android.webkit.WebViewProvider createWebView(android.webkit.WebView, android.webkit.WebView.PrivateAccess); 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(@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 b04105ab1e75..28496c6f8a07 100644 --- a/core/java/android/webkit/PacProcessor.java +++ b/core/java/android/webkit/PacProcessor.java @@ -44,24 +44,17 @@ public interface PacProcessor { } /** - * Returns PacProcessor instance associated with the {@link Network}. - * The host resolution is done on this {@link Network}. + * Create a new PacProcessor instance. * - * <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. + * <p> The created instance needs to be released manually once it is no longer needed + * by calling {@link #releasePacProcessor} to prevent memory leaks. * - * @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. + * <p> The created instance is not tied to any particular {@link Network}. + * To associate {@link PacProcessor} with a {@link Network} use {@link #setNetwork} method. */ @NonNull - static PacProcessor getInstanceForNetwork(@Nullable Network network) { - return WebViewFactory.getProvider().getPacProcessorForNetwork(network); + static PacProcessor createInstance() { + throw new UnsupportedOperationException("Not implemented"); } /** @@ -94,6 +87,18 @@ public interface PacProcessor { } /** + * Associate {@link PacProcessor} instance with the {@link Network}. + * Once this method returns host resolution is done on the set {@link Network}. + + * @param network a {@link Network} which this {@link PacProcessor} + * will use for host/address resolution. If {@code null} reset + * {@link PacProcessor} instance so it is not associated with any {@link Network}. + */ + default void setNetwork(@Nullable Network network) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** * Returns a {@link Network} associated with this {@link PacProcessor}. * * @return an associated {@link Network} or {@code null} if a network is unspecified. diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java index ce999cd5e235..3d6450632e06 100644 --- a/core/java/android/webkit/WebViewFactoryProvider.java +++ b/core/java/android/webkit/WebViewFactoryProvider.java @@ -17,7 +17,6 @@ package android.webkit; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; @@ -186,8 +185,7 @@ public interface WebViewFactoryProvider { } /** - * Returns PacProcessor instance associated with the {@link Network}. - * The host resolution is done on this {@link Network}. + * Create a new PacProcessor instance. * * @param network a {@link Network} which needs to be associated * with the returned {@link PacProcessor}. @@ -195,7 +193,7 @@ public interface WebViewFactoryProvider { * @return the {@link PacProcessor} instance associated with {@link Network}. */ @NonNull - default PacProcessor getPacProcessorForNetwork(@Nullable Network network) { + default PacProcessor createPacProcessor() { throw new UnsupportedOperationException("Not implemented"); } diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index 916e21f43f61..684968c0719a 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -11797,11 +11797,12 @@ package android.webkit { } public interface PacProcessor { + method @NonNull public static android.webkit.PacProcessor createInstance(); method @Nullable public String findProxyForUrl(@NonNull String); method @NonNull public static android.webkit.PacProcessor getInstance(); - 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 default void setNetwork(@Nullable android.net.Network); method public boolean setProxyScript(@NonNull String); } @@ -11937,11 +11938,11 @@ package android.webkit { } public interface WebViewFactoryProvider { + method @NonNull public default android.webkit.PacProcessor createPacProcessor(); method public android.webkit.WebViewProvider createWebView(android.webkit.WebView, android.webkit.WebView.PrivateAccess); 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(@Nullable android.net.Network); method public android.webkit.ServiceWorkerController getServiceWorkerController(); method public android.webkit.WebViewFactoryProvider.Statics getStatics(); method @Deprecated public android.webkit.TokenBindingService getTokenBindingService(); |