Don't canonicalize app paths in system.
The provider isn't in the requesting app's sandbox, so it's unlikely
that we can canonicalize the path.
Bug: 128383017
Test: none
Change-Id: I689ebb44e4c5d7f579ec998ff7333ee9b8d46542
(cherry picked from commit b099a65974b787f66450592780ffe42cb08911e8)
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index db1f7cf..acc814c 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -929,14 +929,10 @@
if (fileUri != null) {
path = fileUri.getPath();
}
- try {
- final File app = new File(path).getCanonicalFile();
- final File system = mStorageManager.translateAppToSystem(app, pid, uid);
- // If the input was file uri, we need to return a file uri
- return fileUri == null ? system.getPath() : Uri.fromFile(system).toString();
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- }
+ final File app = new File(path);
+ final File system = mStorageManager.translateAppToSystem(app, pid, uid);
+ // If the input was file uri, we need to return a file uri
+ return fileUri == null ? system.getPath() : Uri.fromFile(system).toString();
}
private @Nullable String translateSystemToApp(@Nullable String path, int pid, int uid) {