mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Limit escape of parameters
Change-Id: I3a7ab069042d5542ab2e033d1eeb13d718cd7698
This commit is contained in:
parent
23a5e9d1a7
commit
13fb8fb775
java/src/com/android/inputmethod/latin
@ -1869,7 +1869,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
|
builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Suggest.shouldBlockAutoCorrectionBySafetyNet(builder, mSuggest)) {
|
if (Suggest.shouldBlockAutoCorrectionBySafetyNet(builder, mSuggest,
|
||||||
|
mSettingsValues.mAutoCorrectionThreshold)) {
|
||||||
builder.setShouldBlockAutoCorrectionBySafetyNet();
|
builder.setShouldBlockAutoCorrectionBySafetyNet();
|
||||||
}
|
}
|
||||||
showSuggestions(builder.build(), typedWord);
|
showSuggestions(builder.build(), typedWord);
|
||||||
|
@ -218,10 +218,6 @@ public class Suggest implements Dictionary.WordCallback {
|
|||||||
mAutoCorrectionThreshold = threshold;
|
mAutoCorrectionThreshold = threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAggressiveAutoCorrectionMode() {
|
|
||||||
return (mAutoCorrectionThreshold == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of suggestions to generate from the input key sequence. This has
|
* Number of suggestions to generate from the input key sequence. This has
|
||||||
* to be a number between 1 and 100 (inclusive).
|
* to be a number between 1 and 100 (inclusive).
|
||||||
@ -554,7 +550,8 @@ public class Suggest implements Dictionary.WordCallback {
|
|||||||
// TODO: Resolve the inconsistencies between the native auto correction algorithms and
|
// TODO: Resolve the inconsistencies between the native auto correction algorithms and
|
||||||
// this safety net
|
// this safety net
|
||||||
public static boolean shouldBlockAutoCorrectionBySafetyNet(
|
public static boolean shouldBlockAutoCorrectionBySafetyNet(
|
||||||
SuggestedWords.Builder suggestedWordsBuilder, Suggest suggest) {
|
final SuggestedWords.Builder suggestedWordsBuilder, final Suggest suggest,
|
||||||
|
final double autoCorrectionThreshold) {
|
||||||
// Safety net for auto correction.
|
// Safety net for auto correction.
|
||||||
// Actually if we hit this safety net, it's actually a bug.
|
// Actually if we hit this safety net, it's actually a bug.
|
||||||
if (suggestedWordsBuilder.size() <= 1 || suggestedWordsBuilder.isTypedWordValid()) {
|
if (suggestedWordsBuilder.size() <= 1 || suggestedWordsBuilder.isTypedWordValid()) {
|
||||||
@ -562,7 +559,7 @@ public class Suggest implements Dictionary.WordCallback {
|
|||||||
}
|
}
|
||||||
// If user selected aggressive auto correction mode, there is no need to use the safety
|
// If user selected aggressive auto correction mode, there is no need to use the safety
|
||||||
// net.
|
// net.
|
||||||
if (suggest.isAggressiveAutoCorrectionMode()) {
|
if (0 == autoCorrectionThreshold) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final CharSequence typedWord = suggestedWordsBuilder.getWord(0);
|
final CharSequence typedWord = suggestedWordsBuilder.getWord(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user