Fix to hide phone number printed in the log

The ConnectionRequest and ImsConferenceState fields may include phone
numbers and it is output to the log.
Since PII should not be printed in the log, mask it using Log.pii().

Bug: 111812270
Test: manual - Checked that phone number is not printed in the log when
receive an incoming call and make an IMS conference call.

Change-Id: I462ae7f923128a2d06d0415bcde0c779e932139f
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index b6e6b0e..d69d2cd 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -337,7 +337,31 @@
                 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> () {