4

Edit: Changed JellyBean to cyanogenmod 10 as it's probably a cyanogen feature

I noticed my phone under CyanogenMod10 phone displays in the call log the (approximate) location of callers (only when the number is a land line phone not in my contacts).

It doesn't just rely on the country code because it also displays the city of the caller when found. I browsed the Contacts package app and found values was fetched from database (in com.android.contacts.CallDetailActivity)

final String countryIso = callCursor.getString(COUNTRY_ISO_COLUMN_INDEX);
final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX);

So I though it was in the Phone package app after successfully placing or receiving a call. But I quickly lost myself in the source... I would to know where and (briefly) how those values are set and the geocode resolved.

Are phone numbers sent to a mysterious web service?

Does Cyanogen have a table with all country codes and city prefixes of the world (I doubt it)?

Or is that DB downloaded depending on the country you are in?

MiniScalope
  • 1,429
  • 1
  • 16
  • 22
  • MIUI Roms had this feature long before Jelly Bean, but they didn't resolved down to the City. – S.D. Nov 24 '12 at 14:23
  • actually i am using cyanogenmod10 I wondered before asking if it wasn't a Cyanogen feature instead :/ I dont have a google phone to compare, maybe i should edit my question... – MiniScalope Nov 24 '12 at 15:02
  • Maybe its a Cyanogen feature. Use an app like [this](https://play.google.com/store/apps/details?id=com.eolwral.osmonitor) to pin down if telephony service or contacts app connects to any server for location details. – S.D. Nov 24 '12 at 15:14

1 Answers1

2

Finally I found how this thing work

First ContactsProvider add this value when calling DefaultCallLogInsertionHelper.addComputedValues

see here

https://github.com/CyanogenMod/android_packages_providers_ContactsProvider/blob/ics/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java#L59

@Override
public void addComputedValues(ContentValues values) {
    // Insert the current country code, so we know the country the number belongs to.
    String countryIso = getCurrentCountryIso();
    values.put(Calls.COUNTRY_ISO, countryIso);
    // Insert the geocoded location, so that we do not need to compute it on the fly.
    values.put(Calls.GEOCODED_LOCATION,
            getGeocodedLocationFor(values.getAsString(Calls.NUMBER), countryIso));
}

so code you see

final String countryIso = callCursor.getString(COUNTRY_ISO_COLUMN_INDEX);
final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX);

is actually reading from saved data

So, real data are from PhoneNumberOfflineGeocoder which you can find here https://github.com/CyanogenMod/android_external_libphonenumber/blob/ics/java/src/com/android/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java

That is something called libphonenumber

https://code.google.com/p/libphonenumber/

farmer1992
  • 7,816
  • 3
  • 30
  • 26
  • Great!! Everyone seems to care of Privacy but no one spotted this feature as potentially intrusive. Thank you :) – MiniScalope Jul 18 '13 at 11:34