diff --git a/mobile/android/base/AboutPages.java b/mobile/android/base/AboutPages.java index 6ed0b3d16e06..fce2fc9eb5ed 100644 --- a/mobile/android/base/AboutPages.java +++ b/mobile/android/base/AboutPages.java @@ -55,8 +55,6 @@ public class AboutPages { } private static final String[] DEFAULT_ICON_PAGES = new String[] { - HOME, - ADDONS, CONFIG, DOWNLOADS, @@ -72,12 +70,17 @@ public class AboutPages { return DEFAULT_ICON_PAGES; } - public static boolean isDefaultIconPage(final String url) { + public static boolean isBuiltinIconPage(final String url) { if (url == null || !url.startsWith("about:")) { return false; } + // about:home uses a separate search built-in icon. + if (isAboutHome(url)) { + return true; + } + // TODO: it'd be quicker to not compare the "about:" part every time. for (int i = 0; i < DEFAULT_ICON_PAGES.length; ++i) { if (DEFAULT_ICON_PAGES[i].equals(url)) { diff --git a/mobile/android/base/Tabs.java b/mobile/android/base/Tabs.java index 4a2bc407af8b..12f3f6e73fe5 100644 --- a/mobile/android/base/Tabs.java +++ b/mobile/android/base/Tabs.java @@ -831,7 +831,7 @@ public class Tabs implements GeckoEventListener { } // TODO: surely we could just fetch *any* cached icon? - if (AboutPages.isDefaultIconPage(url)) { + if (AboutPages.isBuiltinIconPage(url)) { Log.d(LOGTAG, "Setting about: tab favicon inline."); added.updateFavicon(getAboutPageFavicon(url)); } diff --git a/mobile/android/base/favicons/Favicons.java b/mobile/android/base/favicons/Favicons.java index a99048071afb..d47266736b95 100644 --- a/mobile/android/base/favicons/Favicons.java +++ b/mobile/android/base/favicons/Favicons.java @@ -40,6 +40,9 @@ public class Favicons { // A magic URL representing the app's own favicon, used for about: pages. private static final String BUILT_IN_FAVICON_URL = "about:favicon"; + // A magic URL representing the app's search favicon, used for about:home. + private static final String BUILT_IN_SEARCH_URL = "about:search"; + // Size of the favicon bitmap cache, in bytes (Counting payload only). public static final int FAVICON_CACHE_SIZE_BYTES = 512 * 1024; @@ -407,6 +410,10 @@ public class Favicons { loadBrandingBitmap(context, "favicon32.png")); putFaviconsInMemCache(BUILT_IN_FAVICON_URL, toInsert.iterator(), true); + + pageURLMappings.putWithoutEviction(AboutPages.HOME, BUILT_IN_SEARCH_URL); + List searchIcons = Arrays.asList(BitmapFactory.decodeResource(res, R.drawable.ab_search)); + putFaviconsInMemCache(BUILT_IN_SEARCH_URL, searchIcons.iterator(), true); } /**