summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-09-23 12:57:44 -0700
committerDianne Hackborn <hackbod@google.com>2011-09-23 13:39:33 -0700
commit90c52de28691ca0bbbf7c039ef20f85ce46882cc (patch)
tree3a6dcf93f186f44561a312927d7fe2e97e45f6d4 /core/java/android/net
parent67c5b1251178532726964c2e0f4229d079ff0a3e (diff)
downloadframeworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.zip
frameworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.tar.gz
frameworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.tar.bz2
Fix issue #5173952: Opening a Notification From Lock Screen...
...Should Skip Unsecure Lockscreen (ICS) Also while I am in there, clean up logging of intent objects to include even less sensitive information, while showing the true Intent in dump output (since apps can't get to that). Change-Id: I35fed714645b21e4304ba38a11ebb9c4c963538e
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/Uri.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index 2c875c8..9d28eff 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -353,6 +353,48 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
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
+ */
+ public String toSafeString() {
+ String scheme = getScheme();
+ String ssp = getSchemeSpecificPart();
+ if (scheme != null) {
+ if (scheme.equalsIgnoreCase("tel") || scheme.equalsIgnoreCase("sip")
+ || scheme.equalsIgnoreCase("sms") || scheme.equalsIgnoreCase("smsto")
+ || scheme.equalsIgnoreCase("mailto")) {
+ StringBuilder builder = new StringBuilder(64);
+ builder.append(scheme);
+ builder.append(':');
+ if (ssp != null) {
+ for (int i=0; i<ssp.length(); i++) {
+ char c = ssp.charAt(i);
+ if (c == '-' || c == '@' || c == '.') {
+ builder.append(c);
+ } else {
+ builder.append('x');
+ }
+ }
+ }
+ return builder.toString();
+ }
+ }
+ // Not a sensitive scheme, but let's still be conservative about
+ // the data we include -- only the ssp, not the query params or
+ // fragment, because those can often have sensitive info.
+ StringBuilder builder = new StringBuilder(64);
+ if (scheme != null) {
+ builder.append(scheme);
+ builder.append(':');
+ }
+ if (ssp != null) {
+ builder.append(ssp);
+ }
+ return builder.toString();
+ }
+
+ /**
* Constructs a new builder, copying the attributes from this Uri.
*/
public abstract Builder buildUpon();