From 849f332ffa5fc9430c4bc38c5a0ee78da77f0a39 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 24 Jan 2018 18:15:17 -0800 Subject: Add skeleton for SpamPhoneLookup Bug: 70989534 Test: SpamPhoneLookupTest PiperOrigin-RevId: 183174131 Change-Id: I46e819a0710ccce293195594e2f249e91d74551a --- .../calllog/database/AnnotatedCallLogContentProvider.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'java/com/android/dialer/calllog') diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java index 2427624a4..77de62ea4 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java @@ -75,7 +75,6 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { } private AnnotatedCallLogDatabaseHelper databaseHelper; - private Coalescer coalescer; private final ThreadLocal applyingBatch = new ThreadLocal<>(); @@ -87,7 +86,12 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { @Override public boolean onCreate() { databaseHelper = new AnnotatedCallLogDatabaseHelper(getContext(), MAX_ROWS); - coalescer = CallLogDatabaseComponent.get(getContext()).coalescer(); + + // Note: As this method is called before Application#onCreate, we must *not* initialize objects + // that require preparation work done in Application#onCreate. + // One example is to avoid obtaining an instance that depends on Google's proprietary config, + // which is initialized in Application#onCreate. + return true; } @@ -158,7 +162,10 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { null, null, AnnotatedCallLog.TIMESTAMP + " DESC")) { - Cursor coalescedRows = coalescer.coalesce(allAnnotatedCallLogRows); + Cursor coalescedRows = + CallLogDatabaseComponent.get(getContext()) + .coalescer() + .coalesce(allAnnotatedCallLogRows); coalescedRows.setNotificationUri( getContext().getContentResolver(), CoalescedAnnotatedCallLog.CONTENT_URI); return coalescedRows; -- cgit v1.2.3