Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b568a627 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Don't kill LatinIME if the spellchecker crashes."

parents 7918ed01 199dc5e0
Loading
Loading
Loading
Loading
+65 −54
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
        @Override
        public SuggestionsInfo onGetSuggestions(final TextInfo textInfo,
                final int suggestionsLimit) {
            try {
                final String text = textInfo.getText();

                if (shouldFilterOut(text)) return EMPTY_SUGGESTIONS_INFO;
@@ -343,7 +344,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
                        proximities = new int[] { character };
                    } else {
                        proximities = Arrays.copyOfRange(SpellCheckerProximityInfo.PROXIMITY,
                            proximityIndex, proximityIndex + SpellCheckerProximityInfo.ROW_SIZE);
                                proximityIndex,
                                proximityIndex + SpellCheckerProximityInfo.ROW_SIZE);
                    }
                    composer.add(character, proximities,
                            WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
@@ -388,6 +390,15 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
                                | (result.mLooksLikeTypo
                                        ? SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO : 0);
                return new SuggestionsInfo(flags, result.mSuggestions);
            } catch (RuntimeException e) {
                // Don't kill the keyboard if there is a bug in the spell checker
                if (DBG) {
                    throw e;
                } else {
                    Log.e(TAG, "Exception while spellcheking: " + e);
                    return EMPTY_SUGGESTIONS_INFO;
                }
            }
        }
    }
}