summaryrefslogtreecommitdiffstats
path: root/java/com/android/contacts
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-11-28 15:27:11 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-29 11:49:11 -0800
commit1306455ce5eb75c74790526ec3687293221a42ba (patch)
treebbbb216c0e61454fab59c06ca5baf194d2ff63da /java/com/android/contacts
parent295d9ad53628eba12d635b35d6b51eb3cae8a4aa (diff)
downloadandroid_packages_apps_Dialer-1306455ce5eb75c74790526ec3687293221a42ba.tar.gz
android_packages_apps_Dialer-1306455ce5eb75c74790526ec3687293221a42ba.tar.bz2
android_packages_apps_Dialer-1306455ce5eb75c74790526ec3687293221a42ba.zip
Format number for SIM selection
Bug: 69812286 Test: PhoneNumberHelperTest PiperOrigin-RevId: 177227451 Change-Id: I6cf53e50d17860f4374cbd9a94451bc0731905a4
Diffstat (limited to 'java/com/android/contacts')
-rw-r--r--java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
index e41a75b22..07891a069 100644
--- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
+++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
@@ -25,11 +25,13 @@ import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import android.telephony.SubscriptionInfo;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -43,7 +45,10 @@ import android.widget.ListAdapter;
import android.widget.TextView;
import com.android.contacts.common.R;
import com.android.contacts.common.compat.PhoneAccountCompat;
-import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
+import com.android.dialer.location.GeoUtil;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
+import com.android.dialer.telecom.TelecomUtil;
+import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
@@ -319,8 +324,9 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
} else {
holder.numberTextView.setVisibility(View.VISIBLE);
holder.numberTextView.setText(
- PhoneNumberUtilsCompat.createTtsSpannable(
- account.getAddress().getSchemeSpecificPart()));
+ PhoneNumberHelper.formatNumberForDisplay(
+ account.getAddress().getSchemeSpecificPart(),
+ getCountryIso(getContext(), accountHandle)));
}
holder.imageView.setImageDrawable(
PhoneAccountCompat.createIconDrawable(account, getContext()));
@@ -339,6 +345,16 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
return rowView;
}
+ private static String getCountryIso(
+ Context context, @NonNull PhoneAccountHandle phoneAccountHandle) {
+ Optional<SubscriptionInfo> info =
+ TelecomUtil.getSubscriptionInfo(context, phoneAccountHandle);
+ if (!info.isPresent()) {
+ return GeoUtil.getCurrentCountryIso(context);
+ }
+ return info.get().getCountryIso().toUpperCase();
+ }
+
private static final class ViewHolder {
TextView labelTextView;