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

Commit 6a3d188f authored by Bai Tao's avatar Bai Tao
Browse files

Format the phone number with the number country's convention.

If the phone number doesn't have country code, the current country's convention will be used.

Change-Id: I3f6ea0104d1a67071bd3beadb667c7159e915eef
parent 23fd61b1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public class CallerInfo {
     */
    public String name;
    public String phoneNumber;
    public String nomalizedNumber;

    public String cnapName;
    public int numberPresentation;
@@ -150,6 +151,12 @@ public class CallerInfo {
                    info.phoneNumber = cursor.getString(columnIndex);
                }

                // Look for the normalized number
                columnIndex = cursor.getColumnIndex(PhoneLookup.NORMALIZED_NUMBER);
                if (columnIndex != -1) {
                    info.nomalizedNumber = cursor.getString(columnIndex);
                }

                // Look for the label/type combo
                columnIndex = cursor.getColumnIndex(PhoneLookup.LABEL);
                if (columnIndex != -1) {
+6 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.AsyncQueryHandler;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.location.CountryDetector;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
@@ -229,7 +230,11 @@ public class CallerInfoAsyncQuery {
                    mCallerInfo = CallerInfo.getCallerInfo(mQueryContext, mQueryUri, cursor);
                    // Use the number entered by the user for display.
                    if (!TextUtils.isEmpty(cw.number)) {
                        mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number);
                        CountryDetector detector = (CountryDetector) mQueryContext.getSystemService(
                                Context.COUNTRY_DETECTOR);
                        mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
                                mCallerInfo.nomalizedNumber,
                                detector.detectCountry().getCountryIso());
                    }
                }