From 130b616419ea7e63c9a98dc7eacc73ff1add6b3a Mon Sep 17 00:00:00 2001 From: zachh Date: Mon, 5 Feb 2018 17:46:14 -0800 Subject: Don't set the "incomplete" bit for empty numbers. There will never be contact information for an empty number, so don't bother trying to look them up at render time. This also prevents a crash in the new voicemail fragment that occurs due to an assertion that voicemail rows will never be incomplete, when it may be possible for a voicemail to exist with an empty number. Also, don't set short numbers in VoicemailPopulator, since we don't expect this to be possible and would like to avoid crashing in the aforementioned assertion when using simulator. Test: unit PiperOrigin-RevId: 184615402 Change-Id: I5286112b57179e002f04de81c04475f30b3e1833 --- .../dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/phonelookup') diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java index 95b14a41d..e051f473c 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java @@ -495,10 +495,18 @@ public final class Cp2LocalPhoneLookup implements PhoneLookup { } else if (deletedPhoneNumbers.contains(dialerPhoneNumber)) { infoBuilder.clear(); } else if (unprocessableNumbers.contains(dialerPhoneNumber)) { - // Don't clear the existing info when the number is unprocessable. It's - // likely that the existing info is up-to-date so keep it in place so that - // the UI doesn't pop when the query is completed at display time. - infoBuilder.setIsIncomplete(true); + // Don't ever set the "incomplete" bit for numbers which are empty; this + // causes unnecessary render time work because there will never be contact + // information for an empty number. It is also required to pass the + // assertion check in the new voicemail fragment, which verifies that no + // voicemails rows are considered "incomplete" (the voicemail fragment + // does not have the ability to fetch information at render time). + if (!dialerPhoneNumber.getNormalizedNumber().isEmpty()) { + // Don't clear the existing info when the number is unprocessable. It's + // likely that the existing info is up-to-date so keep it in place so + // that the UI doesn't pop when the query is completed at display time. + infoBuilder.setIsIncomplete(true); + } } // If the DialerPhoneNumber didn't change, add the unchanged existing info. -- cgit v1.2.3