diff options
author | wangqi <wangqi@google.com> | 2017-07-26 16:52:18 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-27 07:27:46 -0700 |
commit | fa4f202fe194280a93b68e639228fa2d2097a55f (patch) | |
tree | ea1e864eb1cecd9c6f5554b21efbb92b3ec1d546 | |
parent | c478adc7ff6a54b9a3fb3de9527d17584c0aa008 (diff) |
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
-rw-r--r-- | java/com/android/incallui/ContactInfoCache.java | 24 |
1 files changed, 21 insertions, 3 deletions
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 + '}'; } } |