在AndroidManife.xml 中添加
android:sharedUserId="",
可以将不同的程序加入到同一个进程中,方便数据的共享。
但必须要满足一个条件,即:共享UserId的程序必须使用相同的签名。
在AndroidManifest.xml中声明
android:sharedUserId="android.uid.system"后,
意味着将自己的程序加入到了系统的进程中,同时也将获得极大的权限。
遗憾的是该应用程序将没有权限读写SD卡。
Processes that continue holding open fds on the sdcard a little after it is
requested to be unmounted will be killed so that it can unmount.
We don't want the system process to be able to access the sdcard to avoid
these kinds of issues (and just general security cleanliness), so that it
does not have permission to access it.
The system user can not access the SD card, because if the SD card gets unmounted it may need to kill any processes that have files open on it and we don't want system processes being killed like that. If you want to access the SD card, you need to not use the system shared user ID.
解决方法:
需要用到android:sharedUserId="android.uid.system"可以做成一个服务,
或者把SD卡操作的功能独立出去,做成一个服务。