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

Commit 0fd0f1e8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I47f1e487,I715a97ba,Idb424831

* changes:
  Added logging for popping in new call log.
  Move update color code from CallCardPresenter to InCallPresenter.
  Log the number of "invalid" CP2 rows.
parents 42d9822a df36d8f1
Loading
Loading
Loading
Loading
+19 −1
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.view.ViewGroup;
import com.android.dialer.calllogutils.CallLogDates;
import com.android.dialer.calllogutils.CallLogDates;
import com.android.dialer.common.Assert;
import com.android.dialer.common.Assert;
import com.android.dialer.logging.Logger;
import com.android.dialer.time.Clock;
import com.android.dialer.time.Clock;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -53,6 +54,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {


  private final Clock clock;
  private final Clock clock;
  private final RealtimeRowProcessor realtimeRowProcessor;
  private final RealtimeRowProcessor realtimeRowProcessor;
  private final PopCounts popCounts = new PopCounts();


  private Cursor cursor;
  private Cursor cursor;


@@ -76,6 +78,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
  void updateCursor(Cursor updatedCursor) {
  void updateCursor(Cursor updatedCursor) {
    this.cursor = updatedCursor;
    this.cursor = updatedCursor;
    this.realtimeRowProcessor.clearCache();
    this.realtimeRowProcessor.clearCache();
    this.popCounts.reset();


    setHeaderPositions();
    setHeaderPositions();
    notifyDataSetChanged();
    notifyDataSetChanged();
@@ -85,6 +88,10 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
    this.realtimeRowProcessor.clearCache();
    this.realtimeRowProcessor.clearCache();
  }
  }


  void logMetrics(Context context) {
    Logger.get(context).logAnnotatedCallLogMetrics(popCounts.popped, popCounts.didNotPop);
  }

  private void setHeaderPositions() {
  private void setHeaderPositions() {
    // If there are no rows to display, set all header positions to null.
    // If there are no rows to display, set all header positions to null.
    if (!cursor.moveToFirst()) {
    if (!cursor.moveToFirst()) {
@@ -138,7 +145,8 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
            LayoutInflater.from(viewGroup.getContext())
            LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.new_call_log_entry, viewGroup, false),
                .inflate(R.layout.new_call_log_entry, viewGroup, false),
            clock,
            clock,
            realtimeRowProcessor);
            realtimeRowProcessor,
            popCounts);
      default:
      default:
        throw Assert.createUnsupportedOperationFailException("Unsupported view type: " + viewType);
        throw Assert.createUnsupportedOperationFailException("Unsupported view type: " + viewType);
    }
    }
@@ -207,4 +215,14 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
    }
    }
    return cursor.getCount() + numberOfHeaders;
    return cursor.getCount() + numberOfHeaders;
  }
  }

  static class PopCounts {
    int popped;
    int didNotPop;

    private void reset() {
      popped = 0;
      didNotPop = 0;
    }
  }
}
}
+9 −0
Original line number Original line Diff line number Diff line
@@ -88,6 +88,15 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback
    }
    }
  }
  }


  @Override
  public void onStop() {
    super.onStop();

    if (recyclerView.getAdapter() != null) {
      ((NewCallLogAdapter) recyclerView.getAdapter()).logMetrics(getContext());
    }
  }

  @Override
  @Override
  public void onPause() {
  public void onPause() {
    super.onPause();
    super.onPause();
+9 −1
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TextView;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.calllog.ui.NewCallLogAdapter.PopCounts;
import com.android.dialer.calllog.ui.menu.NewCallLogMenu;
import com.android.dialer.calllog.ui.menu.NewCallLogMenu;
import com.android.dialer.calllogutils.CallLogEntryText;
import com.android.dialer.calllogutils.CallLogEntryText;
import com.android.dialer.calllogutils.CallLogIntents;
import com.android.dialer.calllogutils.CallLogIntents;
@@ -60,10 +61,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
  private final Clock clock;
  private final Clock clock;
  private final RealtimeRowProcessor realtimeRowProcessor;
  private final RealtimeRowProcessor realtimeRowProcessor;
  private final ExecutorService uiExecutorService;
  private final ExecutorService uiExecutorService;
  private final PopCounts popCounts;


  private long currentRowId;
  private long currentRowId;


  NewCallLogViewHolder(View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor) {
  NewCallLogViewHolder(
      View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor, PopCounts popCounts) {
    super(view);
    super(view);
    this.context = view.getContext();
    this.context = view.getContext();
    contactPhotoView = view.findViewById(R.id.contact_photo_view);
    contactPhotoView = view.findViewById(R.id.contact_photo_view);
@@ -79,6 +82,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {


    this.clock = clock;
    this.clock = clock;
    this.realtimeRowProcessor = realtimeRowProcessor;
    this.realtimeRowProcessor = realtimeRowProcessor;
    this.popCounts = popCounts;
    uiExecutorService = DialerExecutorComponent.get(context).uiExecutor();
    uiExecutorService = DialerExecutorComponent.get(context).uiExecutor();
  }
  }


@@ -258,13 +262,17 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
      // If the user scrolled then this ViewHolder may not correspond to the completed task and
      // If the user scrolled then this ViewHolder may not correspond to the completed task and
      // there's nothing to do.
      // there's nothing to do.
      if (originalRow.getId() != currentRowId) {
      if (originalRow.getId() != currentRowId) {
        popCounts.didNotPop++;
        return;
        return;
      }
      }
      // Only update the UI if the updated row differs from the original row (which has already
      // Only update the UI if the updated row differs from the original row (which has already
      // been displayed).
      // been displayed).
      if (!updatedRow.equals(originalRow)) {
      if (!updatedRow.equals(originalRow)) {
        displayRow(updatedRow);
        displayRow(updatedRow);
        popCounts.popped++;
        return;
      }
      }
      popCounts.didNotPop++;
    }
    }


    @Override
    @Override
+7 −1
Original line number Original line Diff line number Diff line
@@ -198,8 +198,14 @@ public final class RealtimeRowProcessor {


  private CoalescedRow applyPhoneLookupInfoToRow(
  private CoalescedRow applyPhoneLookupInfoToRow(
      PhoneLookupInfo phoneLookupInfo, CoalescedRow row) {
      PhoneLookupInfo phoneLookupInfo, CoalescedRow row) {
    // Force the "cp2_info_incomplete" value to the original value so that it is not used when
    // comparing the original row to the updated row.
    // TODO(linyuh): Improve the comparison instead.
    return row.toBuilder()
    return row.toBuilder()
        .setNumberAttributes(NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo).build())
        .setNumberAttributes(
            NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo)
                .setIsCp2InfoIncomplete(row.getNumberAttributes().getIsCp2InfoIncomplete())
                .build())
        .build();
        .build();
  }
  }
}
}
+6 −0
Original line number Original line Diff line number Diff line
@@ -90,4 +90,10 @@ public interface LoggingBindings {


  /** Logs a call auto-blocked in call screening. */
  /** Logs a call auto-blocked in call screening. */
  void logAutoBlockedCall(String phoneNumber);
  void logAutoBlockedCall(String phoneNumber);

  /** Logs annotated call log metrics. */
  void logAnnotatedCallLogMetrics(int invalidNumbersInCallLog);

  /** Logs annotated call log metrics. */
  void logAnnotatedCallLogMetrics(int numberRowsThatDidPop, int numberRowsThatDidNotPop);
}
}
Loading