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

Commit b3e5edd5 authored by Tony Huang's avatar Tony Huang Committed by Android (Google) Code Review
Browse files

Merge "Fix ExternalStorageProvider always throw exception when rename"

parents 9165f58f 7bf90408
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,6 +232,7 @@ public abstract class FileSystemProvider extends DocumentsProvider {
        displayName = FileUtils.buildValidFatFilename(displayName);

        final File before = getFileForDocId(docId);
        final File beforeVisibleFile = getFileForDocId(docId, true);
        final File after = FileUtils.buildUniqueFile(before.getParentFile(), displayName);
        if (!before.renameTo(after)) {
            throw new IllegalStateException("Failed to rename to " + after);
@@ -241,7 +242,6 @@ public abstract class FileSystemProvider extends DocumentsProvider {
        onDocIdChanged(docId);
        onDocIdChanged(afterDocId);

        final File beforeVisibleFile = getFileForDocId(docId, true);
        final File afterVisibleFile = getFileForDocId(afterDocId, true);
        moveInMediaStore(beforeVisibleFile, afterVisibleFile);