04-19 14:38:08.868: W/ContextImpl(17290): Failed to ensure directory: /storage/sdcard1/Android/data/xxxx/files/xxx-cache
在android4.0源码出来以后,关于sd卡问题似乎没有解决好,起码上层api中没有体现到位。其实在framework层中有相应的类去获得内外置sd卡信息,是否可读写的权限。
在2.x的版本中,在manifest中配置的权限android.permission.WRITE_EXTERNAL_STORAGE确实是用来使得sd卡获得写的权限。而在4.0开发的源码当中,由于有了内外置sd卡的区分,android.permission.WRITE_EXTERNAL_STORAGE的权限用来设置了内置sd卡的写权限,如果在manifest中只是配置了这个权限,那个应用只能在内置sd卡中进行写操作,还是无法在外置sd卡中进行写操作。需要写外置sd卡的话,需要配置另一个权限android.permission.WRITE_MEDIA_STORAGE,这样就可以在外置sd卡中进行写入操作了。
这两个权限都被定义在android源码目录\frameworks\base\data\etc\platform.xml中:
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
<group gid="sdcard_rw" />
</permission>
<permission name="android.permission.WRITE_MEDIA_STORAGE" >
<group gid="media_rw" />
</permission>
分享到:
相关推荐
- Added additional USB 2.0 Loopback plug test initialization to ensure plugs are in a 'clean' state when starting the USB tests. This was added due to reported USB data verification errors after ...
ought to be relative to the directory "git init" gets invoked in, but it instead was made relative to the repository, which has been corrected. * "git worktree add" used to fail when another work...
1. **报错:“cp:cannot stat ‘kernel/resource.img’: No such file or directory”** - **问题描述**:当尝试使用`make otapackage`命令进行打包时,可能会遇到此错误提示。该错误通常出现在那些不会自动生成`...
All of a project's header files should be listed as descentants of the project's source directory without use of UNIX directory shortcuts . (the current directory) or .. (the parent directory). For...
apply to PHP files in the /www/mysite directory. Directives ; following the section heading [HOST=www.example.com] only apply to ; PHP files served from www.example.com. Directives set in these ; ...
Added #pragma pack(8/4) to acobject.h to ensure that the structures in this header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work ...
- name: Copy kubeconfig to user's home directory become: yes copy: src: /etc/kubernetes/admin.conf dest: ~/.kube/config remote_src: yes notify: Source kubeconfig - meta: flush_handlers - name:...
Create /opt/CIS Directory (optional) .......................................................................................... 12 Benchmark Items ........................................................