Bug 993698 Update target density while reading BitmapDrawable from stream r=sebastian
authorvivek <vivekb.balakrishnan@gmail.com>
Tue, 13 Oct 2015 19:52:15 +0300
changeset 268291 c8ec00c5d04fab4dfc576dde62536272ff29e4fd
parent 268290 cd5a178c7a85b916cdaa26876d1439363938b58d
child 268292 672eab895605523dd371462b1f1b89ae696d6cf8
push id15751
push uservivekb.balakrishnan@gmail.com
push dateMon, 19 Oct 2015 14:17:53 +0000
treeherderfx-team@c8ec00c5d04f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs993698
milestone44.0a1
Bug 993698 Update target density while reading BitmapDrawable from stream r=sebastian
mobile/android/base/util/GeckoJarReader.java
--- a/mobile/android/base/util/GeckoJarReader.java
+++ b/mobile/android/base/util/GeckoJarReader.java
@@ -47,16 +47,19 @@ public final class GeckoJarReader {
 
         NativeZip zip = null;
         try {
             // Load the initial jar file as a zip
             zip = getZipFile(context, jarUrls.pop());
             inputStream = getStream(zip, jarUrls, url);
             if (inputStream != null) {
                 bitmap = new BitmapDrawable(resources, inputStream);
+                // BitmapDrawable created from a stream does not set the correct target density from resources.
+                // In fact it discards the resources https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/graphics/java/android/graphics/drawable/BitmapDrawable.java#191
+                bitmap.setTargetDensity(resources.getDisplayMetrics());
             }
         } catch (IOException | URISyntaxException ex) {
             Log.e(LOGTAG, "Exception ", ex);
         } finally {
             if (inputStream != null) {
                 try {
                     inputStream.close();
                 } catch(IOException ex) {