Switch to AsyncQueryHandler to NoNullAsyncQueryHandler.

To prevent random null cursors, changed all usages of AsyncQueryHandler to
NoNullAsyncQueryHandler.

Bug: 7012260
Change-Id: I0c3d9593a7b68eb0220a444a21f27b6282f94e07
diff --git a/src/com/android/dialer/CallDetailActivityQueryHandler.java b/src/com/android/dialer/CallDetailActivityQueryHandler.java
index 08510f9..ecbbac1 100644
--- a/src/com/android/dialer/CallDetailActivityQueryHandler.java
+++ b/src/com/android/dialer/CallDetailActivityQueryHandler.java
@@ -16,7 +16,6 @@
 
 package com.android.dialer;
 
-import android.content.AsyncQueryHandler;
 import android.database.Cursor;
 import android.net.Uri;
 import android.provider.VoicemailContract.Status;
@@ -24,12 +23,13 @@
 import android.util.Log;
 
 import com.android.common.io.MoreCloseables;
+import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
 import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
 
 /**
  * Class used by {@link CallDetailActivity} to fire async content resolver queries.
  */
-public class CallDetailActivityQueryHandler extends AsyncQueryHandler {
+public class CallDetailActivityQueryHandler extends NoNullCursorAsyncQueryHandler {
     private static final String TAG = "CallDetail";
     private static final int QUERY_VOICEMAIL_CONTENT_TOKEN = 101;
     private static final int QUERY_VOICEMAIL_STATUS_TOKEN = 102;
@@ -63,7 +63,8 @@
     }
 
     @Override
-    protected synchronized void onQueryComplete(int token, Object cookie, Cursor cursor) {
+    protected synchronized void onNotNullableQueryComplete(int token, Object cookie,
+            Cursor cursor) {
         try {
             if (token == QUERY_VOICEMAIL_CONTENT_TOKEN) {
                 // Query voicemail status only if this voicemail record does not have audio.
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index 5b88c8d..79d499d 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -19,7 +19,6 @@
 import android.app.AlertDialog;
 import android.app.KeyguardManager;
 import android.app.ProgressDialog;
-import android.content.AsyncQueryHandler;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -37,6 +36,7 @@
 import android.widget.Toast;
 
 import com.android.contacts.R;
+import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
 import com.android.internal.telephony.ITelephony;
 import com.android.internal.telephony.TelephonyCapabilities;
 import com.android.internal.telephony.TelephonyIntents;
@@ -352,7 +352,7 @@
      *
      * Queries originate from {@link handleAdnEntry}.
      */
-    private static class QueryHandler extends AsyncQueryHandler {
+    private static class QueryHandler extends NoNullCursorAsyncQueryHandler {
 
         private boolean mCanceled;
 
@@ -365,7 +365,7 @@
          * we're handed the ADN cursor.
          */
         @Override
-        protected void onQueryComplete(int token, Object cookie, Cursor c) {
+        protected void onNotNullableQueryComplete(int token, Object cookie, Cursor c) {
             sPreviousAdnQueryHandler = null;
             if (mCanceled) {
                 return;
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 2e67e5a..43b8d21 100644
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -35,6 +35,7 @@
 import android.util.Log;
 
 import com.android.common.io.MoreCloseables;
+import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
 import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
 import com.google.common.collect.Lists;
 
@@ -45,7 +46,7 @@
 import javax.annotation.concurrent.GuardedBy;
 
 /** Handles asynchronous queries to the call log. */
-/*package*/ class CallLogQueryHandler extends AsyncQueryHandler {
+/*package*/ class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
     private static final String TAG = "CallLogQueryHandler";
@@ -268,7 +269,7 @@
     }
 
     @Override
-    protected synchronized void onQueryComplete(int token, Object cookie, Cursor cursor) {
+    protected void onNotNullableQueryComplete(int token, Object cookie, Cursor cursor) {
         if (token == QUERY_NEW_CALLS_TOKEN) {
             int requestId = ((Integer) cookie).intValue();
             if (requestId != mCallsRequestId) {