summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt1
-rw-r--r--core/java/android/provider/DocumentsProvider.java13
2 files changed, 14 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index be36d6327124..1464c5b5058b 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -36889,6 +36889,7 @@ package android.provider {
method public String[] getDocumentStreamTypes(String, String);
method public String getDocumentType(String) throws java.io.FileNotFoundException;
method public final String getType(android.net.Uri);
+ method @Nullable public final String getTypeAnonymous(@NonNull android.net.Uri);
method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
method public boolean isChildDocument(String, String);
method public String moveDocument(String, String, String) throws java.io.FileNotFoundException;
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 07d500176fe5..5b527c70b4f7 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -979,6 +979,19 @@ public abstract class DocumentsProvider extends ContentProvider {
}
/**
+ * An unrestricted version of getType, which does not reveal sensitive information
+ */
+ @Override
+ public final @Nullable String getTypeAnonymous(@NonNull Uri uri) {
+ switch (mMatcher.match(uri)) {
+ case MATCH_ROOT:
+ return DocumentsContract.Root.MIME_TYPE_ITEM;
+ default:
+ return null;
+ }
+ }
+
+ /**
* Implementation is provided by the parent class. Can be overridden to
* provide additional functionality, but subclasses <em>must</em> always
* call the superclass. If the superclass returns {@code null}, the subclass