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
This commit is contained in:
Jeff Sharkey
2016-10-10 15:26:14 -06:00
committed by Jeff Sharkey
parent 9e4733ed33
commit 42a4aaab44

View File

@@ -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.