Merge "Revert "Remove old FUSE bypass now that we have sdcardfs."" into nyc-dev

am: 8b704d44

* commit '8b704d4474caf9fa0c7a734582fb6cce55248de4':
  Revert "Remove old FUSE bypass now that we have sdcardfs."

Change-Id: I65236959348e3a2781e82e9d56eecb58f5d7fcce
This commit is contained in:
Jeff Sharkey
2016-04-07 18:03:17 +00:00
committed by android-build-merger

View File

@@ -1184,7 +1184,23 @@ public class StorageManager {
/** {@hide} */
public static File maybeTranslateEmulatedPathToInternal(File path) {
// Disabled now that FUSE has been replaced by sdcardfs
final IMountService mountService = IMountService.Stub.asInterface(
ServiceManager.getService("mount"));
try {
final VolumeInfo[] vols = mountService.getVolumes(0);
for (VolumeInfo vol : vols) {
if ((vol.getType() == VolumeInfo.TYPE_EMULATED
|| vol.getType() == VolumeInfo.TYPE_PUBLIC) && vol.isMountedReadable()) {
final File internalPath = FileUtils.rewriteAfterRename(vol.getPath(),
vol.getInternalPath(), path);
if (internalPath != null && internalPath.exists()) {
return internalPath;
}
}
}
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
return path;
}