summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGarfield Tan <xutan@google.com>2017-03-15 14:20:04 -0700
committerGarfield Tan <xutan@google.com>2017-03-16 00:20:33 +0000
commit8180fa5d5f72e88aadaa00f39ff39ecdfc6d3144 (patch)
tree78fddb7614889728b7726ed7cd1020f6354e777e /src
parentde53f470eae4c673aefd93a76a7390fa35de0641 (diff)
downloadandroid_packages_providers_DownloadProvider-8180fa5d5f72e88aadaa00f39ff39ecdfc6d3144.tar.gz
android_packages_providers_DownloadProvider-8180fa5d5f72e88aadaa00f39ff39ecdfc6d3144.tar.bz2
android_packages_providers_DownloadProvider-8180fa5d5f72e88aadaa00f39ff39ecdfc6d3144.zip
Add findDocumentPath support to DownloadStorageProvider.
Bug: 36254483 Change-Id: Ia53312cd79673ee85d0385f50e8dfef4d7ace3d4
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/downloads/DownloadStorageProvider.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java
index 8e4d7900..ee963623 100644
--- a/src/com/android/providers/downloads/DownloadStorageProvider.java
+++ b/src/com/android/providers/downloads/DownloadStorageProvider.java
@@ -34,6 +34,7 @@ import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Document;
+import android.provider.DocumentsContract.Path;
import android.provider.DocumentsContract.Root;
import android.provider.Downloads;
import android.text.TextUtils;
@@ -123,6 +124,22 @@ public class DownloadStorageProvider extends FileSystemProvider {
return result;
}
+ @Override
+ public Path findDocumentPath(String parentDocId, String docId) throws FileNotFoundException {
+
+ if (parentDocId == null) {
+ parentDocId = DOC_ID_ROOT;
+ }
+
+ final File parent = getFileForDocId(parentDocId);
+
+ final File doc = getFileForDocId(docId);
+
+ final String rootId = (parentDocId == null) ? DOC_ID_ROOT : null;
+
+ return new Path(rootId, findDocumentPath(parent, doc));
+ }
+
/**
* Calls on {@link FileSystemProvider#createDocument(String, String, String)}, and then creates
* a new database entry in {@link DownloadManager} if it is not a raw file and not a folder.