Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 889a2204 authored by zachh's avatar zachh Committed by android-build-merger
Browse files

Merge changes I2123f37c,I56efda40

am: bc583a06

Change-Id: If4caad91bce1c63c6d0b4dbd97c843e605b42403
parents 146f6de7 bc583a06
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper {
          + (AnnotatedCallLog.TIMESTAMP + " integer, ")
          + (AnnotatedCallLog.NUMBER + " blob, ")
          + (AnnotatedCallLog.FORMATTED_NUMBER + " text, ")
          + (AnnotatedCallLog.NUMBER_PRESENTATION + " integer, ")
          + (AnnotatedCallLog.DURATION + " integer, ")
          + (AnnotatedCallLog.DATA_USAGE + " integer, ")
          + (AnnotatedCallLog.IS_READ + " integer, ")
+5 −0
Original line number Diff line number Diff line
@@ -156,6 +156,11 @@ public class Coalescer {
      return false;
    }

    if (!row1.getAsInteger(AnnotatedCallLog.NUMBER_PRESENTATION)
        .equals(row2.getAsInteger(AnnotatedCallLog.NUMBER_PRESENTATION))) {
      return false;
    }

    if (!meetsAssistedDialingCriteria(row1, row2)) {
      return false;
    }
+9 −1
Original line number Diff line number Diff line
@@ -58,6 +58,13 @@ public class AnnotatedCallLogContract {
     */
    String FORMATTED_NUMBER = "formatted_number";

    /**
     * See {@link android.provider.CallLog.Calls#NUMBER_PRESENTATION}.
     *
     * <p>Type: INTEGER (int)
     */
    String NUMBER_PRESENTATION = "presentation";

    /**
     * See {@link android.provider.CallLog.Calls#IS_READ}.
     *
@@ -136,6 +143,7 @@ public class AnnotatedCallLogContract {
          TIMESTAMP,
          NUMBER,
          FORMATTED_NUMBER,
          NUMBER_PRESENTATION,
          IS_READ,
          NEW,
          GEOCODED_LOCATION,
@@ -145,7 +153,7 @@ public class AnnotatedCallLogContract {
          PHONE_ACCOUNT_COLOR,
          FEATURES,
          NUMBER_ATTRIBUTES,
          CALL_TYPE,
          CALL_TYPE
        };
  }

+13 −2
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
        // recent one.
        .useMostRecentBlob(AnnotatedCallLog.NUMBER)
        .useMostRecentString(AnnotatedCallLog.FORMATTED_NUMBER)
        .useSingleValueInt(AnnotatedCallLog.NUMBER_PRESENTATION)
        .useMostRecentString(AnnotatedCallLog.GEOCODED_LOCATION)
        .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME)
        .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_ID)
@@ -239,6 +240,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
                  Calls.DATE,
                  Calls.LAST_MODIFIED, // TODO(a bug): Not available in M
                  Calls.NUMBER,
                  Calls.NUMBER_PRESENTATION,
                  Calls.TYPE,
                  Calls.COUNTRY_ISO,
                  Calls.DURATION,
@@ -251,7 +253,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
                  Calls.PHONE_ACCOUNT_COMPONENT_NAME,
                  Calls.PHONE_ACCOUNT_ID,
                  Calls.FEATURES,
                  Calls.POST_DIAL_DIGITS, // TODO(a bug): Not available in M
                  Calls.POST_DIAL_DIGITS // TODO(a bug): Not available in M
                },
                // TODO(a bug): LAST_MODIFIED not available on M
                Calls.LAST_MODIFIED + " > ? AND " + Voicemails.DELETED + " = 0",
@@ -273,6 +275,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
        int dateColumn = cursor.getColumnIndexOrThrow(Calls.DATE);
        int lastModifiedColumn = cursor.getColumnIndexOrThrow(Calls.LAST_MODIFIED);
        int numberColumn = cursor.getColumnIndexOrThrow(Calls.NUMBER);
        int presentationColumn = cursor.getColumnIndexOrThrow(Calls.NUMBER_PRESENTATION);
        int typeColumn = cursor.getColumnIndexOrThrow(Calls.TYPE);
        int countryIsoColumn = cursor.getColumnIndexOrThrow(Calls.COUNTRY_ISO);
        int durationsColumn = cursor.getColumnIndexOrThrow(Calls.DURATION);
@@ -295,11 +298,18 @@ public class SystemCallLogDataSource implements CallLogDataSource {
          long id = cursor.getLong(idColumn);
          long date = cursor.getLong(dateColumn);
          String numberAsStr = cursor.getString(numberColumn);
          long type;
          int type;
          if (cursor.isNull(typeColumn) || (type = cursor.getInt(typeColumn)) == 0) {
            // CallLog.Calls#TYPE lists the allowed values, which are non-null and non-zero.
            throw new IllegalStateException("call type is missing");
          }
          int presentation;
          if (cursor.isNull(presentationColumn)
              || (presentation = cursor.getInt(presentationColumn)) == 0) {
            // CallLog.Calls#NUMBER_PRESENTATION lists the allowed values, which are non-null and
            // non-zero.
            throw new IllegalStateException("presentation is missing");
          }
          String countryIso = cursor.getString(countryIsoColumn);
          int duration = cursor.getInt(durationsColumn);
          int dataUsage = cursor.getInt(dataUsageColumn);
@@ -333,6 +343,7 @@ public class SystemCallLogDataSource implements CallLogDataSource {
            contentValues.put(
                AnnotatedCallLog.NUMBER, DialerPhoneNumber.getDefaultInstance().toByteArray());
          }
          contentValues.put(AnnotatedCallLog.NUMBER_PRESENTATION, presentation);
          contentValues.put(AnnotatedCallLog.CALL_TYPE, type);
          contentValues.put(AnnotatedCallLog.IS_READ, isRead);
          contentValues.put(AnnotatedCallLog.NEW, isNew);
+12 −0
Original line number Diff line number Diff line
@@ -80,6 +80,18 @@ public class RowCombiner {
    return this;
  }

  /** Asserts that all column values for the given column name are the same, and uses it. */
  public RowCombiner useSingleValueInt(String columnName) {
    Iterator<ContentValues> iterator = individualRowsSortedByTimestampDesc.iterator();
    Integer singleValue = iterator.next().getAsInteger(columnName);
    while (iterator.hasNext()) {
      Integer current = iterator.next().getAsInteger(columnName);
      Assert.checkState(Objects.equals(singleValue, current), "Values different for " + columnName);
    }
    combinedRow.put(columnName, singleValue);
    return this;
  }

  /** Performs a bitwise OR on the specified column and yields the result. */
  public RowCombiner bitwiseOr(String columnName) {
    int combinedValue = 0;
Loading