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

Commit c53fae10 authored by Tao Bai's avatar Tao Bai
Browse files

WebView: Add the definition of crash API.

Bug: 30824898
Test: There is no test yet, this patch just add the defintion of API,
 and make it easy to work on chromium side.

Change-Id: I7fdaf894f18cc8bad8e84465e4a0390b22f8bba8
parent 03c403d2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -45630,6 +45630,11 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
@@ -46154,6 +46159,7 @@ package android.webkit {
    method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
    method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
    method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
    method public boolean onRenderProcessGone(android.webkit.WebView, android.webkit.RenderProcessGoneDetail);
    method public void onScaleChanged(android.webkit.WebView, float, float);
    method public deprecated void onTooManyRedirects(android.webkit.WebView, android.os.Message, android.os.Message);
    method public void onUnhandledKeyEvent(android.webkit.WebView, android.view.KeyEvent);
+6 −0
Original line number Diff line number Diff line
@@ -48854,6 +48854,11 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
@@ -49449,6 +49454,7 @@ package android.webkit {
    method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
    method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
    method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
    method public boolean onRenderProcessGone(android.webkit.WebView, android.webkit.RenderProcessGoneDetail);
    method public void onScaleChanged(android.webkit.WebView, float, float);
    method public deprecated void onTooManyRedirects(android.webkit.WebView, android.os.Message, android.os.Message);
    method public void onUnhandledKeyEvent(android.webkit.WebView, android.view.KeyEvent);
+6 −0
Original line number Diff line number Diff line
@@ -45877,6 +45877,11 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public abstract class RenderProcessGoneDetail {
    ctor public RenderProcessGoneDetail();
    method public abstract boolean didCrash();
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
@@ -46401,6 +46406,7 @@ package android.webkit {
    method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
    method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
    method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
    method public boolean onRenderProcessGone(android.webkit.WebView, android.webkit.RenderProcessGoneDetail);
    method public void onScaleChanged(android.webkit.WebView, float, float);
    method public deprecated void onTooManyRedirects(android.webkit.WebView, android.os.Message, android.os.Message);
    method public void onUnhandledKeyEvent(android.webkit.WebView, android.view.KeyEvent);
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.webkit;

/**
 * This class provides more specific information about why the render process
 * exited. The application may use this to decide how to handle the situation.
 **/
public abstract class RenderProcessGoneDetail {
    /**
     * Indicates whether the render process was observed to crash, or whether
     * it was killed by the system.
     *
     * If the render process was killed, this is most likely caused by the
     * system being low on memory.
     *
     * @return True if render process crashed, otherwise it was killed by
     *         system.
     **/
    public abstract boolean didCrash();
}
+27 −0
Original line number Diff line number Diff line
@@ -466,4 +466,31 @@ public class WebViewClient {
    public void onReceivedLoginRequest(WebView view, String realm,
            String account, String args) {
    }

    /**
     * Notify host application that the given webview's render process has exited.
     *
     * Multiple WebView instances may be associated with a single render process;
     * onRenderProcessGone will be called for each WebView that was affected.
     * The application's implementation of this callback should only attempt to
     * clean up the specific WebView given as a parameter, and should not assume
     * that other WebView instances are affected.
     *
     * The given WebView can't be used, and should be removed from the view hierarchy,
     * all references to it should be cleaned up, e.g any references in the Activity
     * or other classes saved using findViewById and similar calls, etc
     *
     * To cause an render process crash for test purpose, the application can
     * call loadUrl("chrome://crash") on the WebView. Note that multiple WebView
     * instances may be affected if they share a render process, not just the
     * specific WebView which loaded chrome://crash.
     *
     * @param view The WebView which needs to be cleaned up.
     * @param detail the reason why it exited.
     * @return true if the host application handled the situation that process has
     *         exited, otherwise, application will crash.
     */
    public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
        return false;
    }
}