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
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
index 97f6b0a..2300150 100644
--- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
+++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
@@ -72,13 +72,6 @@
         .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 95b14a4..e051f47 100644
--- a/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java
@@ -495,10 +495,18 @@
                         } 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.