diff options
author | Chiao Cheng <chiaocheng@google.com> | 2012-09-14 12:05:14 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2012-09-14 12:05:14 -0700 |
commit | 07af764827a7d6d426f6097d3e769084968f84fd (patch) | |
tree | 794003a64f932ebe48d8d3e6d5d751b579fa53f6 | |
parent | 9d4f3b20793a007b4489547aa40fc1049d0d8fef (diff) |
Switch to AsyncQueryHandler to NoNullAsyncQueryHandler.
To prevent random null cursors, changed all usages of AsyncQueryHandler to
NoNullAsyncQueryHandler.
Bug: 7012260
Change-Id: I0c3d9593a7b68eb0220a444a21f27b6282f94e07
-rw-r--r-- | src/com/android/dialer/CallDetailActivityQueryHandler.java | 7 | ||||
-rw-r--r-- | src/com/android/dialer/SpecialCharSequenceMgr.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogQueryHandler.java | 5 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/com/android/dialer/CallDetailActivityQueryHandler.java b/src/com/android/dialer/CallDetailActivityQueryHandler.java index 08510f96f..ecbbac114 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.provider.VoicemailContract.Voicemails; 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 @@ public class CallDetailActivityQueryHandler extends AsyncQueryHandler { } @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 5b88c8daa..79d499dfc 100644 --- a/src/com/android/dialer/SpecialCharSequenceMgr.java +++ b/src/com/android/dialer/SpecialCharSequenceMgr.java @@ -19,7 +19,6 @@ package com.android.dialer; 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.EditText; 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 @@ public class SpecialCharSequenceMgr { * * Queries originate from {@link handleAdnEntry}. */ - private static class QueryHandler extends AsyncQueryHandler { + private static class QueryHandler extends NoNullCursorAsyncQueryHandler { private boolean mCanceled; @@ -365,7 +365,7 @@ public class SpecialCharSequenceMgr { * 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 2e67e5a01..43b8d21ca 100644 --- a/src/com/android/dialer/calllog/CallLogQueryHandler.java +++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java @@ -35,6 +35,7 @@ import android.provider.VoicemailContract.Status; 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 java.util.concurrent.TimeUnit; 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 @@ import javax.annotation.concurrent.GuardedBy; } @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) { |