summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-07-21 19:54:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-07-21 19:54:39 +0000
commit3eb7d4d907aed92f3f45b84720c7f2e013b50ac0 (patch)
tree826664c740546fc9dda50015fa3557c44e26c767 /src
parentf9ec511ff6568190ea30543b743b1aba4a137ed3 (diff)
parent329a94b7cbaab13f3a046fa0989a9e3eea92cac9 (diff)
downloadandroid_packages_providers_DownloadProvider-3eb7d4d907aed92f3f45b84720c7f2e013b50ac0.tar.gz
android_packages_providers_DownloadProvider-3eb7d4d907aed92f3f45b84720c7f2e013b50ac0.tar.bz2
android_packages_providers_DownloadProvider-3eb7d4d907aed92f3f45b84720c7f2e013b50ac0.zip
Merge "Move the null check before assigning parentId to root doc ID."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/downloads/DownloadStorageProvider.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java
index caff89df..2fde777d 100644
--- a/src/com/android/providers/downloads/DownloadStorageProvider.java
+++ b/src/com/android/providers/downloads/DownloadStorageProvider.java
@@ -131,7 +131,11 @@ public class DownloadStorageProvider extends FileSystemProvider {
}
@Override
- public Path findDocumentPath(String parentDocId, String docId) throws FileNotFoundException {
+ public Path findDocumentPath(@Nullable String parentDocId, String docId) throws FileNotFoundException {
+
+ // parentDocId is null if the client is asking for the path to the root of a doc tree.
+ // Don't share root information with those who shouldn't know it.
+ final String rootId = (parentDocId == null) ? DOC_ID_ROOT : null;
if (parentDocId == null) {
parentDocId = DOC_ID_ROOT;
@@ -141,8 +145,6 @@ public class DownloadStorageProvider extends FileSystemProvider {
final File doc = getFileForDocId(docId);
- final String rootId = (parentDocId == null) ? DOC_ID_ROOT : null;
-
return new Path(rootId, findDocumentPath(parent, doc));
}