diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index d53a46042c8..add7aac9588 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -573,6 +573,8 @@ RES_DRAWABLE_BASE = \ res/drawable/validation_arrow.png \ res/drawable/validation_arrow_inverted.png \ res/drawable/validation_bg.9.png \ + res/drawable/bookmarkdefaults_favicon_support.png \ + res/drawable/bookmarkdefaults_favicon_addons.png \ res/drawable/handle_end.png \ res/drawable/handle_middle.png \ res/drawable/handle_start.png \ diff --git a/mobile/android/base/db/BrowserProvider.java.in b/mobile/android/base/db/BrowserProvider.java.in index dc506ead9fd..b2df70a2eec 100644 --- a/mobile/android/base/db/BrowserProvider.java.in +++ b/mobile/android/base/db/BrowserProvider.java.in @@ -41,7 +41,6 @@ import org.mozilla.gecko.db.DBUtils; import org.mozilla.gecko.ProfileMigrator; import org.mozilla.gecko.sync.Utils; import org.mozilla.gecko.util.GeckoBackgroundThread; -import org.mozilla.gecko.util.GeckoJarReader; import android.app.SearchManager; import android.content.ContentProvider; @@ -61,7 +60,6 @@ import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteQueryBuilder; import android.graphics.BitmapFactory; import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.Build; import android.text.TextUtils; @@ -1020,72 +1018,31 @@ public class BrowserProvider extends ContentProvider { } private void setDefaultFavicon(SQLiteDatabase db, String name, String url) { - ByteArrayOutputStream stream = getDefaultFaviconFromPath(db, name, url); - if (stream == null) { - stream = getDefaultFaviconFromDrawable(db, name, url); - } - if (stream != null) { - ContentValues values = new ContentValues(); - values.put(Favicons.DATA, stream.toByteArray()); - values.put(Favicons.PAGE_URL, url); - insertFavicon(db, values); - } - } - - private ByteArrayOutputStream getDefaultFaviconFromPath(SQLiteDatabase db, String name, String url) { - ByteArrayOutputStream stream = null; - Class stringClass = R.string.class; - try { - // Look for a drawable with the id R.drawable.bookmarkdefaults_favicon_* - Field faviconField = stringClass.getField(name.replace("_title_", "_favicon_")); - if (faviconField == null) - return null; - int faviconId = faviconField.getInt(null); - String path = mContext.getString(faviconId); - - String apkPath = mContext.getPackageResourcePath(); - File apkFile = new File(apkPath); - BitmapDrawable bitmapDrawable = GeckoJarReader.getBitmapDrawable(mContext.getResources(), - "jar:jar:" + apkFile.toURI() + "!/omni.ja!/" + path); - if (bitmapDrawable == null) { - return null; - } - Bitmap bitmap = bitmapDrawable.getBitmap(); - if (bitmap == null) { - return null; - } - stream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); - } catch (java.lang.IllegalAccessException ex) { - Log.e(LOGTAG, "[Path] Can't create favicon " + name, ex); - } catch (java.lang.NoSuchFieldException ex) { - // if there is no such field, create the bookmark without a favicon - Log.d(LOGTAG, "[Path] Can't create favicon " + name); - } - return stream; - } - - private ByteArrayOutputStream getDefaultFaviconFromDrawable(SQLiteDatabase db, String name, String url) { Class drawablesClass = R.drawable.class; ByteArrayOutputStream stream = null; try { // Look for a drawable with the id R.drawable.bookmarkdefaults_favicon_* Field faviconField = drawablesClass.getField(name.replace("_title_", "_favicon_")); if (faviconField == null) - return null; + return; int faviconId = faviconField.getInt(null); Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), faviconId); stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); } catch (java.lang.IllegalAccessException ex) { - Log.e(LOGTAG, "[Drawable] Can't create favicon " + name, ex); + Log.e(LOGTAG, "Can't create favicon " + name, ex); } catch (java.lang.NoSuchFieldException ex) { // if there is no such field, create the bookmark without a favicon - Log.d(LOGTAG, "[Drawable] Can't create favicon " + name); + Log.d(LOGTAG, "Can't create favicon " + name); } - return stream; + if (stream != null) { + ContentValues values = new ContentValues(); + values.put(Favicons.DATA, stream.toByteArray()); + values.put(Favicons.PAGE_URL, url); + insertFavicon(db, values); + } } private void createOrUpdateAllSpecialFolders(SQLiteDatabase db) { diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index 920e94badf3..8a83491a96b 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -209,14 +209,12 @@ profile/bookmarks.inc. Don't expose the URLs to L10N. --> @bookmarks_aboutBrowser@ about:firefox - chrome/chrome/content/branding/favicon64.png @bookmarks_addons@ https://addons.mozilla.org/@AB_CD@/android/ @bookmarks_support@ http://support.mozilla.org/@AB_CD@/mobile - chrome/chrome/content/branding/favicon64.png @bookmarks_aboutHome@ about:home diff --git a/mobile/android/branding/aurora/android-resources.mn b/mobile/android/branding/aurora/android-resources.mn index b85e33467d9..b75b8717111 100644 --- a/mobile/android/branding/aurora/android-resources.mn +++ b/mobile/android/branding/aurora/android-resources.mn @@ -1,3 +1,4 @@ mobile/android/branding/aurora/content/logo.png mobile/android/branding/aurora/content/favicon32.png +mobile/android/branding/aurora/content/bookmarkdefaults_favicon_aboutfirefox.png mobile/android/branding/aurora/content/mdpi/widget_icon.png diff --git a/mobile/android/branding/aurora/content/bookmarkdefaults_favicon_aboutfirefox.png b/mobile/android/branding/aurora/content/bookmarkdefaults_favicon_aboutfirefox.png new file mode 100644 index 00000000000..f515b5d337e Binary files /dev/null and b/mobile/android/branding/aurora/content/bookmarkdefaults_favicon_aboutfirefox.png differ diff --git a/mobile/android/branding/aurora/content/favicon32.png b/mobile/android/branding/aurora/content/favicon32.png index 40421cc7948..f515b5d337e 100644 Binary files a/mobile/android/branding/aurora/content/favicon32.png and b/mobile/android/branding/aurora/content/favicon32.png differ diff --git a/mobile/android/branding/aurora/content/favicon64.png b/mobile/android/branding/aurora/content/favicon64.png deleted file mode 100644 index bb949ccbade..00000000000 Binary files a/mobile/android/branding/aurora/content/favicon64.png and /dev/null differ diff --git a/mobile/android/branding/aurora/content/jar.mn b/mobile/android/branding/aurora/content/jar.mn index 32eae6af95b..0052ad0243d 100644 --- a/mobile/android/branding/aurora/content/jar.mn +++ b/mobile/android/branding/aurora/content/jar.mn @@ -8,4 +8,3 @@ chrome.jar: content/branding/logoWordmark.png (logoWordmark.png) content/branding/logo.png (logo.png) content/branding/favicon32.png (favicon32.png) - content/branding/favicon64.png (favicon64.png) diff --git a/mobile/android/branding/beta/android-resources.mn b/mobile/android/branding/beta/android-resources.mn index 22ad106ed4a..7c6e5de0423 100644 --- a/mobile/android/branding/beta/android-resources.mn +++ b/mobile/android/branding/beta/android-resources.mn @@ -1,3 +1,4 @@ mobile/android/branding/beta/content/logo.png mobile/android/branding/beta/content/favicon32.png +mobile/android/branding/beta/content/bookmarkdefaults_favicon_aboutfirefox.png mobile/android/branding/beta/content/mdpi/widget_icon.png diff --git a/mobile/android/branding/beta/content/bookmarkdefaults_favicon_aboutfirefox.png b/mobile/android/branding/beta/content/bookmarkdefaults_favicon_aboutfirefox.png new file mode 100644 index 00000000000..ac4a6968bf2 Binary files /dev/null and b/mobile/android/branding/beta/content/bookmarkdefaults_favicon_aboutfirefox.png differ diff --git a/mobile/android/branding/beta/content/favicon64.png b/mobile/android/branding/beta/content/favicon64.png deleted file mode 100644 index 20bae0717c7..00000000000 Binary files a/mobile/android/branding/beta/content/favicon64.png and /dev/null differ diff --git a/mobile/android/branding/beta/content/jar.mn b/mobile/android/branding/beta/content/jar.mn index 32eae6af95b..0052ad0243d 100644 --- a/mobile/android/branding/beta/content/jar.mn +++ b/mobile/android/branding/beta/content/jar.mn @@ -8,4 +8,3 @@ chrome.jar: content/branding/logoWordmark.png (logoWordmark.png) content/branding/logo.png (logo.png) content/branding/favicon32.png (favicon32.png) - content/branding/favicon64.png (favicon64.png) diff --git a/mobile/android/branding/nightly/android-resources.mn b/mobile/android/branding/nightly/android-resources.mn index 53b5afd7715..62e901eeef1 100644 --- a/mobile/android/branding/nightly/android-resources.mn +++ b/mobile/android/branding/nightly/android-resources.mn @@ -1,3 +1,4 @@ mobile/android/branding/nightly/content/logo.png mobile/android/branding/nightly/content/favicon32.png +mobile/android/branding/nightly/content/bookmarkdefaults_favicon_aboutfirefox.png mobile/android/branding/nightly/content/mdpi/widget_icon.png diff --git a/mobile/android/branding/nightly/content/bookmarkdefaults_favicon_aboutfirefox.png b/mobile/android/branding/nightly/content/bookmarkdefaults_favicon_aboutfirefox.png new file mode 100644 index 00000000000..43ad466c615 Binary files /dev/null and b/mobile/android/branding/nightly/content/bookmarkdefaults_favicon_aboutfirefox.png differ diff --git a/mobile/android/branding/nightly/content/favicon64.png b/mobile/android/branding/nightly/content/favicon64.png deleted file mode 100644 index 1ac6eaf5197..00000000000 Binary files a/mobile/android/branding/nightly/content/favicon64.png and /dev/null differ diff --git a/mobile/android/branding/nightly/content/jar.mn b/mobile/android/branding/nightly/content/jar.mn index 32eae6af95b..0052ad0243d 100644 --- a/mobile/android/branding/nightly/content/jar.mn +++ b/mobile/android/branding/nightly/content/jar.mn @@ -8,4 +8,3 @@ chrome.jar: content/branding/logoWordmark.png (logoWordmark.png) content/branding/logo.png (logo.png) content/branding/favicon32.png (favicon32.png) - content/branding/favicon64.png (favicon64.png) diff --git a/mobile/android/branding/official/android-resources.mn b/mobile/android/branding/official/android-resources.mn index 9e3ca743cce..c380a12da36 100644 --- a/mobile/android/branding/official/android-resources.mn +++ b/mobile/android/branding/official/android-resources.mn @@ -1,3 +1,4 @@ mobile/android/branding/official/content/logo.png mobile/android/branding/official/content/favicon32.png +mobile/android/branding/official/content/bookmarkdefaults_favicon_aboutfirefox.png mobile/android/branding/official/content/mdpi/widget_icon.png diff --git a/mobile/android/branding/official/content/bookmarkdefaults_favicon_aboutfirefox.png b/mobile/android/branding/official/content/bookmarkdefaults_favicon_aboutfirefox.png new file mode 100644 index 00000000000..ac4a6968bf2 Binary files /dev/null and b/mobile/android/branding/official/content/bookmarkdefaults_favicon_aboutfirefox.png differ diff --git a/mobile/android/branding/official/content/favicon64.png b/mobile/android/branding/official/content/favicon64.png deleted file mode 100644 index 20bae0717c7..00000000000 Binary files a/mobile/android/branding/official/content/favicon64.png and /dev/null differ diff --git a/mobile/android/branding/official/content/jar.mn b/mobile/android/branding/official/content/jar.mn index 32eae6af95b..0052ad0243d 100644 --- a/mobile/android/branding/official/content/jar.mn +++ b/mobile/android/branding/official/content/jar.mn @@ -8,4 +8,3 @@ chrome.jar: content/branding/logoWordmark.png (logoWordmark.png) content/branding/logo.png (logo.png) content/branding/favicon32.png (favicon32.png) - content/branding/favicon64.png (favicon64.png) diff --git a/mobile/android/branding/unofficial/android-resources.mn b/mobile/android/branding/unofficial/android-resources.mn index 03c8177bd90..a5eab084ae8 100644 --- a/mobile/android/branding/unofficial/android-resources.mn +++ b/mobile/android/branding/unofficial/android-resources.mn @@ -1,3 +1,4 @@ mobile/android/branding/unofficial/content/favicon32.png mobile/android/branding/unofficial/content/logo.png +mobile/android/branding/unofficial/content/bookmarkdefaults_favicon_aboutfirefox.png mobile/android/branding/unofficial/content/mdpi/widget_icon.png diff --git a/mobile/android/branding/unofficial/content/bookmarkdefaults_favicon_aboutfirefox.png b/mobile/android/branding/unofficial/content/bookmarkdefaults_favicon_aboutfirefox.png new file mode 100644 index 00000000000..3f04acd50d3 Binary files /dev/null and b/mobile/android/branding/unofficial/content/bookmarkdefaults_favicon_aboutfirefox.png differ diff --git a/mobile/android/branding/unofficial/content/favicon64.png b/mobile/android/branding/unofficial/content/favicon64.png deleted file mode 100644 index d6263c9d240..00000000000 Binary files a/mobile/android/branding/unofficial/content/favicon64.png and /dev/null differ diff --git a/mobile/android/branding/unofficial/content/fennec_72x72.png b/mobile/android/branding/unofficial/content/fennec_72x72.png index 1cdb4df2fcb..c7874013f6a 100644 Binary files a/mobile/android/branding/unofficial/content/fennec_72x72.png and b/mobile/android/branding/unofficial/content/fennec_72x72.png differ diff --git a/mobile/android/branding/unofficial/content/jar.mn b/mobile/android/branding/unofficial/content/jar.mn index 32eae6af95b..0052ad0243d 100644 --- a/mobile/android/branding/unofficial/content/jar.mn +++ b/mobile/android/branding/unofficial/content/jar.mn @@ -8,4 +8,3 @@ chrome.jar: content/branding/logoWordmark.png (logoWordmark.png) content/branding/logo.png (logo.png) content/branding/favicon32.png (favicon32.png) - content/branding/favicon64.png (favicon64.png) diff --git a/mobile/android/chrome/content/about.xhtml b/mobile/android/chrome/content/about.xhtml index 3122ccf07f9..b6fcd233627 100644 --- a/mobile/android/chrome/content/about.xhtml +++ b/mobile/android/chrome/content/about.xhtml @@ -18,7 +18,7 @@ &aboutPage.title; - + diff --git a/mobile/android/chrome/content/aboutAddons.xhtml b/mobile/android/chrome/content/aboutAddons.xhtml index 5a3877fe703..518d65b3ef2 100644 --- a/mobile/android/chrome/content/aboutAddons.xhtml +++ b/mobile/android/chrome/content/aboutAddons.xhtml @@ -18,7 +18,7 @@ &aboutAddons.title2; - +