From 42a4aaab44de53ff692277d0fff74120c23724b8 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 10 Oct 2016 15:26:14 -0600 Subject: [PATCH] Set MIME type when building BROWSE intents. If we created a BROWSE PendingIntent early during boot (while the device was still locked), we would resolve the MIME type as "null" meaning the intent would fail to launch. Since we always know what the MIME type will be, set it explicitly. Test: boot device while USB device attached Bug: 30742481 Change-Id: I23c523cbe2660ca63a3b7df1f41300ab803b314c --- core/java/android/os/storage/VolumeInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java index 5a98482383822..19210b5291e55 100644 --- a/core/java/android/os/storage/VolumeInfo.java +++ b/core/java/android/os/storage/VolumeInfo.java @@ -437,7 +437,7 @@ public class VolumeInfo implements Parcelable { final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE); intent.addCategory(Intent.CATEGORY_DEFAULT); - intent.setData(uri); + intent.setDataAndType(uri, DocumentsContract.Root.MIME_TYPE_ITEM); // note that docsui treats this as *force* show advanced. So sending // false permits advanced to be shown based on user preferences.