From 162f3b9e381e8d4eb17e9ea7af78380484df2552 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 7 Jun 2019 18:21:57 -0700 Subject: [PATCH] Revert "Keyboard support for embedded Android views. (#9203)" (flutter/engine#9239) --- .../embedding/android/FlutterView.java | 3 +- .../systemchannels/PlatformViewsChannel.java | 29 ----- .../systemchannels/TextInputChannel.java | 14 -- .../plugin/editing/TextInputPlugin.java | 120 ++---------------- .../PlatformViewsAccessibilityDelegate.java | 1 + .../platform/PlatformViewsController.java | 95 ++------------ .../platform/SingleViewPresentation.java | 23 +--- .../platform/VirtualDisplayController.java | 28 +--- .../android/io/flutter/view/FlutterView.java | 10 +- 9 files changed, 29 insertions(+), 294 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 37986439e4..df3e9d9306 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -477,8 +477,7 @@ public class FlutterView extends FrameLayout { // in a way that Flutter understands. textInputPlugin = new TextInputPlugin( this, - this.flutterEngine.getDartExecutor(), - null + this.flutterEngine.getDartExecutor() ); androidKeyProcessor = new AndroidKeyProcessor( this.flutterEngine.getKeyEventChannel(), diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java index 21bc466991..2a470011c8 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java @@ -26,13 +26,6 @@ public class PlatformViewsChannel { private final MethodChannel channel; private PlatformViewsHandler handler; - public void invokeViewFocused(int viewId) { - if (channel == null) { - return; - } - channel.invokeMethod("viewFocused", viewId); - } - private final MethodChannel.MethodCallHandler parsingHandler = new MethodChannel.MethodCallHandler() { @Override public void onMethodCall(MethodCall call, MethodChannel.Result result) { @@ -58,9 +51,6 @@ public class PlatformViewsChannel { case "setDirection": setDirection(call, result); break; - case "clearFocus": - clearFocus(call, result); - break; default: result.notImplemented(); } @@ -182,20 +172,6 @@ public class PlatformViewsChannel { ); } } - - private void clearFocus(MethodCall call, MethodChannel.Result result) { - int viewId = call.arguments(); - try { - handler.clearFocus(viewId); - result.success(null); - } catch (IllegalStateException exception) { - result.error( - "error", - exception.getMessage(), - null - ); - } - } }; /** @@ -265,11 +241,6 @@ public class PlatformViewsChannel { */ // TODO(mattcarroll): Introduce an annotation for @TextureId void setDirection(int viewId, int direction); - - /** - * Clears the focus from the platform view with a give id if it is currently focused. - */ - void clearFocus(int viewId); } /** diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java index ec43f402ea..728ae40797 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java @@ -70,10 +70,6 @@ public class TextInputChannel { result.error("error", exception.getMessage(), null); } break; - case "TextInput.setPlatformViewClient": - final int id = (int) args; - textInputMethodHandler.setPlatformViewClient(id); - break; case "TextInput.setEditingState": try { final JSONObject editingState = (JSONObject) args; @@ -222,16 +218,6 @@ public class TextInputChannel { // TODO(mattcarroll): javadoc void setClient(int textInputClientId, @NonNull Configuration configuration); - /** - * Sets a platform view as the text input client. - * - * Subsequent calls to createInputConnection will be delegated to the platform view until a - * different client is set. - * - * @param id the ID of the platform view to be set as a text input client. - */ - void setPlatformViewClient(int id); - // TODO(mattcarroll): javadoc void setEditingState(@NonNull TextEditState editingState); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index 15ddd66338..051befd6fa 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -18,7 +18,7 @@ import android.view.inputmethod.InputMethodManager; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.systemchannels.TextInputChannel; -import io.flutter.plugin.platform.PlatformViewsController; +import io.flutter.view.FlutterView; /** * Android implementation of the text input plugin. @@ -30,8 +30,7 @@ public class TextInputPlugin { private final InputMethodManager mImm; @NonNull private final TextInputChannel textInputChannel; - @NonNull - private InputTarget inputTarget = new InputTarget(InputTarget.Type.NO_TARGET, 0); + private int mClient = 0; @Nullable private TextInputChannel.Configuration configuration; @Nullable @@ -40,13 +39,7 @@ public class TextInputPlugin { @Nullable private InputConnection lastInputConnection; - private PlatformViewsController platformViewsController; - - // When true following calls to createInputConnection will return the cached lastInputConnection if the input - // target is a platform view. See the comments on lockPlatformViewInputConnection for more details. - private boolean isInputConnectionLocked; - - public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor, PlatformViewsController platformViewsController) { + public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); @@ -68,11 +61,6 @@ public class TextInputPlugin { setTextInputClient(textInputClientId, configuration); } - @Override - public void setPlatformViewClient(int platformViewId) { - setPlatformViewTextInputClient(platformViewId); - } - @Override public void setEditingState(TextInputChannel.TextEditState editingState) { setTextInputEditingState(mView, editingState); @@ -83,8 +71,6 @@ public class TextInputPlugin { clearTextInputClient(); } }); - this.platformViewsController = platformViewsController; - platformViewsController.attachTextInputPlugin(this); } @NonNull @@ -92,40 +78,6 @@ public class TextInputPlugin { return mImm; } - /*** - * Use the current platform view input connection until unlockPlatformViewInputConnection is called. - * - * The current input connection instance is cached and any following call to @{link createInputConnection} returns - * the cached connection until unlockPlatformViewInputConnection is called. - * - * This is a no-op if the current input target isn't a platform view. - * - * This is used to preserve an input connection when moving a platform view from one virtual display to another. - */ - public void lockPlatformViewInputConnection() { - if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { - isInputConnectionLocked = true; - } - } - - /** - * Unlocks the input connection. - * - * See also: @{link lockPlatformViewInputConnection}. - */ - public void unlockPlatformViewInputConnection() { - isInputConnectionLocked = false; - } - - /** - * Detaches the text input plugin from the platform views controller. - * - * The TextInputPlugin instance should not be used after calling this. - */ - public void destroy() { - platformViewsController.detachTextInputPlugin(); - } - private static int inputTypeFromTextInputType( TextInputChannel.InputType type, boolean obscureText, @@ -176,16 +128,8 @@ public class TextInputPlugin { } public InputConnection createInputConnection(View view, EditorInfo outAttrs) { - if (inputTarget.type == InputTarget.Type.NO_TARGET) { + if (mClient == 0) { lastInputConnection = null; - return null; - } - - if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { - if (isInputConnectionLocked) { - return lastInputConnection; - } - lastInputConnection = platformViewsController.getPlatformViewById(inputTarget.id).onCreateInputConnection(outAttrs); return lastInputConnection; } @@ -214,7 +158,7 @@ public class TextInputPlugin { InputConnectionAdaptor connection = new InputConnectionAdaptor( view, - inputTarget.id, + mClient, textInputChannel, mEditable ); @@ -236,26 +180,17 @@ public class TextInputPlugin { } private void hideTextInput(View view) { - if (inputTarget.type == InputTarget.Type.FRAMEWORK_CLIENT) { - mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); - } + mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { - inputTarget = new InputTarget(InputTarget.Type.FRAMEWORK_CLIENT, client); + mClient = client; this.configuration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. // Do a restartInput at that time. mRestartInputPending = true; - unlockPlatformViewInputConnection(); - } - - private void setPlatformViewTextInputClient(int platformViewId) { - inputTarget = new InputTarget(InputTarget.Type.PLATFORM_VIEW, platformViewId); - mImm.restartInput(mView); - mRestartInputPending = false; } private void applyStateToSelection(TextInputChannel.TextEditState state) { @@ -285,45 +220,6 @@ public class TextInputPlugin { } private void clearTextInputClient() { - if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) { - // Focus changes in the framework tree have no guarantees on the order focus nodes are notified. A node - // that lost focus may be notified before or after a node that gained focus. - // When moving the focus from a Flutter text field to an AndroidView, it is possible that the Flutter text - // field's focus node will be notified that it lost focus after the AndroidView was notified that it gained - // focus. When this happens the text field will send a clearTextInput command which we ignore. - // By doing this we prevent the framework from clearing a platform view input client(the only way to do so - // is to set a new framework text client). I don't see an obvious use case for "clearing" a platform views - // text input client, and it may be error prone as we don't know how the platform view manages the input - // connection and we probably shouldn't interfere. - // If we ever want to allow the framework to clear a platform view text client we should probably consider - // changing the focus manager such that focus nodes that lost focus are notified before focus nodes that - // gained focus as part of the same focus event. - return; - } - inputTarget = new InputTarget(InputTarget.Type.NO_TARGET, 0); - unlockPlatformViewInputConnection(); - } - - static private class InputTarget { - enum Type { - NO_TARGET, - // InputConnection is managed by the TextInputPlugin, and events are forwarded to the Flutter framework. - FRAMEWORK_CLIENT, - // InputConnection is managed by an embedded platform view. - PLATFORM_VIEW - } - - public InputTarget(@NonNull Type type, int id) { - this.type = type; - this.id = id; - } - - @NonNull - Type type; - // The ID of the input target. - // - // For framework clients this is the framework input connection client ID. - // For platform views this is the platform view's ID. - int id; + mClient = 0; } } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java index b26c60ff6f..3b81a50555 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java @@ -11,6 +11,7 @@ import io.flutter.view.AccessibilityBridge; * Facilitates interaction between the accessibility bridge and embedded platform views. */ public interface PlatformViewsAccessibilityDelegate { + /** * Returns the root of the view hierarchy for the platform view with the requested id, or null if there is no * corresponding view. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index e6b8f387b3..2e2b621c7b 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -23,15 +23,12 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.StandardMethodCodec; -import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.view.AccessibilityBridge; import io.flutter.view.TextureRegistry; -import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; /** @@ -54,8 +51,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega // The texture registry maintaining the textures into which the embedded views will be rendered. private TextureRegistry textureRegistry; - private TextInputPlugin textInputPlugin; - // The system channel used to communicate with the framework about platform views. private PlatformViewsChannel platformViewsChannel; @@ -64,11 +59,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega private final HashMap vdControllers; - // The set of root views for all active virtual displays managed by this controller. - // This allows an O(1) check whether a view is managed by this controller(by checking if it's root view is in this - // set). This is used by isPlatformView. - private final HashSet vdRootViews; - private final PlatformViewsChannel.PlatformViewsHandler channelHandler = new PlatformViewsChannel.PlatformViewsHandler() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override @@ -102,19 +92,14 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega TextureRegistry.SurfaceTextureEntry textureEntry = textureRegistry.createSurfaceTexture(); VirtualDisplayController vdController = VirtualDisplayController.create( - context, - accessibilityEventsDelegate, - viewFactory, - textureEntry, - physicalWidth, - physicalHeight, - request.viewId, - createParams, - (view, hasFocus) -> { - if (hasFocus) { - platformViewsChannel.invokeViewFocused(request.viewId); - } - } + context, + accessibilityEventsDelegate, + viewFactory, + textureEntry, + toPhysicalPixels(request.logicalWidth), + toPhysicalPixels(request.logicalHeight), + request.viewId, + createParams ); if (vdController == null) { @@ -123,9 +108,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega } vdControllers.put(request.viewId, vdController); - View platformView = vdController.getView(); - platformView.setLayoutDirection(request.direction); - vdRootViews.add(platformView.getRootView()); + vdController.getView().setLayoutDirection(request.direction); // TODO(amirh): copy accessibility nodes to the FlutterView's accessibility tree. @@ -142,9 +125,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega + viewId); } - View rootView = vdController.getView().getRootView(); - vdRootViews.remove(rootView); - vdController.dispose(); vdControllers.remove(viewId); } @@ -163,28 +143,11 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega int physicalHeight = toPhysicalPixels(request.newLogicalHeight); validateVirtualDisplayDimensions(physicalWidth, physicalHeight); - if (textInputPlugin != null) { - // Resizing involved moving the platform view to a new virtual display. - // Doing so potentially results in losing an active input connection. - // To make sure we preserve the input connection when resizing we lock it here - // and unlock after the resize is complete. - textInputPlugin.lockPlatformViewInputConnection(); - } - vdRootViews.remove(vdController.getView().getRootView()); vdController.resize( - physicalWidth, - physicalHeight, - new Runnable() { - @Override - public void run() { - if (textInputPlugin != null) { - textInputPlugin.unlockPlatformViewInputConnection(); - } - onComplete.run(); - } - } + physicalWidth, + physicalHeight, + onComplete ); - vdRootViews.add(vdController.getView().getRootView()); } @Override @@ -244,12 +207,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega view.setLayoutDirection(direction); } - @Override - public void clearFocus(int viewId) { - View view = vdControllers.get(viewId).getView(); - view.clearFocus(); - } - private void ensureValidAndroidVersion() { if (Build.VERSION.SDK_INT < MINIMAL_SDK) { Log.e(TAG, "Trying to use platform views with API " + Build.VERSION.SDK_INT @@ -264,7 +221,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega registry = new PlatformViewRegistryImpl(); vdControllers = new HashMap<>(); accessibilityEventsDelegate = new AccessibilityEventsDelegate(); - vdRootViews = new HashSet<>(); } /** @@ -314,33 +270,6 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega accessibilityEventsDelegate.setAccessibilityBridge(null); } - /** - * Attaches this controller to a text input plugin. - * - * While a text input plugin is available, the platform views controller interacts with it to facilitate - * delegation of text input connections to platform views. - * - * A platform views controller should be attached to a text input plugin whenever it is possible for the Flutter - * framework to receive text input. - */ - public void attachTextInputPlugin(TextInputPlugin textInputPlugin) { - this.textInputPlugin = textInputPlugin; - } - - /** - * Detaches this controller from the currently attached text input plugin. - */ - public void detachTextInputPlugin() { - textInputPlugin = null; - } - - /** - * Returns true if the view is a platform view managed by this controller. - */ - public boolean isPlatformView(View view) { - return vdRootViews.contains(view.getRootView()); - } - public PlatformViewRegistry getRegistry() { return registry; } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java index d48343e273..baec72717d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java @@ -19,7 +19,6 @@ import android.widget.FrameLayout; import java.lang.reflect.*; import static android.content.Context.WINDOW_SERVICE; -import static android.view.View.OnFocusChangeListener; /* * A presentation used for hosting a single Android view in a virtual display. @@ -62,8 +61,6 @@ class SingleViewPresentation extends Presentation { // A reference to the current accessibility bridge to which accessibility events will be delegated. private final AccessibilityEventsDelegate accessibilityEventsDelegate; - private final OnFocusChangeListener focusChangeListener; - // This is the view id assigned by the Flutter framework to the embedded view, we keep it here // so when we create the platform view we can tell it its view id. private int viewId; @@ -81,8 +78,6 @@ class SingleViewPresentation extends Presentation { private PresentationState state; - private boolean startFocused = false; - /** * Creates a presentation that will use the view factory to create a new * platform view in the presentation's onCreate, and attach it. @@ -93,15 +88,13 @@ class SingleViewPresentation extends Presentation { PlatformViewFactory viewFactory, AccessibilityEventsDelegate accessibilityEventsDelegate, int viewId, - Object createParams, - OnFocusChangeListener focusChangeListener + Object createParams ) { super(outerContext, display); this.viewFactory = viewFactory; this.accessibilityEventsDelegate = accessibilityEventsDelegate; this.viewId = viewId; this.createParams = createParams; - this.focusChangeListener = focusChangeListener; state = new PresentationState(); getWindow().setFlags( WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, @@ -120,20 +113,16 @@ class SingleViewPresentation extends Presentation { Context outerContext, Display display, AccessibilityEventsDelegate accessibilityEventsDelegate, - PresentationState state, - OnFocusChangeListener focusChangeListener, - boolean startFocused + PresentationState state ) { super(outerContext, display); this.accessibilityEventsDelegate = accessibilityEventsDelegate; viewFactory = null; this.state = state; - this.focusChangeListener = focusChangeListener; getWindow().setFlags( WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE ); - this.startFocused = startFocused; } @Override @@ -159,14 +148,6 @@ class SingleViewPresentation extends Presentation { rootView = new AccessibilityDelegatingFrameLayout(getContext(), accessibilityEventsDelegate, embeddedView); rootView.addView(container); rootView.addView(state.fakeWindowViewGroup); - - embeddedView.setOnFocusChangeListener(focusChangeListener); - rootView.setFocusableInTouchMode(true); - if (startFocused) { - embeddedView.requestFocus(); - } else { - rootView.requestFocus(); - } setContentView(rootView); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java index eb59218ca6..2f1ce898d8 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java @@ -9,14 +9,11 @@ import android.content.Context; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; import android.os.Build; -import android.util.Log; import android.view.Surface; import android.view.View; import android.view.ViewTreeObserver; import io.flutter.view.TextureRegistry; -import static android.view.View.OnFocusChangeListener; - @TargetApi(Build.VERSION_CODES.KITKAT_WATCH) class VirtualDisplayController { @@ -28,8 +25,7 @@ class VirtualDisplayController { int width, int height, int viewId, - Object createParams, - OnFocusChangeListener focusChangeListener + Object createParams ) { textureEntry.surfaceTexture().setDefaultBufferSize(width, height); Surface surface = new Surface(textureEntry.surfaceTexture()); @@ -50,14 +46,13 @@ class VirtualDisplayController { } return new VirtualDisplayController( - context, accessibilityEventsDelegate, virtualDisplay, viewFactory, surface, textureEntry, focusChangeListener, viewId, createParams); + context, accessibilityEventsDelegate, virtualDisplay, viewFactory, surface, textureEntry, viewId, createParams); } private final Context context; private final AccessibilityEventsDelegate accessibilityEventsDelegate; private final int densityDpi; private final TextureRegistry.SurfaceTextureEntry textureEntry; - private final OnFocusChangeListener focusChangeListener; private VirtualDisplay virtualDisplay; private SingleViewPresentation presentation; private Surface surface; @@ -70,30 +65,21 @@ class VirtualDisplayController { PlatformViewFactory viewFactory, Surface surface, TextureRegistry.SurfaceTextureEntry textureEntry, - OnFocusChangeListener focusChangeListener, int viewId, Object createParams ) { this.context = context; this.accessibilityEventsDelegate = accessibilityEventsDelegate; this.textureEntry = textureEntry; - this.focusChangeListener = focusChangeListener; this.surface = surface; this.virtualDisplay = virtualDisplay; densityDpi = context.getResources().getDisplayMetrics().densityDpi; presentation = new SingleViewPresentation( - context, - this.virtualDisplay.getDisplay(), - viewFactory, - accessibilityEventsDelegate, - viewId, - createParams, - focusChangeListener); + context, this.virtualDisplay.getDisplay(), viewFactory, accessibilityEventsDelegate, viewId, createParams); presentation.show(); } public void resize(final int width, final int height, final Runnable onNewSizeFrameAvailable) { - boolean isFocused = getView().isFocused(); final SingleViewPresentation.PresentationState presentationState = presentation.detachState(); // We detach the surface to prevent it being destroyed when releasing the vd. // @@ -139,13 +125,7 @@ class VirtualDisplayController { public void onViewDetachedFromWindow(View v) {} }); - presentation = new SingleViewPresentation( - context, - virtualDisplay.getDisplay(), - accessibilityEventsDelegate, - presentationState, - focusChangeListener, - isFocused); + presentation = new SingleViewPresentation(context, virtualDisplay.getDisplay(), accessibilityEventsDelegate, presentationState); presentation.show(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index 28e3338857..1893a22e71 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -191,11 +191,9 @@ public class FlutterView extends SurfaceView implements BinaryMessenger, Texture PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - PlatformViewsController platformViewsController = mNativeView.getPluginRegistry().getPlatformViewsController(); - mTextInputPlugin = new TextInputPlugin(this, dartExecutor, platformViewsController); + mTextInputPlugin = new TextInputPlugin(this, dartExecutor); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel, mTextInputPlugin); androidTouchProcessor = new AndroidTouchProcessor(flutterRenderer); - mNativeView.getPluginRegistry().getPlatformViewsController().attachTextInputPlugin(mTextInputPlugin); // Send initial platform information to Dart sendLocalesToDart(getResources().getConfiguration()); @@ -397,12 +395,6 @@ public class FlutterView extends SurfaceView implements BinaryMessenger, Texture return mTextInputPlugin.createInputConnection(this, outAttrs); } - @Override - public boolean checkInputConnectionProxy(View view) { - PlatformViewsController platformViewsController = mNativeView.getPluginRegistry().getPlatformViewsController(); - return platformViewsController.isPlatformView(view); - } - @Override public boolean onTouchEvent(MotionEvent event) { if (!isAttached()) {