Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8aece2fa authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by Android (Google) Code Review
Browse files

Merge "Fix copying virtual files."

parents e33d41f8 6704808b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ class CopyJob extends Job {
        // TODO: When optimized copy kicks in, we'll not making any progress updates.
        // For now. Local storage isn't using optimized copy.

        // When copying within the same provider, try to use optimized copying and moving.
        // When copying within the same provider, try to use optimized copying.
        // If not supported, then fallback to byte-by-byte copy/move.
        if (srcInfo.authority.equals(dstDirInfo.authority)) {
            if ((srcInfo.flags & Document.FLAG_SUPPORTS_COPY) != 0) {
@@ -251,9 +251,10 @@ class CopyJob extends Job {
                        dstDirInfo.derivedUri) == null) {
                    onFileFailed(srcInfo,
                            "Provider side copy failed for documents: " + srcInfo.derivedUri + ".");
                }
                    return false;
                }
                return true;
            }
        }

        // If we couldn't do an optimized copy...we fall back to vanilla byte copy.
+4 −3
Original line number Diff line number Diff line
@@ -78,18 +78,19 @@ final class MoveJob extends CopyJob {
    @Override
    boolean processDocument(DocumentInfo srcInfo, DocumentInfo dstDirInfo) throws RemoteException {

        // TODO: When optimized copy kicks in, we're not making any progress updates. FIX IT!
        // TODO: When optimized move kicks in, we're not making any progress updates. FIX IT!

        // When copying within the same provider, try to use optimized copying and moving.
        // When moving within the same provider, try to use optimized moving.
        // If not supported, then fallback to byte-by-byte copy/move.
        if (srcInfo.authority.equals(dstDirInfo.authority)) {
            if ((srcInfo.flags & Document.FLAG_SUPPORTS_MOVE) != 0) {
                if (DocumentsContract.moveDocument(srcClient, srcInfo.derivedUri,
                        dstDirInfo.derivedUri) == null) {
                    onFileFailed(srcInfo);
                }
                    return false;
                }
                return true;
            }
        }

        // If we couldn't do an optimized copy...we fall back to vanilla byte copy.