@@ -104,7 +104,7 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC
104104 @ Nullable private MouseCursorPlugin mouseCursorPlugin ;
105105 @ Nullable private TextInputPlugin textInputPlugin ;
106106 @ Nullable private LocalizationPlugin localizationPlugin ;
107- @ Nullable private AndroidKeyProcessor androidKeyProcessor ;
107+ @ Nullable private KeyboardManager keyboardManager ;
108108 @ Nullable private AndroidTouchProcessor androidTouchProcessor ;
109109 @ Nullable private AccessibilityBridge accessibilityBridge ;
110110
@@ -705,7 +705,7 @@ public InputConnection onCreateInputConnection(@NonNull EditorInfo outAttrs) {
705705 return super .onCreateInputConnection (outAttrs );
706706 }
707707
708- return textInputPlugin .createInputConnection (this , outAttrs );
708+ return textInputPlugin .createInputConnection (this , keyboardManager , outAttrs );
709709 }
710710
711711 /**
@@ -730,7 +730,7 @@ public boolean checkInputConnectionProxy(View view) {
730730 * D-pad button. It is generally not invoked when a virtual software keyboard is used, though a
731731 * software keyboard may choose to invoke this method in some situations.
732732 *
733- * <p>{@link KeyEvent}s are sent from Android to Flutter. {@link AndroidKeyProcessor } may do some
733+ * <p>{@link KeyEvent}s are sent from Android to Flutter. {@link KeyboardManager } may do some
734734 * additional work with the given {@link KeyEvent}, e.g., combine this {@code keyCode} with the
735735 * previous {@code keyCode} to generate a unicode combined character.
736736 */
@@ -747,7 +747,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
747747 // superclass. The key processor will typically handle all events except
748748 // those where it has re-dispatched the event after receiving a reply from
749749 // the framework that the framework did not handle it.
750- return (isAttachedToFlutterEngine () && androidKeyProcessor . onKeyEvent (event ))
750+ return (isAttachedToFlutterEngine () && keyboardManager . handleEvent (event ))
751751 || super .dispatchKeyEvent (event );
752752 }
753753
@@ -975,8 +975,14 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) {
975975 this .flutterEngine .getTextInputChannel (),
976976 this .flutterEngine .getPlatformViewsController ());
977977 localizationPlugin = this .flutterEngine .getLocalizationPlugin ();
978- androidKeyProcessor =
979- new AndroidKeyProcessor (this , this .flutterEngine .getKeyEventChannel (), textInputPlugin );
978+
979+ keyboardManager =
980+ new KeyboardManager (
981+ this ,
982+ textInputPlugin ,
983+ new KeyChannelResponder [] {
984+ new KeyChannelResponder (flutterEngine .getKeyEventChannel ())
985+ });
980986 androidTouchProcessor =
981987 new AndroidTouchProcessor (this .flutterEngine .getRenderer (), /*trackMotionEvents=*/ false );
982988 accessibilityBridge =
@@ -1060,8 +1066,7 @@ public void detachFromFlutterEngine() {
10601066 // TODO(mattcarroll): once this is proven to work, move this line ot TextInputPlugin
10611067 textInputPlugin .getInputMethodManager ().restartInput (this );
10621068 textInputPlugin .destroy ();
1063-
1064- androidKeyProcessor .destroy ();
1069+ keyboardManager .destroy ();
10651070
10661071 if (mouseCursorPlugin != null ) {
10671072 mouseCursorPlugin .destroy ();
0 commit comments