Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 242def42 authored by Anna Malova's avatar Anna Malova
Browse files

Use Network object instead of network handle and expand documentation.

Bug: 165192953
Bug: 165307632
Test: N/A
Change-Id: I5e2d22d3c332debe33d0cc617f86071b5926c50a
parent de010ce1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -12744,8 +12744,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);
  }
@@ -12886,7 +12886,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();
+25 −11
Original line number Diff line number Diff line
@@ -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");
    }
}
+5 −4
Original line number Diff line number Diff line
@@ -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");
    }

+3 −3
Original line number Diff line number Diff line
@@ -11585,8 +11585,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);
  }
@@ -11727,7 +11727,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();