Revert "Fix canonicalizing /sdcard"

This reverts commit 50e73370ca.

Reason for revert: ag/10112811 is better and more reliable fix

Change-Id: Ice0c0e7a033013b01156898cd58df14b999e700f
This commit is contained in:
Zimuzo Ezeozue
2020-01-17 01:28:36 +00:00
parent 50e73370ca
commit 85f83ff275

View File

@@ -829,14 +829,7 @@ public class StorageManager {
*/
public @NonNull UUID getUuidForPath(@NonNull File path) throws IOException {
Preconditions.checkNotNull(path);
String pathString = path.getCanonicalPath();
if (path.getPath().startsWith("/sdcard")) {
// On FUSE enabled devices, realpath(2) /sdcard is /mnt/user/<userid>/emulated/<userid>
// as opposed to /storage/emulated/<userid>.
// And vol.path below expects to match with a path starting with /storage
pathString = pathString.replaceFirst("^/mnt/user/[0-9]+/", "/storage/");
}
final String pathString = path.getCanonicalPath();
if (FileUtils.contains(Environment.getDataDirectory().getAbsolutePath(), pathString)) {
return UUID_DEFAULT;
}