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

Commit 1d0dede7 authored by Anna Malova's avatar Anna Malova
Browse files

Add new methods to PacProcessor to

- allow multiple PacProcessors
- allow network-aware DNS lookups in PAC scripts

Bug: 162785263
Test: n/a

Change-Id: I39432d8f6358e386527b00b58d92e74ef32763d1
parent cb631bcf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -12725,6 +12725,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);
  }
@@ -12864,6 +12867,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();
+34 −1
Original line number Diff line number Diff line
@@ -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.
@@ -39,6 +39,20 @@ public interface PacProcessor {
        return WebViewFactory.getProvider().getPacProcessor();
    }

    /**
     * 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.
     *
@@ -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");
    }
}
+16 −1
Original line number Diff line number Diff line
@@ -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
@@ -183,6 +184,20 @@ public interface WebViewFactoryProvider {
        throw new UnsupportedOperationException("Not implemented");
    }

    /**
     * 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.
+4 −0
Original line number Diff line number Diff line
@@ -11568,6 +11568,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);
  }
@@ -11707,6 +11710,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();