Make the virtual display's presentation window non focusable. (flutter/engine#5845)

When the FlutterView's window loses focus Flutter cannot bring up the
keyboard (so e.g tapping on text fields doesn't work).

This workaround makes sure that Flutter text fields are working but
unfortunately now the embedded Android view cannot bring up the keyboard
as it's window is not focused.

Submitting this until as a stop gap while we're trying to figure out if
it's possible to allow both windows to bring up the keyboard.
This commit is contained in:
amirh
2018-07-25 08:51:56 -07:00
committed by GitHub
parent 1ea25ee2a8
commit b2d92b2c9f

View File

@@ -11,6 +11,7 @@ import android.os.Build;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@@ -32,6 +33,10 @@ class SingleViewPresentation extends Presentation {
super(outerContext, display);
mViewFactory = viewFactory;
mViewId = viewId;
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
);
}
/**
@@ -45,6 +50,10 @@ class SingleViewPresentation extends Presentation {
super(outerContext, display);
mViewFactory = null;
mView = view;
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
);
}
@Override