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

Commit 73a74942 authored by Alexandre Elias's avatar Alexandre Elias
Browse files

Add some View methods overrides and WebViewDelegate interfaces.

There are IME use cases for returning a different value from
getHandler() and findFocus(), in order to make InputMethodManager
communicate with a separate IME thread.  Currently, it's cumbersome to
do so in WebView because we cannot alter View-inherited methods without
a framework change.

This patch pair adds the framework-side override and adds no-op stub
methods on the Chromium side, to enable us to take this approach in the
future.

https://codereview.chromium.org/1669873003 implementing the stubs will
land first, and after it rolls in we can land this to add the interface.

Change-Id: I53ffeb8540b0cb288103c3973274795efc5c2b8e
parent 9f19f5ae
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -48153,7 +48153,9 @@ package android.webkit {
  public static abstract interface WebViewProvider.ViewDelegate {
    method public abstract boolean dispatchKeyEvent(android.view.KeyEvent);
    method public abstract android.view.View findFocus(android.view.View);
    method public abstract android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider();
    method public abstract android.os.Handler getHandler(android.os.Handler);
    method public abstract void onActivityResult(int, int, android.content.Intent);
    method public abstract void onAttachedToWindow();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
+11 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.net.http.SslCertificate;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.StrictMode;
@@ -2616,6 +2617,16 @@ public class WebView extends AbsoluteLayout
        mProvider.getViewDelegate().onFinishTemporaryDetach();
    }

    @Override
    public Handler getHandler() {
        return mProvider.getViewDelegate().getHandler(super.getHandler());
    }

    @Override
    public View findFocus() {
        return mProvider.getViewDelegate().findFocus(super.findFocus());
    }

    /**
     * Receive the result from a previous call to {@link #startActivityForResult(Intent, int)}.
     *
+5 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.net.http.SslCertificate;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.print.PrintDocumentAdapter;
import android.view.KeyEvent;
@@ -383,6 +384,10 @@ public interface WebViewProvider {
        public void onFinishTemporaryDetach();

        public void onActivityResult(int requestCode, int resultCode, Intent data);

        public Handler getHandler(Handler originalHandler);

        public View findFocus(View originalFocusedView);
    }

    interface ScrollDelegate {