summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRohit Yengisetty <rohit@cyngn.com>2016-05-17 17:25:47 -0700
committerRohit Yengisetty <rohit@cyngn.com>2016-05-17 18:04:49 -0700
commitc9ec0e37a3004c5517e133f7a9e44285cc49f57a (patch)
tree401e1d8bc88e32392b364ac465a0b991d9cc5c39 /src
parent6a15637c0746c664310f34739e1126abde956565 (diff)
downloadandroid_packages_apps_Dialer-c9ec0e37a3004c5517e133f7a9e44285cc49f57a.tar.gz
android_packages_apps_Dialer-c9ec0e37a3004c5517e133f7a9e44285cc49f57a.tar.bz2
android_packages_apps_Dialer-c9ec0e37a3004c5517e133f7a9e44285cc49f57a.zip
Add location information from contact-info provider
Add City and/or Country information to the call, if that information was surfaced by a caller-info provider Change-Id: I58d860f1473430880ada943296108032e2f0c4cd Issue-Id: OPO-712
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 8b17ece07..0061d3a3d 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -52,6 +52,8 @@ import com.cyanogen.lookup.phonenumber.response.StatusCode;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Locale;
+
/**
* Utility class to look up the contact information for a given number.
*/
@@ -340,6 +342,21 @@ public class ContactInfoHelper {
contactInfo.spamCount = response.mSpamCount;
contactInfo.attributionDrawable = response.mAttributionLogo;
+ StringBuilder succinctLocation = new StringBuilder();
+ // convert country code to country name
+ String country = new Locale("", response.mCountry).getDisplayCountry();
+
+ if (!TextUtils.isEmpty(response.mCity)) {
+ succinctLocation.append(response.mCity);
+ }
+ if (!TextUtils.isEmpty(country)) {
+ if (succinctLocation.length() > 0) {
+ succinctLocation.append(", ");
+ }
+ succinctLocation.append(country);
+ }
+ contactInfo.label = succinctLocation.toString();
+
// construct encoded lookup uri
ContactBuilder contactBuilder = new ContactBuilder(ContactBuilder.REVERSE_LOOKUP,
response.mNumber, formattedNumber);