diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-03 02:41:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-03 02:41:22 +0000 |
commit | 15fd7535818344e905745b390a1b4098ca4d2cf1 (patch) | |
tree | 484de8c21bcfd61f299013a318d915cd2f29bcb1 /java/com/android/dialer/calllog | |
parent | ae140ba6eee4164f6856d33635cc15414c2db40b (diff) | |
parent | f212de674ed1678aa35a5c72e041e82e1f38dce6 (diff) |
Merge "Add assisted dialing to the new call log."
Diffstat (limited to 'java/com/android/dialer/calllog')
4 files changed, 39 insertions, 1 deletions
diff --git a/java/com/android/dialer/calllog/database/Coalescer.java b/java/com/android/dialer/calllog/database/Coalescer.java index 71052b907..f4ef02a25 100644 --- a/java/com/android/dialer/calllog/database/Coalescer.java +++ b/java/com/android/dialer/calllog/database/Coalescer.java @@ -29,6 +29,7 @@ import com.android.dialer.calllog.datasources.CallLogDataSource; import com.android.dialer.calllog.datasources.DataSources; import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.common.Assert; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.phonenumberproto.DialerPhoneNumberUtil; import com.google.common.base.Preconditions; import com.google.i18n.phonenumbers.PhoneNumberUtil; @@ -171,10 +172,31 @@ public class Coalescer { // An empty number should not be combined with any other number. return false; } + + if (!meetsAssistedDialingCriteria(row1, row2)) { + return false; + } return dialerPhoneNumberUtil.isExactMatch(number1, number2); } /** + * Returns a boolean indicating whether or not FEATURES_ASSISTED_DIALING is mutually exclusive + * between two rows. + */ + private static boolean meetsAssistedDialingCriteria(ContentValues row1, ContentValues row2) { + int row1Assisted = + row1.getAsInteger(AnnotatedCallLog.FEATURES) + & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING; + int row2Assisted = + row2.getAsInteger(AnnotatedCallLog.FEATURES) + & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING; + + // FEATURES_ASSISTED_DIALING should not be combined with calls that are + // !FEATURES_ASSISTED_DIALING + return row1Assisted == row2Assisted; + } + + /** * Delegates to data sources to aggregate individual columns to create a new coalesced row. * * @param individualRows {@link AnnotatedCallLog} rows sorted by timestamp descending diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java index 95fbf9d04..5edc46a0a 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -199,6 +199,9 @@ public class SystemCallLogDataSource implements CallLogDataSource { .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_LABEL) .useSingleValueLong(AnnotatedCallLog.PHONE_ACCOUNT_COLOR) .useMostRecentLong(AnnotatedCallLog.CALL_TYPE) + // If any call in a group includes a feature (like Wifi/HD), consider the group to have the + // feature. + .bitwiseOr(AnnotatedCallLog.FEATURES) .combine(); } diff --git a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java index 8e9e9c659..ebb1ba665 100644 --- a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java +++ b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java @@ -73,6 +73,16 @@ public class RowCombiner { return this; } + /** Performs a bitwise OR on the specified column and yields the result. */ + public RowCombiner bitwiseOr(String columnName) { + int combinedValue = 0; + for (ContentValues val : individualRowsSortedByTimestampDesc) { + combinedValue |= val.getAsInteger(columnName); + } + combinedRow.put(columnName, combinedValue); + return this; + } + public ContentValues combine() { return combinedRow; } diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 629a9a289..e45257f7b 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -30,6 +30,7 @@ import com.android.dialer.calllog.ui.menu.NewCallLogMenu; import com.android.dialer.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogIntents; import com.android.dialer.calllogutils.CallTypeIconsView; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.oem.MotorolaUtils; @@ -114,11 +115,13 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } private void setPrimaryCallTypes(CoalescedRow row) { - // Only HD and Wifi icons are shown following the primary text. primaryCallTypeIconsView.setShowHd( (row.features() & Calls.FEATURES_HD_CALL) == Calls.FEATURES_HD_CALL); primaryCallTypeIconsView.setShowWifi( MotorolaUtils.shouldShowWifiIconInCallLog(context, row.features())); + primaryCallTypeIconsView.setShowAssistedDialed( + (row.features() & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING) + == TelephonyManagerCompat.FEATURES_ASSISTED_DIALING); } private void setSecondaryCallTypes(CoalescedRow row) { |