summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJustin Koh <justinkoh@google.com>2014-06-08 17:04:17 -0700
committerJustin Koh <justinkoh@google.com>2014-06-09 11:28:53 -0700
commitb4be02088f221564817b2ac164408cc3eeff118c (patch)
treee0eeb39a0fcffb48c66fdd53ed8e0313b41dd2a2 /core
parent4d9fcae2024c9be8d5bd7e92cd836aa8b9cacc5b (diff)
downloadframeworks_base-b4be02088f221564817b2ac164408cc3eeff118c.zip
frameworks_base-b4be02088f221564817b2ac164408cc3eeff118c.tar.gz
frameworks_base-b4be02088f221564817b2ac164408cc3eeff118c.tar.bz2
Fix Browser when running on a platform without webview
Fix Browser: can't access the WebIconDatabase. Added build version checks so that the icon database isn't used on devices <= KITKAT: the entire class is deprecated as of JB MR2 anyway, according to the comments. Bug: 15088030 Change-Id: I4403b1a429c08abb288f5ee3bae7eb2e23303916
Diffstat (limited to 'core')
-rw-r--r--core/java/android/provider/Browser.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index a34d9c3..fa85903 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -25,6 +25,7 @@ import android.database.Cursor;
import android.database.DatabaseUtils;
import android.graphics.BitmapFactory;
import android.net.Uri;
+import android.os.Build;
import android.provider.BrowserContract.Bookmarks;
import android.provider.BrowserContract.Combined;
import android.provider.BrowserContract.History;
@@ -404,12 +405,17 @@ public class Browser {
null, null, History.DATE_LAST_VISITED + " ASC");
if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
- final WebIconDatabase iconDb = WebIconDatabase.getInstance();
+ WebIconDatabase iconDb = null;
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
+ 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));
+ null, null);
+ if (iconDb != null) {
+ iconDb.releaseIconForPageUrl(cursor.getString(1));
+ }
if (!cursor.moveToNext()) break;
}
}
@@ -469,11 +475,16 @@ public class Browser {
cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
null, null);
if (cursor.moveToFirst()) {
- final WebIconDatabase iconDb = WebIconDatabase.getInstance();
+ 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
- iconDb.releaseIconForPageUrl(cursor.getString(0));
+ // 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);
@@ -568,7 +579,9 @@ public class Browser {
*/
public static final void requestAllIcons(ContentResolver cr, String where,
WebIconDatabase.IconListener listener) {
- WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener);
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
+ WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener);
+ }
}
/**