From 6f4ace91fd2ba61ec860fb1ae8a5a51758e59011 Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Mon, 19 Apr 2021 22:08:54 -0700 Subject: [PATCH] ContentCapture: Log the text length for VIEW_APPEARED events. Helps for matching logs to screen contents while debugging. Bug: 177687849 Test: manual Change-Id: Id7e43034843f65f36c9030278728d27ec4f27168 --- .../android/view/contentcapture/ContentCaptureEvent.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/java/android/view/contentcapture/ContentCaptureEvent.java b/core/java/android/view/contentcapture/ContentCaptureEvent.java index ce014693c4c44..ac4554134a44b 100644 --- a/core/java/android/view/contentcapture/ContentCaptureEvent.java +++ b/core/java/android/view/contentcapture/ContentCaptureEvent.java @@ -428,10 +428,11 @@ public final class ContentCaptureEvent implements Parcelable { } if (mNode != null) { final String className = mNode.getClassName(); - if (mNode != null) { - string.append(", class=").append(className); - } + string.append(", class=").append(className); string.append(", id=").append(mNode.getAutofillId()); + if (mNode.getText() != null) { + string.append(", text=").append(getSanitizedString(mNode.getText())); + } } if (mText != null) { string.append(", text=").append(getSanitizedString(mText));