Merge "Restricting DocumentsProvider#getType by implementing getTypeAnonymous" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e990e9b660
@@ -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;
|
||||
|
||||
@@ -978,6 +978,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
|
||||
|
||||
Reference in New Issue
Block a user