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

Commit 773dedda authored by Toby Sargeant's avatar Toby Sargeant Committed by Android (Google) Code Review
Browse files

Merge "WebView: Add the definition of the renderer importance API."

parents 83d57758 d10e4af0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -46607,6 +46607,7 @@ package android.webkit {
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
    method public abstract int rendererPriorityAtExit();
  }
  public class ServiceWorkerClient {
@@ -47023,6 +47024,8 @@ package android.webkit {
    method public deprecated java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String);
    method public java.lang.String getOriginalUrl();
    method public int getProgress();
    method public boolean getRendererPriorityWaivedWhenNotVisible();
    method public int getRendererRequestedPriority();
    method public deprecated float getScale();
    method public android.webkit.WebSettings getSettings();
    method public java.lang.String getTitle();
@@ -47070,6 +47073,7 @@ package android.webkit {
    method public deprecated void setMapTrackballToArrowKeys(boolean);
    method public void setNetworkAvailable(boolean);
    method public deprecated void setPictureListener(android.webkit.WebView.PictureListener);
    method public void setRendererPriorityPolicy(int, boolean);
    method public deprecated void setVerticalScrollbarOverlay(boolean);
    method public void setWebChromeClient(android.webkit.WebChromeClient);
    method public static void setWebContentsDebuggingEnabled(boolean);
@@ -47079,6 +47083,9 @@ package android.webkit {
    method public void zoomBy(float);
    method public boolean zoomIn();
    method public boolean zoomOut();
    field public static final int RENDERER_PRIORITY_BOUND = 1; // 0x1
    field public static final int RENDERER_PRIORITY_IMPORTANT = 2; // 0x2
    field public static final int RENDERER_PRIORITY_WAIVED = 0; // 0x0
    field public static final java.lang.String SCHEME_GEO = "geo:0,0?q=";
    field public static final java.lang.String SCHEME_MAILTO = "mailto:";
    field public static final java.lang.String SCHEME_TEL = "tel:";
+10 −0
Original line number Diff line number Diff line
@@ -49939,6 +49939,7 @@ package android.webkit {
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
    method public abstract int rendererPriorityAtExit();
  }
  public class ServiceWorkerClient {
@@ -50394,6 +50395,8 @@ package android.webkit {
    method public deprecated java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String);
    method public java.lang.String getOriginalUrl();
    method public int getProgress();
    method public boolean getRendererPriorityWaivedWhenNotVisible();
    method public int getRendererRequestedPriority();
    method public deprecated float getScale();
    method public android.webkit.WebSettings getSettings();
    method public java.lang.String getTitle();
@@ -50442,6 +50445,7 @@ package android.webkit {
    method public deprecated void setMapTrackballToArrowKeys(boolean);
    method public void setNetworkAvailable(boolean);
    method public deprecated void setPictureListener(android.webkit.WebView.PictureListener);
    method public void setRendererPriorityPolicy(int, boolean);
    method public deprecated void setVerticalScrollbarOverlay(boolean);
    method public void setWebChromeClient(android.webkit.WebChromeClient);
    method public static void setWebContentsDebuggingEnabled(boolean);
@@ -50452,6 +50456,9 @@ package android.webkit {
    method public boolean zoomIn();
    method public boolean zoomOut();
    field public static final java.lang.String DATA_REDUCTION_PROXY_SETTING_CHANGED = "android.webkit.DATA_REDUCTION_PROXY_SETTING_CHANGED";
    field public static final int RENDERER_PRIORITY_BOUND = 1; // 0x1
    field public static final int RENDERER_PRIORITY_IMPORTANT = 2; // 0x2
    field public static final int RENDERER_PRIORITY_WAIVED = 0; // 0x0
    field public static final java.lang.String SCHEME_GEO = "geo:0,0?q=";
    field public static final java.lang.String SCHEME_MAILTO = "mailto:";
    field public static final java.lang.String SCHEME_TEL = "tel:";
@@ -50673,6 +50680,8 @@ package android.webkit {
    method public abstract java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String);
    method public abstract java.lang.String getOriginalUrl();
    method public abstract int getProgress();
    method public abstract boolean getRendererPriorityWaivedWhenNotVisible();
    method public abstract int getRendererRequestedPriority();
    method public abstract float getScale();
    method public abstract android.webkit.WebViewProvider.ScrollDelegate getScrollDelegate();
    method public abstract android.webkit.WebSettings getSettings();
@@ -50727,6 +50736,7 @@ package android.webkit {
    method public abstract void setMapTrackballToArrowKeys(boolean);
    method public abstract void setNetworkAvailable(boolean);
    method public abstract void setPictureListener(android.webkit.WebView.PictureListener);
    method public abstract void setRendererPriorityPolicy(int, boolean);
    method public abstract void setVerticalScrollbarOverlay(boolean);
    method public abstract void setWebChromeClient(android.webkit.WebChromeClient);
    method public abstract void setWebViewClient(android.webkit.WebViewClient);
+7 −0
Original line number Diff line number Diff line
@@ -46905,6 +46905,7 @@ package android.webkit {
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
    method public abstract int rendererPriorityAtExit();
  }
  public class ServiceWorkerClient {
@@ -47321,6 +47322,8 @@ package android.webkit {
    method public deprecated java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String);
    method public java.lang.String getOriginalUrl();
    method public int getProgress();
    method public boolean getRendererPriorityWaivedWhenNotVisible();
    method public int getRendererRequestedPriority();
    method public deprecated float getScale();
    method public android.webkit.WebSettings getSettings();
    method public java.lang.String getTitle();
@@ -47368,6 +47371,7 @@ package android.webkit {
    method public deprecated void setMapTrackballToArrowKeys(boolean);
    method public void setNetworkAvailable(boolean);
    method public deprecated void setPictureListener(android.webkit.WebView.PictureListener);
    method public void setRendererPriorityPolicy(int, boolean);
    method public deprecated void setVerticalScrollbarOverlay(boolean);
    method public void setWebChromeClient(android.webkit.WebChromeClient);
    method public static void setWebContentsDebuggingEnabled(boolean);
@@ -47377,6 +47381,9 @@ package android.webkit {
    method public void zoomBy(float);
    method public boolean zoomIn();
    method public boolean zoomOut();
    field public static final int RENDERER_PRIORITY_BOUND = 1; // 0x1
    field public static final int RENDERER_PRIORITY_IMPORTANT = 2; // 0x2
    field public static final int RENDERER_PRIORITY_WAIVED = 0; // 0x0
    field public static final java.lang.String SCHEME_GEO = "geo:0,0?q=";
    field public static final java.lang.String SCHEME_MAILTO = "mailto:";
    field public static final java.lang.String SCHEME_TEL = "tel:";
+11 −0
Original line number Diff line number Diff line
@@ -32,4 +32,15 @@ public abstract class RenderProcessGoneDetail {
     *         system.
     **/
    public abstract boolean didCrash();

    /**
     * Returns the renderer priority that was set at the time that the
     * renderer exited.  This may be greater than the priority that
     * any individual {@link WebView} requested using
     * {@link WebView#setRendererPriorityPolicy}.
     *
     * @return the priority of the renderer at exit.
     **/
    @WebView.RendererPriority
    public abstract int rendererPriorityAtExit();
}
+91 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.Widget;
@@ -60,6 +61,8 @@ import android.widget.AbsoluteLayout;

import java.io.BufferedWriter;
import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Map;

/**
@@ -2151,6 +2154,94 @@ public class WebView extends AbsoluteLayout
        return mProvider.findHierarchyView(className, hashCode);
    }

    /** @hide */
    @IntDef({
        RENDERER_PRIORITY_WAIVED,
        RENDERER_PRIORITY_BOUND,
        RENDERER_PRIORITY_IMPORTANT
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface RendererPriority {}

    /**
     * The renderer associated with this WebView is bound with
     * {@link Context#BIND_WAIVE_PRIORITY}. At this priority level
     * {@link WebView} renderers will be strong targets for out of memory
     * killing.
     *
     * Use with {@link #setRendererPriorityPolicy}.
     */
    public static final int RENDERER_PRIORITY_WAIVED = 0;
    /**
     * The renderer associated with this WebView is bound with
     * the default priority for services.
     *
     * Use with {@link #setRendererPriorityPolicy}.
     */
    public static final int RENDERER_PRIORITY_BOUND = 1;
    /**
     * The renderer associated with this WebView is bound with
     * {@link Context#BIND_IMPORTANT}.
     *
     * Use with {@link #setRendererPriorityPolicy}.
     */
    public static final int RENDERER_PRIORITY_IMPORTANT = 2;

    /**
     * Set the renderer priority policy for this {@link WebView}. The
     * priority policy will be used to determine whether an out of
     * process renderer should be considered to be a target for OOM
     * killing.
     *
     * Because a renderer can be associated with more than one
     * WebView, the final priority it is computed as the maximum of
     * any attached WebViews. When a WebView is destroyed it will
     * cease to be considerered when calculating the renderer
     * priority. Once no WebViews remain associated with the renderer,
     * the priority of the renderer will be reduced to
     * {@link #RENDERER_PRIORITY_WAIVED}.
     *
     * The default policy is to set the priority to
     * {@link #RENDERER_PRIORITY_IMPORTANT} regardless of visibility,
     * and this should not be changed unless the caller also handles
     * renderer crashes with
     * {@link WebViewClient#onRenderProcessGone}. Any other setting
     * will result in WebView renderers being killed by the system
     * more aggressively than the application.
     *
     * @param rendererRequestedPriority the minimum priority at which
     *        this WebView desires the renderer process to be bound.
     * @param waivedWhenNotVisible if true, this flag specifies that
     *        when this WebView is not visible, it will be treated as
     *        if it had requested a priority of
     *        {@link #RENDERER_PRIORITY_WAIVED}.
     */
    public void setRendererPriorityPolicy(
            @RendererPriority int rendererRequestedPriority,
            boolean waivedWhenNotVisible) {
        mProvider.setRendererPriorityPolicy(rendererRequestedPriority, waivedWhenNotVisible);
    }

    /**
     * Get the requested renderer priority for this WebView.
     *
     * @return the requested renderer priority policy.
     */
    @RendererPriority
    public int getRendererRequestedPriority() {
        return mProvider.getRendererRequestedPriority();
    }

    /**
     * Return whether this WebView requests a priority of
     * {@link #RENDERER_PRIORITY_WAIVED} when not visible.
     *
     * @return whether this WebView requests a priority of
     * {@link #RENDERER_PRIORITY_WAIVED} when not visible.
     */
    public boolean getRendererPriorityWaivedWhenNotVisible() {
        return mProvider.getRendererPriorityWaivedWhenNotVisible();
    }
    //-------------------------------------------------------------------------
    // Interface for WebView providers
    //-------------------------------------------------------------------------
Loading