Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26182] An exception is raised when a remote image URL is set on an ImageView on some Android devices

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-09-17T20:15:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsAndroid
Labelsregression
ReporterGautier Drusch
AssigneeGary Mathews
Created2018-07-03T07:49:14.000+0000
Updated2018-10-11T19:36:55.000+0000

Description

On one of our Android device, a native exception is raised when we set a remote URL on an ImageView (no problems with local URLs). Visually, no remote images are displayed on the app. If we turn on the storage permission on the device for our app, the images are displayed. This error happens only on SDKs 7.1 and more. Here's the exception :
 [ERROR] TiDrawableReference: (pool-6-thread-1) [46,103593] Problem opening stream with url [the URL]: /storage/emulated/0/Android/data/[the package name]/cache/_tmp/remote-cache/ec4d7d79f9e6687d490bf9eea8f8a779667ad14f.hdr: open failed: EACCES (Permission denied)
 java.io.FileNotFoundException: /storage/emulated/0/Android/data/[the package name]/cache/_tmp/remote-cache/ec4d7d79f9e6687d490bf9eea8f8a779667ad14f.hdr: open failed: EACCES (Permission denied)
 	at libcore.io.IoBridge.open(IoBridge.java:452)
 	at java.io.FileInputStream.<init>(FileInputStream.java:76)
 	at java.io.FileReader.<init>(FileReader.java:42)
 	at org.appcelerator.titanium.util.TiResponseCache.readHeaders(TiResponseCache.java:351)
 	at org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:338)
 	at com.android.okhttp.internal.huc.CacheAdapter.getJavaCachedResponse(CacheAdapter.java:103)
 	at com.android.okhttp.internal.huc.CacheAdapter.get(CacheAdapter.java:47)
 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:229)
 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:384)
 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:231)
 	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
 	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java)
 	at java.net.URL.openStream(URL.java:470)
 	at org.appcelerator.titanium.util.TiFileHelper.handleNetworkURL(TiFileHelper.java:248)
 	at org.appcelerator.titanium.util.TiFileHelper.openInputStream(TiFileHelper.java:186)
 	at org.appcelerator.titanium.view.TiDrawableReference.getInputStream(TiDrawableReference.java:896)
 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:373)
 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:330)
 	at org.appcelerator.titanium.util.TiLoadImageManager$LoadImageJob.run(TiLoadImageManager.java:132)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
 	at java.lang.Thread.run(Thread.java:818)
 Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
 	at libcore.io.Posix.open(Native Method)
 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
 	at libcore.io.IoBridge.open(IoBridge.java:438)
 	... 22 more

Comments

  1. Rene Pot 2018-07-03

    Can you share your code and the url of the image of the problem. And does this only happen on certain domains, or all remote images?
  2. Gary Mathews 2018-07-03

    master: https://github.com/appcelerator/titanium_mobile/pull/10153
  3. Lokesh Choudhary 2018-09-17

    FR Passed.
  4. Lokesh Choudhary 2018-09-17

    PR Merged.
  5. Keerthi Mahalingam 2018-10-11

    Verified the fix on SDK 7.5.0.v20181010051919. Image displayed without any issue on with or without permission. Closing
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Titanium SDK
         SDK Version                 =7.5.0.v20181010051919
       Device			      = Samsung s5 Android 6
       					Pixel 2 xl android 8 emulator
       

JSON Source