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

Commit 265afdb1 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Add a method for fetching the WebView classloader.

The WebView Support Library needs a way to hook into the WebView APK,
this new method returns a classloader that can be used to load internal
WebView classes.
The idea is to have this classloader be provided by the WebView APK
itself, so that the classes accessed from the classloader can be
filtered to avoid apps accidentally adding dependencies on internal
details of the WebView APK.

Test: N/A - cannot add CTS tests until we drop a WebView APK containing
the implementation for this API.
Bug: 38220806
Change-Id: If744a740ff0b1728d2d4674e73697bc6a5e27dde
parent 8f0d71e3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -50131,6 +50131,7 @@ package android.webkit {
    method public java.lang.String getTitle();
    method public java.lang.String getUrl();
    method public android.webkit.WebChromeClient getWebChromeClient();
    method public static java.lang.ClassLoader getWebViewClassLoader();
    method public android.webkit.WebViewClient getWebViewClient();
    method public void goBack();
    method public void goBackOrForward(int);
+1 −0
Original line number Diff line number Diff line
@@ -4963,6 +4963,7 @@ package android.webkit {
    method public abstract android.webkit.TracingController getTracingController();
    method public abstract android.webkit.WebIconDatabase getWebIconDatabase();
    method public abstract android.webkit.WebStorage getWebStorage();
    method public abstract java.lang.ClassLoader getWebViewClassLoader();
    method public abstract android.webkit.WebViewDatabase getWebViewDatabase(android.content.Context);
  }

+10 −0
Original line number Diff line number Diff line
@@ -2412,6 +2412,16 @@ public class WebView extends AbsoluteLayout
        return mProvider.getTextClassifier();
    }

    /**
     * Returns the {@link ClassLoader} used to load internal WebView classes.
     * This method is meant for use by the WebView Support Library, there is no reason to use this
     * method otherwise.
     */
    @NonNull
    public static ClassLoader getWebViewClassLoader() {
        return getFactory().getWebViewClassLoader();
    }

    //-------------------------------------------------------------------------
    // Interface for WebView providers
    //-------------------------------------------------------------------------
+6 −0
Original line number Diff line number Diff line
@@ -172,4 +172,10 @@ public interface WebViewFactoryProvider {
     * @return the singleton WebViewDatabase instance
     */
    WebViewDatabase getWebViewDatabase(Context context);

    /**
     * Gets the classloader used to load internal WebView implementation classes. This interface
     * should only be used by the WebView Support Library.
     */
    ClassLoader getWebViewClassLoader();
}