diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java index 3aa01961b3644..ca17b264e4853 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java @@ -27,9 +27,8 @@ *

Once the spell check results are received by the {@link * io.flutter.plugin.editing.SpellCheckPlugin}, it will send back to the framework the {@code * ArrayList} of encoded spell check results (see {@link - * io.flutter.plugin.editing.SpellCheckPlugin#onGetSentenceSuggestions} for details) with the text - * that these results correspond to appended to the front as an argument. For example, the argument - * may look like: {@code {"Hello, wrold!", "7.11.world\nword\nold"}}. The {@link + * io.flutter.plugin.editing.SpellCheckPlugin#onGetSentenceSuggestions} for details). For example, + * the argument may look like: {@code {"7.11.world\nword\nold"}}. The {@link * io.flutter.plugin.editing.SpellCheckPlugin} only handles one request to fetch spell check results * at a time; see {@link io.flutter.plugin.editing.SpellCheckPlugin#initiateSpellCheck} for details. * diff --git a/shell/platform/android/io/flutter/plugin/editing/SpellCheckPlugin.java b/shell/platform/android/io/flutter/plugin/editing/SpellCheckPlugin.java index af024801748c6..3f9d00951d347 100644 --- a/shell/platform/android/io/flutter/plugin/editing/SpellCheckPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/SpellCheckPlugin.java @@ -15,7 +15,6 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.localization.LocalizationPlugin; import java.util.ArrayList; -import java.util.Arrays; import java.util.Locale; /** @@ -36,7 +35,6 @@ public class SpellCheckPlugin private SpellCheckerSession mSpellCheckerSession; @VisibleForTesting MethodChannel.Result pendingResult; - @VisibleForTesting String pendingResultText; // The maximum number of suggestions that the Android spell check service is allowed to provide // per word. Same number that is used by default for Android's TextViews. @@ -80,7 +78,6 @@ public void initiateSpellCheck( } pendingResult = result; - pendingResultText = text; performSpellCheck(locale, text); } @@ -115,7 +112,7 @@ public void performSpellCheck(@NonNull String locale, @NonNull String text) { @Override public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) { if (results.length == 0) { - pendingResult.success(new ArrayList<>(Arrays.asList(pendingResultText, ""))); + pendingResult.success(new ArrayList()); pendingResult = null; return; } @@ -146,7 +143,6 @@ public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) { spellCheckerSuggestionSpan.substring(0, spellCheckerSuggestionSpan.length() - 1)); } - spellCheckerSuggestionSpans.add(0, pendingResultText); pendingResult.success(spellCheckerSuggestionSpans); pendingResult = null; } diff --git a/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java b/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java index 42a8f97d1874a..aa450c6dfe518 100644 --- a/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java +++ b/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java @@ -182,11 +182,10 @@ public void onGetSentenceSuggestionsResultsWithSuccessAndNoResultsProperly() { spy(new SpellCheckPlugin(fakeTextServicesManager, fakeSpellCheckChannel)); MethodChannel.Result mockResult = mock(MethodChannel.Result.class); spellCheckPlugin.pendingResult = mockResult; - spellCheckPlugin.pendingResultText = "Hello, world!"; spellCheckPlugin.onGetSentenceSuggestions(new SentenceSuggestionsInfo[] {}); - verify(mockResult).success(new ArrayList(Arrays.asList("Hello, world!", ""))); + verify(mockResult).success(new ArrayList()); } @Test @@ -197,7 +196,6 @@ public void onGetSentenceSuggestionsResultsWithSuccessAndResultsProperly() { spy(new SpellCheckPlugin(fakeTextServicesManager, fakeSpellCheckChannel)); MethodChannel.Result mockResult = mock(MethodChannel.Result.class); spellCheckPlugin.pendingResult = mockResult; - spellCheckPlugin.pendingResultText = "Hello, wrold!"; spellCheckPlugin.onGetSentenceSuggestions( new SentenceSuggestionsInfo[] { @@ -211,7 +209,6 @@ public void onGetSentenceSuggestionsResultsWithSuccessAndResultsProperly() { new int[] {5}) }); - verify(mockResult) - .success(new ArrayList(Arrays.asList("Hello, wrold!", "7.11.world\nword\nold"))); + verify(mockResult).success(new ArrayList(Arrays.asList("7.11.world\nword\nold"))); } }