diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-12-17 17:59:40 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-12-17 17:59:40 +0000 |
| commit | 56208f49dc69ebfb334d371af9d412ab6ffd2b01 (patch) | |
| tree | 75523c2956c53420cc91502dee224075b925d722 /core/java/android/widget/TextView.java | |
| parent | 347373655a66cb3f4ab0dd318b1bd8098d31d428 (diff) | |
| parent | aa5088ede6b10c38a1a1ea29289e3c110d06962e (diff) | |
Merge "Another round of changes on Content Capture."
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 4574f636306c..b5cdedc4ea80 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -158,6 +158,7 @@ import android.view.animation.AnimationUtils; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; import android.view.contentcapture.ContentCaptureManager; +import android.view.contentcapture.ContentCaptureSession; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CorrectionInfo; @@ -10227,12 +10228,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } + // TODO(b/121045053): should use a flag / boolean to keep status of SHOWN / HIDDEN instead + // of using isLaidout(), so it's not called in cases where it's laid out but a + // notifyAppeared was not sent. + // ContentCapture if (isLaidOut() && isImportantForContentCapture() && isTextEditable()) { final ContentCaptureManager cm = mContext.getSystemService(ContentCaptureManager.class); if (cm != null && cm.isContentCaptureEnabled()) { - // TODO(b/111276913): pass flags when edited by user / add CTS test - cm.notifyViewTextChanged(getAutofillId(), getText(), /* flags= */ 0); + final ContentCaptureSession session = getContentCaptureSession(); + if (session != null) { + // TODO(b/111276913): pass flags when edited by user / add CTS test + session.notifyViewTextChanged(getAutofillId(), getText(), /* flags= */ 0); + } } } } |
