删除USB时接收广播意图{act=android.Intent.action.MEDIA_弹出时出错
我们修改了AOSP,以便可以在模拟器中浏览USB设备(连接到PC) 问题是,如果我在未卸载的情况下弹出USB,则会出现“不幸的是,进程android.process.media已停止”对话框 在logcat中,我看到以下内容:删除USB时接收广播意图{act=android.Intent.action.MEDIA_弹出时出错,android,Android,我们修改了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) -&
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...
有什么提示吗
问候,,
Ravi有一个NPE(MediaProvider.java:238)。您在那里做了任何修改吗?发布MediaProvider.java的源代码没有对文件MediaProvider.javaOK进行任何修改,只是检查了MediaProvider.java的代码。它看起来像是
意图。操作\u MEDIA\u EJECT
不包含所需的额外代码,因此第234~235行中的代码返回空值:StorageVolume storage=(StorageVolume)intent.getParcelableExtra(StorageVolume.EXTRA_STORAGE_VOLUME);
。因此第238行中的NPE:如果(STORAGE.getPath().equals(mexternalStoragePath[0]){
。在异常之前我看到:D/MountService(276):sendStorageIntent{act=android.intent.action.MEDIA_弹出数据=file:///mnt/USB/USBDISK1 (有附加项)}…这不表示意图有附加项所以不为空吗?