Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -34099,7 +34099,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri); api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -37001,7 +37001,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri); api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -34226,7 +34226,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri); core/java/android/provider/DocumentsContract.java +16 −13 Original line number Diff line number Diff line Loading @@ -1367,24 +1367,25 @@ public final class DocumentsContract { } /** * Finds the canonical path to the top of the tree. The return value starts * from the top of the tree or the root document to the requested document, * both inclusive. * Finds the canonical path from the top of the document tree. * * The {@link Path#getPath()} of the return value contains the document ID * of all documents along the path from the top the document tree to the * requested document, both inclusive. * * Document ID should be unique across roots. * The {@link Path#getRootId()} of the return value returns {@code null}. * * @param treeUri treeUri of the document which path is requested. * @return a list of documents ID starting from the top of the tree to the * requested document, or {@code null} if failed. * @return the path of the document, or {@code null} if failed. * @see DocumentsProvider#findDocumentPath(String, String) */ public static List<String> findDocumentPath(ContentResolver resolver, Uri treeUri) { public static Path findDocumentPath(ContentResolver resolver, Uri treeUri) { checkArgument(isTreeUri(treeUri), treeUri + " is not a tree uri."); final ContentProviderClient client = resolver.acquireUnstableContentProviderClient( treeUri.getAuthority()); try { return findDocumentPath(client, treeUri).getPath(); return findDocumentPath(client, treeUri); } catch (Exception e) { Log.w(TAG, "Failed to find path", e); return null; Loading @@ -1394,12 +1395,14 @@ public final class DocumentsContract { } /** * Finds the canonical path. If uri is a document uri returns path to a root and * its associated root id. If uri is a tree uri returns the path to the top of * the tree. The {@link Path#getPath()} in the return value starts from the top of * the tree or the root document to the requested document, both inclusive. * Finds the canonical path. If uri is a document uri returns path from a root and * its associated root id. If uri is a tree uri returns the path from the top of * the tree. The {@link Path#getPath()} of the return value contains document ID * starts from the top of the tree or the root document to the requested document, * both inclusive. * * Document id should be unique across roots. * Callers can expect the root ID returned from multiple calls to this method is * consistent. * * @param uri uri of the document which path is requested. It can be either a * plain document uri or a tree uri. Loading core/java/android/provider/DocumentsProvider.java +10 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.util.Log; import libcore.io.IoUtils; import java.io.FileNotFoundException; import java.util.LinkedList; import java.util.Objects; /** Loading Loading @@ -352,14 +353,14 @@ public abstract class DocumentsProvider extends ContentProvider { * Different roots should use different document ID to refer to the same * document. * * @param childDocumentId the document which path is requested. * @param parentDocumentId the document from which the path starts if not null, * or null to indicate a path from the root is requested. * @param childDocumentId the document which path is requested. * @return the path of the requested document. If parentDocumentId is null * returned root ID must not be null. If parentDocumentId is not null * returned root ID must be null. */ public Path findDocumentPath(String childDocumentId, @Nullable String parentDocumentId) public Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException { throw new UnsupportedOperationException("findDocumentPath not supported."); } Loading Loading @@ -1048,13 +1049,19 @@ public abstract class DocumentsProvider extends ContentProvider { ? DocumentsContract.getTreeDocumentId(documentUri) : null; Path path = findDocumentPath(documentId, parentDocumentId); Path path = findDocumentPath(parentDocumentId, documentId); // Ensure provider doesn't leak information to unprivileged callers. if (isTreeUri) { if (!Objects.equals(path.getPath().get(0), parentDocumentId)) { Log.wtf(TAG, "Provider doesn't return path from the tree root. Expected: " + parentDocumentId + " found: " + path.getPath().get(0)); LinkedList<String> docs = new LinkedList<>(path.getPath()); while (docs.size() > 1 && !Objects.equals(docs.getFirst(), parentDocumentId)) { docs.removeFirst(); } path = new Path(null, docs); } if (path.getRootId() != null) { Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -34099,7 +34099,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri);
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -37001,7 +37001,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri);
api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -34226,7 +34226,7 @@ package android.provider { method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); method public static android.content.IntentSender createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle); method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri); method public static java.util.List<java.lang.String> findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static android.provider.DocumentsContract.Path findDocumentPath(android.content.ContentResolver, android.net.Uri); method public static java.lang.String getDocumentId(android.net.Uri); method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal); method public static java.lang.String getRootId(android.net.Uri);
core/java/android/provider/DocumentsContract.java +16 −13 Original line number Diff line number Diff line Loading @@ -1367,24 +1367,25 @@ public final class DocumentsContract { } /** * Finds the canonical path to the top of the tree. The return value starts * from the top of the tree or the root document to the requested document, * both inclusive. * Finds the canonical path from the top of the document tree. * * The {@link Path#getPath()} of the return value contains the document ID * of all documents along the path from the top the document tree to the * requested document, both inclusive. * * Document ID should be unique across roots. * The {@link Path#getRootId()} of the return value returns {@code null}. * * @param treeUri treeUri of the document which path is requested. * @return a list of documents ID starting from the top of the tree to the * requested document, or {@code null} if failed. * @return the path of the document, or {@code null} if failed. * @see DocumentsProvider#findDocumentPath(String, String) */ public static List<String> findDocumentPath(ContentResolver resolver, Uri treeUri) { public static Path findDocumentPath(ContentResolver resolver, Uri treeUri) { checkArgument(isTreeUri(treeUri), treeUri + " is not a tree uri."); final ContentProviderClient client = resolver.acquireUnstableContentProviderClient( treeUri.getAuthority()); try { return findDocumentPath(client, treeUri).getPath(); return findDocumentPath(client, treeUri); } catch (Exception e) { Log.w(TAG, "Failed to find path", e); return null; Loading @@ -1394,12 +1395,14 @@ public final class DocumentsContract { } /** * Finds the canonical path. If uri is a document uri returns path to a root and * its associated root id. If uri is a tree uri returns the path to the top of * the tree. The {@link Path#getPath()} in the return value starts from the top of * the tree or the root document to the requested document, both inclusive. * Finds the canonical path. If uri is a document uri returns path from a root and * its associated root id. If uri is a tree uri returns the path from the top of * the tree. The {@link Path#getPath()} of the return value contains document ID * starts from the top of the tree or the root document to the requested document, * both inclusive. * * Document id should be unique across roots. * Callers can expect the root ID returned from multiple calls to this method is * consistent. * * @param uri uri of the document which path is requested. It can be either a * plain document uri or a tree uri. Loading
core/java/android/provider/DocumentsProvider.java +10 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.util.Log; import libcore.io.IoUtils; import java.io.FileNotFoundException; import java.util.LinkedList; import java.util.Objects; /** Loading Loading @@ -352,14 +353,14 @@ public abstract class DocumentsProvider extends ContentProvider { * Different roots should use different document ID to refer to the same * document. * * @param childDocumentId the document which path is requested. * @param parentDocumentId the document from which the path starts if not null, * or null to indicate a path from the root is requested. * @param childDocumentId the document which path is requested. * @return the path of the requested document. If parentDocumentId is null * returned root ID must not be null. If parentDocumentId is not null * returned root ID must be null. */ public Path findDocumentPath(String childDocumentId, @Nullable String parentDocumentId) public Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException { throw new UnsupportedOperationException("findDocumentPath not supported."); } Loading Loading @@ -1048,13 +1049,19 @@ public abstract class DocumentsProvider extends ContentProvider { ? DocumentsContract.getTreeDocumentId(documentUri) : null; Path path = findDocumentPath(documentId, parentDocumentId); Path path = findDocumentPath(parentDocumentId, documentId); // Ensure provider doesn't leak information to unprivileged callers. if (isTreeUri) { if (!Objects.equals(path.getPath().get(0), parentDocumentId)) { Log.wtf(TAG, "Provider doesn't return path from the tree root. Expected: " + parentDocumentId + " found: " + path.getPath().get(0)); LinkedList<String> docs = new LinkedList<>(path.getPath()); while (docs.size() > 1 && !Objects.equals(docs.getFirst(), parentDocumentId)) { docs.removeFirst(); } path = new Path(null, docs); } if (path.getRootId() != null) { Loading