import android.os.RemoteException;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Document;
+import android.util.Log;
import com.android.documentsui.R;
import com.android.documentsui.model.DocumentInfo;
}
}
+ // Moving virtual files by bytes is not supported. This is because, it would involve
+ // conversion, and the source file should not be deleted in such case (as it's a different
+ // file).
+ if (src.isVirtualDocument()) {
+ Log.w(TAG, "Cannot move virtual files byte by byte.");
+ onFileFailed(src);
+ return false;
+ }
+
// If we couldn't do an optimized copy...we fall back to vanilla byte copy.
boolean copied = byteCopyDocument(src, dest);
package com.android.documentsui.services;
+import static com.google.common.collect.Lists.newArrayList;
+
+import android.net.Uri;
import android.test.suitebuilder.annotation.MediumTest;
import com.android.documentsui.model.DocumentInfo;
}
public void testMoveVirtualTypedFile() throws Exception {
- runCopyVirtualTypedFileTest();
+ Uri testFile = mDocs.createVirtualFile(
+ mSrcRoot, "/virtual.sth", "virtual/mime-type",
+ FRUITY_BYTES, "application/pdf", "text/html");
+ createJob(newArrayList(testFile)).run();
- mDocs.assertChildCount(mSrcRoot, 0);
+ mJobListener.waitForFinished();
+
+ // Should have failed, source not deleted. Moving by bytes for virtual files
+ // is not supported.
+ mDocs.assertChildCount(mDestRoot, 0);
+ mDocs.assertChildCount(mSrcRoot, 1);
}
public void testMoveVirtualNonTypedFile() throws Exception {
runCopyVirtualNonTypedFileTest();
- // should have failed, source not deleted
+ // Should have failed, source not deleted.
mDocs.assertChildCount(mSrcRoot, 1);
}