{ "id": "170010", "key": "TIMOB-25507", "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": "19957", "description": "", "name": "Release 7.1.0", "archived": false, "released": true, "releaseDate": "2018-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-02-22T16:21:33.000+0000", "created": "2017-10-13T12:52:01.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "cache", "permissions" ], "versions": [], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-03-02T16:34:42.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": "HTTP response caching is disabled, if \"WRITE_EXTERNAL_STORAGE\" is not granted.\r\nAfter TIMOB-20470 directory for cache is taken by '.getCacheDir()' or '.getExternalCacheDir().\r\nNo permissions required to write files in this directories.", "attachment": [ { "id": "63433", "filename": "0001-remove-external_storage-permission-requirement-for-c.patch", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-10-13T12:44:56.000+0000", "size": 1687, "mimeType": "text/x-patch" }, { "id": "63554", "filename": "app.js", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-11-07T10:58:07.000+0000", "size": 511, "mimeType": "application/javascript" } ], "flagged": false, "summary": "Android. TiResponseCache. Permission", "creator": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "subtasks": [], "reporter": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "environment": "SDK 6.3.0\r\nAndroid M+", "closedSprints": [ { "id": 1000, "state": "closed", "name": "2018 Sprint 04 SDK", "startDate": "2018-02-12T04:23:01.913Z", "endDate": "2018-02-26T04:23:00.000Z", "completeDate": "2018-02-26T19:36:01.769Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "429386", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, What seems to be the issue here? Any particular error you see or application not functioning properly? ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-10-21T19:31:36.000+0000", "updated": "2017-10-21T19:31:45.000+0000" }, { "id": "429483", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "Hi. Problem is that HTTP responses are not cached on Android API 23+, if \"WRITE_EXTERNAL_STORAGE\" is not granted. Cache directory (\"//Android/data//cache/_tmp/remote-cache\") is empty.\r\nBut fixing this by asking user for \"WRITE_EXTERNAL_STORAGE\" is wrong, because access to this directory is not restricted by this permission.\r\n\r\nTake a look at TIMOB-20251 and TIMOB-20470.", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-10-24T07:07:47.000+0000", "updated": "2017-10-24T07:07:47.000+0000" }, { "id": "430216", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": " [^app.js] \r\n\r\nHow it works now:\r\n* First click on button creates request, image is cached in memory, cache directory is empty. No requests are created for later clicks.\r\n* After app restart all operate same way (one request for first click).\r\n\r\nWhat I expect:\r\n* First click on button creates request, image is cached in memory, also image is chaced in storage directory. No requests are created for later clicks.\r\n* After app restart no requests are created, image is taken from cache.\r\n\r\n\r\n", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-11-07T11:13:02.000+0000", "updated": "2017-11-07T11:13:02.000+0000" }, { "id": "430450", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I tried to test your sample code. I click on the button shows a small android icon in the window. for additional click, the new icon is coming up beneath the previous one. Can you explain the testing process? Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-11T19:26:12.000+0000", "updated": "2017-11-11T19:26:12.000+0000" }, { "id": "430509", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "You will need an emulator with Android API 23+\r\n1. Install app\r\n2. You should not change default permissions in app settings (\"Storage\" is disabled by default)\r\n3. Run application\r\n4. Check cache directory (\"//Android/data//cache/_tmp/remote-cache\"). It should be empty.\r\n5. Run \"tcpdump -n -i eth1 host docs.appcelerator.com\" in emulator shell. (you may have different device name)\r\n6. Click on the button\r\n6.1. Packets are shown in tcpdump\r\n6.2. Small android icon appear in the window\r\n6.3. Cache directory is still empty\r\n7. Close app; stop/start tcpdump; run app\r\n8. Click on the button\r\n8.1. Packets are shown in tcpdump\r\n8.2. Small android icon appear in the window\r\n8.3. Cache directory is still empty\r\n\r\n\r\nExpected result (SDK with [^0001-remove-external_storage-permission-requirement-for-c.patch]):\r\n6.3. Cache directory is not empty\r\n8.1. No packets in tcpdump\r\n8.3. Cache directory is not empty\r\n", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-11-13T08:57:40.000+0000", "updated": "2017-11-13T08:57:40.000+0000" }, { "id": "430514", "author": { "name": "l0wb1rd", "key": "l0wb1rd", "displayName": "Low Bird", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I can confirm this: Images loaded via http(s) are not cached in filesystem (tmp dir) for Android by default. They are \r\nonly cached after the WRITE_EXTERNAL_STORAGE permission is granted. But this permission is not necessary for writing to the tmp dir.\r\n\r\nI cant explain it any better than s.volkov already did.\r\n\r\nSo the question is: Why is WRITE_EXTERNAL_STORAGE required for TiRepsonseCache to work under android? Is this a bug or is there another dependency we are missing here?\r\n\r\n", "updateAuthor": { "name": "l0wb1rd", "key": "l0wb1rd", "displayName": "Low Bird", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T12:39:15.000+0000", "updated": "2017-11-13T12:39:53.000+0000" }, { "id": "430516", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "Originally, TiResponseCache wrote to directory on external storage. There was no restrictions to write to external storage.\r\nIn Android API 23 permissions model was changed, so apps could not write to external storage without permisson. In TIMOB-20251 this problem was solved in wrong way (\"No caching if permission is not enabled\" [commit|https://github.com/appcelerator/titanium_mobile/commit/1868b11f98a09381a921540c1e660a1872405880])\r\n\r\nSince Android API 8, 'Context.getExternalCacheDir()' is available, and in TIMOB-20470 I made appropriate change. ", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-11-13T13:20:13.000+0000", "updated": "2017-11-13T13:20:13.000+0000" }, { "id": "430581", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/9596", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2017-11-14T08:43:14.000+0000", "updated": "2017-11-14T08:43:14.000+0000" }, { "id": "430589", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jquick] Can you review the community PR for 7.1.0?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-14T15:45:47.000+0000", "updated": "2017-11-14T15:45:47.000+0000" }, { "id": "434549", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9838", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-15T22:24:51.000+0000", "updated": "2018-02-15T22:24:51.000+0000" }, { "id": "434776", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Master and 7_1_x eerged test and other information can be found at:\r\n\r\nMaster: https://github.com/appcelerator/titanium_mobile/pull/9596\r\n7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9838", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-22T16:22:37.000+0000", "updated": "2018-02-22T16:22:37.000+0000" }, { "id": "435114", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket; Verified fix in SDK Version: 7.1.0.v20180228160738 and SDK Version: 7.2.0.v20180301101144.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-02T16:34:34.000+0000", "updated": "2018-03-02T16:34:34.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }