Fix repeated calls into reportExtractedText

As part of adding the hint text feature in
I357dd5c74b61d149cf8612d1f52c7118ec70c696  I refactored
the code inside reportExtractedText to avoid nesting but lost one
of the condition checks in the process. Since onDraw calls into
this method on each frame, the missing check was causing calls to be
made into the IME even when no content or selection changes have
happened.

Test: CtsWidgetTestCases:.TextViewTest
Bug: 73613936
Change-Id: If56e3f1d45e64dccd052e4cff4d742f0cbecc07c
This commit is contained in:
Clara Bayarri
2018-06-04 15:00:07 +01:00
parent f225af4f6c
commit 038f7a8b09

View File

@@ -1688,6 +1688,11 @@ public class Editor {
if (ims == null) {
return false;
}
final boolean wasContentChanged = ims.mContentChanged;
if (!wasContentChanged && !ims.mSelectionModeChanged) {
return false;
}
ims.mContentChanged = false;
ims.mSelectionModeChanged = false;
final ExtractedTextRequest req = ims.mExtractedTextRequest;
if (req == null) {
@@ -1703,7 +1708,7 @@ public class Editor {
+ " end=" + ims.mChangedEnd
+ " delta=" + ims.mChangedDelta);
}
if (ims.mChangedStart < 0 && !ims.mContentChanged) {
if (ims.mChangedStart < 0 && !wasContentChanged) {
ims.mChangedStart = EXTRACT_NOTHING;
}
if (extractTextInternal(req, ims.mChangedStart, ims.mChangedEnd,