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

Commit fe30cb6f authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by Android (Google) Code Review
Browse files

Merge "Revert "Remove the rename() interceptor""

parents c7a828b0 e59cb735
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -7395,6 +7395,24 @@ public final class ActivityThread extends ClientTransactionHandler {
                super.remove(path);
            }
        }

        @Override
        public void rename(String oldPath, String newPath) throws ErrnoException {
            try {
                super.rename(oldPath, newPath);
            } catch (ErrnoException e) {
                if (e.errno == OsConstants.EXDEV && oldPath.startsWith("/storage/")) {
                    Log.v(TAG, "Recovering failed rename " + oldPath + " to " + newPath);
                    try {
                        Files.move(new File(oldPath).toPath(), new File(newPath).toPath());
                    } catch (IOException e2) {
                        throw e;
                    }
                } else {
                    throw e;
                }
            }
        }
    }

    public static void main(String[] args) {