summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-10-07 17:49:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-07 17:49:35 +0000
commita0a08083e2f21ec45ef40064687b550b9af6a388 (patch)
tree06ccd13e98268af765d849850504d04d4454ce23 /src
parente9c8233a77d6daa5374e146e1c871e000d7657e4 (diff)
parent42e25341043525b7f9bc991dfe1afba7846b4f5f (diff)
Merge "Group blocked calls separately in call log." into ub-contactsdialer-a-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogGroupBuilder.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/com/android/dialer/calllog/CallLogGroupBuilder.java b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
index 4cf2d07cd..5eea096b8 100644
--- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java
+++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
@@ -24,6 +24,7 @@ import android.text.TextUtils;
import com.android.contacts.common.util.DateUtils;
import com.android.contacts.common.util.PhoneNumberHelper;
+import com.android.dialer.util.AppCompatConstants;
import com.google.common.annotations.VisibleForTesting;
@@ -145,10 +146,11 @@ public class CallLogGroupBuilder {
final boolean isSameAccount = isSameAccount(
groupAccountComponentName, accountComponentName, groupAccountId, accountId);
- // Group with the same number and account which are not voicemail.
- if (isSameNumber && isSameAccount
- && (callType != Calls.VOICEMAIL_TYPE)
- && (groupCallType != Calls.VOICEMAIL_TYPE)) {
+ // Group with the same number and account. Never group voicemails. Only group blocked
+ // calls with other blocked calls.
+ if (isSameNumber && isSameAccount && areBothNotVoicemail(callType, groupCallType)
+ && (areBothNotBlocked(callType, groupCallType)
+ || areBothBlocked(callType, groupCallType))) {
// Increment the size of the group to include the current call, but do not create
// the group until finding a call that does not match.
groupSize++;
@@ -240,4 +242,19 @@ public class CallLogGroupBuilder {
return DAY_GROUP_OTHER;
}
}
+
+ private boolean areBothNotVoicemail(int callType, int groupCallType) {
+ return callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE
+ && groupCallType != AppCompatConstants.CALLS_VOICEMAIL_TYPE;
+ }
+
+ private boolean areBothNotBlocked(int callType, int groupCallType) {
+ return callType != AppCompatConstants.CALLS_BLOCKED_TYPE
+ && groupCallType != AppCompatConstants.CALLS_BLOCKED_TYPE;
+ }
+
+ private boolean areBothBlocked(int callType, int groupCallType) {
+ return callType == AppCompatConstants.CALLS_BLOCKED_TYPE
+ && groupCallType == AppCompatConstants.CALLS_BLOCKED_TYPE;
+ }
}