我们已经修改了 AOSP,以便我们可以在模拟器中浏览 USB 设备(连接到 PC)。
问题是,如果我在没有卸载的情况下弹出 USB,我会得到“不幸的是进程 android.process.media 已停止”对话框。
在 logcat 中,我看到以下内容:
D/DirectVolume( 98): Volume usb1 /mnt/USB/USBDISK1 partition 8:49 removed
D/Vold ( 98): Volume usb1 state changing 4 (Mounted) -> 5 (Unmounting)
D/MountService( 276): volume state changed for /mnt/USB/USBDISK1 (mounted -> unmounted)
I/StorageNotification( 430): Media {/mnt/USB/USBDISK1} state changed from {mounted} -> {unmounted}
D/VoldCmdListener( 98): volume shared /mnt/sdcard ums
E/MountService( 276): Failed to read response to volume shared /mnt/sdcard ums
D/MountService( 276): volume state changed for /mnt/USB/USBDISK1 (unmounted -> bad_removal)
I/StorageNotification( 430): Media {/mnt/USB/USBDISK1} state changed from {unmounted} -> {bad_removal}
D/MountService( 276): sendStorageIntent Intent { act=android.intent.action.MEDIA_BAD_REMOVAL dat=file:///mnt/USB/USBDISK1 (has extras) }
D/MountService( 276): sendStorageIntent Intent { act=android.intent.action.MEDIA_EJECT dat=file:///mnt/USB/USBDISK1 (has extras) }
D/AndroidRuntime( 827): Shutting down VM
W/dalvikvm( 827): threadid=1: thread exiting with uncaught exception (group=0xa6271288)
E/AndroidRuntime( 827): FATAL EXCEPTION: main
E/AndroidRuntime( 827): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.MEDIA_EJECT dat=file:///mnt/USB/USBDISK1 flg=0x10 (has extras) } in com.android.providers.media.MediaProvider$1@a6a85f38
E/AndroidRuntime( 827): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
E/AndroidRuntime( 827): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 827): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 827): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 827): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 827): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 827): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 827): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 827): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 827): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 827): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 827): at com.android.providers.media.MediaProvider$1.onReceive(MediaProvider.java:238)
E/AndroidRuntime( 827): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
E/AndroidRuntime( 827): ... 9 more
I/TvNotificationBuilder( 655): topAppWindowChanged
I/USB BreakIn Service( 530): USB Service, Action Intent Received : android.hardware.usb.action.USB_DEVICE_DETACHED
D/dalvikvm( 530): GC_CONCURRENT freed 479K, 18% free 7262K/8771K, paused 16ms+0ms, total 34ms
I/USB BreakIn Service( 530): USB BREAKOUT, Detached USB Device Name - JetFlash-MassStorageDevice-PQHJ742X and Mount Path - /mnt/USB/USBDISK1
I/USBBroadcastReceiver( 1140): ### onReceive called usbbreakin.ACTION_USB_BREAKOUT
I/USBBroadcastReceiver( 1140): ###getContext org.droidtv.contentexplorer.MainActivity@a6aba858
I/USBDeviceHandler( 1140): ###PROCESS_USB_DETACHED
I/TvSettingsManager( 1473): Constructing TvSettingsManager...
有什么提示吗?
问候,拉维