From 72285d3eb29a6505783891eb5e3f344c2eacfd25 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Thu, 8 Nov 2018 16:56:08 +0800 Subject: [PATCH] Expose Uri toSafeString api Expose toSafeString api as public and stand api. Bug: 119153962 Test: atest UriTest Change-Id: Id9da309193c1e175e5fc795570687735c7722689 --- api/current.txt | 1 + core/java/android/net/Uri.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/current.txt b/api/current.txt index 3580fa520f22..3c38643fb88f 100755 --- a/api/current.txt +++ b/api/current.txt @@ -27779,6 +27779,7 @@ package android.net { method public abstract boolean isRelative(); method public android.net.Uri normalizeScheme(); method public static android.net.Uri parse(java.lang.String); + method public java.lang.String toSafeString(); method public abstract java.lang.String toString(); method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String); method public static void writeToParcel(android.os.Parcel, android.net.Uri); diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index d09f33bcb755..af3ee0911d2f 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -374,11 +374,12 @@ public abstract class Uri implements Parcelable, Comparable { public abstract String toString(); /** - * Return a string representation of the URI that is safe to print - * to logs and other places where PII should be avoided. - * @hide + * Return a string representation of this URI that has common forms of PII redacted, + * making it safer to use for logging purposes. For example, {@code tel:800-466-4411} is + * returned as {@code tel:xxx-xxx-xxxx} and {@code http://example.com/path/to/item/} is + * returned as {@code http://example.com/...}. + * @return the common forms PII redacted string of this URI */ - @UnsupportedAppUsage public String toSafeString() { String scheme = getScheme(); String ssp = getSchemeSpecificPart(); -- 2.11.0