Remove references to WebIconDatabase
Since WebIconDatabase is deprecated and most of its
operations are no op even in frameworks from Kitkat and above.
The dead code is removed from browser.
Change-Id: If1b126bb8d460915e2e3c5da1cb3d76622ed14ff
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java
index 4a49520..9bd84f8 100644
--- a/src/com/android/browser/Bookmarks.java
+++ b/src/com/android/browser/Bookmarks.java
@@ -34,7 +34,6 @@
import android.text.TextUtils;
import android.util.Log;
-import android.webkit.WebIconDatabase;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
@@ -118,7 +117,6 @@
}
// Remove from bookmarks
- WebIconDatabase.getInstance().releaseIconForPageUrl(url);
uri = ContentUris.withAppendedId(BrowserContract.Bookmarks.CONTENT_URI,
cursor.getLong(0));
cr.delete(uri, null, null);
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 0318f8f..e8ecd93 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -28,7 +28,6 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.DisplayMetrics;
-import android.webkit.WebIconDatabase;
import android.webkit.WebStorage;
import com.android.browser.R;
@@ -504,7 +503,6 @@
}
public void clearCache() {
- WebIconDatabase.getInstance().removeAllIcons();
if (mController != null) {
WebView current = mController.getCurrentWebView();
if (current != null) {
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 9b22b08..d0d329b 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -78,7 +78,6 @@
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback;
-import android.webkit.WebIconDatabase;
import android.widget.Toast;
import org.codeaurora.swe.CookieManager;
@@ -271,7 +270,6 @@
BrowserContract.Bookmarks.CONTENT_URI, true, mBookmarksObserver);
mNetworkHandler = new NetworkStateHandler(mActivity, this);
- openIconDatabase();
}
@Override
@@ -480,19 +478,6 @@
return mTabControl.getTabs();
}
- // Open the icon database.
- private void openIconDatabase() {
- // We have to call getInstance on the UI thread
- final WebIconDatabase instance = WebIconDatabase.getInstance();
- BackgroundHandler.execute(new Runnable() {
-
- @Override
- public void run() {
- instance.open(mActivity.getDir("icons", 0).getPath());
- }
- });
- }
-
private void startHandler() {
mHandler = new Handler() {
@@ -816,7 +801,6 @@
mActivity.getContentResolver().unregisterContentObserver(mBookmarksObserver);
// Destroy all the tabs
mTabControl.destroy();
- WebIconDatabase.getInstance().close();
}
protected boolean isActivityPaused() {
diff --git a/src/com/android/browser/platformsupport/Browser.java b/src/com/android/browser/platformsupport/Browser.java
index a5346eb..feb9f87 100644
--- a/src/com/android/browser/platformsupport/Browser.java
+++ b/src/com/android/browser/platformsupport/Browser.java
@@ -26,7 +26,6 @@
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.util.Log;
-import android.webkit.WebIconDatabase;
import com.android.browser.R;
import com.android.browser.platformsupport.BrowserContract.Bookmarks;
@@ -157,8 +156,8 @@
* @param title Title for the bookmark. Can be null or empty string.
* @param url Url for the bookmark. Can be null or empty string.
*/
- public static final void saveBookmark(Context c,
- String title,
+ public static final void saveBookmark(Context c,
+ String title,
String url) {
Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI);
i.putExtra("title", title);
@@ -235,10 +234,10 @@
*
* @param cr The ContentResolver used to access the database.
*/
- public static final Cursor getAllBookmarks(ContentResolver cr) throws
+ public static final Cursor getAllBookmarks(ContentResolver cr) throws
IllegalStateException {
return cr.query(Bookmarks.CONTENT_URI,
- new String[] { Bookmarks.URL },
+ new String[] { Bookmarks.URL },
Bookmarks.IS_FOLDER + " = 0", null, null);
}
@@ -399,19 +398,17 @@
// TODO make a single request to the provider to do this in a single transaction
Cursor cursor = null;
try {
-
+
// Select non-bookmark history, ordered by date
cursor = cr.query(History.CONTENT_URI,
new String[] { History._ID, History.URL, History.DATE_LAST_VISITED },
null, null, History.DATE_LAST_VISITED + " ASC");
if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
- final WebIconDatabase iconDb = WebIconDatabase.getInstance();
/* eliminate oldest history items */
for (int i = 0; i < TRUNCATE_N_OLDEST; i++) {
cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)),
null, null);
- iconDb.releaseIconForPageUrl(cursor.getString(1));
if (!cursor.moveToNext()) break;
}
}
@@ -471,13 +468,6 @@
cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
null, null);
if (cursor.moveToFirst()) {
- final WebIconDatabase iconDb = WebIconDatabase.getInstance();
- do {
- // Delete favicons
- // TODO don't release if the URL is bookmarked
- iconDb.releaseIconForPageUrl(cursor.getString(0));
- } while (cursor.moveToNext());
-
cr.delete(History.CONTENT_URI, whereClause, null);
}
} catch (IllegalStateException e) {
@@ -522,7 +512,7 @@
* @param cr The ContentResolver used to access the database.
* @param url url to remove.
*/
- public static final void deleteFromHistory(ContentResolver cr,
+ public static final void deleteFromHistory(ContentResolver cr,
String url) {
cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url });
}
@@ -558,35 +548,6 @@
}
/**
- * Request all icons from the database. This call must either be called
- * in the main thread or have had Looper.prepare() invoked in the calling
- * thread.
- * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
- * @param cr The ContentResolver used to access the database.
- * @param where Clause to be used to limit the query from the database.
- * Must be an allowable string to be passed into a database query.
- * @param listener IconListener that gets the icons once they are
- * retrieved.
- */
- public static final void requestAllIcons(ContentResolver cr, String where,
- WebIconDatabase.IconListener listener) {
- try {
- final Cursor c = cr.query(BOOKMARKS_URI, HISTORY_PROJECTION,
- where, null, null);
- if (c.moveToFirst()) {
- final WebIconDatabase db = WebIconDatabase.getInstance();
- do {
- db.requestIconForPageUrl(c.getString(HISTORY_PROJECTION_URL_INDEX),
- listener);
- } while (c.moveToNext());
- }
- c.deactivate();
- } catch (IllegalStateException e) {
- Log.e(LOGTAG, "requestAllIcons", e);
- }
- }
-
- /**
* Column definitions for the mixed bookmark and history items available
* at {@link #BOOKMARKS_URI}.
*/