Handle null DownloadManager
If the DownloadManager has been disabled by the user via Settings for
instance, DownloadManager can be null, so MediaProvider should handle
it gracefully
Test: Manual
Bug: 178679250
Merged-In: If7b94298f281a31ffb6b4f829161c5f5dc44317d
Change-Id: I313f1239d1551cdbff6a58e35769d3495eb043da
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 6b485e3..9e1efa5 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4772,8 +4772,10 @@
// Do this on a background thread, since we don't want to make binder
// calls as part of a FUSE call.
helper.postBackground(() -> {
- getContext().getSystemService(DownloadManager.class)
- .onMediaStoreDownloadsDeleted(deletedDownloadIds);
+ DownloadManager dm = getContext().getSystemService(DownloadManager.class);
+ if (dm != null) {
+ dm.onMediaStoreDownloadsDeleted(deletedDownloadIds);
+ }
});
}