android 4.0.4为例子
/system/core/init/builtins.c
/* If this fails, it may be an encrypted filesystem
* or it could just be wiped. If wiped, that will be
* handled later in the boot process.
* We only support encrypting /data. Check
* if we're trying to mount it, and if so,
* assume it's encrypted, mount a tmpfs instead.
* Then save the orig mount parms in properties
* for vold to query when it mounts the real
* encrypted /data.
*/
如果mount失败,可能是加密文件系统,或者是被擦除了。如果是擦除了,讲在boot处理。
我们只支持/data加密。我们将mount成tmpfs.
/* Set the property that triggers the framework to do a minimal
* startup and ask the user for a password
*/
我们设置属性,framework最小的启动,问密码。
./packages/apps/Settings/src/com/android/settings/CryptKeeper.java:164:
./base/services/java/com/android/server/SystemServer.java
152 // Only run "core" apps if we're encrypting the device.
153 String cryptState = SystemProperties.get("vold.decrypt");