diff options
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 49a8e2f3f816..93b6454edcf3 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -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) { |
