[Passpoint] Truncate IMSI from the SimCredential toString method

Truncate IMSI from the SimCredential toString method, avoid displaying
confidential IMSI information.

Bug: 149422812
Test: dumpsys wifi - confirm result
Change-Id: I9d542bc6ff60de1a78076abe1010c0c03a5f444b
This commit is contained in:
Hai Shalom
2020-02-12 15:11:24 -08:00
parent 1345eb11fd
commit 91c3b5af51

View File

@@ -738,7 +738,16 @@ public final class Credential implements Parcelable {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("IMSI: ").append(mImsi).append("\n");
String imsi;
if (mImsi != null) {
if (mImsi.length() > 6 && mImsi.charAt(6) != '*') {
// Truncate the full IMSI from the log
imsi = mImsi.substring(0, 6) + "****";
} else {
imsi = mImsi;
}
builder.append("IMSI: ").append(imsi).append("\n");
}
builder.append("EAPType: ").append(mEapType).append("\n");
return builder.toString();
}