summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityThread.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index a62f0a6807bb..bd3fee2d1fc7 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -201,6 +201,7 @@ import java.lang.reflect.Method;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -7413,8 +7414,10 @@ public final class ActivityThread extends ClientTransactionHandler {
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());
+ Files.move(new File(oldPath).toPath(), new File(newPath).toPath(),
+ StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e2) {
+ Log.e(TAG, "Rename recovery failed ", e);
throw e;
}
} else {