Fix the SuggestionSpan overwrite logic.

Previously, the SpellChecker use the start and end positions as the key
to maintain the SuggestionSpan cache.

However, the actual start/end position of the SuggestionSpan may changes
when the text is changed. Hence we may not be able to find the
corresponding SuggestonSpan for a new suggestion with the changed
start/end positions.

In this fix, we deprecated the cache and use Spanned#getSpans to find
overlapped spans instead.

Change-Id: I1e732f335ad745d85a7620e3ced6858551f18232

Fix: 182982338

Test: atest CtsInputMethodTestCases:SpellCheckerTest
Change-Id: I327e5163499cfc978ff8480664a7e728b6ea7249
1 file changed