{ "id": "169739", "key": "TIMOB-25259", "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": "20060", "description": "", "name": "Release 7.0.2", "archived": false, "released": true, "releaseDate": "2018-02-09" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-01-24T21:44:41.000+0000", "created": "2017-09-08T22:17:00.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "qe-6.2.0" ], "versions": [ { "id": "18414", "description": "", "name": "Release 6.2.0", "archived": false, "released": true, "releaseDate": "2017-09-13" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-25T00:00:29.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": "*Reason:* https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en\r\n\r\nh5. Steps to reproduce:\r\n1. Use the code below in the app.js:\r\n{code}\r\nif (Ti.Media.hasCameraPermissions()) {\r\n win.open(); \r\n } else { \r\n Ti.Media.requestCameraPermissions(function(e) {\r\n if (e.success === true) {\r\n \tTi.API.info(\"Camera Permissions Granted\");\r\n win.open();\r\n } else {\r\n alert(\"Access denied, error: \" + e.error);\r\n }\r\n });\r\n }\r\n\r\nvar win = Ti.UI.createWindow({backgroundColor: 'grey'});\r\n\r\nwin.add(Ti.UI.createLabel({\r\n\tbackgroundColor : \"blue\",\r\n\tcolor : \"yellow\",\r\n\ttext : \"Hello There\",\r\n\ttextAlign : \"center\",\r\n\tleft : \"10dp\",\r\n\tright : \"10dp\",\r\n\ttop : \"5dp\",\r\n\theight : \"40dp\"\r\n}));\r\n\r\nwin.add(Ti.UI.createImageView({\r\n\theight : \"43dp\",\r\n\twidth : \"46dp\",\r\n\timage : \"KS_nav_ui.png\",\r\n\ttop : \"100dp\"\r\n}));\r\n\r\nvar btn;\r\nwin.add( btn = Ti.UI.createButton({\r\n\ttitle : \"Take screenshot\",\r\n\tbottom : \"5dp\",\r\n\theight : \"40dp\",\r\n\tleft : \"50dp\",\r\n\tright : \"50dp\"\r\n}));\r\n\r\nfunction previewCallback(args) {\r\n\tTi.API.info(\"previewImage success\");\r\n}\r\n\r\nfunction previewError(e) {\r\n\talert(\"previewImage failure: \" + e.message);\r\n\tTi.API.error(e.message);\r\n}\r\n\r\nfunction screenshotCallback(image) {\r\n\tif (!image) {\r\n\t\talert(\"Eeks, takeScreenshot didn't return anything.\");\r\n\t\treturn;\r\n\t} else {\r\n\t\tvar blob = image.media;\r\n\t\tif (!blob) {\r\n\t\t\talert(\"Eeks, there was no useful 'media' member of the passed result dictionary.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (Ti.Platform.osname === \"android\") {\r\n\t\t\tTi.API.info(\"Got an image blob back from takeScreenshot. Gonna store it and preview it.\");\r\n\t\t\tvar tempdir = Ti.Filesystem.tempDirectory;\r\n\t\t\tvar file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, \"temp.png\");\r\n\t\t\tif (file.exists()) {\r\n\t\t\t\tfile.deleteFile();\r\n\t\t\t}\r\n\t\t\tfile.write(blob);\r\n\t\t\tTi.Media.previewImage({\r\n\t\t\t\tsuccess : previewCallback,\r\n\t\t\t\terror : previewError,\r\n\t\t\t\timage : file.read()\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\talert(\"Call to takeScreenshot successful. Got a blob back.\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n\tTi.Media.takeScreenshot(screenshotCallback);\r\n});\r\n\r\nwin.add(btn);\r\n{code}\r\n\r\n2. Make sure you have {{camera}} permission in your tiapp.xml:\r\n{code}\r\n\r\n \t\r\n \t\r\n \r\n\r\n{code}\r\n2. Build the app to android device.\r\n3. After the app launches, click on {{TAKE SCREENSHOT}}.\r\n\r\nh5.Actual result:\r\n1. On API 24 & higher clicking the {{TAKE SCREENSHOT}} button causes {{Runtime Error}}:{code}\r\n[ERROR] : [Pixel] TiExceptionHandler: (main) [1069017,2565939] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : [Pixel] TiExceptionHandler: (main) [0,2565939] - In /acceptance.js:4015,14\r\n[ERROR] : [Pixel] TiExceptionHandler: (main) [0,2565939] - Message: Uncaught file:///storage/emulated/0/com.appcelerator.MediaModule/temp.png exposed beyond app through Intent.getData()\r\n[ERROR] : [Pixel] TiExceptionHandler: (main) [0,2565939] - Source: \t\t\t\tTi.Media.previewImage({\r\n[ERROR] : [Pixel] V8Exception: Exception occurred at /acceptance.js:4015: Uncaught file:///storage/emulated/0/com.appcelerator.MediaModule/temp.png exposed beyond app through Intent.getData()\r\n[ERROR] : [Pixel] V8Exception: file:///storage/emulated/0/com.appcelerator.MediaModule/temp.png exposed beyond app through Intent.getData()\r\n{code}\r\n\r\nh5.Expected results:\r\n1. No runtime error should be thrown.", "attachment": [], "flagged": false, "summary": "Android: Runtime error \"exposed beyond app through Intent.getData()\" on API 24 & higher when using Ti.Media.previewImage()", "creator": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Studio Ver: 4.9.1.201707200100\r\nSDK Ver: 6.2.0.v20170908103920\r\nOS Ver: 10.12.3\r\nXcode Ver: Xcode 8.3.3\r\nAppc NPM: 4.2.9\r\nAppc CLI: 6.2.4-9\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.9.13\r\nNode Ver: 6.11.2\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ google Nexus 5 --- Android 6.0.1\r\n ⇨ google Pixel --- Android 7.1.1\r\n", "closedSprints": [ { "id": 948, "state": "closed", "name": "2017 Sprint 19 SDK", "startDate": "2017-09-10T21:24:51.562Z", "endDate": "2017-09-24T21:24:00.000Z", "completeDate": "2017-09-25T17:49:27.460Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "427758", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile/pull/9419", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-09-11T14:37:53.000+0000", "updated": "2017-09-11T14:37:53.000+0000" }, { "id": "432851", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~gmathews], Can you please provide a backport.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-08T17:07:52.000+0000", "updated": "2018-01-08T17:07:52.000+0000" }, { "id": "432873", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed for master.\r\nWaiting for backport.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-08T19:55:45.000+0000", "updated": "2018-01-08T19:55:45.000+0000" }, { "id": "432875", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "7_0_X: https://github.com/appcelerator/titanium_mobile/pull/9703", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-08T22:41:26.000+0000", "updated": "2018-01-08T22:41:26.000+0000" }, { "id": "432942", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed for backport.\r\nWaiting for merge to get enabled for PR's.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-10T00:05:13.000+0000", "updated": "2018-01-10T00:05:13.000+0000" }, { "id": "433606", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Master PR merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T21:12:36.000+0000", "updated": "2018-01-24T21:12:36.000+0000" }, { "id": "433613", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Backport PR merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T21:44:36.000+0000", "updated": "2018-01-24T21:44:36.000+0000" }, { "id": "433631", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with SDK 7.1.0.v20180124153334 & 7.0.2.v20180124142857.\r\n\r\nClosing.\r\n\r\nStudio Ver: 5.0.0.201712081732\r\nOS Ver: 10.13.2\r\nXcode Ver: Xcode 9.2\r\nAppc NPM: 4.2.11\r\nAppc CLI: 7.0.1\r\nDaemon Ver: 1.0.1\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.10.10\r\nNode Ver: 8.9.1\r\nNPM Ver: 5.5.1\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ samsung SM-G955U1 --- Android 7.0\r\n ⇨ google Nexus 5 --- Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-25T00:00:24.000+0000", "updated": "2018-01-25T00:00:24.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }