Android下开机启动后U盘经常不能自动挂载
来源:互联网 发布:淘宝怎么申请换货 编辑:程序博客网 时间:2024/05/22 07:49
原因大致为状态机混乱:
Initializing No-Media Idle-Unmounted Pending Mounted Unmounting Checking Formatting Shared-Unmounted Shared-Mounted Unknown-Error
一、问题描述
挂U盘开机正常;开机后挂U盘不正常。经常出现状态混乱。
二、正确流程
1.挂载
D/Vold ( 1148): Volume 1214-9D53 state changing -1 (Initializing) -> 0 (No-Media)D/Vold ( 1148): Volume 1214-9D53 state changing 0 (No-Media) -> 1 (Idle-Unmounted)D/Vold ( 1148): Volume 1214-9D53 state changing 1 (Idle-Unmounted) -> 3 (Checking)D/Vold ( 1148): Volume 1214-9D53 state changing 3 (Checking) -> 4 (Mounted)2.卸载
D/Vold ( 1148): Volume 1214-9D53 state changing 4 (Mounted) -> 5 (Unmounting)D/Vold ( 1148): Volume 1214-9D53 state changing 5 (Unmounting) -> 1 (Idle-Unmounted)D/Vold ( 1148): Volume 1214-9D53 state changing 1 (Idle-Unmounted) -> 0 (No-Media)
MountService启动:
private void readStorageListLocked();
3.MountService启动时U盘已经挂上
D/MountService( 2044): got storage path: null description: SD卡 primary: false removable: false emulated: true mtpReserve: 0 allowMassStorage: false maxFileSize: 0D/MountService( 2044): addVolumeLocked() StorageVolume:D/MountService( 2044): mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040783 D/MountService( 2044): mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=0 D/MountService( 2044): mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null D/MountService( 2044): mUserLabel=null mState=null D/MountService( 2044): got storage path: /mnt/sdcard description: SD卡 primary: true removable: false emulated: false mtpReserve: 0 allowMassStorage: false maxFileSize: 0D/MountService( 2044): addVolumeLocked() StorageVolume:D/MountService( 2044): mStorageId=0 mPath=/mnt/sdcard mDescriptionId=17040783 mPrimary=true D/MountService( 2044): mRemovable=true mEmulated=false mMtpReserveSpace=0 mAllowMassStorage=false D/MountService( 2044): mMaxFileSize=0 mOwner=null mUuid=null mUserLabel=null mState=null D/MountService( 2044): got storage path: null description: USB存储器 primary: false removable: false emulated: false mtpReserve: 0 allowMassStorage: false maxFileSize: 0I/MountService( 2044): Updating valid state unmountedD/MountService( 2044): addVolumeLocked() StorageVolume:D/MountService( 2044): mStorageId=0 mPath=/mnt/usb/1214-9D53 mDescriptionId=17040784 D/MountService( 2044): mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 D/MountService( 2044): mAllowMassStorage=false mMaxFileSize=0 mOwner=null mUuid=null D/MountService( 2044): mUserLabel=null mState=null D/MountService( 2044): volume state changed for /mnt/usb/1214-9D53 (removed -> unmounted)W/MountService( 2044): getSecureContainerList() called when storage not mountedW/MountService( 2044): getSecureContainerList() called when storage not mountedI/MountService( 2044): doMountVolume: Mouting /mnt/sdcardE/MountService( 2044): Boot-time mount failed (-1)I/MountService( 2044): doMountVolume: Mouting /mnt/usb/1214-9D534.MountService启动时U盘没有挂上
D/MountService( 2015): got storage path: null description: SD卡 primary: false removable: false emulated: true mtpReserve: 0 allowMassStorage: false maxFileSize: 0D/MountService( 2015): addVolumeLocked() StorageVolume:D/MountService( 2015): mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040783 D/MountService( 2015): mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=0 D/MountService( 2015): mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null D/MountService( 2015): mUserLabel=null mState=null D/MountService( 2015): got storage path: /mnt/sdcard description: SD卡 primary: true removable: false emulated: false mtpReserve: 0 allowMassStorage: false maxFileSize: 0D/MountService( 2015): addVolumeLocked() StorageVolume:D/MountService( 2015): mStorageId=0 mPath=/mnt/sdcard mDescriptionId=17040783 mPrimary=true D/MountService( 2015): mRemovable=true mEmulated=false mMtpReserveSpace=0 mAllowMassStorage=false D/MountService( 2015): mMaxFileSize=0 mOwner=null mUuid=null mUserLabel=null mState=null D/MountService( 2015): got storage path: null description: USB存储器 primary: false removable: false emulated: false mtpReserve: 0 allowMassStorage: false maxFileSize: 0W/MountService( 2015): getSecureContainerList() called when storage not mountedW/MountService( 2015): getSecureContainerList() called when storage not mountedI/MountService( 2015): doMountVolume: Mouting /mnt/sdcardE/MountService( 2015): Boot-time mount failed (-1)W/MountService( 2015): Duplicate state transition (mounted -> mounted) for /storage/emulated/0
三、问题解决
该问题不是逻辑问题;而是creash问题。
后来发现公司添加一个新增接口,对指针没有做判断;存在野指针问题,同时没有在析构函数中做指针为null的free判断,导致vold进程不定时creash、导致mount状态混乱。
通过在free后至null、解决野指针问题;在析构函数中做null判断,显示调用free后;问题解决。
0 0
- Android下开机启动后U盘经常不能自动挂载
- Android下开机启动后U盘经常不能自动挂载
- 在linux系统下,Oracle数据库开机后自动启动
- 开机后自动启动程序
- android开机自动启动
- android 开机自动启动
- android 开机自动启动
- Android 设置apk开机自启,启动后自动禁用
- android开机自启动后自动解锁进入
- 添加特殊U盘filter后,virtualbox不能启动
- linux下开机自动启动
- 树莓派3B+gpsd 3.16不能开机后自动启动问题
- linux开机启动后不能连网
- Windows 开机小键盘 不能自动启动
- 开机设置U盘启动
- Android 开机启动后执行
- android 开机自动启动 | 开机自启
- android 设置开机自动启动
- poj 3281 Dining (最大流)
- 华为模拟题一:密码截取C++实现
- 通过socket读取异地文件
- Python编程基础之十五网络编程
- View中的scrollTo和scrollBy
- Android下开机启动后U盘经常不能自动挂载
- 照片上传回显基于spring mvc的 MultipartHttpServletRequest
- Python--ZOJ1350
- 在VC中使用自定义资源制作自解压安装程序
- 大神 PK 红米背后,2G 内存将成互联网手机分水岭
- 腾讯研发工程师A笔试卷
- c语言编程:实现数字的翻转
- POJ 3080 Blue Jeans(暴力)
- 我的自建博客成立啦!wxtlife.com