From 0f163f5557a632890bdc63fabafc02abd5e9fea8 Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Tue, 15 Jun 2021 09:05:16 -0700 Subject: [PATCH] ContentCapture: DEBUG flag to log raw text Bug: 184311217 Test: manual Change-Id: I9a60bcf95574583c14f5962a3dde603abea85498 --- .../android/view/contentcapture/ContentCaptureEvent.java | 7 +++++-- .../android/view/contentcapture/ContentCaptureManager.java | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/contentcapture/ContentCaptureEvent.java b/core/java/android/view/contentcapture/ContentCaptureEvent.java index ac4554134a44b..2ff0d98679108 100644 --- a/core/java/android/view/contentcapture/ContentCaptureEvent.java +++ b/core/java/android/view/contentcapture/ContentCaptureEvent.java @@ -16,6 +16,7 @@ package android.view.contentcapture; import static android.view.contentcapture.ContentCaptureHelper.getSanitizedString; +import static android.view.contentcapture.ContentCaptureManager.DEBUG; import static android.view.contentcapture.ContentCaptureManager.NO_SESSION_ID; import android.annotation.IntDef; @@ -431,11 +432,13 @@ public final class ContentCaptureEvent implements Parcelable { string.append(", class=").append(className); string.append(", id=").append(mNode.getAutofillId()); if (mNode.getText() != null) { - string.append(", text=").append(getSanitizedString(mNode.getText())); + string.append(", text=") + .append(DEBUG ? mNode.getText() : getSanitizedString(mNode.getText())); } } if (mText != null) { - string.append(", text=").append(getSanitizedString(mText)); + string.append(", text=") + .append(DEBUG ? mText : getSanitizedString(mText)); } if (mClientContext != null) { string.append(", context=").append(mClientContext); diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java index ed840ce3061b9..9241c3074ddd4 100644 --- a/core/java/android/view/contentcapture/ContentCaptureManager.java +++ b/core/java/android/view/contentcapture/ContentCaptureManager.java @@ -212,6 +212,9 @@ public final class ContentCaptureManager { private static final String TAG = ContentCaptureManager.class.getSimpleName(); + /** @hide */ + public static final boolean DEBUG = false; + /** Error happened during the data sharing session. */ public static final int DATA_SHARE_ERROR_UNKNOWN = 1;