From 46e946a251f133af59f2b95f279c02ca17c7a0a9 Mon Sep 17 00:00:00 2001 From: TYM Tsai Date: Wed, 16 Jun 2021 22:47:11 +0800 Subject: [PATCH] Notify Content Capture the selection was changed The ContentCapture service is interested in the selection changes. When the selection was changed, notifies a text changed event to ContentCapture. Bug: 184311217 Test: manual 1.long press trigger selection, event is sent. 2.drag selection indicators, send event after the drag is done. Test: atest CtsContentCaptureServiceTestCases Change-Id: Ie45f617b132bc240b6cf61ee7ebc3041275f1694 --- core/java/android/widget/SelectionActionModeHelper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/widget/SelectionActionModeHelper.java b/core/java/android/widget/SelectionActionModeHelper.java index eb6bce4a2f59c..3fed9beeaaba2 100644 --- a/core/java/android/widget/SelectionActionModeHelper.java +++ b/core/java/android/widget/SelectionActionModeHelper.java @@ -565,6 +565,7 @@ public final class SelectionActionModeHelper { */ public void onSmartSelection(SelectionResult result) { onClassifiedSelection(result); + mTextView.notifyContentCaptureTextChanged(); mLogger.logSelectionModified( result.mStart, result.mEnd, result.mClassification, result.mSelection); } @@ -595,6 +596,7 @@ public final class SelectionActionModeHelper { mSelectionStart = selectionStart; mSelectionEnd = selectionEnd; mAllowReset = false; + mTextView.notifyContentCaptureTextChanged(); mLogger.logSelectionModified(selectionStart, selectionEnd, classification, null); } }