diff options
author | zachh <zachh@google.com> | 2018-02-05 17:46:14 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-05 19:25:57 -0800 |
commit | 130b616419ea7e63c9a98dc7eacc73ff1add6b3a (patch) | |
tree | a0fe5041cc74a495fa6b18eb71e0c910da461538 /java | |
parent | 1407d25aa8f79e6ff5badc2ed8c234827c762a84 (diff) |
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
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/databasepopulator/VoicemailPopulator.java | 7 | ||||
-rw-r--r-- | java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java | 16 |
2 files changed, 12 insertions, 11 deletions
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java index 97f6b0a32..2300150f4 100644 --- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java +++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java @@ -72,13 +72,6 @@ public final class VoicemailPopulator { .setDurationSeconds(0) .setPhoneAccountComponentName(componentName) .setIsRead(true), - // Short number. - Voicemail.builder() - .setPhoneNumber("711") - .setTranscription("This is a short voicemail.") - .setDurationSeconds(12) - .setPhoneAccountComponentName(componentName) - .setIsRead(true), }; @WorkerThread 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<Cp2Info> { } 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. |