Merge "Fix to hide phone number printed in the log"

This commit is contained in:
Treehugger Robot
2019-03-01 00:45:51 +00:00
committed by Gerrit Code Review
2 changed files with 33 additions and 8 deletions

View File

@@ -337,7 +337,31 @@ public final class ConnectionRequest implements Parcelable {
mAddress == null
? Uri.EMPTY
: Connection.toLogSafePhoneNumber(mAddress.toString()),
mExtras == null ? "" : mExtras);
bundleToString(mExtras));
}
private static String bundleToString(Bundle extras){
if (extras == null) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append("Bundle[");
for (String key : extras.keySet()) {
sb.append(key);
sb.append("=");
switch (key) {
case TelecomManager.EXTRA_INCOMING_CALL_ADDRESS:
case TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE:
sb.append(Log.pii(extras.get(key)));
break;
default:
sb.append(extras.get(key));
break;
}
sb.append(", ");
}
sb.append("]");
return sb.toString();
}
public static final Creator<ConnectionRequest> CREATOR = new Creator<ConnectionRequest> () {

View File

@@ -16,17 +16,18 @@
package android.telephony.ims;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telecom.Call;
import android.telecom.Connection;
import android.telecom.Log;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
/**
* Provides the conference information (defined in RFC 4575) for IMS conference call.
@@ -189,7 +190,7 @@ public final class ImsConferenceState implements Parcelable {
sb.append("<");
while (iterator.hasNext()) {
Entry<String, Bundle> entry = iterator.next();
sb.append(entry.getKey());
sb.append(Log.pii(entry.getKey()));
sb.append(": ");
Bundle participantData = entry.getValue();
@@ -197,7 +198,7 @@ public final class ImsConferenceState implements Parcelable {
sb.append(key);
sb.append("=");
if (ENDPOINT.equals(key) || USER.equals(key)) {
sb.append(android.telecom.Log.pii(participantData.get(key)));
sb.append(Log.pii(participantData.get(key)));
} else {
sb.append(participantData.get(key));
}