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

Commit ff88f7bb authored by zachh's avatar zachh Committed by Copybara-Service
Browse files

Added RealtimeRowProcessor.

This is for performing work inside of the call log's RecyclerView, when the view holder is bound. Most of the time, this should be a no-op but there are possible edge cases where the call log data cannot be updated efficiently through the standard batch mechanism.

One example of this is when there are too many invalid numbers in the call log; the CP2 information for invalid numbers cannot be efficiently batch updated so we fetch this information at display time. (Note that we do handle up to 5 invalid numbers in the batch update mechanism, but if there are more than that we fallback to this realtime processing.)

Test: unit, manual
PiperOrigin-RevId: 181400016
Change-Id: Iea6b380742e757b48d19f319fe46dc5fae837604
parent 9f8d0676
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.dialer.binary.basecomponent;

import com.android.dialer.calllog.CallLogComponent;
import com.android.dialer.calllog.database.CallLogDatabaseComponent;
import com.android.dialer.calllog.ui.CallLogUiComponent;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.configprovider.ConfigProviderComponent;
import com.android.dialer.duo.DuoComponent;
@@ -44,6 +45,7 @@ public interface BaseDialerRootComponent
    extends CallLocationComponent.HasComponent,
        CallLogComponent.HasComponent,
        CallLogDatabaseComponent.HasComponent,
        CallLogUiComponent.HasComponent,
        ConfigProviderComponent.HasComponent,
        DialerExecutorComponent.HasComponent,
        DuoComponent.HasComponent,
+2 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper {
          + (AnnotatedCallLog.TRANSCRIPTION + " integer, ")
          + (AnnotatedCallLog.VOICEMAIL_URI + " text, ")
          + (AnnotatedCallLog.CALL_TYPE + " integer, ")
          + (AnnotatedCallLog.CAN_REPORT_AS_INVALID_NUMBER + " integer")
          + (AnnotatedCallLog.CAN_REPORT_AS_INVALID_NUMBER + " integer, ")
          + (AnnotatedCallLog.CP2_INFO_INCOMPLETE + " integer")
          + ");";

  /** Deletes all but the first maxRows rows (by timestamp) to keep the table a manageable size. */
+9 −1
Original line number Diff line number Diff line
@@ -185,6 +185,13 @@ public class AnnotatedCallLogContract {
     */
    String CAN_REPORT_AS_INVALID_NUMBER = "can_report_as_invalid_number";

    /**
     * True if the CP2 information is incomplete and needs to be queried at display time.
     *
     * <p>TYPE: INTEGER (boolean)
     */
    String CP2_INFO_INCOMPLETE = "cp2_info_incomplete";

    String[] ALL_COMMON_COLUMNS =
        new String[] {
          _ID,
@@ -207,7 +214,8 @@ public class AnnotatedCallLogContract {
          IS_BUSINESS,
          IS_VOICEMAIL,
          CALL_TYPE,
          CAN_REPORT_AS_INVALID_NUMBER
          CAN_REPORT_AS_INVALID_NUMBER,
          CP2_INFO_INCOMPLETE
        };
  }

+3 −0
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ public final class PhoneLookupDataSource
        .useMostRecentLong(AnnotatedCallLog.PHOTO_ID)
        .useMostRecentString(AnnotatedCallLog.LOOKUP_URI)
        .useMostRecentInt(AnnotatedCallLog.CAN_REPORT_AS_INVALID_NUMBER)
        .useMostRecentInt(AnnotatedCallLog.CP2_INFO_INCOMPLETE)
        .combine();
  }

@@ -582,6 +583,8 @@ public final class PhoneLookupDataSource
    contentValues.put(
        AnnotatedCallLog.CAN_REPORT_AS_INVALID_NUMBER,
        PhoneLookupSelector.canReportAsInvalidNumber(phoneLookupInfo));
    contentValues.put(
        AnnotatedCallLog.CP2_INFO_INCOMPLETE, phoneLookupInfo.getCp2Info().getIsIncomplete());
  }

  private static Uri numberUri(String number) {
+7 −0
Original line number Diff line number Diff line
@@ -40,9 +40,12 @@ public abstract class CoalescedRow {
        .setIsVoicemail(false)
        .setCallType(0)
        .setCanReportAsInvalidNumber(false)
        .setCp2InfoIncomplete(false)
        .setCoalescedIds(CoalescedIds.getDefaultInstance());
  }

  public abstract Builder toBuilder();

  public abstract int id();

  public abstract long timestamp();
@@ -95,6 +98,8 @@ public abstract class CoalescedRow {

  public abstract boolean canReportAsInvalidNumber();

  public abstract boolean cp2InfoIncomplete();

  public abstract CoalescedIds coalescedIds();

  /** Builder for {@link CoalescedRow}. */
@@ -144,6 +149,8 @@ public abstract class CoalescedRow {

    public abstract Builder setCanReportAsInvalidNumber(boolean canReportAsInvalidNumber);

    public abstract Builder setCp2InfoIncomplete(boolean cp2InfoIncomplete);

    public abstract Builder setCoalescedIds(CoalescedIds coalescedIds);

    public abstract CoalescedRow build();
Loading