Multi-user MTP, handle secondary user boot.
Watch for BOOT_COMPLETED, and dispatch any current USB state or
mounted volumes which may have already occured. This specifically
handles starting of secondary users.
The current MTP kernel driver at /dev/mtp_usb is exclusive, meaning
only one process can have it open. To solve this, the framework
cycles the USB host stack when switching users, giving the new
user's media process a chance to claim the kernel device. We only
start an MtpServer when we're the active user.
Bug: 6925114
Change-Id: Idfcda09aed88140bb470a110a9e4434f5b79abdd
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 34b6a94..f035150 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -10,6 +10,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_MTP" />
+ <uses-permission android:name="android.permission.MANAGE_USERS" />
+ <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<application android:process="android.process.media"
android:label="@string/app_label"
@@ -57,12 +59,15 @@
</intent-filter>
</service>
- <receiver android:name="UsbReceiver">
+ <receiver android:name=".MtpReceiver">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_STATE" />
</intent-filter>
</receiver>
-
+
<service android:name="MtpService" />
<activity android:name="RingtonePickerActivity"