From e62700865987d7a46c8d51d7be1144282194c94f Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 3 May 2018 15:18:04 -0700 Subject: Filter out unnecessary bottom sheet options for a call to a voicemail box. Bug: 78476115 Test: HistoryItemActionModulesBuilderTest PiperOrigin-RevId: 195319447 Change-Id: I7d431e74c2f4efe6ea3ce24b7d3ae42ebb4525b2 --- .../HistoryItemActionModulesBuilder.java | 36 +++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java index ca6d3f3e4..9af08be50 100644 --- a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java +++ b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java @@ -115,7 +115,13 @@ public final class HistoryItemActionModulesBuilder { /** * Adds a module for a carrier video call *or* a Duo video call. * - *

If the number is blocked or marked as spam, this method is a no-op. + *

This method is a no-op if + * + *

* *

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 @@ public final class HistoryItemActionModulesBuilder { * 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 @@ public final class HistoryItemActionModulesBuilder { /** * Adds a module for sending text messages. * - *

The method is a no-op if the number is blocked or empty. + *

The method is a no-op if + * + *

*/ 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 @@ public final class HistoryItemActionModulesBuilder { *

The method is a no-op if * *

*/ public HistoryItemActionModulesBuilder addModuleForAddingToContacts() { - if (moduleInfo.getIsBlocked() + if (moduleInfo.getIsVoicemailCall() + || moduleInfo.getIsBlocked() || moduleInfo.getIsSpam() || isExistingContact() || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) { @@ -237,6 +253,8 @@ public final class HistoryItemActionModulesBuilder { /** * Add modules for blocking/unblocking a number and/or marking it as spam/not spam. * + *

The method is a no-op if the call is one made to a voicemail box. + * *

If a number is marked as spam, add two modules: * *