{ "id": "174043", "key": "TIMOB-27406", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20033", "name": "Release 9.0.0", "archived": false, "released": true, "releaseDate": "2020-03-18" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-01-10T16:57:50.000+0000", "created": "2019-08-21T18:33:04.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "engSchedule" ], "versions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" }, { "id": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" }, { "id": "20827", "name": "Release 8.2.0", "archived": false, "released": true, "releaseDate": "2019-09-19" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-10T16:57:50.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "I downloaded the following image to the device, so after that in the app I am selecting the image from the gallery of download, and it is causing a black/ gray window after selecting the image.\r\n\r\nhttp://www.effigis.com/wp-content/uploads/2015/02/Airbus_Pleiades_50cm_8bit_RGB_Yogyakarta.jpg\r\n\r\nThe purpose of use this huge image it is that I am using the ti.imagefactory module to compress the image, but at the moment I am selecting the image downloaded the app is behaving in this way showing a black or gray window. \r\n\r\nNote this issue is not happening in iOS.\r\n\r\nXML:\r\n\r\n{code:java}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n\r\nJS:\r\n{code:java}\r\nfunction doClick(e) {\r\n\talert($.label.text);\r\n\t\r\n\tTitanium.Media.openPhotoGallery({\r\n\t success:function(event)\r\n\t {\t \r\n\t if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\t \t\tTi.API.info(\"success\");\r\n\t \t\t$.mImageContainer.image = event.media;\r\n\t \t\t\r\n\t }\r\n\t },\r\n\t cancel: function(e){\r\n\t \t\tTi.API.info(e);\r\n\t },\r\n\t error:function(e) {\r\n\t \t\tTi.API.info(e);\r\n\t },\r\n\t mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]\r\n });\r\n\t\r\n}\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\n\r\n{code:java}\r\n[ERROR] TiExceptionHandler: (main) [15193,15193] Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=co\r\nntent://com.android.providers.downloads.documents/document/raw:/storage/emulated/0/Download/x.jpg flg=0x1 }} to activity {com.tony.tony/or\r\ng.appcelerator.titanium.TiActivity}: java.lang.NumberFormatException: For input string: \"raw:/storage/emulated/0/Download/x.jpg\"\r\n[ERROR] TiExceptionHandler:\r\n[ERROR] TiExceptionHandler: java.lang.Long.parseLong(Long.java:594)\r\n[ERROR] TiExceptionHandler: java.lang.Long.valueOf(Long.java:808)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.io.TitaniumBlob.init(TitaniumBlob.java:89)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.io.TitaniumBlob.(TitaniumBlob.java:41)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.io.TiFileFactory.createTitaniumFile(TiFileFactory.java:112)\r\n[ERROR] TiExceptionHandler: ti.modules.titanium.media.MediaModule.createImageData(MediaModule.java:1276)\r\n[ERROR] TiExceptionHandler: ti.modules.titanium.media.MediaModule.createDictForImage(MediaModule.java:1267)\r\n[ERROR] TiExceptionHandler: ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:1199)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:60)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:117)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:905)\r\n[ERROR] TiExceptionHandler: android.app.Activity.dispatchActivityResult(Activity.java:7797)\r\n[ERROR] TiExceptionHandler: android.app.ActivityThread.deliverResults(ActivityThread.java:5071)\r\n[ERROR] TiExceptionHandler: android.app.ActivityThread.handleSendResult(ActivityThread.java:5120)\r\n[ERROR] TiExceptionHandler: android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)\r\n[ERROR] TiExceptionHandler: android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)\r\n[ERROR] TiExceptionHandler: android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)\r\n[ERROR] TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)\r\n[ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:112)\r\n[ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:216)\r\n[ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7625)\r\n[ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)\r\n[ERROR] TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)\r\n{code}\r\n\r\nPlease let me know whether you have any doubt or question.\r\n\r\nThanks, and best,\r\nFrancisco Antonio Duran Ramirez.\r\n", "attachment": [ { "id": "66886", "filename": "1566788007519.JPEG", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2019-08-26T04:24:21.000+0000", "size": 43794, "mimeType": "image/jpeg" }, { "id": "66887", "filename": "console.docx", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2019-08-26T04:25:54.000+0000", "size": 12043, "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }, { "id": "66866", "filename": "Screenshot_20190822-135247.png", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-08-22T07:55:27.000+0000", "size": 2074056, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Cannot select content from downloads", "creator": { "name": "antonioduran", "key": "antonioduran", "displayName": "Francisco Antonio Duran Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "antonioduran", "key": "antonioduran", "displayName": "Francisco Antonio Duran Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "environment": " Titanium SDK : 8.1.0.GA - CLI 7.1.0 - Node version : 8.9.1 - Axway Appcelerator Studio, build: 5.1.2.201903111843 - Android 9", "closedSprints": [ { "id": 1175, "state": "closed", "name": "2019 Sprint 26", "startDate": "2019-12-16T06:12:12.044Z", "endDate": "2019-12-21T06:12:00.000Z", "completeDate": "2019-12-22T03:07:15.802Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "450710", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nTested the sample code provide by you with SDK 8.1.0.GA on Android 7 device(Huawei y9 2018) and does not able to reproduce the issue. Can you please share the correct code?\r\n\r\nTest output:\r\n !Screenshot_20190822-135247.png|thumbnail! ", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-08-22T07:56:35.000+0000", "updated": "2019-08-22T07:56:35.000+0000" }, { "id": "450717", "author": { "name": "antonioduran", "key": "antonioduran", "displayName": "Francisco Antonio Duran Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello @Rakhi Mitro. Good afternoon / morning.\r\n\r\nPlease download, and use the image I mentioned before with the following link:\r\n\r\nhttp://www.effigis.com/wp-content/uploads/2015/02/Airbus_Pleiades_50cm_8bit_RGB_Yogyakarta.jpg\r\n\r\n\r\nThe size of this image (link provided) is 41MB approximately, and the image you are using is 2.1MB approximately, so it seems that the issue is when we are using an image with a huge size.\r\n\r\n\r\nPlease let me know whether you have any doubt or question.\r\n\r\nThanks, and best,\r\nFrancisco Antonio Duran Ramirez.", "updateAuthor": { "name": "antonioduran", "key": "antonioduran", "displayName": "Francisco Antonio Duran Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-08-22T12:41:12.000+0000", "updated": "2019-08-22T12:41:12.000+0000" }, { "id": "450806", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~antonioduran] [~rmitro] I think it is related to this: https://stackoverflow.com/questions/51136671/oreo-documentscontract-getdocumentiduri-returns-path-instead-of-long\r\n\r\nThe problem is located in this line: https://github.com/appcelerator/titanium_mobile/blob/1a2343d1500a47ea5adabe8a52fcc077dd4b5169/android/titanium/src/java/org/appcelerator/titanium/io/TitaniumBlob.java#L89 and it is complaining about the parameter not beeing a number. Since [~antonioduran] is testing on Android 9 he has the problem while [~rmitro] is testing on Android 7 which should be fine (if the image was downloaded from the Cloud, so it wasn't physically on the device while clicking on it in the gallery)", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-08-25T09:32:49.000+0000", "updated": "2019-08-25T09:32:49.000+0000" }, { "id": "450838", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-08-26T18:45:18.000+0000", "updated": "2019-08-26T18:45:18.000+0000" }, { "id": "451423", "author": { "name": "rfarfan", "key": "rfarfan", "displayName": "Rodrigo Farfán", "active": true, "timeZone": "Europe/Madrid" }, "body": "Hello everyone. Last night this issue was reported on TiSlack by Diego Freniche (@dfreniche) and I explored the line of code where the exception is thrown. After googling a couple of sites, I realized that this is a known issue when accessing files located in downloads folder. Take a look at this SO entry:\r\nhttps://stackoverflow.com/questions/51136671/oreo-documentscontract-getdocumentiduri-returns-path-instead-of-long\r\n\r\nThat's why I switched my forked Titanium_Mobile code to branch 8_1_X and tried a work around that fixes this behaviour. Basically I modified the org.appcelerator.titanium.io.TitaniumBlob.java class doing this:\r\n\r\n{code}\r\n\r\n} else if (url.startsWith(\"content://com.android.providers.downloads.documents\")) {\r\n\t\t\t// This was a file downloaded from the Google cloud.\r\n\t\t\tString id = DocumentsContract.getDocumentId(Uri.parse(url));\r\n\t\t\t// phobeous - 2019.09.17 - AC-6341 >> Start of modification\r\n\t\t\tif (id.startsWith(\"raw:\")) {\r\n\t\t\t\tid = id.replaceFirst(\"raw:\", \"\");\r\n\t\t\t\tthis.name = id.substring(id.lastIndexOf(File.pathSeparatorChar) + 1);\r\n\t\t\t\tthis.path = id;\r\n\t\t\t} else { // phobeous - 2019.09.17 - AC-6341 << End of modification\r\n\t\t\t\tUri uri = ContentUris.withAppendedId(Uri.parse(\"content://downloads/public_downloads\"), Long.valueOf(id));\r\n\t\t\t\ttry (Cursor cursor = contentResolver.query(uri, projection, null, null, null)) {\r\n\t\t\t\t\tif ((cursor != null) && cursor.moveToNext()) {\r\n\t\t\t\t\t\tthis.name = getStringFrom(cursor, 0);\r\n\t\t\t\t\t\tthis.path = getStringFrom(cursor, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (Exception ex) {\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n{code}\r\n\r\nDiego confirms it works. Please, consider this solution.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-09-17T08:36:28.000+0000", "updated": "2019-09-17T08:40:01.000+0000" }, { "id": "451426", "author": { "name": "rfarfan", "key": "rfarfan", "displayName": "Rodrigo Farfán", "active": true, "timeZone": "Europe/Madrid" }, "body": "Please, consider update this issue title to \"Issue opening files from downloads folder on Android 8+\"", "updateAuthor": { "name": "rfarfan", "key": "rfarfan", "displayName": "Rodrigo Farfán", "active": true, "timeZone": "Europe/Madrid" }, "created": "2019-09-17T09:37:25.000+0000", "updated": "2019-09-17T09:37:25.000+0000" }, { "id": "451442", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~rfarfan] I've linked to the exact same issue some posts above :) Could have saved you some time. But at least you've tested it and made a PR! Please remove the commets \"{{ phobeous - 2019.09.17 - TIMOB-27406 >> Start of modification}}\" from the PR and run \"{{clang-format -style=file -i android/src/....filename}}\" to make the validator happy ", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-09-17T15:50:01.000+0000", "updated": "2019-09-17T15:50:01.000+0000" }, { "id": "451444", "author": { "name": "rfarfan", "key": "rfarfan", "displayName": "Rodrigo Farfán", "active": true, "timeZone": "Europe/Madrid" }, "body": "Yeah. I visited this issue 3 or 4 weeks ago, but today I couldn't remember. Anyway, it took me more time building the SDK than searching on the web and apply the fix. Sorry for my silly comments in the code (it's my first PR ever). Comments are away now.", "updateAuthor": { "name": "rfarfan", "key": "rfarfan", "displayName": "Rodrigo Farfán", "active": true, "timeZone": "Europe/Madrid" }, "created": "2019-09-17T16:07:00.000+0000", "updated": "2019-09-17T16:07:20.000+0000" }, { "id": "453183", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile/pull/11395", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-13T23:32:59.000+0000", "updated": "2019-12-13T23:32:59.000+0000" }, { "id": "453501", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed, Waiting on Jenkins build.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-08T14:02:40.000+0000", "updated": "2020-01-08T14:02:40.000+0000" }, { "id": "453532", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master for 9.0.0", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-01-09T16:39:25.000+0000", "updated": "2020-01-09T16:39:25.000+0000" }, { "id": "453640", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket, fix verified in SDK version {{9.0.0.v20200109153329}}. \r\n\r\nTest and other information can be found at: \r\nhttps://github.com/appcelerator/titanium_mobile/pull/11395", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-10T16:57:40.000+0000", "updated": "2020-01-10T16:57:40.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }