Bug 1175355 - Add AsyncQueryHandlerImpl in SearchActivity. r=nalexander

This avoids the "HandlerLeak" Android Lint warning.

--HG--
extra : commitid : 3sLO4YQ6Gjk
extra : rebase_source : 84cd05b1c4848895271e7f577ffa94b72de0281a
This commit is contained in:
Michael Comella 2015-06-24 16:58:06 -07:00
parent 152d8dd058
commit ea4537aef2

View File

@ -19,6 +19,7 @@ import org.mozilla.search.providers.SearchEngineManager;
import org.mozilla.search.providers.SearchEngineManager.SearchEngineCallback;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Rect;
@ -92,6 +93,16 @@ public class SearchActivity extends Locales.LocaleAwareFragmentActivity
private int cardPaddingX;
private int cardPaddingY;
/**
* An empty implementation of AsyncQueryHandler to avoid the "HandlerLeak" warning from Android
* Lint. See also {@see org.mozilla.gecko.util.WeakReferenceHandler}.
*/
private static class AsyncQueryHandlerImpl extends AsyncQueryHandler {
public AsyncQueryHandlerImpl(final ContentResolver that) {
super(that);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
GeckoAppShell.ensureCrashHandling();
@ -108,7 +119,7 @@ public class SearchActivity extends Locales.LocaleAwareFragmentActivity
// Initialize the fragments with the selected search engine.
searchEngineManager.getEngine(this);
queryHandler = new AsyncQueryHandler(getContentResolver()) {};
queryHandler = new AsyncQueryHandlerImpl(getContentResolver());
searchBar = (SearchBar) findViewById(R.id.search_bar);
searchBar.setOnClickListener(new View.OnClickListener() {