diff options
author | Wink Saville <wink@google.com> | 2014-06-12 17:02:31 -0700 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2014-06-13 13:30:57 +0000 |
commit | fb40dd4d00bd3361b2535bc866e6c21eadc52558 (patch) | |
tree | 01786f3e2bc9c803801f43fb8bc942e55a06e859 /telephony/java/com/android/internal/telephony/CallerInfo.java | |
parent | 6dfa6e2a9be08a3a0f152a7b772efc8ce2469bce (diff) | |
download | frameworks_base-fb40dd4d00bd3361b2535bc866e6c21eadc52558.zip frameworks_base-fb40dd4d00bd3361b2535bc866e6c21eadc52558.tar.gz frameworks_base-fb40dd4d00bd3361b2535bc866e6c21eadc52558.tar.bz2 |
Merge kwd to master
Add initial IMS and MSIM support from klp-wireless-dev-mirror
Change-Id: Idb607c0aa32f80fe4fe1539aedea7a221e9e7f04
Diffstat (limited to 'telephony/java/com/android/internal/telephony/CallerInfo.java')
-rw-r--r-- | telephony/java/com/android/internal/telephony/CallerInfo.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index f8dd7cf..745c9d0 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -37,6 +37,9 @@ import com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder; import com.android.i18n.phonenumbers.NumberParseException; import com.android.i18n.phonenumbers.PhoneNumberUtil; import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber; +import android.telephony.SubscriptionManager; + +import android.telephony.TelephonyManager; import java.util.Locale; @@ -233,6 +236,7 @@ public class CallerInfo { info.contactExists = true; } cursor.close(); + cursor = null; } info.needUpdate = false; @@ -269,6 +273,23 @@ public class CallerInfo { public static CallerInfo getCallerInfo(Context context, String number) { if (VDBG) Rlog.v(TAG, "getCallerInfo() based on number..."); + long subId = SubscriptionManager.getDefaultSubId(); + return getCallerInfo(context, number, subId); + } + + /** + * getCallerInfo given a phone number and subscription, look up in the call-log database + * for the matching caller id info. + * @param context the context used to get the ContentResolver + * @param number the phone number used to lookup caller id + * @param subId the subscription for checking for if voice mail number or not + * @return the CallerInfo which contains the caller id for the given + * number. The returned CallerInfo is null if no number is supplied. If + * a matching number is not found, then a generic caller info is returned, + * with all relevant fields empty or null. + */ + public static CallerInfo getCallerInfo(Context context, String number, long subId) { + if (TextUtils.isEmpty(number)) { return null; } @@ -278,7 +299,7 @@ public class CallerInfo { // shortcut and skip the query. if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) { return new CallerInfo().markAsEmergency(context); - } else if (PhoneNumberUtils.isVoiceMailNumber(number)) { + } else if (PhoneNumberUtils.isVoiceMailNumber(subId, number)) { return new CallerInfo().markAsVoiceMail(); } @@ -400,10 +421,17 @@ public class CallerInfo { // TODO: As in the emergency number handling, we end up writing a // string in the phone number field. /* package */ CallerInfo markAsVoiceMail() { + + long subId = SubscriptionManager.getDefaultSubId(); + return markAsVoiceMail(subId); + + } + + /* package */ CallerInfo markAsVoiceMail(long subId) { mIsVoiceMail = true; try { - String voiceMailLabel = TelephonyManager.getDefault().getVoiceMailAlphaTag(); + String voiceMailLabel = TelephonyManager.getDefault().getVoiceMailAlphaTag(subId); phoneNumber = voiceMailLabel; } catch (SecurityException se) { |