Using the phone number without formate for the unique DisplayName

If the phone number has formate, the getUniqueSubscriptionDisplayNames may have the white space.

Bug: 318022908
Change-Id: I459fb244ec690eff03d565b494b007849ef44c8b
Test: atest SubscriptionUtilTest
This commit is contained in:
SongFerng Wang
2024-01-19 17:44:53 +00:00
parent 6c7dbdd64a
commit 1229c54470

View File

@@ -335,8 +335,16 @@ public class SubscriptionUtil {
if (duplicateOriginalNames.contains(info.originalName)) {
// This may return null, if the user cannot view the phone number itself.
final String phoneNumber = getBidiFormattedPhoneNumber(context,
info.subscriptionInfo);
String phoneNumber = "";
try {
final SubscriptionManager subscriptionManager = context.getSystemService(
SubscriptionManager.class);
phoneNumber = subscriptionManager.getPhoneNumber(infoSubId);
} catch (IllegalStateException
| SecurityException
| UnsupportedOperationException e) {
Log.w(TAG, "get number error." + e);
}
String lastFourDigits = "";
if (phoneNumber != null) {
lastFourDigits = (phoneNumber.length() > 4)