mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add support for IME_FLAG_NO_PERSONALIZED_LEARNING on Android (flutter/engine#27691)
This commit is contained in:
parent
407d7bbe5d
commit
ceb3cb1d1a
@ -424,6 +424,7 @@ public class TextInputChannel {
|
||||
json.optBoolean("obscureText"),
|
||||
json.optBoolean("autocorrect", true),
|
||||
json.optBoolean("enableSuggestions"),
|
||||
json.optBoolean("enableIMEPersonalizedLearning"),
|
||||
TextCapitalization.fromValue(json.getString("textCapitalization")),
|
||||
InputType.fromJson(json.getJSONObject("inputType")),
|
||||
inputAction,
|
||||
@ -573,6 +574,7 @@ public class TextInputChannel {
|
||||
public final boolean obscureText;
|
||||
public final boolean autocorrect;
|
||||
public final boolean enableSuggestions;
|
||||
public final boolean enableIMEPersonalizedLearning;
|
||||
@NonNull public final TextCapitalization textCapitalization;
|
||||
@NonNull public final InputType inputType;
|
||||
@Nullable public final Integer inputAction;
|
||||
@ -584,6 +586,7 @@ public class TextInputChannel {
|
||||
boolean obscureText,
|
||||
boolean autocorrect,
|
||||
boolean enableSuggestions,
|
||||
boolean enableIMEPersonalizedLearning,
|
||||
@NonNull TextCapitalization textCapitalization,
|
||||
@NonNull InputType inputType,
|
||||
@Nullable Integer inputAction,
|
||||
@ -593,6 +596,7 @@ public class TextInputChannel {
|
||||
this.obscureText = obscureText;
|
||||
this.autocorrect = autocorrect;
|
||||
this.enableSuggestions = enableSuggestions;
|
||||
this.enableIMEPersonalizedLearning = enableIMEPersonalizedLearning;
|
||||
this.textCapitalization = textCapitalization;
|
||||
this.inputType = inputType;
|
||||
this.inputAction = inputAction;
|
||||
|
||||
@ -230,6 +230,7 @@ public class TextInputPlugin implements ListenableEditingState.EditingStateWatch
|
||||
boolean obscureText,
|
||||
boolean autocorrect,
|
||||
boolean enableSuggestions,
|
||||
boolean enableIMEPersonalizedLearning,
|
||||
TextInputChannel.TextCapitalization textCapitalization) {
|
||||
if (type.type == TextInputChannel.TextInputType.DATETIME) {
|
||||
return InputType.TYPE_CLASS_DATETIME;
|
||||
@ -311,8 +312,15 @@ public class TextInputPlugin implements ListenableEditingState.EditingStateWatch
|
||||
configuration.obscureText,
|
||||
configuration.autocorrect,
|
||||
configuration.enableSuggestions,
|
||||
configuration.enableIMEPersonalizedLearning,
|
||||
configuration.textCapitalization);
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& !configuration.enableIMEPersonalizedLearning) {
|
||||
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING;
|
||||
}
|
||||
|
||||
int enterAction;
|
||||
if (configuration.inputAction == null) {
|
||||
// If an explicit input action isn't set, then default to none for multi-line fields
|
||||
|
||||
@ -151,6 +151,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -196,6 +197,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.TEXT, false, false),
|
||||
null,
|
||||
@ -284,6 +286,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -321,6 +324,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -367,6 +371,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.TEXT, false, false),
|
||||
null,
|
||||
@ -462,6 +467,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -504,6 +510,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.TEXT, false, false),
|
||||
null,
|
||||
@ -582,6 +589,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.TEXT, false, false),
|
||||
null,
|
||||
@ -617,6 +625,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.NONE, false, false),
|
||||
null,
|
||||
@ -646,6 +655,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
new TextInputChannel.InputType(TextInputChannel.TextInputType.NONE, false, false),
|
||||
null,
|
||||
@ -682,6 +692,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -693,6 +704,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -706,6 +718,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -754,6 +767,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -805,6 +819,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -816,6 +831,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -830,6 +846,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -872,6 +889,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -926,6 +944,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -937,6 +956,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -949,6 +969,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -1011,6 +1032,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -1022,6 +1044,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
@ -1034,6 +1057,7 @@ public class TextInputPluginTest {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
TextInputChannel.TextCapitalization.NONE,
|
||||
null,
|
||||
null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user