Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3291)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java

Issue 2616893005: Catch exception from DownloadManager.getUriForDownloadedFile() for Xiaomi phones (Closed)
Patch Set: catch exceptions Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
index 6c81ee06599b901c07af820343a6721cadfa2856..8eedeb39375274be5aea8717d5d852125be233e8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -987,11 +987,12 @@ public class DownloadManagerService extends BroadcastReceiver implements
Context context, @Nullable String filePath, long downloadId,
boolean isSupportedMimeType) {
assert !ThreadUtils.runningOnUiThread();
- DownloadManager manager =
- (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
- Uri contentUri = manager.getUriForDownloadedFile(downloadId);
+ Uri contentUri = DownloadManagerDelegate.getContentUriFromDownloadManager(
+ context, downloadId);
if (contentUri == null) return null;
+ DownloadManager manager =
+ (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
String mimeType = manager.getMimeTypeForDownloadedFile(downloadId);
if (isSupportedMimeType) {
// Redirect the user to an internal media viewer. The file path is necessary to show
@@ -1000,7 +1001,6 @@ public class DownloadManagerService extends BroadcastReceiver implements
if (filePath != null) fileUri = Uri.fromFile(new File(filePath));
return DownloadUtils.getMediaViewerIntentForDownloadItem(fileUri, contentUri, mimeType);
}
-
return DownloadUtils.createViewIntentForDownloadItem(contentUri, mimeType);
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698