Bug 1555051 - Use GeckoJarReader to read the theme image; r=VladBaicu
authorPetru Lingurar <petru.lingurar@softvision.ro>
Tue, 25 Jun 2019 14:54:41 +0000
changeset 480043 53b89d516cbce0085e231c9c981fb0cf3747eef1
parent 480042 cd51e03eae41569182609d970dafaf6eb62b6f2e
child 480044 5af72b4513c93bca57f7be03eabb3036afd11068
push id36200
push useraiakab@mozilla.com
push dateTue, 25 Jun 2019 21:58:14 +0000
treeherdermozilla-central@b23bd78e4d94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu
bugs1555051
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1555051 - Use GeckoJarReader to read the theme image; r=VladBaicu If the theme is persisted as an xpi we'll use GeckoJarReader to read get the image from inside the archive otherwise read it directly. Differential Revision: https://phabricator.services.mozilla.com/D35808
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/BitmapUtils.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/BitmapUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/BitmapUtils.java
@@ -19,16 +19,18 @@ import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.support.annotation.ColorInt;
 import android.support.v7.graphics.Palette;
 import android.util.Base64;
 import android.util.Log;
 
+import org.mozilla.gecko.GeckoAppShell;
+
 public final class BitmapUtils {
     private static final String LOGTAG = "GeckoBitmapUtils";
 
     private BitmapUtils() {}
 
     public static Bitmap decodeByteArray(final byte[] bytes) {
         return decodeByteArray(bytes, null);
     }
@@ -97,17 +99,22 @@ public final class BitmapUtils {
 
         return decodeUrl(url);
     }
 
     public static Bitmap decodeUrl(final URL url) {
         InputStream stream = null;
 
         try {
-            stream = url.openStream();
+            if ("jar".equals(url.getProtocol())) {
+                final Context context = GeckoAppShell.getApplicationContext();
+                stream = GeckoJarReader.getStream(context, url.toString());
+            } else {
+                stream = url.openStream();
+            }
         } catch (IOException e) {
             Log.w(LOGTAG, "decodeUrl: IOException downloading " + url);
             return null;
         }
 
         if (stream == null) {
             Log.w(LOGTAG, "decodeUrl: stream not found downloading " + url);
             return null;