Merge branch 'froyo' into froyo-release
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index c51c52b..8a70c56 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -824,10 +824,7 @@
&& !mActivityInPause) {
WebView mainView = mTabControl.getCurrentWebView();
// if there is no current WebView, don't show the faked title bar;
- // if the main WebView's contentHeight is 0, it means the WebView
- // hasn't finished the start up process yet. Don't try to show this
- // window which will slow down the starting process.
- if (mainView == null || mainView.getContentHeight() == 0) {
+ if (mainView == null) {
return;
}
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java
index 4442c7f..03e3e5d 100644
--- a/src/com/android/browser/BrowserBookmarksAdapter.java
+++ b/src/com/android/browser/BrowserBookmarksAdapter.java
@@ -25,6 +25,7 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Browser;
@@ -250,26 +251,32 @@
* @param url The current url.
* @param favicon The favicon bitmap to write to the db.
*/
- /* package */ static void updateBookmarkFavicon(ContentResolver cr,
- String originalUrl, String url, Bitmap favicon) {
- final Cursor c = queryBookmarksForUrl(cr, originalUrl, url, true);
- if (c == null) {
- return;
- }
- boolean succeed = c.moveToFirst();
- ContentValues values = null;
- while (succeed) {
- if (values == null) {
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
- favicon.compress(Bitmap.CompressFormat.PNG, 100, os);
- values = new ContentValues();
- values.put(Browser.BookmarkColumns.FAVICON, os.toByteArray());
+ /* package */ static void updateBookmarkFavicon(final ContentResolver cr,
+ final String originalUrl, final String url, final Bitmap favicon) {
+ new AsyncTask<Void, Void, Void>() {
+ protected Void doInBackground(Void... unused) {
+ final Cursor c =
+ queryBookmarksForUrl(cr, originalUrl, url, true);
+ if (c == null) {
+ return null;
+ }
+ if (c.moveToFirst()) {
+ ContentValues values = new ContentValues();
+ final ByteArrayOutputStream os =
+ new ByteArrayOutputStream();
+ favicon.compress(Bitmap.CompressFormat.PNG, 100, os);
+ values.put(Browser.BookmarkColumns.FAVICON,
+ os.toByteArray());
+ do {
+ cr.update(ContentUris.withAppendedId(
+ Browser.BOOKMARKS_URI, c.getInt(0)),
+ values, null, null);
+ } while (c.moveToNext());
+ }
+ c.close();
+ return null;
}
- cr.update(ContentUris.withAppendedId(Browser.BOOKMARKS_URI, c
- .getInt(0)), values, null, null);
- succeed = c.moveToNext();
- }
- c.close();
+ }.execute();
}
/* package */ static Cursor queryBookmarksForUrl(ContentResolver cr,