summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-02-12 09:58:34 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-14 17:47:47 -0800
commit86135a2f4d9b6dc5facf5e33e554c23a31824c41 (patch)
tree0947e18c2998df21d07ca68fceff35fae87185cd /java/com/android/dialer/calllog
parent70f98d3997c42c7d4e3b3e3920659aca78820d14 (diff)
Add bottom sheet options for blocked and/or spam numbers in the new call log.
Bug: 70989605 Test: ModulesTest PiperOrigin-RevId: 185392711 Change-Id: I709a1e307925f1c99d2740ed52dc2b7784bca986
Diffstat (limited to 'java/com/android/dialer/calllog')
-rw-r--r--java/com/android/dialer/calllog/ui/menu/Modules.java39
1 files changed, 29 insertions, 10 deletions
diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java
index d59155810..c85a9fddd 100644
--- a/java/com/android/dialer/calllog/ui/menu/Modules.java
+++ b/java/com/android/dialer/calllog/ui/menu/Modules.java
@@ -52,15 +52,8 @@ final class Modules {
if (canPlaceCalls) {
addModuleForVideoOrAudioCall(context, modules, row, normalizedNumber);
-
- SharedModules.maybeAddModuleForAddingToContacts(
- context,
- modules,
- row.number(),
- row.numberAttributes().getName(),
- row.numberAttributes().getLookupUri());
-
- SharedModules.maybeAddModuleForSendingTextMessage(context, modules, normalizedNumber);
+ SharedModules.maybeAddModuleForSendingTextMessage(
+ context, modules, normalizedNumber, row.numberAttributes().getIsBlocked());
}
if (!modules.isEmpty()) {
@@ -68,10 +61,23 @@ final class Modules {
}
- // TODO(zachh): Module for blocking/unblocking spam.
// TODO(zachh): Module for CallComposer.
if (canPlaceCalls) {
+ SharedModules.maybeAddModuleForAddingToContacts(
+ context,
+ modules,
+ row.number(),
+ row.numberAttributes().getName(),
+ row.numberAttributes().getLookupUri(),
+ row.numberAttributes().getIsBlocked(),
+ row.numberAttributes().getIsSpam());
+ SharedModules.addModulesHandlingBlockedOrSpamNumber(
+ context,
+ modules,
+ normalizedNumber,
+ row.numberAttributes().getIsBlocked(),
+ row.numberAttributes().getIsSpam());
SharedModules.maybeAddModuleForCopyingNumber(context, modules, normalizedNumber);
}
@@ -89,10 +95,23 @@ final class Modules {
List<ContactActionModule> modules,
CoalescedRow row,
String normalizedNumber) {
+ // If a number is blocked, skip this menu item.
+ if (row.numberAttributes().getIsBlocked()) {
+ return;
+ }
+
PhoneAccountHandle phoneAccountHandle =
TelecomUtil.composePhoneAccountHandle(
row.phoneAccountComponentName(), row.phoneAccountId());
+ // For a spam number, only audio calls are allowed.
+ if (row.numberAttributes().getIsSpam()) {
+ modules.add(
+ IntentModule.newCallModule(
+ context, normalizedNumber, phoneAccountHandle, CallInitiationType.Type.CALL_LOG));
+ return;
+ }
+
if ((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
// Add an audio call item for video calls. Clicking the top entry on the bottom sheet will
// trigger a video call.