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

Commit b51e8892 authored by Martijn Coenen's avatar Martijn Coenen Committed by Automerger Merge Worker
Browse files

Merge "Limit rename() workaround to /storage/emulated." into rvc-dev am:...

Merge "Limit rename() workaround to /storage/emulated." into rvc-dev am: 5019f6c5 am: 24508819 am: 9a881585 am: 088e9321

Change-Id: Idd3d14e2776051d3db79dddd73520aa5409d0b24
parents ff98e0fa 088e9321
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -7519,7 +7519,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(),