summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Clara Bayarri <clarabayarri@google.com> 2018-06-04 15:00:07 +0100
committer Clara Bayarri <clarabayarri@google.com> 2018-06-05 13:41:58 +0100
commit038f7a8b09db95a375a9eab49fa89ab8b2e40b81 (patch)
treed535da3464451b63ff31b66228b4baedeca09bce
parentf225af4f6c7143fcfac837d87c9991ea91e55a5a (diff)
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
-rw-r--r--core/java/android/widget/Editor.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 10de4497c05c..d07721a3c27a 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -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,