Loading core/java/com/android/internal/content/FileSystemProvider.java +7 −4 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { * Callback indicating that the given document has been deleted or moved. This gives * the provider a hook to revoke the uri permissions. */ protected void onDocIdDeleted(String docId) { protected void onDocIdDeleted(String docId, boolean shouldRevokeUriPermission) { // Default is no-op } Loading Loading @@ -292,7 +292,6 @@ public abstract class FileSystemProvider extends DocumentsProvider { final String afterDocId = getDocIdForFile(after); onDocIdChanged(docId); onDocIdDeleted(docId); onDocIdChanged(afterDocId); final File afterVisibleFile = getFileForDocId(afterDocId, true); Loading @@ -301,6 +300,10 @@ public abstract class FileSystemProvider extends DocumentsProvider { updateMediaStore(getContext(), afterVisibleFile); if (!TextUtils.equals(docId, afterDocId)) { // DocumentsProvider handles the revoking / granting uri permission for the docId and // the afterDocId in the renameDocument case. Don't need to call revokeUriPermission // for the docId here. onDocIdDeleted(docId, /* shouldRevokeUriPermission */ false); return afterDocId; } else { return null; Loading @@ -324,7 +327,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { final String docId = getDocIdForFile(after); onDocIdChanged(sourceDocumentId); onDocIdDeleted(sourceDocumentId); onDocIdDeleted(sourceDocumentId, /* shouldRevokeUriPermission */ true); onDocIdChanged(docId); // update the database updateMediaStore(getContext(), visibleFileBefore); Loading Loading @@ -362,7 +365,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { } onDocIdChanged(docId); onDocIdDeleted(docId); onDocIdDeleted(docId, /* shouldRevokeUriPermission */ true); updateMediaStore(getContext(), visibleFile); } Loading packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +4 −1 Original line number Diff line number Diff line Loading @@ -596,7 +596,10 @@ public class ExternalStorageProvider extends FileSystemProvider { } @Override protected void onDocIdDeleted(String docId) { protected void onDocIdDeleted(String docId, boolean shouldRevokeUriPermission) { if (!shouldRevokeUriPermission) { return; } Uri uri = DocumentsContract.buildDocumentUri(AUTHORITY, docId); getContext().revokeUriPermission(uri, ~0); } Loading Loading
core/java/com/android/internal/content/FileSystemProvider.java +7 −4 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { * Callback indicating that the given document has been deleted or moved. This gives * the provider a hook to revoke the uri permissions. */ protected void onDocIdDeleted(String docId) { protected void onDocIdDeleted(String docId, boolean shouldRevokeUriPermission) { // Default is no-op } Loading Loading @@ -292,7 +292,6 @@ public abstract class FileSystemProvider extends DocumentsProvider { final String afterDocId = getDocIdForFile(after); onDocIdChanged(docId); onDocIdDeleted(docId); onDocIdChanged(afterDocId); final File afterVisibleFile = getFileForDocId(afterDocId, true); Loading @@ -301,6 +300,10 @@ public abstract class FileSystemProvider extends DocumentsProvider { updateMediaStore(getContext(), afterVisibleFile); if (!TextUtils.equals(docId, afterDocId)) { // DocumentsProvider handles the revoking / granting uri permission for the docId and // the afterDocId in the renameDocument case. Don't need to call revokeUriPermission // for the docId here. onDocIdDeleted(docId, /* shouldRevokeUriPermission */ false); return afterDocId; } else { return null; Loading @@ -324,7 +327,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { final String docId = getDocIdForFile(after); onDocIdChanged(sourceDocumentId); onDocIdDeleted(sourceDocumentId); onDocIdDeleted(sourceDocumentId, /* shouldRevokeUriPermission */ true); onDocIdChanged(docId); // update the database updateMediaStore(getContext(), visibleFileBefore); Loading Loading @@ -362,7 +365,7 @@ public abstract class FileSystemProvider extends DocumentsProvider { } onDocIdChanged(docId); onDocIdDeleted(docId); onDocIdDeleted(docId, /* shouldRevokeUriPermission */ true); updateMediaStore(getContext(), visibleFile); } Loading
packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +4 −1 Original line number Diff line number Diff line Loading @@ -596,7 +596,10 @@ public class ExternalStorageProvider extends FileSystemProvider { } @Override protected void onDocIdDeleted(String docId) { protected void onDocIdDeleted(String docId, boolean shouldRevokeUriPermission) { if (!shouldRevokeUriPermission) { return; } Uri uri = DocumentsContract.buildDocumentUri(AUTHORITY, docId); getContext().revokeUriPermission(uri, ~0); } Loading