Filter out unnecessary bottom sheet options for a call to a voicemail box.

Bug: 78476115
Test: HistoryItemActionModulesBuilderTest
PiperOrigin-RevId: 195319447
Change-Id: I7d431e74c2f4efe6ea3ce24b7d3ae42ebb4525b2
diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
index ca6d3f3..9af08be 100644
--- a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
+++ b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
@@ -115,7 +115,13 @@
   /**
    * Adds a module for a carrier video call *or* a Duo video call.
    *
-   * <p>If the number is blocked or marked as spam, this method is a no-op.
+   * <p>This method is a no-op if
+   *
+   * <ul>
+   *   <li>the call is one made to a voicemail box,
+   *   <li>the number is blocked, or
+   *   <li>the number is marked as spam.
+   * </ul>
    *
    * <p>If the provided module info is for a Duo video call and Duo is available, add a Duo video
    * call module.
@@ -132,7 +138,7 @@
    * capability, and Duo is available, add a Duo video call module.
    */
   public HistoryItemActionModulesBuilder addModuleForVideoCall() {
-    if (moduleInfo.getIsBlocked() || moduleInfo.getIsSpam()) {
+    if (moduleInfo.getIsVoicemailCall() || moduleInfo.getIsBlocked() || moduleInfo.getIsSpam()) {
       return this;
     }
 
@@ -169,12 +175,20 @@
   /**
    * Adds a module for sending text messages.
    *
-   * <p>The method is a no-op if the number is blocked or empty.
+   * <p>The method is a no-op if
+   *
+   * <ul>
+   *   <li>the call is one made to a voicemail box,
+   *   <li>the number is blocked, or
+   *   <li>the number is empty.
+   * </ul>
    */
   public HistoryItemActionModulesBuilder addModuleForSendingTextMessage() {
-    // TODO(zachh): There are other conditions where this module should not be shown; consider
-    // voicemail, business numbers, etc.
-    if (moduleInfo.getIsBlocked() || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) {
+    // TODO(zachh): There are other conditions where this module should not be shown
+    // (e.g., business numbers).
+    if (moduleInfo.getIsVoicemailCall()
+        || moduleInfo.getIsBlocked()
+        || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) {
       return this;
     }
 
@@ -203,6 +217,7 @@
    * <p>The method is a no-op if
    *
    * <ul>
+   *   <li>the call is one made to a voicemail box,
    *   <li>the number is blocked,
    *   <li>the number is marked as spam,
    *   <li>the number is empty, or
@@ -210,7 +225,8 @@
    * </ul>
    */
   public HistoryItemActionModulesBuilder addModuleForAddingToContacts() {
-    if (moduleInfo.getIsBlocked()
+    if (moduleInfo.getIsVoicemailCall()
+        || moduleInfo.getIsBlocked()
         || moduleInfo.getIsSpam()
         || isExistingContact()
         || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) {
@@ -237,6 +253,8 @@
   /**
    * Add modules for blocking/unblocking a number and/or marking it as spam/not spam.
    *
+   * <p>The method is a no-op if the call is one made to a voicemail box.
+   *
    * <p>If a number is marked as spam, add two modules:
    *
    * <ul>
@@ -249,6 +267,10 @@
    * <p>If a number is not blocked or marked as spam, add the "Block/Report spam" module.
    */
   public HistoryItemActionModulesBuilder addModuleForBlockedOrSpamNumber() {
+    if (moduleInfo.getIsVoicemailCall()) {
+      return this;
+    }
+
     BlockReportSpamDialogInfo blockReportSpamDialogInfo =
         BlockReportSpamDialogInfo.newBuilder()
             .setNormalizedNumber(moduleInfo.getNormalizedNumber())