Bug 712718 - Force creation of WebIconDatabase event handler. r=dougt a=clegnitto
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Sat, 24 Dec 2011 00:55:53 +0100
changeset 84799 8f4d507c294f0db02a94ce28ad43810702cdaf06
parent 84798 a57df475441d440a13977596a184c0b924185fb0
child 84800 70ddf5c18897d3805f1cd62a867a2c3b0b720df1
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, clegnitto
bugs712718
milestone11.0a2
Bug 712718 - Force creation of WebIconDatabase event handler. r=dougt a=clegnitto
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -45,16 +45,17 @@ import android.database.sqlite.SQLiteExc
 import android.database.sqlite.SQLiteStatement;
 import android.content.ContentResolver;
 import android.database.Cursor;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.AsyncTask;
 import android.provider.Browser;
 import android.util.Log;
+import android.webkit.WebIconDatabase;
 
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.File;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -109,16 +110,21 @@ public class ProfileMigrator {
     final String faviconMime = "a_mime";
 
     public ProfileMigrator(ContentResolver cr, File profileDir) {
         mProfileDir = profileDir;
         mCr = cr;
     }
 
     public void launchBackground() {
+        // Work around http://code.google.com/p/android/issues/detail?id=11291
+        // The WebIconDatabase needs to be initialized within the UI thread so
+        // just request the instance here.
+        WebIconDatabase.getInstance();
+
         PlacesTask placesTask = new PlacesTask();
         new Thread(placesTask).start();
     }
 
     private class PlacesTask implements Runnable {
         // Get a list of the last times an URL was accessed
         protected Map<String, Long> gatherAndroidHistory() {
             Map<String, Long> history = new HashMap<String, Long>();