summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/datasources
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2017-10-03 17:27:01 -0700
committerEric Erfanian <erfanian@google.com>2017-10-04 08:18:36 -0700
commit5ee0b1e574ed93c7000e355e4a6b03fb9ed8aaba (patch)
treeade09fe638ed0dc2bf65bd64fa6d68a4e51a0b82 /java/com/android/dialer/calllog/datasources
parent01a964d7fbba63c670062ffca9a0ebe30cdcb1ff (diff)
Only show the most recent call type icon in the new call log, instead of the last 3.
This is according to the latest PRD: https://docs.google.com/document/d/1FLoQ6kNYL-QKplbniJAIUCHku87S9eYuYPs6IXe-U78 Also cleaned up warnings in CallLogQueryHandler. Screenshot: https://screenshot.googleplex.com/Z7p4BRVpLpE Bug: 34672501 Test: unit PiperOrigin-RevId: 170941445 Change-Id: Ibf79b70eda3837ea46d365729aaed0a87961e42b
Diffstat (limited to 'java/com/android/dialer/calllog/datasources')
-rw-r--r--java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java42
1 files changed, 15 insertions, 27 deletions
diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
index 1bdbb8a1b..d6ad618b3 100644
--- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
@@ -38,9 +38,7 @@ import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.ArraySet;
-import com.android.dialer.CallTypes;
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
-import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.CoalescedAnnotatedCallLog;
import com.android.dialer.calllog.datasources.CallLogDataSource;
import com.android.dialer.calllog.datasources.CallLogMutations;
import com.android.dialer.calllog.datasources.util.RowCombiner;
@@ -153,30 +151,20 @@ public class SystemCallLogDataSource implements CallLogDataSource {
@Override
public ContentValues coalesce(List<ContentValues> individualRowsSortedByTimestampDesc) {
// TODO(zachh): Complete implementation.
- ContentValues coalescedValues =
- new RowCombiner(individualRowsSortedByTimestampDesc)
- .useMostRecentLong(AnnotatedCallLog.TIMESTAMP)
- .useMostRecentLong(AnnotatedCallLog.NEW)
- .useMostRecentString(AnnotatedCallLog.NUMBER_TYPE_LABEL)
- .useMostRecentString(AnnotatedCallLog.NAME)
- .useMostRecentString(AnnotatedCallLog.FORMATTED_NUMBER)
- .useMostRecentString(AnnotatedCallLog.PHOTO_URI)
- .useMostRecentLong(AnnotatedCallLog.PHOTO_ID)
- .useMostRecentString(AnnotatedCallLog.LOOKUP_URI)
- .useMostRecentString(AnnotatedCallLog.GEOCODED_LOCATION)
- .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_LABEL)
- .useSingleValueLong(AnnotatedCallLog.PHONE_ACCOUNT_COLOR)
- .combine();
-
- CallTypes.Builder callTypes = CallTypes.newBuilder();
- // Store a maximum of 3 call types since that's all we show to users via icons.
- for (int i = 0; i < 3 && i < individualRowsSortedByTimestampDesc.size(); i++) {
- callTypes.addType(
- individualRowsSortedByTimestampDesc.get(i).getAsInteger(AnnotatedCallLog.TYPE));
- }
- coalescedValues.put(CoalescedAnnotatedCallLog.CALL_TYPES, callTypes.build().toByteArray());
-
- return coalescedValues;
+ return new RowCombiner(individualRowsSortedByTimestampDesc)
+ .useMostRecentLong(AnnotatedCallLog.TIMESTAMP)
+ .useMostRecentLong(AnnotatedCallLog.NEW)
+ .useMostRecentString(AnnotatedCallLog.NUMBER_TYPE_LABEL)
+ .useMostRecentString(AnnotatedCallLog.NAME)
+ .useMostRecentString(AnnotatedCallLog.FORMATTED_NUMBER)
+ .useMostRecentString(AnnotatedCallLog.PHOTO_URI)
+ .useMostRecentLong(AnnotatedCallLog.PHOTO_ID)
+ .useMostRecentString(AnnotatedCallLog.LOOKUP_URI)
+ .useMostRecentString(AnnotatedCallLog.GEOCODED_LOCATION)
+ .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_LABEL)
+ .useSingleValueLong(AnnotatedCallLog.PHONE_ACCOUNT_COLOR)
+ .useMostRecentLong(AnnotatedCallLog.CALL_TYPE)
+ .combine();
}
@TargetApi(Build.VERSION_CODES.M) // Uses try-with-resources
@@ -286,7 +274,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
contentValues.put(AnnotatedCallLog.NUMBER, numberAsProtoBytes);
}
- contentValues.put(AnnotatedCallLog.TYPE, type);
+ contentValues.put(AnnotatedCallLog.CALL_TYPE, type);
contentValues.put(AnnotatedCallLog.NAME, cachedName);
contentValues.put(AnnotatedCallLog.FORMATTED_NUMBER, formattedNumber);
contentValues.put(AnnotatedCallLog.PHOTO_URI, cachedPhotoUri);