Loading src/com/android/server/telecom/ui/MissedCallNotifierImpl.java +34 −0 Original line number Diff line number Diff line Loading @@ -52,12 +52,14 @@ import android.provider.CallLog.Calls; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; import java.lang.Override; import java.lang.String; import java.util.Locale; // TODO: Needed for move to system service: import com.android.internal.R; Loading Loading @@ -293,6 +295,18 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements String handle = call.getHandle() == null ? null : call.getHandle().getSchemeSpecificPart(); String name = call.getName(); if (!TextUtils.isEmpty(handle)) { String formattedNumber = PhoneNumberUtils.formatNumber(handle, getCurrentCountryIso(mContext)); // The formatted number will be null if there was a problem formatting it, but we can // default to using the unformatted number instead (e.g. a SIP URI may not be able to // be formatted. if (!TextUtils.isEmpty(formattedNumber)) { handle = formattedNumber; } } if (!TextUtils.isEmpty(name) && TextUtils.isGraphic(name)) { return name; } else if (!TextUtils.isEmpty(handle)) { Loading @@ -307,6 +321,26 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements } } /** * @return The ISO 3166-1 two letters country code of the country the user is in based on the * network location. If the network location does not exist, fall back to the locale * setting. */ private String getCurrentCountryIso(Context context) { // Without framework function calls, this seems to be the most accurate location service // we can rely on. final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String countryIso = telephonyManager.getNetworkCountryIso().toUpperCase(); if (countryIso == null) { countryIso = Locale.getDefault().getCountry(); Log.w(this, "No CountryDetector; falling back to countryIso based on locale: " + countryIso); } return countryIso; } /** * Creates a new pending intent that sends the user to the call log. * Loading Loading
src/com/android/server/telecom/ui/MissedCallNotifierImpl.java +34 −0 Original line number Diff line number Diff line Loading @@ -52,12 +52,14 @@ import android.provider.CallLog.Calls; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; import java.lang.Override; import java.lang.String; import java.util.Locale; // TODO: Needed for move to system service: import com.android.internal.R; Loading Loading @@ -293,6 +295,18 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements String handle = call.getHandle() == null ? null : call.getHandle().getSchemeSpecificPart(); String name = call.getName(); if (!TextUtils.isEmpty(handle)) { String formattedNumber = PhoneNumberUtils.formatNumber(handle, getCurrentCountryIso(mContext)); // The formatted number will be null if there was a problem formatting it, but we can // default to using the unformatted number instead (e.g. a SIP URI may not be able to // be formatted. if (!TextUtils.isEmpty(formattedNumber)) { handle = formattedNumber; } } if (!TextUtils.isEmpty(name) && TextUtils.isGraphic(name)) { return name; } else if (!TextUtils.isEmpty(handle)) { Loading @@ -307,6 +321,26 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements } } /** * @return The ISO 3166-1 two letters country code of the country the user is in based on the * network location. If the network location does not exist, fall back to the locale * setting. */ private String getCurrentCountryIso(Context context) { // Without framework function calls, this seems to be the most accurate location service // we can rely on. final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String countryIso = telephonyManager.getNetworkCountryIso().toUpperCase(); if (countryIso == null) { countryIso = Locale.getDefault().getCountry(); Log.w(this, "No CountryDetector; falling back to countryIso based on locale: " + countryIso); } return countryIso; } /** * Creates a new pending intent that sends the user to the call log. * Loading