{ "id": "175384", "key": "TIMOB-28058", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-11-20T15:14:14.000+0000", "created": "2020-07-30T04:09:15.000+0000", "epic": { "id": 175371, "key": "TIMOB-28045", "name": "Android 11: Implement Support", "summary": "Android 11: Implement Support", "color": { "key": "color_3" }, "done": false }, "priority": { "name": "High", "id": "2" }, "labels": [ "android", "file", "filesystem", "storage", "tempdir" ], "versions": [], "issuelinks": [ { "id": "58795", "type": { "id": "10000", "name": "Blocks", "inward": "is blocked by", "outward": "blocks" }, "inwardIssue": { "id": "175385", "key": "TIMOB-28059", "fields": { "summary": "Android: Modify Ti.Media APIs to use scoped storage", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "58797", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "175617", "key": "TIMOB-28176", "fields": { "summary": "Android: createTempDirectory() does not create a directory", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "58798", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "175618", "key": "TIMOB-28177", "fields": { "summary": "Android: createTempFile() should create file under Ti.Filesystem.tempDirectory", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-20T15:14:14.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": "*Summary:*\r\nThe following APIs need to use app's scoped storage and avoid external storage.\r\n* Ti.Filesystem.createTempDirectory()\r\n* Ti.Filesystem.createTempFile()\r\n* Ti.Filesystem.tempDirectory\r\n\r\n*Note 1:*\r\nWe should write temp files according to Google's docs in the link below. They expect us to explicitly set the temp directory to the app's cache directory.\r\nhttps://developer.android.com/training/data-storage/app-specific#internal-create-cache\r\n\r\n*Note 2:*\r\nOur {{Ti.Filesystem.tempDirectory}} property return...\r\n{code}\r\n.//_tmp\r\n{code}\r\n\r\nOur {{Ti.Filesystem.createTempFile()}} and {{Ti.Filesystem.createTempDirectory()}} methods should change their base directory to the below to avoid collision with the above folder.\r\n{code}\r\n.//.titanium/tmp\r\n{code}\r\n\r\n*Note 3:*\r\nOur [TiTempFileHelper.java|https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/common/src/java/org/appcelerator/kroll/util/TiTempFileHelper.java] code (used to acquire a temp directory path) will use {{getExternalCacheDir()}} or {{getCacheDir()}} depending on if it has access to external storage or not. This may not be a good idea since the temp directory can suddenly change at runtime due to...\r\n* End-user granting permission, making it dynamically switch to external storage.\r\n* End-user ejects SD card, which makes temp path switch to internal storage.\r\n\r\nIt would be better for the path to be consistent for the app's lifetime. So, it should be hardcoded to internal storage via {{getCacheDir()}} like Google's examples.\r\n\r\n*Note 4:*\r\nOur HTTP response cache should favor internal storage's cache directory for improved security/privacy. That is what Google suggests in the link below and is what the Chrome browser app does. External storage is best used for large files intended to be shared (like downloaded files).\r\nhttps://developer.android.com/reference/android/net/http/HttpResponseCache\r\n\r\nIf we do this, then we can remove our {{startExternalStorageMonitor()}} related code in [TiApplication.java|https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java] and hard-code our {{TiResponseCache}} to always be the default. This means HTTP response caching will alway be enabled, even if you don't have external storage permission.\r\n", "attachment": [], "flagged": false, "summary": "Android: Change Ti.Filesystem \"temp\" APIs to use app's cache folder", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1208, "state": "closed", "name": "2020 Sprint 21", "startDate": "2020-10-12T16:34:00.000Z", "endDate": "2020-10-23T16:34:00.000Z", "completeDate": "2020-10-23T02:32:43.674Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "457178", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12161", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-07T03:28:10.000+0000", "updated": "2020-10-07T03:28:10.000+0000" }, { "id": "457282", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nWaiting for Jenkins build.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-19T20:13:55.000+0000", "updated": "2020-10-19T20:13:55.000+0000" }, { "id": "457287", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Merged to master for 9.3.0 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-10-19T21:31:07.000+0000", "updated": "2020-10-19T21:31:07.000+0000" }, { "id": "457656", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Improvement verified in SDK version {{9.3.0.v20201119063936}}.\r\n\r\nTest and other information can be found at:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/12161", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-20T15:14:07.000+0000", "updated": "2020-11-20T15:14:07.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }