summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-10-02 16:47:57 -0700
committerAndrew Lee <anwlee@google.com>2015-10-03 15:54:49 -0700
commit42e25341043525b7f9bc991dfe1afba7846b4f5f (patch)
treec051ddacfd9e059dd9fe645be3460a3903391095 /src/com/android
parentea0742761c5511a713b43af16d4abd1a9059dcd8 (diff)
Group blocked calls separately in call log.
+ Group blocked calls separately from other call types, but group adjacent blocked calls together. + Add unit tests. Bug: 23943480 Change-Id: Iffe6fac800007f6b88e0feb15d91c63515e496f8
Diffstat (limited to 'src/com/android')
-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;
+ }
}