summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SelectionActionModeHelper.java
diff options
context:
space:
mode:
authorJan Althaus <jalt@google.com>2018-02-02 09:20:14 +0100
committerJan Althaus <jalt@google.com>2018-02-05 16:56:52 +0100
commit92c6decbb8e39f9b5ffae38528f47fcebabf7d44 (patch)
treede8686b4182870fdc4fccf7ac0a8ec31800430c5 /core/java/android/widget/SelectionActionModeHelper.java
parentfd673f32393aed9ee20a3ffe9cf882307198811d (diff)
Logging for linkify selections
Bug: 67629726, 70246800 Test: Manually validated, ran CTS tests, and framework tests Change-Id: Icd41f1e171767bc466f47c87a6ab611185745fd4
Diffstat (limited to 'core/java/android/widget/SelectionActionModeHelper.java')
-rw-r--r--core/java/android/widget/SelectionActionModeHelper.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/java/android/widget/SelectionActionModeHelper.java b/core/java/android/widget/SelectionActionModeHelper.java
index 2e354c1eee1f..9ff5f5910677 100644
--- a/core/java/android/widget/SelectionActionModeHelper.java
+++ b/core/java/android/widget/SelectionActionModeHelper.java
@@ -111,7 +111,8 @@ public final class SelectionActionModeHelper {
mSelectionTracker.onOriginalSelection(
getText(mTextView),
mTextView.getSelectionStart(),
- mTextView.getSelectionEnd());
+ mTextView.getSelectionEnd(),
+ false /*isLink*/);
cancelAsyncTask();
if (skipTextClassification()) {
startSelectionActionMode(null);
@@ -134,7 +135,11 @@ public final class SelectionActionModeHelper {
* Starts Link ActionMode.
*/
public void startLinkActionModeAsync(TextLinks.TextLink textLink) {
- //TODO: tracking/logging
+ mSelectionTracker.onOriginalSelection(
+ getText(mTextView),
+ mTextView.getSelectionStart(),
+ mTextView.getSelectionEnd(),
+ true /*isLink*/);
cancelAsyncTask();
if (skipTextClassification()) {
startLinkActionMode(null);
@@ -483,7 +488,8 @@ public final class SelectionActionModeHelper {
/**
* Called when the original selection happens, before smart selection is triggered.
*/
- public void onOriginalSelection(CharSequence text, int selectionStart, int selectionEnd) {
+ public void onOriginalSelection(
+ CharSequence text, int selectionStart, int selectionEnd, boolean isLink) {
// If we abandoned a selection and created a new one very shortly after, we may still
// have a pending request to log ABANDON, which we flush here.
mDelayedLogAbandon.flush();
@@ -492,7 +498,8 @@ public final class SelectionActionModeHelper {
mOriginalEnd = mSelectionEnd = selectionEnd;
mAllowReset = false;
maybeInvalidateLogger();
- mLogger.logSelectionStarted(text, selectionStart);
+ mLogger.logSelectionStarted(text, selectionStart,
+ isLink ? SelectionEvent.INVOCATION_LINK : SelectionEvent.INVOCATION_MANUAL);
}
/**
@@ -675,7 +682,9 @@ public final class SelectionActionModeHelper {
return Logger.WIDGET_UNSELECTABLE_TEXTVIEW;
}
- public void logSelectionStarted(CharSequence text, int index) {
+ public void logSelectionStarted(
+ CharSequence text, int index,
+ @SelectionEvent.InvocationMethod int invocationMethod) {
try {
Preconditions.checkNotNull(text);
Preconditions.checkArgumentInRange(index, 0, text.length(), "index");
@@ -684,7 +693,7 @@ public final class SelectionActionModeHelper {
}
mTokenIterator.setText(mText);
mStartIndex = index;
- mLogger.logSelectionStartedEvent(0);
+ mLogger.logSelectionStartedEvent(invocationMethod, 0);
} catch (Exception e) {
// Avoid crashes due to logging.
Log.d(LOG_TAG, e.getMessage());