summaryrefslogtreecommitdiff
path: root/java/com/android/incallui
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-09-21 09:37:40 -0700
committerEric Erfanian <erfanian@google.com>2017-09-22 15:59:39 +0000
commit1420a22d5dc0d87f8634980b729a3511e42b6493 (patch)
treee82dd12010685713517e7b4737b999839880e843 /java/com/android/incallui
parent3f4a31982fc815b1620671f16f7d45a8d2c07988 (diff)
Better handling country iso when getting geo location of phone number.
1. Use existing country iso info instead of guessing current country iso from sim and locale for blocked number. 2. Use country iso of current sim instead of default sim for incall location info. This fixes bug in multi sim device when default sim is out of service and making call with the other sim. Bug: 65399976 Test: manual PiperOrigin-RevId: 169554641 Change-Id: I416d7e2d6bc3c872bfec3eda4005a5a1684f0e40
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r--java/com/android/incallui/CallerInfo.java4
-rw-r--r--java/com/android/incallui/CallerInfoAsyncQuery.java3
-rw-r--r--java/com/android/incallui/CallerInfoUtils.java3
-rw-r--r--java/com/android/incallui/ContactInfoCache.java6
4 files changed, 11 insertions, 5 deletions
diff --git a/java/com/android/incallui/CallerInfo.java b/java/com/android/incallui/CallerInfo.java
index e552d7cd9..cc1a60a5b 100644
--- a/java/com/android/incallui/CallerInfo.java
+++ b/java/com/android/incallui/CallerInfo.java
@@ -162,6 +162,8 @@ public class CallerInfo {
*/
public String callSubject;
+ public String countryIso;
+
private boolean mIsEmergency;
private boolean mIsVoiceMail;
@@ -522,7 +524,7 @@ public class CallerInfo {
*/
public void updateGeoDescription(Context context, String fallbackNumber) {
String number = TextUtils.isEmpty(phoneNumber) ? fallbackNumber : phoneNumber;
- geoDescription = PhoneNumberHelper.getGeoDescription(context, number);
+ geoDescription = PhoneNumberHelper.getGeoDescription(context, number, countryIso);
}
/** @return a string debug representation of this instance. */
diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java
index 858d0f4b7..86b1b7f22 100644
--- a/java/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/java/com/android/incallui/CallerInfoAsyncQuery.java
@@ -162,6 +162,7 @@ public class CallerInfoAsyncQuery {
cw.listener = listener;
cw.cookie = cookie;
cw.number = info.phoneNumber;
+ cw.countryIso = info.countryIso;
// check to see if these are recognized numbers, and use shortcuts if we can.
if (PhoneNumberUtils.isLocalEmergencyNumber(context, info.phoneNumber)) {
@@ -268,6 +269,7 @@ public class CallerInfoAsyncQuery {
public Object cookie;
public int event;
public String number;
+ public String countryIso;
}
/* Directory lookup related code - END */
@@ -493,6 +495,7 @@ public class CallerInfoAsyncQuery {
mCallerInfo = newCallerInfo;
Log.d(this, "#####async contact look up with numeric username" + mCallerInfo);
}
+ mCallerInfo.countryIso = cw.countryIso;
// Final step: look up the geocoded description.
if (ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION) {
diff --git a/java/com/android/incallui/CallerInfoUtils.java b/java/com/android/incallui/CallerInfoUtils.java
index 8f2310760..bf586f504 100644
--- a/java/com/android/incallui/CallerInfoUtils.java
+++ b/java/com/android/incallui/CallerInfoUtils.java
@@ -70,7 +70,7 @@ public class CallerInfoUtils {
"CallerInfoUtils.getCallerInfoForCall",
"Actually starting CallerInfoAsyncQuery.startQuery()...");
- //noinspection MissingPermission
+ // noinspection MissingPermission
CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, info, listener, cookie);
} else {
LogUtil.w(
@@ -93,6 +93,7 @@ public class CallerInfoUtils {
info.namePresentation = call.getCnapNamePresentation();
info.callSubject = call.getCallSubject();
info.contactExists = false;
+ info.countryIso = PhoneNumberHelper.getCurrentCountryIso(context, call.getAccountHandle());
String number = call.getNumber();
if (!TextUtils.isEmpty(number)) {
diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java
index 7bac6d329..39c4c2fda 100644
--- a/java/com/android/incallui/ContactInfoCache.java
+++ b/java/com/android/incallui/ContactInfoCache.java
@@ -211,7 +211,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// No name, but we do have a valid CNAP name, so use that.
displayName = info.cnapName;
info.name = info.cnapName;
- displayNumber = PhoneNumberHelper.formatNumber(number, context);
+ displayNumber = PhoneNumberHelper.formatNumber(number, info.countryIso);
Log.d(
TAG,
" ==> cnapName available: displayName '"
@@ -224,7 +224,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// case when an incoming call doesn't match any contact,
// or if you manually dial an outgoing number using the
// dialpad.
- displayNumber = PhoneNumberHelper.formatNumber(number, context);
+ displayNumber = PhoneNumberHelper.formatNumber(number, info.countryIso);
Log.d(
TAG,
@@ -249,7 +249,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// later determine whether to use the name or nameAlternative when presenting
displayName = info.name;
cce.nameAlternative = info.nameAlternative;
- displayNumber = PhoneNumberHelper.formatNumber(number, context);
+ displayNumber = PhoneNumberHelper.formatNumber(number, info.countryIso);
label = info.phoneLabel;
Log.d(
TAG,