Loading packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +17 −0 Original line number Diff line number Diff line Loading @@ -273,10 +273,12 @@ public class ExternalStorageProvider extends DocumentsProvider { flags |= Document.FLAG_DIR_SUPPORTS_CREATE; flags |= Document.FLAG_SUPPORTS_DELETE; flags |= Document.FLAG_SUPPORTS_RENAME; flags |= Document.FLAG_SUPPORTS_MOVE; } else { flags |= Document.FLAG_SUPPORTS_WRITE; flags |= Document.FLAG_SUPPORTS_DELETE; flags |= Document.FLAG_SUPPORTS_RENAME; flags |= Document.FLAG_SUPPORTS_MOVE; } } Loading Loading @@ -408,6 +410,21 @@ public class ExternalStorageProvider extends DocumentsProvider { new String[] { path, path }); } @Override public String moveDocument(String sourceDocumentId, String targetParentDocumentId) throws FileNotFoundException { final File before = getFileForDocId(sourceDocumentId); final File after = new File(getFileForDocId(targetParentDocumentId), before.getName()); if (after.exists()) { throw new IllegalStateException("Already exists " + after); } if (!before.renameTo(after)) { throw new IllegalStateException("Failed to move to " + after); } return getDocIdForFile(after); } @Override public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException { Loading Loading
packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +17 −0 Original line number Diff line number Diff line Loading @@ -273,10 +273,12 @@ public class ExternalStorageProvider extends DocumentsProvider { flags |= Document.FLAG_DIR_SUPPORTS_CREATE; flags |= Document.FLAG_SUPPORTS_DELETE; flags |= Document.FLAG_SUPPORTS_RENAME; flags |= Document.FLAG_SUPPORTS_MOVE; } else { flags |= Document.FLAG_SUPPORTS_WRITE; flags |= Document.FLAG_SUPPORTS_DELETE; flags |= Document.FLAG_SUPPORTS_RENAME; flags |= Document.FLAG_SUPPORTS_MOVE; } } Loading Loading @@ -408,6 +410,21 @@ public class ExternalStorageProvider extends DocumentsProvider { new String[] { path, path }); } @Override public String moveDocument(String sourceDocumentId, String targetParentDocumentId) throws FileNotFoundException { final File before = getFileForDocId(sourceDocumentId); final File after = new File(getFileForDocId(targetParentDocumentId), before.getName()); if (after.exists()) { throw new IllegalStateException("Already exists " + after); } if (!before.renameTo(after)) { throw new IllegalStateException("Failed to move to " + after); } return getDocIdForFile(after); } @Override public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException { Loading