Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f573b5 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Backport PhoneNumberUtils methods (1/2)

Used compat methods to handle compatibility and removed a completed TODO.

Bug: 25629359
Change-Id: Iedb6fb694657f201452c28e954d08f2a71470fa6
parent 8efcf7ab
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.RawContacts;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Pair;
@@ -39,6 +38,7 @@ import android.widget.TextView;

import com.android.contacts.R;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
import com.android.contacts.common.model.RawContactModifier;
import com.android.contacts.common.model.RawContactDelta;
import com.android.contacts.common.model.ValuesDelta;
@@ -172,7 +172,7 @@ public class RawContactReadOnlyEditorView extends BaseRawContactEditorView
                if (TextUtils.isEmpty(phoneNumber)) {
                    continue;
                }
                final String formattedNumber = PhoneNumberUtils.formatNumber(
                final String formattedNumber = PhoneNumberUtilsCompat.formatNumber(
                        phoneNumber, phone.getPhoneNormalizedNumber(),
                        GeoUtil.getCurrentCountryIso(getContext()));
                CharSequence phoneType = null;
+2 −4
Original line number Diff line number Diff line
@@ -23,11 +23,11 @@ import android.database.Cursor;
import android.database.DatabaseUtils;
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;

import com.google.common.annotations.VisibleForTesting;

import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
import com.android.contacts.common.util.PermissionsUtil;

import java.util.ArrayList;
@@ -107,9 +107,7 @@ public class CallLogInteractionsLoader extends AsyncTaskLoader<List<ContactInter
    }

    private List<ContactInteraction> getCallLogInteractions(String phoneNumber) {
        // TODO: the phone number added to the ContactInteractions result should retain their
        // original formatting since TalkBack is not reading the normalized number correctly
        final String normalizedNumber = PhoneNumberUtils.normalizeNumber(phoneNumber);
        final String normalizedNumber = PhoneNumberUtilsCompat.normalizeNumber(phoneNumber);
        // If the number contains only symbols, we can skip it
        if (TextUtils.isEmpty(normalizedNumber)) {
            return Collections.emptyList();