summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/datasources
diff options
context:
space:
mode:
authorZachary Heidepriem <zachh@google.com>2017-10-11 16:03:06 -0700
committerZachary Heidepriem <zachh@google.com>2017-10-11 16:03:06 -0700
commita0df9f7f52b4d7f926581f30bd0a7774a6abac43 (patch)
treec83d8715c6c6ed61423c285bb71b8fe71e1bad5c /java/com/android/dialer/calllog/datasources
parent36a5f1a127ca18869cd25cef0315076591a0b518 (diff)
Added basic bottom sheet to new call log.
Also added ability to click on row to call. Required plumbing through the original phone number and phone account info through AnnotatedCallLog and CoalescedAnnotatedCallLog, so that clicking to dial doesn't require an additional lookup. Required some refactoring: -created autovalue for CoalescedRow. -created autovalue for ContactPrimaryActionInfo and use it in ContactActionBottomSheet -moved logic for building primary and secondary text into CallLogUtils so it can be shared between call log list and bottom sheets -moved clipboard logic to own package for copying numbers Bug: 34672501 Test: unit PiperOrigin-RevId: 171760252 Change-Id: I645d89974460b611c1d9668c3ca3e50a716c7f8f
Diffstat (limited to 'java/com/android/dialer/calllog/datasources')
-rw-r--r--java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java14
-rw-r--r--java/com/android/dialer/calllog/datasources/util/RowCombiner.java6
2 files changed, 20 insertions, 0 deletions
diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
index d6ad618b3..0a965f63e 100644
--- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
@@ -38,6 +38,7 @@ import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.ArraySet;
+import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
import com.android.dialer.calllog.datasources.CallLogDataSource;
import com.android.dialer.calllog.datasources.CallLogMutations;
@@ -156,11 +157,17 @@ public class SystemCallLogDataSource implements CallLogDataSource {
.useMostRecentLong(AnnotatedCallLog.NEW)
.useMostRecentString(AnnotatedCallLog.NUMBER_TYPE_LABEL)
.useMostRecentString(AnnotatedCallLog.NAME)
+ // Two different DialerPhoneNumbers could be combined if they are different but considered
+ // to be an "exact match" by libphonenumber; in this case we arbitrarily select the most
+ // recent one.
+ .useMostRecentBlob(AnnotatedCallLog.NUMBER)
.useMostRecentString(AnnotatedCallLog.FORMATTED_NUMBER)
.useMostRecentString(AnnotatedCallLog.PHOTO_URI)
.useMostRecentLong(AnnotatedCallLog.PHOTO_ID)
.useMostRecentString(AnnotatedCallLog.LOOKUP_URI)
.useMostRecentString(AnnotatedCallLog.GEOCODED_LOCATION)
+ .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME)
+ .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_ID)
.useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_LABEL)
.useSingleValueLong(AnnotatedCallLog.PHONE_ACCOUNT_COLOR)
.useMostRecentLong(AnnotatedCallLog.CALL_TYPE)
@@ -272,10 +279,14 @@ public class SystemCallLogDataSource implements CallLogDataSource {
dialerPhoneNumberUtil.parse(numberAsStr, countryIso).toByteArray();
// TODO(zachh): Need to handle post-dial digits; different on N and M.
contentValues.put(AnnotatedCallLog.NUMBER, numberAsProtoBytes);
+ } else {
+ contentValues.put(
+ AnnotatedCallLog.NUMBER, DialerPhoneNumber.getDefaultInstance().toByteArray());
}
contentValues.put(AnnotatedCallLog.CALL_TYPE, type);
contentValues.put(AnnotatedCallLog.NAME, cachedName);
+ // TODO(zachh): Format the number using DialerPhoneNumberUtil here.
contentValues.put(AnnotatedCallLog.FORMATTED_NUMBER, formattedNumber);
contentValues.put(AnnotatedCallLog.PHOTO_URI, cachedPhotoUri);
contentValues.put(AnnotatedCallLog.PHOTO_ID, cachedPhotoId);
@@ -292,6 +303,9 @@ public class SystemCallLogDataSource implements CallLogDataSource {
contentValues.put(AnnotatedCallLog.IS_READ, isRead);
contentValues.put(AnnotatedCallLog.NEW, isNew);
contentValues.put(AnnotatedCallLog.GEOCODED_LOCATION, geocodedLocation);
+ contentValues.put(
+ AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME, phoneAccountComponentName);
+ contentValues.put(AnnotatedCallLog.PHONE_ACCOUNT_ID, phoneAccountId);
populatePhoneAccountLabelAndColor(
appContext, contentValues, phoneAccountComponentName, phoneAccountId);
contentValues.put(AnnotatedCallLog.FEATURES, features);
diff --git a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java
index adb7a0742..8e9e9c659 100644
--- a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java
+++ b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java
@@ -43,6 +43,12 @@ public class RowCombiner {
return this;
}
+ public RowCombiner useMostRecentBlob(String columnName) {
+ combinedRow.put(
+ columnName, individualRowsSortedByTimestampDesc.get(0).getAsByteArray(columnName));
+ return this;
+ }
+
/** Asserts that all column values for the given column name are the same, and uses it. */
public RowCombiner useSingleValueString(String columnName) {
Iterator<ContentValues> iterator = individualRowsSortedByTimestampDesc.iterator();