Skip to content

Commit 0205537

Browse files
author
Daisuke Miyakawa
committed
Add debug log for 5914560 and 6383850
This won't be shown in usual condition since in most cases the method will just use the block just above the logging and return true/false there. On the other hand this might be useful if the case is truely exceptional and thus this path is really used. Bug: 5914560 Bug: 6383850 Change-Id: I2242f93a9b905b5a39d997aa30d9fd6f5bfbdf49
1 parent 66556c7 commit 0205537

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

telephony/java/android/telephony/PhoneNumberUtils.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,6 +1711,13 @@ private static boolean isEmergencyNumberInternal(String number,
17111711
return false;
17121712
}
17131713

1714+
// STOPSHIP: remove this after figuring out issue 5914560, 6383850.
1715+
Log.d(LOG_TAG, "System property doesn't provide any emergency numbers."
1716+
+ " Use embedded logic for determining emergency numbers."
1717+
+ " number: " + toLogSafePhoneNumber(number)
1718+
+ ", Iso: " + defaultCountryIso
1719+
+ ", useExactMatch: " + useExactMatch);
1720+
17141721
// No ecclist system property, so use our own list.
17151722
if (defaultCountryIso != null) {
17161723
ShortNumberUtil util = new ShortNumberUtil();
@@ -1728,6 +1735,21 @@ private static boolean isEmergencyNumberInternal(String number,
17281735
}
17291736
}
17301737

1738+
private static String toLogSafePhoneNumber(String number) {
1739+
// Do exactly same thing as Uri#toSafeString() does, which will enable us to compare
1740+
// sanitized phone numbers.
1741+
StringBuilder builder = new StringBuilder();
1742+
for (int i = 0; i < number.length(); i++) {
1743+
char c = number.charAt(i);
1744+
if (c == '-' || c == '@' || c == '.') {
1745+
builder.append(c);
1746+
} else {
1747+
builder.append('x');
1748+
}
1749+
}
1750+
return builder.toString();
1751+
}
1752+
17311753
/**
17321754
* Checks if a given number is an emergency number for the country that the user is in. The
17331755
* current country is determined using the CountryDetector.

0 commit comments

Comments
 (0)