diff options
| author | Martijn Coenen <maco@google.com> | 2020-05-12 15:01:13 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-12 15:01:13 +0000 |
| commit | 5019f6c50b9fb84389a41fb8741eb444b3516830 (patch) | |
| tree | 0ce7b4e2cc8b81840b80a0b02f524a87d975e623 /core/java/android/app/ActivityThread.java | |
| parent | e0ae189f8a7b8e4d0add8f6595b4f72f413f0d28 (diff) | |
| parent | 76ce2ccb191494ae1ec3cbdcf591183a5c8f4d55 (diff) | |
Merge "Limit rename() workaround to /storage/emulated." into rvc-dev
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index c75870e933f8..eea1d69b6326 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -7513,7 +7513,15 @@ public final class ActivityThread extends ClientTransactionHandler { try { super.rename(oldPath, newPath); } catch (ErrnoException e) { - if (e.errno == OsConstants.EXDEV && oldPath.startsWith("/storage/")) { + // On emulated volumes, we have bind mounts for /Android/data and + // /Android/obb, which prevents move from working across those directories + // and other directories on the filesystem. To work around that, try to + // recover by doing a copy instead. + // Note that we only do this for "/storage/emulated", because public volumes + // don't have these bind mounts, neither do private volumes that are not + // the primary storage. + if (e.errno == OsConstants.EXDEV && oldPath.startsWith("/storage/emulated") + && newPath.startsWith("/storage/emulated")) { Log.v(TAG, "Recovering failed rename " + oldPath + " to " + newPath); try { Files.move(new File(oldPath).toPath(), new File(newPath).toPath(), |
