2011年3月3日 星期四

[Android] System process cannot write file to the /sdcard

http://groups.google.com/group/android-platform/browse_thread/thread/065bc037e44af858

The system process is explicitly forbidden to open files on SD because those devices are frequently removable during runtime.

If a process holds open file descriptors when the file system is unmounted, that process will be killed by the kernel.

In the case of the system process, that would bring down the whole Android runtime; hence the restriction.

Applications resident on SD complicate this a bit, but that's the basic problem in a nutshell, and is the reason for the explicit policy that you're seeing in action.

For your test suite, you might consider using a two-process architecture in which the system-process test code communicates via the Binder or other IPC mechanism with another process whose job is mostly to handle the file I/O.

Note that system process can write file to the /data.

沒有留言:

張貼留言