|
|
Description[Downloads] Use content:// URIs when sharing
BUG=616324
Committed: https://crrev.com/0a681ef8a944e744d31918da6b156c1159af24d7
Cr-Commit-Position: refs/heads/master@{#411419}
Patch Set 1 #
Total comments: 7
Patch Set 2 : Changes from dfalcantara@ review #Patch Set 3 : Add comment #
Total comments: 2
Patch Set 4 : Add StrictMode exception #
Total comments: 2
Patch Set 5 : Rebase #Patch Set 6 : Add strict mode comment #Patch Set 7 : [Downloads] Use content:// URIs when sharing #
Messages
Total messages: 34 (21 generated)
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
twellington@chromium.org changed reviewers: + dfalcantara@chromium.org, qinmin@chromium.org
ptal https://codereview.chromium.org/2230803004/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://codereview.chromium.org/2230803004/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:309: Uri uri = itemWrapper.getUri(); dfalcantara@ - do you think we'll need getUri() for other things? For the share application, it might make more sense to just use itemWrapper.getFilePath() so that we're only turning it into a Java file once.
https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... File chrome/android/java/res/xml/file_paths.xml (right): https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/res/xml/file_paths.xml:12: <external-path name="downloads" path="Download/" /> Not sure if this will work if we eventually allow users to save files elsewhere. Can you add a note about that here? https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:309: Uri uri = itemWrapper.getUri(); On 2016/08/10 17:53:51, Theresa Wellington wrote: > dfalcantara@ - do you think we'll need getUri() for other things? For the share > application, it might make more sense to just use itemWrapper.getFilePath() so > that we're only turning it into a Java file once. Yeah, caching makes sense. https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:316: Log.e(TAG, "Could not create content uri: " + e); If this fails, should we just fall back to using the Uri.fromFile method?
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... File chrome/android/java/res/xml/file_paths.xml (right): https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/res/xml/file_paths.xml:12: <external-path name="downloads" path="Download/" /> On 2016/08/10 18:14:57, dfalcantara wrote: > Not sure if this will work if we eventually allow users to save files elsewhere. > Can you add a note about that here? Done. https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:309: Uri uri = itemWrapper.getUri(); On 2016/08/10 18:14:57, dfalcantara wrote: > On 2016/08/10 17:53:51, Theresa Wellington wrote: > > dfalcantara@ - do you think we'll need getUri() for other things? For the > share > > application, it might make more sense to just use itemWrapper.getFilePath() so > > that we're only turning it into a Java file once. > > Yeah, caching makes sense. Done. https://chromiumcodereview.appspot.com/2230803004/diff/1/chrome/android/java/... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:316: Log.e(TAG, "Could not create content uri: " + e); On 2016/08/10 18:14:58, dfalcantara wrote: > If this fails, should we just fall back to using the Uri.fromFile method? Done.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
lgtm
lgtm % nit
https://chromiumcodereview.appspot.com/2230803004/diff/40001/chrome/android/j... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://chromiumcodereview.appspot.com/2230803004/diff/40001/chrome/android/j... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:308: Uri uri; nit: not needed. Just do return in try block, and return Uri.FromFile() outside the try block. No uri assignment needed in catch block
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
twellington@chromium.org changed reviewers: + wnwen@chromium.org
+wnwen@ -- I'm adding a StrictMode exception in DownloadManagerUi.java. Getting the content URI causes a disk read because ContentUriUtils#getContentUriFromFile() (our method) calls into FileProvider#getUriForFile() (Android's method) which calls File#getCanonicalPath() which apparently reads from the disk. I think allowing disk reads for this is okay. It should be fast, and the other option is creating the content:// URI on a background thread, which may cause a delay in firing the share intent after the share button is clicked. What do you think? https://chromiumcodereview.appspot.com/2230803004/diff/40001/chrome/android/j... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://chromiumcodereview.appspot.com/2230803004/diff/40001/chrome/android/j... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:308: Uri uri; On 2016/08/10 18:56:18, qinmin wrote: > nit: not needed. > Just do return in try block, and return Uri.FromFile() outside the try block. No > uri assignment needed in catch block I left this alone for now. It turns out that #getContentUriFromFile() causes a disk read so I want to muck with the StrictMode settings. cc'ing wnwen@ on this change for his approval.
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Thanks for checking/fixing this. lgtm % comment https://chromiumcodereview.appspot.com/2230803004/diff/60001/chrome/android/j... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://chromiumcodereview.appspot.com/2230803004/diff/60001/chrome/android/j... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:310: // #getContentUriFromFile causes a disk read when it calls into FileProvider#getUriForFile. Can you add that since this is due to a user action to share selected items, it is on the critical path and we will have to wait for it even if we run it on a separate thread? As it depends on user-selected items, we cannot know/preload which URIs we need until the user presses share. Just so it's clear for others reading this code that we've thought carefully about why this is a valid exception.
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
dfalcantara/qinmin - does DownloadManagerUI still look good to you two? https://codereview.chromium.org/2230803004/diff/60001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java (right): https://codereview.chromium.org/2230803004/diff/60001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java:310: // #getContentUriFromFile causes a disk read when it calls into FileProvider#getUriForFile. On 2016/08/11 15:18:55, Peter Wen wrote: > Can you add that since this is due to a user action to share selected items, it > is on the critical path and we will have to wait for it even if we run it on a > separate thread? As it depends on user-selected items, we cannot know/preload > which URIs we need until the user presses share. > > Just so it's clear for others reading this code that we've thought carefully > about why this is a valid exception. Done.
slgtm
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by twellington@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from qinmin@chromium.org, dfalcantara@chromium.org, wnwen@chromium.org Link to the patchset: https://codereview.chromium.org/2230803004/#ps120001 (title: "[Downloads] Use content:// URIs when sharing")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== [Downloads] Use content:// URIs when sharing BUG=616324 ========== to ========== [Downloads] Use content:// URIs when sharing BUG=616324 Committed: https://crrev.com/0a681ef8a944e744d31918da6b156c1159af24d7 Cr-Commit-Position: refs/heads/master@{#411419} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/0a681ef8a944e744d31918da6b156c1159af24d7 Cr-Commit-Position: refs/heads/master@{#411419} |