Remove WebIconDatabase calls from android.provider.Browser
This class has been deprecated, so no need to call it. Bug: 15088030 Change-Id: I6092a9d5f7a12cc14def0996efff7cb689935acb
This commit is contained in:
@@ -156,8 +156,8 @@ public class Browser {
|
|||||||
* @param title Title for the bookmark. Can be null or empty string.
|
* @param title Title for the bookmark. Can be null or empty string.
|
||||||
* @param url Url 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,
|
public static final void saveBookmark(Context c,
|
||||||
String title,
|
String title,
|
||||||
String url) {
|
String url) {
|
||||||
Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI);
|
Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI);
|
||||||
i.putExtra("title", title);
|
i.putExtra("title", title);
|
||||||
@@ -234,10 +234,10 @@ public class Browser {
|
|||||||
*
|
*
|
||||||
* @param cr The ContentResolver used to access the database.
|
* @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 {
|
IllegalStateException {
|
||||||
return cr.query(Bookmarks.CONTENT_URI,
|
return cr.query(Bookmarks.CONTENT_URI,
|
||||||
new String[] { Bookmarks.URL },
|
new String[] { Bookmarks.URL },
|
||||||
Bookmarks.IS_FOLDER + " = 0", null, null);
|
Bookmarks.IS_FOLDER + " = 0", null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,24 +398,17 @@ public class Browser {
|
|||||||
// TODO make a single request to the provider to do this in a single transaction
|
// TODO make a single request to the provider to do this in a single transaction
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Select non-bookmark history, ordered by date
|
// Select non-bookmark history, ordered by date
|
||||||
cursor = cr.query(History.CONTENT_URI,
|
cursor = cr.query(History.CONTENT_URI,
|
||||||
new String[] { History._ID, History.URL, History.DATE_LAST_VISITED },
|
new String[] { History._ID, History.URL, History.DATE_LAST_VISITED },
|
||||||
null, null, History.DATE_LAST_VISITED + " ASC");
|
null, null, History.DATE_LAST_VISITED + " ASC");
|
||||||
|
|
||||||
if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
|
if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
|
||||||
WebIconDatabase iconDb = null;
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
|
||||||
iconDb = WebIconDatabase.getInstance();
|
|
||||||
}
|
|
||||||
/* eliminate oldest history items */
|
/* eliminate oldest history items */
|
||||||
for (int i = 0; i < TRUNCATE_N_OLDEST; i++) {
|
for (int i = 0; i < TRUNCATE_N_OLDEST; i++) {
|
||||||
cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)),
|
cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)),
|
||||||
null, null);
|
null, null);
|
||||||
if (iconDb != null) {
|
|
||||||
iconDb.releaseIconForPageUrl(cursor.getString(1));
|
|
||||||
}
|
|
||||||
if (!cursor.moveToNext()) break;
|
if (!cursor.moveToNext()) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -475,18 +468,6 @@ public class Browser {
|
|||||||
cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
|
cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
|
||||||
null, null);
|
null, null);
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
WebIconDatabase iconDb = null;
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
|
||||||
iconDb = WebIconDatabase.getInstance();
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
// Delete favicons
|
|
||||||
// TODO don't release if the URL is bookmarked
|
|
||||||
if (iconDb != null) {
|
|
||||||
iconDb.releaseIconForPageUrl(cursor.getString(0));
|
|
||||||
}
|
|
||||||
} while (cursor.moveToNext());
|
|
||||||
|
|
||||||
cr.delete(History.CONTENT_URI, whereClause, null);
|
cr.delete(History.CONTENT_URI, whereClause, null);
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
@@ -531,7 +512,7 @@ public class Browser {
|
|||||||
* @param cr The ContentResolver used to access the database.
|
* @param cr The ContentResolver used to access the database.
|
||||||
* @param url url to remove.
|
* @param url url to remove.
|
||||||
*/
|
*/
|
||||||
public static final void deleteFromHistory(ContentResolver cr,
|
public static final void deleteFromHistory(ContentResolver cr,
|
||||||
String url) {
|
String url) {
|
||||||
cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url });
|
cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url });
|
||||||
}
|
}
|
||||||
@@ -565,7 +546,7 @@ public class Browser {
|
|||||||
Log.e(LOGTAG, "clearSearches", e);
|
Log.e(LOGTAG, "clearSearches", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request all icons from the database. This call must either be called
|
* 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
|
* in the main thread or have had Looper.prepare() invoked in the calling
|
||||||
@@ -574,14 +555,12 @@ public class Browser {
|
|||||||
* @param cr The ContentResolver used to access the database.
|
* @param cr The ContentResolver used to access the database.
|
||||||
* @param where Clause to be used to limit the query from 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.
|
* Must be an allowable string to be passed into a database query.
|
||||||
* @param listener IconListener that gets the icons once they are
|
* @param listener IconListener that gets the icons once they are
|
||||||
* retrieved.
|
* retrieved.
|
||||||
*/
|
*/
|
||||||
public static final void requestAllIcons(ContentResolver cr, String where,
|
public static final void requestAllIcons(ContentResolver cr, String where,
|
||||||
WebIconDatabase.IconListener listener) {
|
WebIconDatabase.IconListener listener) {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
// Do nothing: this is no longer used.
|
||||||
WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user