Loading java/com/android/dialer/calllog/ui/NewCallLogAdapter.java +19 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.view.LayoutInflater; import android.view.ViewGroup; import com.android.dialer.calllogutils.CallLogDates; import com.android.dialer.common.Assert; import com.android.dialer.logging.Logger; import com.android.dialer.time.Clock; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -53,6 +54,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; private final PopCounts popCounts = new PopCounts(); private Cursor cursor; Loading @@ -76,6 +78,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { void updateCursor(Cursor updatedCursor) { this.cursor = updatedCursor; this.realtimeRowProcessor.clearCache(); this.popCounts.reset(); setHeaderPositions(); notifyDataSetChanged(); Loading @@ -85,6 +88,10 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { this.realtimeRowProcessor.clearCache(); } void logMetrics(Context context) { Logger.get(context).logAnnotatedCallLogMetrics(popCounts.popped, popCounts.didNotPop); } private void setHeaderPositions() { // If there are no rows to display, set all header positions to null. if (!cursor.moveToFirst()) { Loading Loading @@ -138,7 +145,8 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.new_call_log_entry, viewGroup, false), clock, realtimeRowProcessor); realtimeRowProcessor, popCounts); default: throw Assert.createUnsupportedOperationFailException("Unsupported view type: " + viewType); } Loading Loading @@ -207,4 +215,14 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { } return cursor.getCount() + numberOfHeaders; } static class PopCounts { int popped; int didNotPop; private void reset() { popped = 0; didNotPop = 0; } } } java/com/android/dialer/calllog/ui/NewCallLogFragment.java +9 −0 Original line number Diff line number Diff line Loading @@ -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 public void onPause() { super.onPause(); Loading java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +9 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.widget.ImageView; import android.widget.TextView; 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.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogIntents; Loading Loading @@ -60,10 +61,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; private final ExecutorService uiExecutorService; private final PopCounts popCounts; private long currentRowId; NewCallLogViewHolder(View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor) { NewCallLogViewHolder( View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor, PopCounts popCounts) { super(view); this.context = view.getContext(); contactPhotoView = view.findViewById(R.id.contact_photo_view); Loading @@ -79,6 +82,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { this.clock = clock; this.realtimeRowProcessor = realtimeRowProcessor; this.popCounts = popCounts; uiExecutorService = DialerExecutorComponent.get(context).uiExecutor(); } Loading Loading @@ -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 // there's nothing to do. if (originalRow.getId() != currentRowId) { popCounts.didNotPop++; return; } // Only update the UI if the updated row differs from the original row (which has already // been displayed). if (!updatedRow.equals(originalRow)) { displayRow(updatedRow); popCounts.popped++; return; } popCounts.didNotPop++; } @Override Loading java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java +7 −1 Original line number Diff line number Diff line Loading @@ -198,8 +198,14 @@ public final class RealtimeRowProcessor { private CoalescedRow applyPhoneLookupInfoToRow( 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() .setNumberAttributes(NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo).build()) .setNumberAttributes( NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo) .setIsCp2InfoIncomplete(row.getNumberAttributes().getIsCp2InfoIncomplete()) .build()) .build(); } } java/com/android/dialer/logging/LoggingBindings.java +6 −0 Original line number Diff line number Diff line Loading @@ -90,4 +90,10 @@ public interface LoggingBindings { /** Logs a call auto-blocked in call screening. */ 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
java/com/android/dialer/calllog/ui/NewCallLogAdapter.java +19 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.view.LayoutInflater; import android.view.ViewGroup; import com.android.dialer.calllogutils.CallLogDates; import com.android.dialer.common.Assert; import com.android.dialer.logging.Logger; import com.android.dialer.time.Clock; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -53,6 +54,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; private final PopCounts popCounts = new PopCounts(); private Cursor cursor; Loading @@ -76,6 +78,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { void updateCursor(Cursor updatedCursor) { this.cursor = updatedCursor; this.realtimeRowProcessor.clearCache(); this.popCounts.reset(); setHeaderPositions(); notifyDataSetChanged(); Loading @@ -85,6 +88,10 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { this.realtimeRowProcessor.clearCache(); } void logMetrics(Context context) { Logger.get(context).logAnnotatedCallLogMetrics(popCounts.popped, popCounts.didNotPop); } private void setHeaderPositions() { // If there are no rows to display, set all header positions to null. if (!cursor.moveToFirst()) { Loading Loading @@ -138,7 +145,8 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.new_call_log_entry, viewGroup, false), clock, realtimeRowProcessor); realtimeRowProcessor, popCounts); default: throw Assert.createUnsupportedOperationFailException("Unsupported view type: " + viewType); } Loading Loading @@ -207,4 +215,14 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { } return cursor.getCount() + numberOfHeaders; } static class PopCounts { int popped; int didNotPop; private void reset() { popped = 0; didNotPop = 0; } } }
java/com/android/dialer/calllog/ui/NewCallLogFragment.java +9 −0 Original line number Diff line number Diff line Loading @@ -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 public void onPause() { super.onPause(); Loading
java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +9 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.widget.ImageView; import android.widget.TextView; 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.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogIntents; Loading Loading @@ -60,10 +61,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; private final ExecutorService uiExecutorService; private final PopCounts popCounts; private long currentRowId; NewCallLogViewHolder(View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor) { NewCallLogViewHolder( View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor, PopCounts popCounts) { super(view); this.context = view.getContext(); contactPhotoView = view.findViewById(R.id.contact_photo_view); Loading @@ -79,6 +82,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { this.clock = clock; this.realtimeRowProcessor = realtimeRowProcessor; this.popCounts = popCounts; uiExecutorService = DialerExecutorComponent.get(context).uiExecutor(); } Loading Loading @@ -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 // there's nothing to do. if (originalRow.getId() != currentRowId) { popCounts.didNotPop++; return; } // Only update the UI if the updated row differs from the original row (which has already // been displayed). if (!updatedRow.equals(originalRow)) { displayRow(updatedRow); popCounts.popped++; return; } popCounts.didNotPop++; } @Override Loading
java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java +7 −1 Original line number Diff line number Diff line Loading @@ -198,8 +198,14 @@ public final class RealtimeRowProcessor { private CoalescedRow applyPhoneLookupInfoToRow( 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() .setNumberAttributes(NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo).build()) .setNumberAttributes( NumberAttributesConverter.fromPhoneLookupInfo(phoneLookupInfo) .setIsCp2InfoIncomplete(row.getNumberAttributes().getIsCp2InfoIncomplete()) .build()) .build(); } }
java/com/android/dialer/logging/LoggingBindings.java +6 −0 Original line number Diff line number Diff line Loading @@ -90,4 +90,10 @@ public interface LoggingBindings { /** Logs a call auto-blocked in call screening. */ void logAutoBlockedCall(String phoneNumber); /** Logs annotated call log metrics. */ void logAnnotatedCallLogMetrics(int invalidNumbersInCallLog); /** Logs annotated call log metrics. */ void logAnnotatedCallLogMetrics(int numberRowsThatDidPop, int numberRowsThatDidNotPop); }