From fa4f202fe194280a93b68e639228fa2d2097a55f Mon Sep 17 00:00:00 2001 From: wangqi Date: Wed, 26 Jul 2017 16:52:18 -0700 Subject: Attempt to fix bug that voicemail or emergency number is changed during a call. This is caused by handling phone number change during a call. This change will remember if it's a voicemail/emergency number after phone number changes and continue to show it as voicemail/emergency number. Bug: 64009408,63716219 Test: SimulatorConnectionService and real device. PiperOrigin-RevId: 163276696 Change-Id: Ibcde9ab9b61dc683de3d77dddca789ade3e895ba --- java/com/android/incallui/ContactInfoCache.java | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'java/com/android') diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index fdfba3b9f..d50a5c26d 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -266,6 +266,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { cce.userType = info.userType; cce.originalPhoneNumber = info.phoneNumber; cce.shouldShowLocation = info.shouldShowGeoDescription; + cce.isEmergencyNumber = info.isEmergencyNumber(); + cce.isVoicemailNumber = info.isVoiceMailNumber(); if (info.contactExists) { cce.contactLookupResult = ContactLookupResult.Type.LOCAL_CONTACT; @@ -428,6 +430,19 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { + "; didLocalLookup = " + didLocalLookup); + ContactCacheEntry existingCacheEntry = mInfoMap.get(callId); + Log.d(TAG, "Existing cacheEntry in hashMap " + existingCacheEntry); + + // Mark it as emergency/voicemail if the cache exists and was emergency/voicemail before the + // number changed. + if (existingCacheEntry != null) { + if (existingCacheEntry.isEmergencyNumber) { + callerInfo.markAsEmergency(mContext); + } else if (existingCacheEntry.isVoicemailNumber) { + callerInfo.markAsVoiceMail(mContext); + } + } + int presentationMode = numberPresentation; if (callerInfo.contactExists || callerInfo.isEmergencyNumber() @@ -439,9 +454,6 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { ContactCacheEntry cacheEntry = buildEntry(mContext, callerInfo, presentationMode); cacheEntry.queryId = queryToken.mQueryId; - ContactCacheEntry existingCacheEntry = mInfoMap.get(callId); - Log.d(TAG, "Existing cacheEntry in hashMap " + existingCacheEntry); - if (didLocalLookup) { if (cacheEntry.displayPhotoUri != null) { // When the difference between 2 numbers is only the prefix (e.g. + or IDD), @@ -704,6 +716,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { boolean shouldShowLocation; boolean isBusiness; + boolean isEmergencyNumber; + boolean isVoicemailNumber; @Override public String toString() { @@ -743,6 +757,10 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { + originalPhoneNumber + ", shouldShowLocation=" + shouldShowLocation + + ", isEmergencyNumber=" + + isEmergencyNumber + + ", isVoicemailNumber=" + + isVoicemailNumber + '}'; } } -- cgit v1.2.3