diff options
author | Eric Erfanian <erfanian@google.com> | 2017-08-31 06:57:16 -0700 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2017-09-04 18:05:19 +0100 |
commit | fc0eb8ccebcc7846db5e8b5c5430070055679bfa (patch) | |
tree | a8a23c3202e4161ffd57a71095a404db1bcf5735 /java/com/android/dialer/calllog/datasources/util/RowCombiner.java | |
parent | ea7b4dc89590ffa3332766a531e0eab6ffb9aebd (diff) |
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google
source control system and only exported to public during AOSP drops.
The Dialer team is now switching to a public development model similar
to the telephony team.
This CL represents all internal Google changes that were committed to
Dialer between the public O release and today's tip of tree on internal
master. This CL squashes those changes into a single commit.
In subsequent changes, changes will be exported on a per-commit basis.
(cherry picked from commit 2ca4318cc1ee57dda907ba2069bd61d162b1baef
and amended to match paths of dependencies under
prebuilts/maven_repo/bumptech/com/github/bumptech/glide/.)
This CL was generated using these commands from a repository at
stage-stage-master at revision ea7b4dc89590ffa3332766a531e0eab6ffb9aebd
("Merge "Update Dialer source to latest internal Google revision." am: c39ea3c55f -s ours"):
git diff --binary 2ca4318cc1ee57dda907ba2069bd61d162b1baef | git apply -R --index
git commit -c 2ca4318cc1ee57dda907ba2069bd61d162b1baef
Test: make, flash install, run
Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8
PiperOrigin-RevId: 167068436
Diffstat (limited to 'java/com/android/dialer/calllog/datasources/util/RowCombiner.java')
-rw-r--r-- | java/com/android/dialer/calllog/datasources/util/RowCombiner.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java index 0c7be1e27..adb7a0742 100644 --- a/java/com/android/dialer/calllog/datasources/util/RowCombiner.java +++ b/java/com/android/dialer/calllog/datasources/util/RowCombiner.java @@ -19,6 +19,7 @@ import android.content.ContentValues; import com.android.dialer.common.Assert; import java.util.Iterator; import java.util.List; +import java.util.Objects; /** Convenience class for aggregating row values. */ public class RowCombiner { @@ -36,12 +37,31 @@ public class RowCombiner { return this; } + /** Use the most recent value for the specified column. */ + public RowCombiner useMostRecentString(String columnName) { + combinedRow.put(columnName, individualRowsSortedByTimestampDesc.get(0).getAsString(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(); String singleValue = iterator.next().getAsString(columnName); while (iterator.hasNext()) { - Assert.checkState(iterator.next().getAsString(columnName).equals(singleValue)); + String current = iterator.next().getAsString(columnName); + Assert.checkState(Objects.equals(singleValue, current), "Values different for " + columnName); + } + combinedRow.put(columnName, singleValue); + return this; + } + + /** Asserts that all column values for the given column name are the same, and uses it. */ + public RowCombiner useSingleValueLong(String columnName) { + Iterator<ContentValues> iterator = individualRowsSortedByTimestampDesc.iterator(); + Long singleValue = iterator.next().getAsLong(columnName); + while (iterator.hasNext()) { + Long current = iterator.next().getAsLong(columnName); + Assert.checkState(Objects.equals(singleValue, current), "Values different for " + columnName); } combinedRow.put(columnName, singleValue); return this; |