Commit 9eef8dcb authored by Jian Li's avatar Jian Li Committed by Commit Bot

Check if storage permission is granted before requesting it

In DownloadController.requestFileAccess, we should check if storage
permission is already granted before requesting it.

Bug: 836397
Change-Id: Idadcdfc3b055696b8f7194e5d63bdee54a8d4959
Reviewed-on: https://chromium-review.googlesource.com/1029116Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Jian Li <jianli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554579}
parent c0ea9aab
...@@ -175,6 +175,11 @@ public class DownloadController { ...@@ -175,6 +175,11 @@ public class DownloadController {
return; return;
} }
if (delegate.hasPermission(permission.WRITE_EXTERNAL_STORAGE)) {
callback.onResult(Pair.create(true, null));
return;
}
if (!delegate.canRequestPermission(permission.WRITE_EXTERNAL_STORAGE)) { if (!delegate.canRequestPermission(permission.WRITE_EXTERNAL_STORAGE)) {
callback.onResult(Pair.create(false, callback.onResult(Pair.create(false,
delegate.isPermissionRevokedByPolicy(permission.WRITE_EXTERNAL_STORAGE) delegate.isPermissionRevokedByPolicy(permission.WRITE_EXTERNAL_STORAGE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment