How does CyanogenMod10 determine the location of the caller?

Edit : Changed JellyBean to cyanogenmod 10 as it probably represents a cyanogenic function

I noticed that my phone under the displays of the CyanogenMod10 phone in the call log is the (approximate) location of the callers (only if the landline phone number is not in my contacts).

It does not just rely on the country code, because it also displays the city of the caller when it is detected. I looked through the Contacts application and the values ​​found were obtained from the 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, although it was in the Phone phone application after successfully placing or receiving a call. But I quickly lost myself in the source ... I would like to know where and (briefly) how these values ​​are set and the geocode is enabled.

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 does the database load depending on the country in which you are located?

+4
source share
1 answer

Finally, I found how this thing works.

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)); } 

the code you see

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

actually reads from stored data

So, the real data is taken 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

This is called libphonenumber

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

+2
source

Source: https://habr.com/ru/post/1448099/


All Articles