release-request-ef177764-b092-4138-885c-f9ecf5a80dc4-for-git_oc-dr1-release-4253863 snap-temp-L73600000090287988
Change-Id: Ifa2d69eb8e211836f9e6761d2f45e59166b63dc6
diff --git a/src/com/android/providers/media/MtpReceiver.java b/src/com/android/providers/media/MtpReceiver.java
index 0895c5e..5f38018 100644
--- a/src/com/android/providers/media/MtpReceiver.java
+++ b/src/com/android/providers/media/MtpReceiver.java
@@ -36,6 +36,10 @@
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
+ // If we somehow fail to configure after boot, it becomes difficult to
+ // recover usb state. Thus we always configure once on boot, but it
+ // has no effect if Mtp is disabled or already configured.
+ MtpServer.configure(false);
final Intent usbState = context.registerReceiver(
null, new IntentFilter(UsbManager.ACTION_USB_STATE));
if (usbState != null) {