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
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java
index cf89848..6e13690 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfo.java
@@ -70,6 +70,7 @@
*/
public String name;
public String phoneNumber;
+ public String nomalizedNumber;
public String cnapName;
public int numberPresentation;
@@ -150,6 +151,12 @@
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) {
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
index 798a5a5..ae9750d 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
@@ -20,6 +20,7 @@
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 @@
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());
}
}