Sriram Ramasubramanian <sriram@mozilla.com>
☠☠ backed out by 18327b3aba42 ☠ ☠
authorSriram Ramasubramanian <sriram>
Wed, 05 Oct 2011 17:21:00 -0400
changeset 79557 b4da81723e56304a4ada0e049fcae3db7078ff34
parent 79556 3f0e81847318a61775a2b23036b7c209588dbcf2
child 79558 616986a1819a34f486460a7d3e82b9ed8344a285
push idunknown
push userunknown
push dateunknown
milestone10.0a1
Sriram Ramasubramanian <sriram@mozilla.com>
embedding/android/LauncherShortcuts.java.in
toolkit/mozapps/webapps/OpenWebapps.jsm
--- a/embedding/android/LauncherShortcuts.java.in
+++ b/embedding/android/LauncherShortcuts.java.in
@@ -124,18 +124,21 @@ public class LauncherShortcuts extends L
                 break;
             case DisplayMetrics.DENSITY_HIGH:
                 size = 72;
                 break;
             default:
                 size = 72;
         }
 
-        Bitmap bitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(favicon), size, size, true);
-        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
+        Bitmap bitmap = BitmapFactory.decodeFile(favicon);
+        if (bitmap != null) {
+            Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, size, size, true);
+            intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, scaledBitmap);
+        }
 
         // Now, return the result to the launcher
         setResult(RESULT_OK, intent);
         finish();
     }
     
     private class FetchWebApps extends AsyncTask<Void, Void, Void> {
         
--- a/toolkit/mozapps/webapps/OpenWebapps.jsm
+++ b/toolkit/mozapps/webapps/OpenWebapps.jsm
@@ -136,19 +136,20 @@ let OpenWebapps = {
       storeURI: aApplication.storeURI,
       appURI: aApplication.appURI,
       installData: aApplication.installData,
       installTime: (new Date()).getTime()
     };
     this._writeFile(this.appsFile, JSON.stringify(this.webapps));
 
     // now save the icon as icon.png in the app directory
+    let iconURI = aApplication.iconURI ? aApplication.iconURI : "chrome://browser/skin/images/homescreen-default-hdpi.png";
     let iconFile = dir.clone();
     iconFile.append("icon.png");
-    let uri = Services.io.newURI(aApplication.iconURI, null, null);
+    let uri = Services.io.newURI(iconURI, null, null);
     let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
     persist.persistFlags = persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES | persist.PERSIST_FLAGS_BYPASS_CACHE;
     persist.saveURI(uri, null, null, null, "", iconFile);
   },
  
   _appId: function(aURI) {
     for (let id in this.webapps) {
       if (this.webapps[id].appURI == aURI)